LookingGlass: Use GSettings for monospace-font-name

Convert code to look up and watch the configured monospace font
to use GSettings instead of GConf.

https://bugzilla.gnome.org/show_bug.cgi?id=636155
This commit is contained in:
Owen W. Taylor 2010-11-30 13:11:11 -05:00
parent b40cc2c294
commit 46ba718ab2

View File

@ -664,10 +664,10 @@ LookingGlass.prototype = {
vertical: true, vertical: true,
visible: false }); visible: false });
let gconf = GConf.Client.get_default();
gconf.add_dir('/desktop/gnome/interface', GConf.ClientPreloadType.PRELOAD_NONE); this._interfaceSettings = new Gio.Settings({ schema: 'org.gnome.desktop.interface' });
gconf.notify_add('/desktop/gnome/interface/monospace_font_name', this._interfaceSettings.connect('changed::monospace-font-name',
Lang.bind(this, this._updateFont)); Lang.bind(this, this._updateFont));
this._updateFont(); this._updateFont();
Main.uiGroup.add_actor(this.actor); Main.uiGroup.add_actor(this.actor);
@ -778,8 +778,7 @@ LookingGlass.prototype = {
}, },
_updateFont: function() { _updateFont: function() {
let gconf = GConf.Client.get_default(); let fontName = this._interfaceSettings.get_string('monospace-font-name');
let fontName = gconf.get_string('/desktop/gnome/interface/monospace_font_name');
// This is mishandled by the scanner - should by Pango.FontDescription_from_string(fontName); // This is mishandled by the scanner - should by Pango.FontDescription_from_string(fontName);
// https://bugzilla.gnome.org/show_bug.cgi?id=595889 // https://bugzilla.gnome.org/show_bug.cgi?id=595889
let fontDesc = Pango.font_description_from_string(fontName); let fontDesc = Pango.font_description_from_string(fontName);