extensionSystem: Allow extensions to provide mode-specific styling

Allow extensions to integrate with modes that provide a distinct
style by providing a mode-specific stylesheet.

https://bugzilla.gnome.org/show_bug.cgi?id=693219
This commit is contained in:
Florian Müllner 2013-02-05 18:45:21 +01:00
parent fcc32fca7e
commit 2344706462

View File

@ -106,11 +106,15 @@ function enableExtension(uuid) {
extensionOrder.push(uuid);
let stylesheetFile = extension.dir.get_child('stylesheet.css');
if (stylesheetFile.query_exists(null)) {
let theme = St.ThemeContext.get_for_stage(global.stage).get_theme();
theme.load_stylesheet(stylesheetFile.get_path());
extension.stylesheet = stylesheetFile;
let stylesheetNames = [global.session_mode + '.css', 'stylesheet.css'];
for (let i = 0; i < stylesheetNames.length; i++) {
let stylesheetFile = extension.dir.get_child(stylesheetNames[i]);
if (stylesheetFile.query_exists(null)) {
let theme = St.ThemeContext.get_for_stage(global.stage).get_theme();
theme.load_stylesheet(stylesheetFile.get_path());
extension.stylesheet = stylesheetFile;
break;
}
}
extension.stateObj.enable();