[gnome-shell] Migrate to GSettings
- From: Milan Bouchet-Valat <milanbv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] Migrate to GSettings
- Date: Fri, 18 Jun 2010 18:29:32 +0000 (UTC)
commit 2799327c84c8ca74fe6b271349e27d7911f3b815
Author: Milan Bouchet-Valat <nalimilan club fr>
Date: Wed May 5 23:05:42 2010 +0200
Migrate to GSettings
Use GSettings for all Shell configuration. GConf is kept to read
configuration from external programs (Metacity, Nautilus and Magnifier),
but ShellGConf is removed because it's mostly useless for the few calls
we still have. Also get rid of unused GConf code in ShellAppSystem.
A basic GConf schema is still used to override Metacity defaults and
configure Magnifier in a system-wide fashion. GConf is also used as
GSettings backend via the GSETTINGS_BACKEND environment variable.
All of this will be removed when these programs have been ported
to GSettings and able to use dconf.
GLib 2.25.9 is required. Schemas are converted to the new XML format,
and compiled at build time in data/ so that the Shell can be run from
the source tree. This also requires setting the GSETTINGS_SCHEMA_DIR
environment variable both when running installed or from source tree,
in src/gnome-shell.in and src/gnome-shell-clock-preferences.in.
https://bugzilla.gnome.org/show_bug.cgi?id=617917
.gitignore | 3 +
configure.ac | 6 +-
data/Makefile.am | 27 ++-
data/gnome-shell.schemas | 233 +-------------------
data/org.gnome.shell.gschema.xml.in | 158 +++++++++++++
js/prefs/clockPreferences.js | 31 ++--
js/ui/appFavorites.js | 11 +-
js/ui/calendar.js | 11 +-
js/ui/extensionSystem.js | 2 +-
js/ui/lookingGlass.js | 11 +-
js/ui/magnifier.js | 51 +++--
js/ui/main.js | 17 +-
js/ui/panel.js | 23 +-
js/ui/placeDisplay.js | 11 +-
js/ui/runDialog.js | 17 +-
js/ui/workspacesView.js | 18 +-
po/POTFILES.in | 1 +
src/Makefile.am | 6 +-
src/gnome-shell-clock-preferences.in | 4 +
src/gnome-shell.in | 8 +-
src/shell-app-system.c | 7 -
src/shell-app-usage.c | 59 +++---
src/shell-gconf.c | 410 ----------------------------------
src/shell-gconf.h | 95 --------
src/shell-global.c | 28 +++
src/shell-global.h | 2 +
tools/build/gnome-shell.modules | 7 +
27 files changed, 370 insertions(+), 887 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index ed0ebf3..413fb08 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,6 +20,9 @@ data/gnome-shell.desktop
data/gnome-shell.desktop.in
data/gnome-shell-clock-preferences.desktop
data/gnome-shell-clock-preferences.desktop.in
+data/gschemas.compiled
+data/org.gnome.shell.gschema.xml
+data/org.gnome.shell.gschema.valid
intltool-extract.in
intltool-merge.in
intltool-update.in
diff --git a/configure.ac b/configure.ac
index 34df13b..863f751 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,6 +33,8 @@ PKG_PROG_PKG_CONFIG([0.22])
AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
AM_GCONF_SOURCE_2
+GLIB_GSETTINGS
+
# Get a value to substitute into gnome-shell.in
AM_PATH_PYTHON([2.5])
AC_SUBST(PYTHON)
@@ -60,9 +62,11 @@ GOBJECT_INTROSPECTION_MIN_VERSION=0.6.11
GJS_MIN_VERSION=0.7
MUTTER_MIN_VERSION=2.31.2
GTK_MIN_VERSION=2.18.0
+GIO_MIN_VERSION=2.25.9
# Collect more than 20 libraries for a prize!
-PKG_CHECK_MODULES(MUTTER_PLUGIN, gio-unix-2.0 dbus-glib-1
+PKG_CHECK_MODULES(MUTTER_PLUGIN, gio-2.0 >= $GIO_MIN_VERSION
+ gio-unix-2.0 dbus-glib-1
gtk+-2.0 >= $GTK_MIN_VERSION
mutter-plugins >= $MUTTER_MIN_VERSION
gjs-gi-1.0 >= $GJS_MIN_VERSION
diff --git a/data/Makefile.am b/data/Makefile.am
index 2dc4199..579ee8e 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -46,9 +46,21 @@ dist_theme_DATA = \
theme/ws-switch-arrow-left.svg \
theme/ws-switch-arrow-right.svg
+gsettings_SCHEMAS = org.gnome.shell.gschema.xml
+ INTLTOOL_XML_NOMERGE_RULE@
+ GSETTINGS_RULES@
-schemadir = @GCONF_SCHEMA_FILE_DIR@
-schema_DATA = gnome-shell.schemas
+# We need to compile schemas at make time
+# to run from source tree
+gschemas.compiled: org.gnome.shell.gschema.xml
+ $(AM_V_GEN) $(GLIB_COMPILE_SCHEMAS) --targetdir=. .
+
+all-local: gschemas.compiled
+
+
+# GConf schemas: provide defaults for keys from Metacity we are overriding
+gconfschemadir = @GCONF_SCHEMA_FILE_DIR@
+gconfschema_DATA = gnome-shell.schemas
menudir = $(sysconfdir)/xdg/menus
@@ -56,16 +68,21 @@ menu_DATA = \
gs-applications.menu
install-data-local:
- GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(srcdir)/$(schema_DATA)
+ GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(srcdir)/$(gconfschema_DATA)
+
+
EXTRA_DIST = \
gnome-shell.desktop.in.in \
gnome-shell-clock-preferences.desktop.in.in \
$(menu_DATA) \
- $(schema_DATA)
+ $(gconfschema_DATA) \
+ org.gnome.shell.gschema.xml.in
CLEANFILES = \
gnome-shell.desktop.in \
gnome-shell-clock-preferences.desktop.in \
- $(desktop_DATA)
+ $(desktop_DATA) \
+ $(gsettings_SCHEMAS) \
+ gschemas.compiled
diff --git a/data/gnome-shell.schemas b/data/gnome-shell.schemas
index 434986f..17373a5 100644
--- a/data/gnome-shell.schemas
+++ b/data/gnome-shell.schemas
@@ -1,223 +1,7 @@
<gconfschemafile>
<schemalist>
- <schema>
- <key>/schemas/desktop/gnome/shell/development_tools</key>
- <applyto>/desktop/gnome/shell/development_tools</applyto>
- <owner>gnome-shell</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Enable internal tools useful for developers and testers from Alt-F2</short>
- <long>
- Allows access to internal debugging and monitoring tools using
- the Alt-F2 dialog.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/gnome/shell/app_monitor/enable_monitoring</key>
- <applyto>/desktop/gnome/shell/app_monitor/enable_monitoring</applyto>
- <owner>gnome-shell</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Whether to collect stats about applications usage</short>
- <long>
- The shell normally monitors active applications in order to present the most used ones (e.g. in launchers). While this data will be kept private, you may want to disable this for privacy reasons. Please note that doing so won't remove already saved data.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/gnome/shell/favorite_apps</key>
- <applyto>/desktop/gnome/shell/favorite_apps</applyto>
- <owner>gnome-shell</owner>
- <type>list</type>
- <list_type>string</list_type>
- <default>[mozilla-firefox.desktop,evolution.desktop,openoffice.org-writer.desktop]</default>
- <locale name="C">
- <short>List of desktop file IDs for favorite applications</short>
- <long>
- The applications corresponding to these identifiers will be displayed in the favorites area.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/gnome/shell/run_dialog/history</key>
- <applyto>/desktop/gnome/shell/run_dialog/history</applyto>
- <owner>gnome-shell</owner>
- <type>list</type>
- <list_type>string</list_type>
- <default>[]</default>
- <locale name="C">
- <short>History for command (Alt-F2) dialog</short>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/gnome/shell/clock/format</key>
- <applyto>/desktop/gnome/shell/clock/format</applyto>
- <owner>gnome-shell</owner>
- <type>string</type>
- <default>
- <!-- Translators:
- This controls whether the GNOME panel clock should display time
- in 24 hour mode or 12 hour mode by default. The only valid values
- for this are "24-hour" and "12-hour".
- If your locale uses 24 hour time notation, translate this to
- "24-hour".
- If your locale uses 12 hour time notation with am/pm, translate
- this to "12-hour".
-
- Do NOT translate this into anything else than "24-hour" or
- "12-hour". For example, if you translate this to "24 sata" or
- anything else that isn't "24-hour" or "12-hour", things will
- not work.
- -->
- 24-hour
- </default>
- <locale name="C">
- <short>Hour format</short>
- <long>
- This key specifies the hour format used by the panel clock.
- Possible values are "12-hour", "24-hour", "unix" and "custom".
- If set to "unix", the clock will display time in seconds since Epoch,
- i.e. 1970-01-01.
- If set to "custom", the clock will display time according to the format
- specified in the custom_format key.
- Note that if set to either "unix" or "custom", the show_date and
- show_seconds keys are ignored.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/gnome/shell/clock/custom_format</key>
- <applyto>/desktop/gnome/shell/clock/custom_format</applyto>
- <owner>gnome-shell</owner>
- <type>string</type>
- <default></default>
- <locale name="C">
- <short>Custom format of the clock</short>
- <long>
- This key specifies the format used by the panel clock when the
- format key is set to "custom". You can use conversion specifiers
- understood by strftime() to obtain a specific format. See the
- strftime() manual for more information.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/gnome/shell/clock/show_seconds</key>
- <applyto>/desktop/gnome/shell/clock/show_seconds</applyto>
- <owner>gnome-shell</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Show time with seconds</short>
- <long>
- If true and format is either "12-hour" or "24-hour",
- display seconds in time.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/gnome/shell/clock/show_date</key>
- <applyto>/desktop/gnome/shell/clock/show_date</applyto>
- <owner>gnome-shell</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Show date in clock</short>
- <long>
- If true and format is either "12-hour" or "24-hour",
- display date in the clock, in addition to time.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/gnome/shell/disabled_extensions</key>
- <applyto>/desktop/gnome/shell/disabled_extensions</applyto>
- <owner>gnome-shell</owner>
- <type>list</type>
- <list_type>string</list_type>
- <default>[]</default>
- <locale name="C">
- <short>Uuids of extensions to disable</short>
- <long>
- GNOME Shell extensions have a uuid property; this key lists extensions which should not be loaded.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/gnome/shell/recorder/framerate</key>
- <applyto>/desktop/gnome/shell/recorder/framerate</applyto>
- <owner>gnome-shell</owner>
- <type>int</type>
- <default>15</default>
- <locale name="C">
- <short>Framerate used for recording screencasts.</short>
- <long>
- The framerate of the resulting screencast recordered by GNOME Shell's screencast recorder in frames-per-second.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/gnome/shell/recorder/pipeline</key>
- <applyto>/desktop/gnome/shell/recorder/pipeline</applyto>
- <owner>gnome-shell</owner>
- <type>string</type>
- <default></default>
- <locale name="C">
- <short>The gstreamer pipeline used to encode the screencast</short>
- <long>
- Sets the GStreamer pipeline used to encode recordings. It follows the syntax used for gst-launch.
- The pipeline should have an unconnected sink pad where the recorded video is recorded. It will
- normally have a unconnected source pad; output from that pad will be written into the output file.
- However the pipeline can also take care of its own output - this might be used to send the output to an icecast server via shout2send or similar.
- When unset or set to an empty value, the default pipeline will be used. This is currently 'videorate ! theoraenc ! oggmux' and records to Ogg Theora.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/gnome/shell/recorder/file_extension</key>
- <applyto>/desktop/gnome/shell/recorder/file_extension</applyto>
- <owner>gnome-shell</owner>
- <type>string</type>
- <default>ogv</default>
- <locale name="C">
- <short>File extension used for storing the screencast</short>
- <long>
- The filename for recorded screencasts will be a unique filename based on the current date, and use this extension.
- It should be changed when recording to a different container format.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/gnome/shell/overview/workspaces_view</key>
- <applyto>/desktop/gnome/shell/overview/workspaces_view</applyto>
- <owner>gnome-shell</owner>
- <type>string</type>
- <default>single</default>
- <locale name="C">
- <short>Overview workspace view mode</short>
- <long>
- The selected workspace view mode in the overview.
- Supported values are "single" and "grid".
- </long>
- </locale>
- </schema>
-
+ <!-- Metacity overrides -->
<schema>
<key>/schemas/desktop/gnome/shell/windows/button_layout</key>
<applyto>/desktop/gnome/shell/windows/button_layout</applyto>
@@ -438,20 +222,5 @@
</locale>
</schema>
- <!-- Calendar -->
- <schema>
- <key>/schemas/desktop/gnome/shell/calendar/show_weekdate</key>
- <applyto>/desktop/gnome/shell/calendar/show_weekdate</applyto>
- <owner>gnome-shell</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Show the week date in the calendar</short>
- <long>
- If true, display the ISO week date in the calendar.
- </long>
- </locale>
- </schema>
</schemalist>
-
</gconfschemafile>
diff --git a/data/org.gnome.shell.gschema.xml.in b/data/org.gnome.shell.gschema.xml.in
new file mode 100644
index 0000000..085db60
--- /dev/null
+++ b/data/org.gnome.shell.gschema.xml.in
@@ -0,0 +1,158 @@
+<schemalist>
+ <schema id="org.gnome.shell" path="/apps/gnome-shell/"
+ gettext-domain="@GETTEXT_PACKAGE@">
+ <key name="development-tools" type="b">
+ <default>true</default>
+ <_summary>
+ Enable internal tools useful for developers and testers from Alt-F2
+ </_summary>
+ <_description>
+ Allows access to internal debugging and monitoring tools
+ using the Alt-F2 dialog.
+ </_description>
+ </key>
+ <key name="disabled-extensions" type="as">
+ <default>[]</default>
+ <_summary>Uuids of extensions to disable</_summary>
+ <_description>
+ GNOME Shell extensions have a uuid property;
+ this key lists extensions which should not be loaded.
+ </_description>
+ </key>
+ <key name="enable-app-monitoring" type="b">
+ <default>true</default>
+ <_summary>Whether to collect stats about applications usage</_summary>
+ <_description>
+ The shell normally monitors active applications in order to present
+ the most used ones (e.g. in launchers). While this data will be
+ kept private, you may want to disable this for privacy reasons.
+ Please note that doing so won't remove already saved data.
+ </_description>
+ </key>
+ <key name="favorite-apps" type="as">
+ <default>[ 'mozilla-firefox.desktop', 'evolution.desktop', 'openoffice.org-writer.desktop' ]</default>
+ <_summary>List of desktop file IDs for favorite applications</_summary>
+ <_description>
+ The applications corresponding to these identifiers
+ will be displayed in the favorites area.
+ </_description>
+ </key>
+ <key name="command-history" type="as">
+ <default>[]</default>
+ <_summary>History for command (Alt-F2) dialog</_summary>
+ </key>
+ <key name="workspaces-view" type="s">
+ <default>'single'</default>
+ <_summary>Overview workspace view mode</_summary>
+ <_description>
+ The selected workspace view mode in the overview.
+ Supported values are "single" and "grid".
+ </_description>
+ <choices>
+ <choice value="single"/>
+ <choice value="grid"/>
+ </choices>
+ </key>
+ <child name="clock" schema="org.gnome.shell.clock"/>
+ <child name="calendar" schema="org.gnome.shell.calendar"/>
+ <child name="recorder" schema="org.gnome.shell.recorder"/>
+ </schema>
+
+ <schema id="org.gnome.shell.calendar" path="/apps/gnome-shell/calendar/"
+ gettext-domain="@GETTEXT_PACKAGE@">
+ <key name="show-weekdate" type="b">
+ <default>false</default>
+ <_summary>Show the week date in the calendar</_summary>
+ <_description>
+ If true, display the ISO week date in the calendar.
+ </_description>
+ </key>
+ </schema>
+
+ <schema id="org.gnome.shell.clock" path="/apps/gnome-shell/clock/"
+ gettext-domain="@GETTEXT_PACKAGE@">
+ <key name="format" type="s">
+ <default l10n="messages" context="hour_format">
+ <!-- TRANSLATORS: This is the default hour format, choose ONLY '12-hour' or '24-hour'. -->
+ "12-hour"
+ </default>
+ <_summary>Hour format</_summary>
+ <_description>
+ This key specifies the hour format used by the panel clock.
+ Possible values are "12-hour", "24-hour", "unix" and "custom". If set
+ to "unix", the clock will display time in seconds since Epoch,
+ i.e. 1970-01-01. If set to "custom", the clock will display time
+ according to the format specified in the custom_format key. Note that
+ if set to either "unix" or "custom", the show_date and show_seconds
+ keys are ignored.
+ </_description>
+ <choices>
+ <choice value="12-hour"/>
+ <choice value="24-hour"/>
+ <choice value="unix"/>
+ <choice value="custom"/>
+ </choices>
+ </key>
+ <key name="custom-format" type="s">
+ <default>''</default>
+ <_summary>Custom format of the clock</_summary>
+ <_description>
+ This key specifies the format used by the panel clock when the format
+ key is set to "custom". You can use conversion specifiers understood
+ by strftime() to obtain a specific format. See the strftime() manual
+ for more information.
+ </_description>
+ </key>
+ <key name="show-seconds" type="b">
+ <default>false</default>
+ <_summary>Show time with seconds</_summary>
+ <_description>
+ If true and format is either "12-hour" or "24-hour", display seconds in time.
+ </_description>
+ </key>
+ <key name="show-date" type="b">
+ <default>false</default>
+ <_summary>Show date in clock</_summary>
+ <_description>
+ If true and format is either "12-hour" or "24-hour",
+ display date in the clock, in addition to time.
+ </_description>
+ </key>
+ </schema>
+
+ <schema id="org.gnome.shell.recorder" path="/apps/gnome-shell/recorder/"
+ gettext-domain="@GETTEXT_PACKAGE@">
+ <key name="framerate" type="i">
+ <default>15</default>
+ <_summary>Framerate used for recording screencasts.</_summary>
+ <_description>
+ The framerate of the resulting screencast recordered
+ by GNOME Shell's screencast recorder in frames-per-second.
+ </_description>
+ </key>
+ <key name="pipeline" type="s">
+ <default>''</default>
+ <_summary>The gstreamer pipeline used to encode the screencast</_summary>
+ <_description>
+ Sets the GStreamer pipeline used to encode recordings.
+ It follows the syntax used for gst-launch. The pipeline should have
+ an unconnected sink pad where the recorded video is recorded. It will
+ normally have a unconnected source pad; output from that pad
+ will be written into the output file. However the pipeline can also
+ take care of its own output - this might be used to send the output
+ to an icecast server via shout2send or similar. When unset or set
+ to an empty value, the default pipeline will be used. This is currently
+ 'videorate ! theoraenc ! oggmux' and records to Ogg Theora.
+ </_description>
+ </key>
+ <key name="file-extension" type="s">
+ <default>'ogv'</default>
+ <_summary>File extension used for storing the screencast</_summary>
+ <_description>
+ The filename for recorded screencasts will be a unique filename
+ based on the current date, and use this extension. It should be
+ changed when recording to a different container format.
+ </_description>
+ </key>
+ </schema>
+</schemalist>
diff --git a/js/prefs/clockPreferences.js b/js/prefs/clockPreferences.js
index 180358b..f35d8e2 100644
--- a/js/prefs/clockPreferences.js
+++ b/js/prefs/clockPreferences.js
@@ -1,18 +1,17 @@
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
+const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const Gtk = imports.gi.Gtk;
-const GConf = imports.gi.GConf;
const Lang = imports.lang;
const Signals = imports.signals;
const Gettext = imports.gettext;
-const GCONF_DIR = '/desktop/gnome/shell/clock';
-const FORMAT_KEY = GCONF_DIR + '/format';
-const SHOW_DATE_KEY = GCONF_DIR + '/show_date';
-const SHOW_SECONDS_KEY = GCONF_DIR + '/show_seconds';
+const FORMAT_KEY = 'format';
+const SHOW_DATE_KEY = 'show-date';
+const SHOW_SECONDS_KEY = 'show-seconds';
function ClockPreferences(uiFile) {
@@ -34,25 +33,25 @@ ClockPreferences.prototype = {
delete builder;
- this._gconf = GConf.Client.get_default();
- this._gconf.add_dir(GCONF_DIR, GConf.ClientPreloadType.PRELOAD_NONE);
- this._notifyId = this._gconf.notify_add(GCONF_DIR,
+ this._settings = new Gio.Settings({ schema: 'org.gnome.shell.clock' });
+ this._notifyId = this._settings.connect('changed',
Lang.bind(this,
this._updateDialog));
this._12hrRadio.connect('toggled', Lang.bind(this,
function() {
let format = this._12hrRadio.active ? '12-hour' : '24-hour';
- this._gconf.set_string(FORMAT_KEY, format);
+ this._settings.set_string(FORMAT_KEY, format);
}));
this._dateCheck.connect('toggled', Lang.bind(this,
function() {
- this._gconf.set_bool(SHOW_DATE_KEY, this._dateCheck.active);
+ this._settings.set_boolean(SHOW_DATE_KEY,
+ this._dateCheck.active);
}));
this._secondsCheck.connect('toggled', Lang.bind(this,
function() {
- this._gconf.set_bool(SHOW_SECONDS_KEY,
- this._secondsCheck.active);
+ this._settings.set_boolean(SHOW_SECONDS_KEY,
+ this._secondsCheck.active);
}));
this._updateDialog();
@@ -63,17 +62,17 @@ ClockPreferences.prototype = {
},
_updateDialog: function() {
- let format = this._gconf.get_string(FORMAT_KEY);
+ let format = this._settings.get_string(FORMAT_KEY);
this._12hrRadio.active = (format == "12-hour");
this._24hrRadio.active = (format == "24-hour");
- this._dateCheck.active = this._gconf.get_bool(SHOW_DATE_KEY);
- this._secondsCheck.active = this._gconf.get_bool(SHOW_SECONDS_KEY);
+ this._dateCheck.active = this._settings.get_boolean(SHOW_DATE_KEY);
+ this._secondsCheck.active = this._settings.get_boolean(SHOW_SECONDS_KEY);
},
_onResponse: function() {
this._dialog.destroy();
- this._gconf.notify_remove(this._notifyId);
+ this._settings.disconnect(this._notifyId);
this.emit('destroy');
}
};
diff --git a/js/ui/appFavorites.js b/js/ui/appFavorites.js
index 16728f7..d916b96 100644
--- a/js/ui/appFavorites.js
+++ b/js/ui/appFavorites.js
@@ -13,12 +13,11 @@ function AppFavorites() {
}
AppFavorites.prototype = {
- FAVORITE_APPS_KEY: 'favorite_apps',
+ FAVORITE_APPS_KEY: 'favorite-apps',
_init: function() {
this._favorites = {};
- this._gconf = Shell.GConf.get_default();
- this._gconf.connect('changed::' + this.FAVORITE_APPS_KEY, Lang.bind(this, this._onFavsChanged));
+ global.settings.connect('changed::' + this.FAVORITE_APPS_KEY, Lang.bind(this, this._onFavsChanged));
this._reload();
},
@@ -28,7 +27,7 @@ AppFavorites.prototype = {
},
_reload: function() {
- let ids = Shell.GConf.get_default().get_string_list('favorite_apps');
+ let ids = global.settings.get_strv(this.FAVORITE_APPS_KEY);
let appSys = Shell.AppSystem.get_default();
let apps = ids.map(function (id) {
return appSys.get_app(id);
@@ -75,7 +74,7 @@ AppFavorites.prototype = {
let ids = this._getIds();
ids.push(appId);
- this._gconf.set_string_list(this.FAVORITE_APPS_KEY, ids);
+ global.settings.set_strv(this.FAVORITE_APPS_KEY, ids);
this._favorites[appId] = app;
return true;
},
@@ -96,7 +95,7 @@ AppFavorites.prototype = {
return false;
let ids = this._getIds().filter(function (id) { return id != appId; });
- this._gconf.set_string_list(this.FAVORITE_APPS_KEY, ids);
+ global.settings.set_strv(this.FAVORITE_APPS_KEY, ids);
return true;
},
diff --git a/js/ui/calendar.js b/js/ui/calendar.js
index 080ab1d..6afbc1c 100644
--- a/js/ui/calendar.js
+++ b/js/ui/calendar.js
@@ -1,6 +1,7 @@
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
const Clutter = imports.gi.Clutter;
+const Gio = imports.gi.Gio;
const Lang = imports.lang;
const St = imports.gi.St;
const Pango = imports.gi.Pango;
@@ -10,7 +11,7 @@ const Gettext_gtk20 = imports.gettext.domain('gtk20');
const MSECS_IN_DAY = 24 * 60 * 60 * 1000;
const MSECS_IN_WEEK = MSECS_IN_DAY * 7;
const WEEKDATE_HEADER_WIDTH_DIGITS = 3;
-const SHOW_WEEKDATE_KEY = 'calendar/show_weekdate';
+const SHOW_WEEKDATE_KEY = 'show-weekdate';
function _sameDay(dateA, dateB) {
return (dateA.getDate() == dateB.getDate() &&
@@ -48,10 +49,10 @@ Calendar.prototype = {
this._weekStart = NaN;
this._weekdate = NaN;
this._digitWidth = NaN;
- this._gconf = Shell.GConf.get_default();
+ this._settings = new Gio.Settings({ schema: 'org.gnome.shell.calendar' });
- this._gconf.connect('changed', Lang.bind(this, this._onSettingsChange));
- this._useWeekdate = this._gconf.get_boolean(SHOW_WEEKDATE_KEY);
+ this._settings.connect('changed::' + SHOW_WEEKDATE_KEY, Lang.bind(this, this._onSettingsChange));
+ this._useWeekdate = this._settings.get_boolean(SHOW_WEEKDATE_KEY);
let weekStartString = Gettext_gtk20.gettext('calendar:week_start:0');
if (weekStartString.indexOf('calendar:week_start:') == 0) {
@@ -201,7 +202,7 @@ Calendar.prototype = {
},
_onSettingsChange: function() {
- this._useWeekdate = this._gconf.get_boolean(SHOW_WEEKDATE_KEY);
+ this._useWeekdate = this._settings.get_boolean(SHOW_WEEKDATE_KEY);
this._buildHeader();
this._update();
},
diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js
index 8031bfe..fa88421 100644
--- a/js/ui/extensionSystem.js
+++ b/js/ui/extensionSystem.js
@@ -127,7 +127,7 @@ function init() {
global.logError('' + e);
}
- disabledExtensions = Shell.GConf.get_default().get_string_list('disabled_extensions');
+ disabledExtensions = global.settings.get_strv('disabled-extensions', -1);
}
function _loadExtensionsIn(dir, type) {
diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js
index 39241c2..ea046ab 100644
--- a/js/ui/lookingGlass.js
+++ b/js/ui/lookingGlass.js
@@ -1,6 +1,7 @@
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
const Clutter = imports.gi.Clutter;
+const GConf = imports.gi.GConf;
const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
const Pango = imports.gi.Pango;
@@ -582,10 +583,10 @@ LookingGlass.prototype = {
vertical: true,
visible: false });
- let gconf = Shell.GConf.get_default();
- gconf.watch_directory('/desktop/gnome/interface');
- gconf.connect('changed::/desktop/gnome/interface/monospace_font_name',
- Lang.bind(this, this._updateFont));
+ let gconf = GConf.Client.get_default();
+ gconf.add_dir('/desktop/gnome/interface', GConf.ClientPreloadType.PRELOAD_NONE);
+ gconf.notify_add('/desktop/gnome/interface/monospace_font_name',
+ Lang.bind(this, this._updateFont));
this._updateFont();
Main.uiGroup.add_actor(this.actor);
@@ -696,7 +697,7 @@ LookingGlass.prototype = {
},
_updateFont: function() {
- let gconf = Shell.GConf.get_default();
+ let gconf = GConf.Client.get_default();
let fontName = gconf.get_string('/desktop/gnome/interface/monospace_font_name');
// This is mishandled by the scanner - should by Pango.FontDescription_from_string(fontName);
// https://bugzilla.gnome.org/show_bug.cgi?id=595889
diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js
index d9643a2..518b33e 100644
--- a/js/ui/magnifier.js
+++ b/js/ui/magnifier.js
@@ -1,6 +1,7 @@
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
const DBus = imports.dbus;
+const GConf = imports.gi.GConf;
const Gtk = imports.gi.Gtk;
const Gdk = imports.gi.Gdk;
const Clutter = imports.gi.Clutter;
@@ -461,7 +462,7 @@ Magnifier.prototype = {
},
_gConfInit: function(zoomRegion) {
- let gConf = Shell.GConf.get_default();
+ let gConf = GConf.Client.get_default();
if (zoomRegion) {
// Mag factor is accurate to two decimal places.
let aPref = parseFloat(gConf.get_float(MAG_FACTOR_KEY).toFixed(2));
@@ -472,42 +473,42 @@ Magnifier.prototype = {
if (aPref)
zoomRegion.setScreenPosition(aPref);
- zoomRegion.setLensMode(gConf.get_boolean(LENS_MODE_KEY));
- zoomRegion.setClampScrollingAtEdges(!gConf.get_boolean(CLAMP_MODE_KEY));
+ zoomRegion.setLensMode(gConf.get_bool(LENS_MODE_KEY));
+ zoomRegion.setClampScrollingAtEdges(!gConf.get_bool(CLAMP_MODE_KEY));
aPref = gConf.get_int(MOUSE_TRACKING_KEY);
if (aPref)
zoomRegion.setMouseTrackingMode(aPref);
}
- let showCrosshairs = gConf.get_boolean(SHOW_CROSS_HAIRS_KEY);
+ let showCrosshairs = gConf.get_bool(SHOW_CROSS_HAIRS_KEY);
let thickness = gConf.get_int(CROSS_HAIRS_THICKNESS_KEY);
let color = gConf.get_string(CROSS_HAIRS_COLOR_KEY);
let opacity = gConf.get_int(CROSS_HAIRS_OPACITY_KEY);
let length = gConf.get_int(CROSS_HAIRS_LENGTH_KEY);
- let clip = gConf.get_boolean(CROSS_HAIRS_CLIP_KEY);
+ let clip = gConf.get_bool(CROSS_HAIRS_CLIP_KEY);
this.addCrosshairs(thickness, color, opacity, length, clip);
this.setCrosshairsVisible(showCrosshairs);
- gConf.watch_directory(A11Y_MAG_PREFS_DIR);
- gConf.connect('changed::' + SHOW_KEY, Lang.bind(this, this._updateShowHide));
- gConf.connect('changed::' + SCREEN_POSITION_KEY, Lang.bind(this, this._updateScreenPosition));
- gConf.connect('changed::' + MAG_FACTOR_KEY, Lang.bind(this, this._updateMagFactor));
- gConf.connect('changed::' + LENS_MODE_KEY, Lang.bind(this, this._updateLensMode));
- gConf.connect('changed::' + CLAMP_MODE_KEY, Lang.bind(this, this._updateClampMode));
- gConf.connect('changed::' + MOUSE_TRACKING_KEY, Lang.bind(this, this._updateMouseTrackingMode));
- gConf.connect('changed::' + SHOW_CROSS_HAIRS_KEY, Lang.bind(this, this._updateShowCrosshairs));
- gConf.connect('changed::' + CROSS_HAIRS_THICKNESS_KEY, Lang.bind(this, this._updateCrosshairsThickness));
- gConf.connect('changed::' + CROSS_HAIRS_COLOR_KEY, Lang.bind(this, this._updateCrosshairsColor));
- gConf.connect('changed::' + CROSS_HAIRS_OPACITY_KEY, Lang.bind(this, this._updateCrosshairsOpacity));
- gConf.connect('changed::' + CROSS_HAIRS_LENGTH_KEY, Lang.bind(this, this._updateCrosshairsLength));
- gConf.connect('changed::' + CROSS_HAIRS_CLIP_KEY, Lang.bind(this, this._updateCrosshairsClip));
-
- return gConf.get_boolean(SHOW_KEY);
+ gConf.add_dir(A11Y_MAG_PREFS_DIR, GConf.ClientPreloadType.PRELOAD_ONELEVEL);
+ gConf.notify_add(SHOW_KEY, Lang.bind(this, this._updateShowHide));
+ gConf.notify_add(SCREEN_POSITION_KEY, Lang.bind(this, this._updateScreenPosition));
+ gConf.notify_add(MAG_FACTOR_KEY, Lang.bind(this, this._updateMagFactor));
+ gConf.notify_add(LENS_MODE_KEY, Lang.bind(this, this._updateLensMode));
+ gConf.notify_add(CLAMP_MODE_KEY, Lang.bind(this, this._updateClampMode));
+ gConf.notify_add(MOUSE_TRACKING_KEY, Lang.bind(this, this._updateMouseTrackingMode));
+ gConf.notify_add(SHOW_CROSS_HAIRS_KEY, Lang.bind(this, this._updateShowCrosshairs));
+ gConf.notify_add(CROSS_HAIRS_THICKNESS_KEY, Lang.bind(this, this._updateCrosshairsThickness));
+ gConf.notify_add(CROSS_HAIRS_COLOR_KEY, Lang.bind(this, this._updateCrosshairsColor));
+ gConf.notify_add(CROSS_HAIRS_OPACITY_KEY, Lang.bind(this, this._updateCrosshairsOpacity));
+ gConf.notify_add(CROSS_HAIRS_LENGTH_KEY, Lang.bind(this, this._updateCrosshairsLength));
+ gConf.notify_add(CROSS_HAIRS_CLIP_KEY, Lang.bind(this, this._updateCrosshairsClip));
+
+ return gConf.get_bool(SHOW_KEY);
},
_updateShowHide: function() {
let gConf = Shell.GConf.get_default();
- this.setActive(gConf.get_boolean(SHOW_KEY));
+ this.setActive(gConf.get_bool(SHOW_KEY));
},
_updateScreenPosition: function() {
@@ -535,7 +536,7 @@ Magnifier.prototype = {
// Applies only to the first zoom region.
if (this._zoomRegions.length) {
let gConf = Shell.GConf.get_default();
- this._zoomRegions[0].setLensMode(gConf.get_boolean(LENS_MODE_KEY));
+ this._zoomRegions[0].setLensMode(gConf.get_bool(LENS_MODE_KEY));
}
},
@@ -544,7 +545,7 @@ Magnifier.prototype = {
if (this._zoomRegions.length) {
let gConf = Shell.GConf.get_default();
this._zoomRegions[0].setClampScrollingAtEdges(
- !gConf.get_boolean(CLAMP_MODE_KEY)
+ !gConf.get_bool(CLAMP_MODE_KEY)
);
}
},
@@ -561,7 +562,7 @@ Magnifier.prototype = {
_updateShowCrosshairs: function() {
let gConf = Shell.GConf.get_default();
- this.setCrosshairsVisible(gConf.get_boolean(SHOW_CROSS_HAIRS_KEY));
+ this.setCrosshairsVisible(gConf.get_bool(SHOW_CROSS_HAIRS_KEY));
},
_updateCrosshairsThickness: function() {
@@ -586,7 +587,7 @@ Magnifier.prototype = {
_updateCrosshairsClip: function() {
let gConf = Shell.GConf.get_default();
- this.setCrosshairsClip(gConf.get_boolean(CROSS_HAIRS_CLIP_KEY));
+ this.setCrosshairsClip(gConf.get_bool(CROSS_HAIRS_CLIP_KEY));
}
};
diff --git a/js/ui/main.js b/js/ui/main.js
index b54ee20..77930a7 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -11,6 +11,7 @@ const DBus = imports.dbus;
const Gdk = imports.gi.Gdk;
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
+const GConf = imports.gi.GConf;
const Lang = imports.lang;
const Mainloop = imports.mainloop;
const Meta = imports.gi.Meta;
@@ -133,7 +134,9 @@ function start() {
_startDate = new Date();
- global.screen.connect('toggle-recording', function() {
+ let recorderSettings = new Gio.Settings({ schema: 'org.gnome.shell.recorder' });
+
+ global.screen.connect('toggle-recording', function(recorderSettings) {
if (recorder == null) {
recorder = new Shell.Recorder({ stage: global.stage });
}
@@ -141,11 +144,11 @@ function start() {
if (recorder.is_recording()) {
recorder.pause();
} else {
- //read the parameters from GConf always in case they have changed
- let gconf = Shell.GConf.get_default();
- recorder.set_framerate(gconf.get_int('recorder/framerate'));
- recorder.set_filename('shell-%d%u-%c.' + gconf.get_string('recorder/file_extension'));
- let pipeline = gconf.get_string('recorder/pipeline');
+ // read the parameters from GSettings always in case they have changed
+ recorder.set_framerate(recorderSettings.get_int('framerate'));
+ recorder.set_filename('shell-%d%u-%c.' + recorderSettings.get_string('file-extension'));
+ let pipeline = recorderSettings.get_string('pipeline');
+
if (!pipeline.match(/^\s*$/))
recorder.set_pipeline(pipeline);
else
@@ -296,7 +299,7 @@ function _globalKeyPressHandler(actor, event) {
let symbol = event.get_key_symbol();
if (symbol == Clutter.Print) {
// We want to be able to take screenshots of the shell at all times
- let gconf = Shell.GConf.get_default();
+ let gconf = GConf.Client.get_default();
let command = gconf.get_string('/apps/metacity/keybinding_commands/command_screenshot');
if (command != null && command != '') {
let [ok, len, args] = GLib.shell_parse_argv(command);
diff --git a/js/ui/panel.js b/js/ui/panel.js
index 40d607e..48dabc8 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -2,6 +2,8 @@
const Cairo = imports.cairo;
const Clutter = imports.gi.Clutter;
+const GConf = imports.gi.GConf;
+const Gio = imports.gi.Gio;
const Gtk = imports.gi.Gtk;
const Lang = imports.lang;
const Mainloop = imports.mainloop;
@@ -40,10 +42,10 @@ const STANDARD_TRAY_ICON_IMPLEMENTATIONS = {
'gnome-power-manager': 'battery'
};
-const CLOCK_FORMAT_KEY = 'clock/format';
-const CLOCK_CUSTOM_FORMAT_KEY = 'clock/custom_format';
-const CLOCK_SHOW_DATE_KEY = 'clock/show_date';
-const CLOCK_SHOW_SECONDS_KEY = 'clock/show_seconds';
+const CLOCK_FORMAT_KEY = 'format';
+const CLOCK_CUSTOM_FORMAT_KEY = 'custom-format';
+const CLOCK_SHOW_DATE_KEY = 'show-date';
+const CLOCK_SHOW_SECONDS_KEY = 'show-seconds';
function AnimatedIcon(name, size) {
this._init(name, size);
@@ -521,8 +523,8 @@ ClockButton.prototype = {
this._calendarPopup = null;
- let gconf = Shell.GConf.get_default();
- gconf.connect('changed', Lang.bind(this, this._updateClock));
+ this._clockSettings = new Gio.Settings({ schema: 'org.gnome.shell.clock' });
+ this._clockSettings.connect('changed', Lang.bind(this, this._updateClock));
// Start the clock
this._updateClock();
@@ -580,10 +582,9 @@ ClockButton.prototype = {
},
_updateClock: function() {
- let gconf = Shell.GConf.get_default();
- let format = gconf.get_string(CLOCK_FORMAT_KEY);
- let showDate = gconf.get_boolean(CLOCK_SHOW_DATE_KEY);
- let showSeconds = gconf.get_boolean(CLOCK_SHOW_SECONDS_KEY);
+ let format = this._clockSettings.get_string(CLOCK_FORMAT_KEY);
+ let showDate = this._clockSettings.get_boolean(CLOCK_SHOW_DATE_KEY);
+ let showSeconds = this._clockSettings.get_boolean(CLOCK_SHOW_SECONDS_KEY);
let clockFormat;
switch (format) {
@@ -595,7 +596,7 @@ ClockButton.prototype = {
case 'custom':
// force updates every second
showSeconds = true;
- clockFormat = gconf.get_string(CLOCK_CUSTOM_FORMAT_KEY);
+ clockFormat = this._clockSettings.get_string(CLOCK_CUSTOM_FORMAT_KEY);
break;
case '24-hour':
if (showDate)
diff --git a/js/ui/placeDisplay.js b/js/ui/placeDisplay.js
index 452c8e1..1689cf5 100644
--- a/js/ui/placeDisplay.js
+++ b/js/ui/placeDisplay.js
@@ -2,6 +2,7 @@
const Clutter = imports.gi.Clutter;
const Pango = imports.gi.Pango;
+const GConf = imports.gi.GConf;
const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
const Shell = imports.gi.Shell;
@@ -120,13 +121,13 @@ function PlacesManager() {
PlacesManager.prototype = {
_init: function() {
- let gconf = Shell.GConf.get_default();
- gconf.watch_directory(NAUTILUS_PREFS_DIR);
+ 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_boolean(DESKTOP_IS_HOME_KEY);
+ this._isDesktopHome = gconf.get_bool(DESKTOP_IS_HOME_KEY);
let homeFile = Gio.file_new_for_path (GLib.get_home_dir());
let homeUri = homeFile.get_uri();
@@ -225,7 +226,7 @@ PlacesManager.prototype = {
this._reloadBookmarks();
- gconf.connect('changed::' + DESKTOP_IS_HOME_KEY, Lang.bind(this, this._updateDesktopMenuVisibility));
+ gconf.notify_add(DESKTOP_IS_HOME_KEY, Lang.bind(this, this._updateDesktopMenuVisibility));
},
@@ -336,7 +337,7 @@ PlacesManager.prototype = {
},
_updateDesktopMenuVisibility: function() {
- let gconf = Shell.GConf.get_default();
+ let gconf = GConf.Client.get_default();
this._isDesktopHome = gconf.get_boolean(DESKTOP_IS_HOME_KEY);
if (this._isDesktopHome)
diff --git a/js/ui/runDialog.js b/js/ui/runDialog.js
index 726d382..8aeb180 100644
--- a/js/ui/runDialog.js
+++ b/js/ui/runDialog.js
@@ -18,7 +18,7 @@ const Tweener = imports.ui.tweener;
const MAX_FILE_DELETED_BEFORE_INVALID = 10;
-const HISTORY_KEY = 'run_dialog/history';
+const HISTORY_KEY = 'command-history';
const HISTORY_LIMIT = 512;
const DIALOG_FADE_TIME = 0.1;
@@ -179,17 +179,16 @@ RunDialog.prototype = {
_init : function() {
this._isOpen = false;
- this._gconf = Shell.GConf.get_default();
- this._gconf.connect('changed::development_tools', Lang.bind(this, function () {
- this._enableInternalCommands = this._gconf.get_boolean('development_tools');
+ global.settings.connect('changed::development-tools', Lang.bind(this, function () {
+ this._enableInternalCommands = global.settings.get_boolean('development-tools');
}));
- this._enableInternalCommands = this._gconf.get_boolean('development_tools');
+ this._enableInternalCommands = global.settings.get_boolean('development-tools');
- this._history = this._gconf.get_string_list(HISTORY_KEY);
+ this._history = global.settings.get_strv(HISTORY_KEY);
this._historyIndex = -1;
- this._gconf.connect('changed::' + HISTORY_KEY, Lang.bind(this, function() {
- this._history = this._gconf.get_string_list(HISTORY_KEY);
+ global.settings.connect('changed::' + HISTORY_KEY, Lang.bind(this, function() {
+ this._history = global.settings.get_strv(HISTORY_KEY);
this._historyIndex = this._history.length;
}));
@@ -327,7 +326,7 @@ RunDialog.prototype = {
if (this._history.length > HISTORY_LIMIT) {
this._history.splice(0, this._history.length - HISTORY_LIMIT);
}
- this._gconf.set_string_list(HISTORY_KEY, this._history);
+ global.settings.set_strv(HISTORY_KEY, this._history);
},
_run : function(input, inTerminal) {
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index 2683d1d..1f2e315 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -26,13 +26,13 @@ const WORKSPACE_SWITCH_TIME = 0.25;
// Note that mutter has a compile-time limit of 36
const MAX_WORKSPACES = 16;
-// The values here are also used for gconf, and the key and value
+// The values here are also used for GSettings, and the key and value
// names must match
const WorkspacesViewType = {
SINGLE: 'single',
GRID: 'grid'
};
-const WORKSPACES_VIEW_KEY = 'overview/workspaces_view';
+const WORKSPACES_VIEW_KEY = 'workspaces-view';
const WORKSPACE_DRAGGING_SCALE = 0.85;
const WORKSPACE_SHADOW_SCALE = (1 - WORKSPACE_DRAGGING_SCALE) / 2;
@@ -1429,9 +1429,7 @@ WorkspacesControls.prototype = {
this.actor = new St.BoxLayout({ style_class: 'workspaces-bar' });
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
- this._gconf = Shell.GConf.get_default();
-
- let view = this._gconf.get_string(WORKSPACES_VIEW_KEY).toUpperCase();
+ let view = global.settings.get_string(WORKSPACES_VIEW_KEY).toUpperCase();
if (view in WorkspacesViewType)
this._currentViewType = WorkspacesViewType[view];
else
@@ -1528,7 +1526,7 @@ WorkspacesControls.prototype = {
this._toggleViewButton.set_style_class_name('workspace-controls switch-single');
this._currentViewType = view;
- this._gconf.set_string(WORKSPACES_VIEW_KEY, view);
+ global.settings.set_string(WORKSPACES_VIEW_KEY, view);
},
_onDestroy: function() {
@@ -1590,8 +1588,8 @@ WorkspacesManager.prototype = {
this.controlsBar.actor.connect('destroy',
Lang.bind(this, this._onDestroy));
this._viewChangedId =
- Shell.GConf.get_default().connect('changed::' + WORKSPACES_VIEW_KEY,
- Lang.bind(this, this._updateView));
+ global.settings.connect('changed::' + WORKSPACES_VIEW_KEY,
+ Lang.bind(this, this._updateView));
this._nWorkspacesNotifyId =
global.screen.connect('notify::n-workspaces',
Lang.bind(this, this._workspacesChanged));
@@ -1600,7 +1598,7 @@ WorkspacesManager.prototype = {
_updateView: function() {
let viewType, newView;
- let view = Shell.GConf.get_default().get_string(WORKSPACES_VIEW_KEY).toUpperCase();
+ let view = global.settings.get_string(WORKSPACES_VIEW_KEY).toUpperCase();
if (view in WorkspacesViewType)
viewType = WorkspacesViewType[view];
else
@@ -1678,7 +1676,7 @@ WorkspacesManager.prototype = {
if (this._nWorkspacesNotifyId > 0)
global.screen.disconnect(this._nWorkspacesNotifyId);
if (this._viewChangedId > 0)
- Shell.GConf.get_default().disconnect(this._viewChangedId);
+ global.settings.disconnect(this._viewChangedId);
for (let w = 0; w < this._workspaces.length; w++) {
this._workspaces[w].disconnectAll();
this._workspaces[w].destroy();
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 8100ca3..352d6b8 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,5 +1,6 @@
data/gnome-shell.desktop.in.in
data/gnome-shell-clock-preferences.desktop.in.in
+data/org.gnome.shell.gschema.xml.in
[type: gettext/glade]data/clock-preferences.ui
js/ui/appDisplay.js
js/ui/appFavorites.js
diff --git a/src/Makefile.am b/src/Makefile.am
index 42ca0a0..b063722 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -12,6 +12,7 @@ bin_SCRIPTS = gnome-shell gnome-shell-clock-preferences
gnome-shell: gnome-shell.in
$(AM_V_GEN) sed -e "s|@MUTTER_BIN_DIR[ ]|$(MUTTER_BIN_DIR)|" \
+ -e "s|@datadir[ ]|$(datadir)|" \
-e "s|@GJS_JS_DIR[ ]|$(GJS_JS_DIR)|" \
-e "s|@GJS_JS_NATIVE_DIR[ ]|$(GJS_JS_NATIVE_DIR)|" \
-e "s|@libexecdir[ ]|$(libexecdir)|" \
@@ -25,7 +26,8 @@ CLEANFILES += gnome-shell
EXTRA_DIST += gnome-shell.in
gnome-shell-clock-preferences: gnome-shell-clock-preferences.in
- $(AM_V_GEN) sed -e "s|@pkgdatadir[ ]|$(pkgdatadir)|" \
+ $(AM_V_GEN) sed -e "s|@datadir[ ]|$(datadir)|" \
+ -e "s|@pkgdatadir[ ]|$(pkgdatadir)|" \
-e "s|@localedir[ ]|$(datadir)/locale|" \
-e "s|@GJS_CONSOLE[ ]|$(GJS_CONSOLE)|" \
$< > $@ && chmod a+x $@
@@ -65,7 +67,6 @@ shell_public_headers_h = \
shell-doc-system.h \
shell-drawing.h \
shell-embedded-window.h \
- shell-gconf.h \
shell-generic-container.h \
shell-gtk-embed.h \
shell-process.h \
@@ -99,7 +100,6 @@ libgnome_shell_la_SOURCES = \
shell-doc-system.c \
shell-drawing.c \
shell-embedded-window.c \
- shell-gconf.c \
shell-generic-container.c \
shell-gtk-embed.c \
shell-process.c \
diff --git a/src/gnome-shell-clock-preferences.in b/src/gnome-shell-clock-preferences.in
index 9c471ab..8ed2aa9 100644
--- a/src/gnome-shell-clock-preferences.in
+++ b/src/gnome-shell-clock-preferences.in
@@ -5,15 +5,19 @@ then
scriptDir="`dirname $0`"
uiDir="$scriptDir/../data"
jsDir="$scriptDir/../js"
+ schemaDir="$scriptDir/../data"
else
uiDir="@pkgdatadir@"
jsDir="@pkgdatadir@/js"
+ schemaDir="@datadir@/glib-2.0/schemas"
fi
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;
ClockPreferences.main({ progName: '$progName',
diff --git a/src/gnome-shell.in b/src/gnome-shell.in
index ad95c55..01f9917 100644
--- a/src/gnome-shell.in
+++ b/src/gnome-shell.in
@@ -155,13 +155,17 @@ 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'})
if running_from_source_tree:
- env.update({'GNOME_SHELL_DATADIR' : data_dir,
- 'GI_TYPELIB_PATH' : typelib_dir})
+ env.update({'GNOME_SHELL_DATADIR' : data_dir,
+ 'GI_TYPELIB_PATH' : typelib_dir,
+ 'GSETTINGS_SCHEMA_DIR' : data_dir })
+ else:
+ env.update({'GSETTINGS_SCHEMA_DIR' : os.path.join('@datadir@', 'glib-2.0', 'schemas')})
jhbuild_gconf_source = os.path.join('@sysconfdir@', 'gconf/2/path.jhbuild')
if os.path.exists(jhbuild_gconf_source):
diff --git a/src/shell-app-system.c b/src/shell-app-system.c
index c0ebc7f..f2813ea 100644
--- a/src/shell-app-system.c
+++ b/src/shell-app-system.c
@@ -8,8 +8,6 @@
#include <gio/gio.h>
#include <gio/gdesktopappinfo.h>
#include <gtk/gtk.h>
-#include <gconf/gconf.h>
-#include <gconf/gconf-client.h>
#include <clutter/clutter.h>
#include "shell-app-private.h"
@@ -20,8 +18,6 @@
#define GMENU_I_KNOW_THIS_IS_UNSTABLE
#include <gmenu-tree.h>
-#define SHELL_APP_FAVORITES_KEY "/desktop/gnome/shell/favorite_apps"
-
/* Vendor prefixes are something that can be preprended to a .desktop
* file name. Undo this.
*/
@@ -197,7 +193,6 @@ static void
shell_app_system_init (ShellAppSystem *self)
{
ShellAppSystemPrivate *priv;
- GConfClient *client;
self->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
SHELL_TYPE_APP_SYSTEM,
@@ -223,8 +218,6 @@ shell_app_system_init (ShellAppSystem *self)
gmenu_tree_add_monitor (priv->settings_tree, on_tree_changed_cb, self);
reread_menus (self);
-
- client = gconf_client_get_default ();
}
static void
diff --git a/src/shell-app-usage.c b/src/shell-app-usage.c
index 2cddffa..6126dc0 100644
--- a/src/shell-app-usage.c
+++ b/src/shell-app-usage.c
@@ -9,9 +9,8 @@
#include <X11/Xatom.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
+#include <glib.h>
#include <gio/gio.h>
-#include <gconf/gconf.h>
-#include <gconf/gconf-client.h>
#include <dbus/dbus-glib.h>
#include "shell-app-usage.h"
@@ -43,8 +42,7 @@
* minutes to signify idle.
*/
-#define APP_MONITOR_GCONF_DIR SHELL_GCONF_DIR"/app_monitor"
-#define ENABLE_MONITORING_KEY APP_MONITOR_GCONF_DIR"/enable_monitoring"
+#define ENABLE_MONITORING_KEY "enable-app-monitoring"
#define FOCUS_TIME_MIN_SECONDS 7 /* Need 7 continuous seconds of focus */
@@ -87,11 +85,10 @@ struct _ShellAppUsage
GFile *configfile;
DBusGProxy *session_proxy;
GdkDisplay *display;
- GConfClient *gconf_client;
gulong last_idle;
guint idle_focus_change_id;
guint save_id;
- guint gconf_notify;
+ guint settings_notify;
gboolean currently_idle;
gboolean enable_monitoring;
@@ -133,10 +130,9 @@ static void restore_from_file (ShellAppUsage *self);
static void update_enable_monitoring (ShellAppUsage *self);
-static void on_enable_monitoring_key_changed (GConfClient *client,
- guint connexion_id,
- GConfEntry *entry,
- gpointer self);
+static void on_enable_monitoring_key_changed (GSettings *settings,
+ const gchar *key,
+ ShellAppUsage *self);
static long
get_time (void)
@@ -381,10 +377,13 @@ on_session_status_changed (DBusGProxy *proxy,
static void
shell_app_usage_init (ShellAppUsage *self)
{
+ ShellGlobal *global;
char *shell_userdata_dir, *path;
DBusGConnection *session_bus;
ShellWindowTracker *tracker;
+ global = shell_global_get ();
+
self->app_usages_for_context = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_hash_table_destroy);
tracker = shell_window_tracker_get_default ();
@@ -411,24 +410,26 @@ shell_app_usage_init (ShellAppUsage *self)
g_free (path);
restore_from_file (self);
- self->gconf_client = gconf_client_get_default ();
- gconf_client_add_dir (self->gconf_client, APP_MONITOR_GCONF_DIR,
- GCONF_CLIENT_PRELOAD_NONE, NULL);
- self->gconf_notify =
- gconf_client_notify_add (self->gconf_client, ENABLE_MONITORING_KEY,
- on_enable_monitoring_key_changed, self, NULL, NULL);
+
+ self->settings_notify = g_signal_connect (shell_global_get_settings (global),
+ "changed::" ENABLE_MONITORING_KEY,
+ G_CALLBACK (on_enable_monitoring_key_changed),
+ self);
update_enable_monitoring (self);
}
static void
shell_app_usage_finalize (GObject *object)
{
+ ShellGlobal *global;
ShellAppUsage *self = SHELL_APP_USAGE (object);
if (self->save_id > 0)
g_source_remove (self->save_id);
- gconf_client_notify_remove (self->gconf_client, self->gconf_notify);
- g_object_unref (self->gconf_client);
+
+ global = shell_global_get ();
+ g_signal_handler_disconnect (shell_global_get_settings (global),
+ self->settings_notify);
g_object_unref (self->configfile);
@@ -896,17 +897,12 @@ out:
static void
update_enable_monitoring (ShellAppUsage *self)
{
- GConfValue *value;
+ ShellGlobal *global;
gboolean enable;
- value = gconf_client_get (self->gconf_client, ENABLE_MONITORING_KEY, NULL);
- if (value)
- {
- enable = gconf_value_get_bool (value);
- gconf_value_free (value);
- }
- else /* Schema is not present, set default value by hand to avoid getting FALSE */
- enable = TRUE;
+ global = shell_global_get ();
+ enable = g_settings_get_boolean (shell_global_get_settings (global),
+ ENABLE_MONITORING_KEY);
/* Be sure not to start the timers if they were already set */
if (enable && !self->enable_monitoring)
@@ -931,12 +927,11 @@ update_enable_monitoring (ShellAppUsage *self)
/* Called when the ENABLE_MONITORING_KEY boolean has changed */
static void
-on_enable_monitoring_key_changed (GConfClient *client,
- guint connexion_id,
- GConfEntry *entry,
- gpointer self)
+on_enable_monitoring_key_changed (GSettings *settings,
+ const gchar *key,
+ ShellAppUsage *self)
{
- update_enable_monitoring ((ShellAppUsage *) self);
+ update_enable_monitoring (self);
}
/**
diff --git a/src/shell-global.c b/src/shell-global.c
index 25afb7b..fa3f922 100644
--- a/src/shell-global.c
+++ b/src/shell-global.c
@@ -50,6 +50,7 @@ struct _ShellGlobal {
GjsContext *js_context;
MutterPlugin *plugin;
ShellWM *wm;
+ GSettings *settings;
const char *datadir;
const char *imagedir;
const char *userdatadir;
@@ -75,6 +76,7 @@ enum {
PROP_STAGE,
PROP_WINDOW_GROUP,
PROP_WINDOW_MANAGER,
+ PROP_SETTINGS,
PROP_DATADIR,
PROP_IMAGEDIR,
PROP_USERDATADIR,
@@ -140,6 +142,9 @@ shell_global_get_property(GObject *object,
case PROP_WINDOW_MANAGER:
g_value_set_object (value, global->wm);
break;
+ case PROP_SETTINGS:
+ g_value_set_object (value, global->settings);
+ break;
case PROP_DATADIR:
g_value_set_string (value, global->datadir);
break;
@@ -181,6 +186,8 @@ shell_global_init (ShellGlobal *global)
/* Ensure config dir exists for later use */
global->userdatadir = g_build_filename (g_get_user_data_dir (), "gnome-shell", NULL);
g_mkdir_with_parents (global->userdatadir, 0700);
+
+ global->settings = g_settings_new ("org.gnome.shell");
global->grab_notifier = GTK_WINDOW (gtk_window_new (GTK_WINDOW_TOPLEVEL));
g_signal_connect (global->grab_notifier, "grab-notify", G_CALLBACK (grab_notify), global);
@@ -262,6 +269,13 @@ shell_global_class_init (ShellGlobalClass *klass)
SHELL_TYPE_WM,
G_PARAM_READABLE));
g_object_class_install_property (gobject_class,
+ PROP_SETTINGS,
+ g_param_spec_object ("settings",
+ "Settings",
+ "GSettings instance for gnome-shell configuration",
+ G_TYPE_SETTINGS,
+ G_PARAM_READABLE));
+ g_object_class_install_property (gobject_class,
PROP_DATADIR,
g_param_spec_string ("datadir",
"Data directory",
@@ -1284,6 +1298,20 @@ shell_get_event_state (ClutterEvent *event)
return state & CLUTTER_MODIFIER_MASK;
}
+/**
+ * shell_global_get_settings:
+ * @global: A #ShellGlobal
+ *
+ * Get the global GSettings instance.
+ *
+ * Return value: (transfer none) The GSettings object (transfer none).
+ */
+GSettings *
+shell_global_get_settings (ShellGlobal *global)
+{
+ return global->settings;
+}
+
static void
shell_popup_menu_position_func (GtkMenu *menu,
int *x,
diff --git a/src/shell-global.h b/src/shell-global.h
index 81df16d..a801238 100644
--- a/src/shell-global.h
+++ b/src/shell-global.h
@@ -89,6 +89,8 @@ void shell_global_get_pointer (ShellGlobal *global,
int *y,
ClutterModifierType *mods);
+GSettings *shell_global_get_settings (ShellGlobal *global);
+
ClutterModifierType shell_get_event_state (ClutterEvent *event);
void shell_popup_menu (GtkMenu *menu, int button, guint32 time,
diff --git a/tools/build/gnome-shell.modules b/tools/build/gnome-shell.modules
index 978399e..cb487f7 100644
--- a/tools/build/gnome-shell.modules
+++ b/tools/build/gnome-shell.modules
@@ -12,6 +12,9 @@
<autotools id="gobject-introspection">
<branch repo="git.gnome.org" module="gobject-introspection"/>
+ <dependencies>
+ <dep package="glib"/>
+ </dependencies>
</autotools>
<autotools id="glib">
@@ -83,6 +86,9 @@
<autotools id="gconf" autogenargs="--disable-defaults-service">
<branch repo="git.gnome.org" module="gconf"/>
+ <dependencies>
+ <dep package="gtk+"/>
+ </dependencies>
</autotools>
<autotools id="mutter" autogenargs="--with-clutter">
@@ -103,6 +109,7 @@
<dep package="mutter"/>
<dep package="gjs"/>
<dep package="gconf"/>
+ <dep package="glib"/>
</dependencies>
</autotools>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]