From e8b72a2a59b0360762c2b70951ab13884b0baa22 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Fri, 25 Jun 2010 10:10:18 -0400 Subject: [PATCH] Switch to using dconf * Add dconf and dependencies to the moduleset and add libxml2 dependency to gnome-shell-build-setup.sh * if we can't ping the dconf D-Bus service, try to activate it manually. * Stop forcing GConf via GSETTINGS_BACKEND https://bugzilla.gnome.org/show_bug.cgi?id=622308 --- src/gnome-shell-clock-preferences.in | 1 - src/gnome-shell.in | 63 ++++++++++++++++++++++++-- tools/build/gnome-shell-build-setup.sh | 12 ++--- tools/build/gnome-shell.modules | 28 ++++++++++++ 4 files changed, 94 insertions(+), 10 deletions(-) diff --git a/src/gnome-shell-clock-preferences.in b/src/gnome-shell-clock-preferences.in index 8ed2aa9bc..b2f94986c 100644 --- a/src/gnome-shell-clock-preferences.in +++ b/src/gnome-shell-clock-preferences.in @@ -16,7 +16,6 @@ progName="`basename $0`" localeDir="@localedir@" uiFile="$uiDir/clock-preferences.ui" export GJS_PATH="$jsDir" -export GSETTINGS_BACKEND="gconf" export GSETTINGS_SCHEMA_DIR="$schemaDir" @GJS_CONSOLE@ -c "const ClockPreferences = imports.prefs.clockPreferences; diff --git a/src/gnome-shell.in b/src/gnome-shell.in index 01f99170d..9ee1ad4fd 100644 --- a/src/gnome-shell.in +++ b/src/gnome-shell.in @@ -3,6 +3,9 @@ import atexit import datetime +import dbus +from dbus.mainloop.glib import DBusGMainLoop +import gobject try: import json except ImportError: @@ -119,6 +122,60 @@ def start_xephyr(): return xephyr; +def start_dconf_await_service(): + DCONF_NAME = 'ca.desrt.dconf' + + dbus_loop = DBusGMainLoop() + bus = dbus.SessionBus(mainloop=dbus_loop) + + # See if the service is already running or normal D-Bus activation works + need_manual_activate = False + try: + dconf_proxy = bus.get_object(DCONF_NAME, '/') + dconf_proxy.Ping(dbus_interface='org.freedesktop.DBus.Peer') + except dbus.exceptions.DBusException, e: + if e.get_dbus_name() == 'org.freedesktop.DBus.Error.ServiceUnknown': + need_manual_activate = True + else: + raise e + + if not need_manual_activate: + return + + # At this point, it looks like we just have a jhbuild install + # of dconf, not known to the session dbus-daemon, so we start + # it manually and wait for it to join the bus + + print "Starting dconf-service... ", + sys.stdout.flush() + + dconf_path = os.path.join('@libexecdir@', 'dconf-service') + try: + subprocess.Popen([dconf_path, '--keep-alive']) + except OSError, e: + print "\nFailed to start %s: %s" % (dconf_path, e) + sys.exit(1) + + bus_proxy = bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus') + bus_iface = dbus.Interface(bus_proxy, 'org.freedesktop.DBus') + + loop = gobject.MainLoop() + + def on_name_owner_changed(name, prev_owner, new_owner): + if not (name == DCONF_NAME and new_owner != ''): + return + print "started" + loop.quit() + return + bus_iface.connect_to_signal('NameOwnerChanged', on_name_owner_changed) + + def on_timeout(): + print "\nFailed to start %s: timed out" % (dconf_path,) + sys.exit(1) + gobject.timeout_add_seconds(7, on_timeout) + + loop.run() + GLXINFO_RE = re.compile(r"^(\S.*):\s*\n((?:^\s+.*\n)*)", re.MULTILINE) def _get_glx_extensions(): @@ -155,7 +212,6 @@ def start_shell(perf_output=None): # Set up environment env = dict(os.environ) env.update({'GNOME_SHELL_JS' : '@GJS_JS_DIR@:@GJS_JS_NATIVE_DIR@:' + js_dir, - 'GSETTINGS_BACKEND' : 'gconf', 'PATH' : '@MUTTER_BIN_DIR@:' + os.environ.get('PATH', ''), 'XDG_CONFIG_DIRS' : '@sysconfdir@/xdg:' + (os.environ.get('XDG_CONFIG_DIRS') or '/etc/xdg'), 'GNOME_DISABLE_CRASH_DIALOG' : '1'}) @@ -656,8 +712,6 @@ if 'DISPLAY' not in os.environ: os.environ.update(running_env) if options.eval_file: - import dbus - f = open(options.eval_file) contents = f.read() f.close() @@ -694,6 +748,9 @@ else: # something else. normal_exit = False +# Make sure dconf daemon is running +start_dconf_await_service() + try: if options.perf: normal_exit = run_performance_test() diff --git a/tools/build/gnome-shell-build-setup.sh b/tools/build/gnome-shell-build-setup.sh index 5b570eaee..b03fd42df 100755 --- a/tools/build/gnome-shell-build-setup.sh +++ b/tools/build/gnome-shell-build-setup.sh @@ -48,8 +48,8 @@ fi # # Devel packages needed by gnome-shell and its deps: # dbus-glib, gconf, GL, gnome-menus, gstreamer, gtk, libffi, -# libgnomeui, librsvg, libwnck, python, readline, spidermonkey -# ({mozilla,firefox,xulrunner}-js), xdamage +# libgnomeui, librsvg, libwnck, libxml2, python, readline, +# spidermonkey ({mozilla,firefox,xulrunner}-js), xdamage # # Non-devel packages needed by gnome-shell and its deps: # glxinfo, gstreamer-plugins-base, gstreamer-plugins-good, @@ -79,7 +79,7 @@ if test x$system = xUbuntu -o x$system = xDebian -o x$system = xLinuxMint ; then automake bison flex git-core gnome-common gtk-doc-tools \ libdbus-glib-1-dev libgconf2-dev libgtk2.0-dev libffi-dev \ libgnome-menu-dev libgnome-desktop-dev librsvg2-dev libwnck-dev libgl1-mesa-dev \ - libreadline5-dev mesa-common-dev mesa-utils python-dev python-gconf python-gobject \ + libreadline5-dev libxml2-dev mesa-common-dev mesa-utils python-dev python-gconf python-gobject \ xulrunner-dev xserver-xephyr gnome-terminal libcroco3-dev \ libgstreamer0.10-dev gstreamer0.10-plugins-base gstreamer0.10-plugins-good \ ; do @@ -101,9 +101,9 @@ if test x$system = xFedora ; then automake bison flex git gnome-common gnome-doc-utils intltool \ libtool pkgconfig \ dbus-glib-devel GConf2-devel gnome-menus-devel gnome-python2-gconf gtk2-devel libffi-devel \ - gnome-desktop-devel librsvg2-devel libwnck-devel mesa-libGL-devel python-devel pygobject2 \ - readline-devel xulrunner-devel libXdamage-devel libcroco-devel \ - gstreamer-devel gstreamer-plugins-base gstreamer-plugins-good \ + gnome-desktop-devel librsvg2-devel libwnck-devel mesa-libGL-devel \ + python-devel pygobject2 readline-devel xulrunner-devel libXdamage-devel libcroco-devel \ + libxml2-devel gstreamer-devel gstreamer-plugins-base gstreamer-plugins-good \ glx-utils xorg-x11-server-Xephyr gnome-terminal zenity \ ; do if ! rpm -q $pkg > /dev/null 2>&1; then diff --git a/tools/build/gnome-shell.modules b/tools/build/gnome-shell.modules index 3a3916881..3098bf8ac 100644 --- a/tools/build/gnome-shell.modules +++ b/tools/build/gnome-shell.modules @@ -21,6 +21,23 @@ + + + + + + + + + + + + + + + @@ -84,6 +101,16 @@ + + + + + + + + + + @@ -108,6 +135,7 @@ +