jhbuild wrapper: don't try to "restore GNOME"

If run under jhbuild, gnome-shell is in PATH, so trying to restore
is just running it again, likely failing in the same way (with the
additional problem of detaching the shell from the terminal). Also,
this is using deprecated GConf keys, and deprecated pygobject
bindings.
This commit is contained in:
Giovanni Campagna 2012-04-12 19:51:40 +02:00
parent 9d33baec70
commit 0ae87270ad

View File

@ -163,48 +163,6 @@ def run_shell():
return normal_exit return normal_exit
def restore_gnome():
# Do imports lazily to save time and memory
import gio
import gconf
# We don't want to start the new gnome-panel in the current
# directory; $HOME is better for stuff launched from it
os.chdir(os.path.expanduser("~"))
def launch_component(gconf_path):
client = gconf.client_get_default()
component = client.get_string(gconf_path)
if component == None or component == "":
return False
# See gnome-session/gsm-util.c:gsm_util_find_desktop_file_for_app_name()
# The one difference is that we don't search the autostart directories,
# and just search normal application search path. (Gio doesnt' know
# how to search the autostart dirs, so we'd have to do that ourselves.)
appinfo = None
try:
appinfo = gio.unix.DesktopAppInfo(component + ".desktop")
except:
try:
appinfo = gio.unix.DesktopAppInfo("gnome-" + component + ".desktop")
except:
pass
if appinfo:
appinfo.launch()
return True
return False
# GNOME2 fallback
wm = launch_component("/desktop/gnome/session/required_components/windowmanager")
panel = launch_component("/desktop/gnome/session/required_components/panel")
if not wm and not panel: # Probably GNOME3
subprocess.Popen(['gnome-shell'])
# Main program # Main program
parser = optparse.OptionParser() parser = optparse.OptionParser()
@ -235,17 +193,7 @@ if options.debug_command:
elif options.debug: elif options.debug:
options.debug_command = "gdb --args" options.debug_command = "gdb --args"
# We only respawn the previous environment on abnormal exit; normal_exit = run_shell()
# for a clean exit, we assume that gnome-shell was replaced with
# something else.
normal_exit = False
try:
normal_exit = run_shell()
finally:
if options.replace and not normal_exit:
restore_gnome()
if normal_exit: if normal_exit:
sys.exit(0) sys.exit(0)
else: else: