[gnome-shell] places: Fail gracefully when not using unstable nautilus



commit 26aaecc33d81695dd79651b0d54a0b7810c80689
Author: Florian Müllner <fmuellner gnome org>
Date:   Sun Jan 16 20:21:10 2011 +0100

    places: Fail gracefully when not using unstable nautilus
    
    The latest development version of nautilus has been ported to
    GSettings, which we now use as well for the desktop-is-home-dir
    preference. Obviously, the required schema is only available if
    a recent enough nautilus version is installed. Instead of adding
    yet another module to the moduleset, catch the exception and
    ignore the preference in case the schema is not available.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=639689

 js/ui/placeDisplay.js |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/placeDisplay.js b/js/ui/placeDisplay.js
index 80f632c..4bbdb06 100644
--- a/js/ui/placeDisplay.js
+++ b/js/ui/placeDisplay.js
@@ -125,11 +125,24 @@ PlacesManager.prototype = {
         this._mounts = [];
         this._bookmarks = [];
 
-        this._settings = new Gio.Settings({ schema: NAUTILUS_PREFS_SCHEMA });
-        this._isDesktopHome = this._settings.get_boolean(DESKTOP_IS_HOME_KEY);
-        this._settings.connect('changed::' + DESKTOP_IS_HOME_KEY,
-                               Lang.bind(this,
-                                         this._updateDesktopMenuVisibility));
+        this._settings = null;
+        this._isDesktopHome = false;
+
+        // The GNOME3 version of nautilus has been ported to GSettings; we
+        // don't require it though, so for now we'll have to deal with the
+        // case of GNOME3 nautilus not being installed.
+        try {
+            this._settings = new Gio.Settings({ schema: NAUTILUS_PREFS_SCHEMA });
+        } catch (e) {
+            log('Failed to get settings from Nautilus. Places may not work as expected');
+        }
+
+        if (this._settings != null) {
+            this._isDesktopHome = this._settings.get_boolean(DESKTOP_IS_HOME_KEY);
+            this._settings.connect('changed::' + DESKTOP_IS_HOME_KEY,
+                                   Lang.bind(this,
+                                             this._updateDesktopMenuVisibility));
+        }
 
         let homeFile = Gio.file_new_for_path (GLib.get_home_dir());
         let homeUri = homeFile.get_uri();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]