user-theme: port to new extension API
main() has been replaced by init(), enable() and disable()
This commit is contained in:
@@ -15,11 +15,26 @@ function ThemeManager() {
|
||||
|
||||
ThemeManager.prototype = {
|
||||
_init: function() {
|
||||
},
|
||||
|
||||
enable: function() {
|
||||
this._settings = new Gio.Settings({ schema: SETTINGS_SCHEMA });
|
||||
this._settings.connect('changed::'+SETTINGS_KEY, Lang.bind(this, this._changeTheme));
|
||||
this._changedId = this._settings.connect('changed::'+SETTINGS_KEY, Lang.bind(this, this._changeTheme));
|
||||
this._changeTheme();
|
||||
},
|
||||
|
||||
disable: function() {
|
||||
if (this._changedId) {
|
||||
this._settings.disconnect(this._changedId);
|
||||
this._changedId = 0;
|
||||
}
|
||||
|
||||
this._settings = null;
|
||||
|
||||
Main.setThemeStylesheet(null);
|
||||
Main.loadTheme();
|
||||
},
|
||||
|
||||
_changeTheme: function() {
|
||||
let _stylesheet = null;
|
||||
let _themeName = this._settings.get_string(SETTINGS_KEY);
|
||||
@@ -52,6 +67,6 @@ ThemeManager.prototype = {
|
||||
}
|
||||
|
||||
|
||||
function main(metadata) {
|
||||
new ThemeManager();
|
||||
function init(metadata) {
|
||||
return new ThemeManager();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user