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
This commit is contained in:
Florian Müllner 2011-01-16 20:21:10 +01:00
parent f91138d0a2
commit 26aaecc33d

View File

@ -125,11 +125,24 @@ PlacesManager.prototype = {
this._mounts = [];
this._bookmarks = [];
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();