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
This commit is contained in:
@ -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');
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user