move torrentAction to onTorrentAction

This commit is contained in:
Damien Churchill 2009-02-19 02:21:13 +00:00
commit 8ca8c5de05

View file

@ -11,12 +11,7 @@ Deluge.ToolBar = {
}); });
}, },
onToolbarRender: function(toolbar) { onTorrentAction: function(item) {
Deluge.Connections.on("connect", this.onConnect.bindWithEvent(this));
}
}
function torrentAction(item) {
var selection = Deluge.Torrents.getSelectionModel().getSelections(); var selection = Deluge.Torrents.getSelectionModel().getSelections();
var ids = new Array(); var ids = new Array();
$each(selection, function(record) { $each(selection, function(record) {
@ -63,6 +58,11 @@ function torrentAction(item) {
Deluge.Connections.Window.show(); Deluge.Connections.Window.show();
break; break;
} }
},
onToolbarRender: function(toolbar) {
Deluge.Connections.on("connect", this.onConnect.bindWithEvent(this));
}
} }
Deluge.ToolBar.Bar = new Ext.Toolbar({ Deluge.ToolBar.Bar = new Ext.Toolbar({
@ -73,61 +73,61 @@ Deluge.ToolBar.Bar = new Ext.Toolbar({
disabled: true, disabled: true,
text: _('Create'), text: _('Create'),
icon: '/icons/16/create.png', icon: '/icons/16/create.png',
handler: torrentAction handler: Deluge.ToolBar.onTorrentAction
},{ },{
id: 'add', id: 'add',
cls: 'x-btn-text-icon', cls: 'x-btn-text-icon',
disabled: true, disabled: true,
text: _('Add'), text: _('Add'),
icon: '/icons/16/add.png', icon: '/icons/16/add.png',
handler: torrentAction handler: Deluge.ToolBar.onTorrentAction
},{ },{
id: 'remove', id: 'remove',
cls: 'x-btn-text-icon', cls: 'x-btn-text-icon',
disabled: true, disabled: true,
text: _('Remove'), text: _('Remove'),
icon: '/icons/16/remove.png', icon: '/icons/16/remove.png',
handler: torrentAction handler: Deluge.ToolBar.onTorrentAction
},'|',{ },'|',{
id: 'pause', id: 'pause',
cls: 'x-btn-text-icon', cls: 'x-btn-text-icon',
disabled: true, disabled: true,
text: _('Pause'), text: _('Pause'),
icon: '/icons/16/pause.png', icon: '/icons/16/pause.png',
handler: torrentAction handler: Deluge.ToolBar.onTorrentAction
},{ },{
id: 'resume', id: 'resume',
cls: 'x-btn-text-icon', cls: 'x-btn-text-icon',
disabled: true, disabled: true,
text: _('Resume'), text: _('Resume'),
icon: '/icons/16/start.png', icon: '/icons/16/start.png',
handler: torrentAction handler: Deluge.ToolBar.onTorrentAction
},'|',{ },'|',{
id: 'up', id: 'up',
cls: 'x-btn-text-icon', cls: 'x-btn-text-icon',
disabled: true, disabled: true,
text: _('Up'), text: _('Up'),
icon: '/icons/16/up.png', icon: '/icons/16/up.png',
handler: torrentAction handler: Deluge.ToolBar.onTorrentAction
},{ },{
id: 'down', id: 'down',
cls: 'x-btn-text-icon', cls: 'x-btn-text-icon',
disabled: true, disabled: true,
text: _('Down'), text: _('Down'),
icon: '/icons/16/down.png', icon: '/icons/16/down.png',
handler: torrentAction handler: Deluge.ToolBar.onTorrentAction
},'|',{ },'|',{
id: 'preferences', id: 'preferences',
cls: 'x-btn-text-icon', cls: 'x-btn-text-icon',
text: _('Preferences'), text: _('Preferences'),
icon: '/icons/16/preferences.png', icon: '/icons/16/preferences.png',
handler: torrentAction handler: Deluge.ToolBar.onTorrentAction
},{ },{
id: 'connectionman', id: 'connectionman',
cls: 'x-btn-text-icon', cls: 'x-btn-text-icon',
text: _('Connection Manager'), text: _('Connection Manager'),
icon: '/icons/16/connection_manager.png', icon: '/icons/16/connection_manager.png',
handler: torrentAction handler: Deluge.ToolBar.onTorrentAction
} }
], ],
listeners: {'render': Deluge.ToolBar.onToolbarRender, scope: Deluge.ToolBar} listeners: {'render': Deluge.ToolBar.onToolbarRender, scope: Deluge.ToolBar}