[gnome-shell] places: Port to GSettings
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] places: Port to GSettings
- Date: Mon, 17 Jan 2011 17:04:06 +0000 (UTC)
commit f91138d0a2fb1301a802d58db70587d2bfd5f2aa
Author: Florian Müllner <fmuellner gnome org>
Date: Sun Jan 16 20:18:09 2011 +0100
places: Port to GSettings
'Places' follows the nautilus preference of whether the Desktop
should be a separate directory or the home folder should be used.
Nautilus has been ported to GSettings a while ago, so follow suit.
https://bugzilla.gnome.org/show_bug.cgi?id=639689
js/ui/placeDisplay.js | 21 +++++++++------------
1 files changed, 9 insertions(+), 12 deletions(-)
---
diff --git a/js/ui/placeDisplay.js b/js/ui/placeDisplay.js
index c31bf96..80f632c 100644
--- a/js/ui/placeDisplay.js
+++ b/js/ui/placeDisplay.js
@@ -1,6 +1,5 @@
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
-const GConf = imports.gi.GConf;
const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
const Shell = imports.gi.Shell;
@@ -16,8 +15,8 @@ const Main = imports.ui.main;
const Search = imports.ui.search;
const Util = imports.misc.util;
-const NAUTILUS_PREFS_DIR = '/apps/nautilus/preferences';
-const DESKTOP_IS_HOME_KEY = NAUTILUS_PREFS_DIR + '/desktop_is_home_dir';
+const NAUTILUS_PREFS_SCHEMA = 'org.gnome.nautilus.preferences';
+const DESKTOP_IS_HOME_KEY = 'desktop-is-home-dir';
/**
* Represents a place object, which is most normally a bookmark entry,
@@ -122,13 +121,15 @@ function PlacesManager() {
PlacesManager.prototype = {
_init: function() {
- let gconf = GConf.Client.get_default();
- gconf.add_dir(NAUTILUS_PREFS_DIR, GConf.ClientPreloadType.PRELOAD_NONE);
-
this._defaultPlaces = [];
this._mounts = [];
this._bookmarks = [];
- this._isDesktopHome = gconf.get_bool(DESKTOP_IS_HOME_KEY);
+
+ 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));
let homeFile = Gio.file_new_for_path (GLib.get_home_dir());
let homeUri = homeFile.get_uri();
@@ -228,9 +229,6 @@ PlacesManager.prototype = {
}));
this._reloadBookmarks();
-
- gconf.notify_add(DESKTOP_IS_HOME_KEY, Lang.bind(this, this._updateDesktopMenuVisibility));
-
},
_updateDevices: function() {
@@ -340,8 +338,7 @@ PlacesManager.prototype = {
},
_updateDesktopMenuVisibility: function() {
- let gconf = GConf.Client.get_default();
- this._isDesktopHome = gconf.get_boolean(DESKTOP_IS_HOME_KEY);
+ this._isDesktopHome = this._settings.get_boolean(DESKTOP_IS_HOME_KEY);
if (this._isDesktopHome)
this._removeById(this._defaultPlaces, 'special:desktop');
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]