lookingGlass: Get font from GConf
Instead of using "Monospace", pick the users configured monospace font name up from GConf. (This is a nice touch, but is more done here to demonstrate that we can do it rather than for any great utility.)
This commit is contained in:
parent
661100abe8
commit
4f070317d2
@ -70,7 +70,6 @@ NbtkScrollBar NbtkButton#vhandle:hover
|
|||||||
padding: 4px;
|
padding: 4px;
|
||||||
border: 1px solid rgba(0,0,172,0.85);
|
border: 1px solid rgba(0,0,172,0.85);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
font-family: Monospace;
|
|
||||||
|
|
||||||
color: #88ff66;
|
color: #88ff66;
|
||||||
}
|
}
|
||||||
|
@ -305,6 +305,13 @@ LookingGlass.prototype = {
|
|||||||
this.actor = new Nbtk.BoxLayout({ name: "LookingGlassDialog",
|
this.actor = new Nbtk.BoxLayout({ name: "LookingGlassDialog",
|
||||||
vertical: true,
|
vertical: true,
|
||||||
visible: false });
|
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));
|
||||||
|
this._updateFont();
|
||||||
|
|
||||||
global.stage.add_actor(this.actor);
|
global.stage.add_actor(this.actor);
|
||||||
|
|
||||||
let toolbar = new Nbtk.BoxLayout({ name: "Toolbar" });
|
let toolbar = new Nbtk.BoxLayout({ name: "Toolbar" });
|
||||||
@ -409,6 +416,19 @@ LookingGlass.prototype = {
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_updateFont: function() {
|
||||||
|
let gconf = Shell.GConf.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
|
||||||
|
let fontDesc = Pango.Font.description_from_string(fontName);
|
||||||
|
// We ignore everything but size and style; you'd be crazy to set your system-wide
|
||||||
|
// monospace font to be bold/oblique/etc. Could easily be added here.
|
||||||
|
this.actor.style =
|
||||||
|
'font-size: ' + fontDesc.get_size() / 1024. + (fontDesc.get_size_is_absolute() ? 'px' : 'pt') + ';'
|
||||||
|
+ 'font-family: "' + fontDesc.get_family() + '";';
|
||||||
|
},
|
||||||
|
|
||||||
_readHistory: function () {
|
_readHistory: function () {
|
||||||
if (!this._historyFile.query_exists(null))
|
if (!this._historyFile.query_exists(null))
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user