fix enabling plugins when the UI is created

change Deluge.Plugin so it implements the enable/disable methods that merely fire events that the plugins can use
This commit is contained in:
Damien Churchill 2009-09-14 10:19:15 +00:00
parent 4df98df1f2
commit e7095195f7
2 changed files with 14 additions and 3 deletions

View File

@ -41,5 +41,15 @@ Deluge.Plugin = Ext.extend(Ext.util.Observable, {
this.isDelugePlugin = true;
Deluge.Plugins[this.name] = this;
Deluge.Plugin.superclass.constructor.call(this, config);
},
disable: function() {
this.fireEvent("disabled", this);
if (this.onDisable) this.onDisable();
},
enable: function() {
this.fireEvent("enable", this);
if (this.onEnable) this.onEnable();
}
});

View File

@ -74,10 +74,11 @@ Deluge.UI = {
Deluge.Client = new Ext.ux.util.RpcClient({
url: '/json'
});
Ext.each(Deluge.Plugins, function(plugin) {
for (var plugin in Deluge.Plugins) {
plugin = Deluge.Plugins[plugin];
plugin.enable();
});
}
Deluge.Client.on('connected', function(e) {
Deluge.Login.show();