add help and logout buttons to the toolbar

improve the enabled/disabling of buttons on connect/disconnect
This commit is contained in:
Damien Churchill 2009-02-19 18:42:19 +00:00
parent 0e78b9c3b1
commit b4cc833044
1 changed files with 27 additions and 7 deletions

View File

@ -1,14 +1,22 @@
Deluge.ToolBar = { Deluge.ToolBar = {
connected_buttons: [
'create', 'add', 'remove', 'pause', 'resume', 'up', 'down'
],
onConnect: function() { onConnect: function() {
Deluge.ToolBar.Bar.items.each(function(bn) { $each(this.connected_buttons, function(button_id) {
bn.enable(); this.Bar.items.get(button_id).enable();
}); }, this);
}, },
onDisconnect: function() { onDisconnect: function() {
Deluge.ToolBar.items.each(function(bn) { $each(this.connected_buttons, function(button_id) {
bn.disable(); this.Bar.items.get(button_id).disable();
}); }, this);
},
onLogout: function() {
}, },
onTorrentAction: function(item) { onTorrentAction: function(item) {
@ -128,6 +136,19 @@ Deluge.ToolBar.Bar = new Ext.Toolbar({
text: _('Connection Manager'), text: _('Connection Manager'),
icon: '/icons/16/connection_manager.png', icon: '/icons/16/connection_manager.png',
handler: Deluge.ToolBar.onTorrentAction handler: Deluge.ToolBar.onTorrentAction
},'->',{
id: 'help',
cls: 'x-btn-text-icon',
disabled: true,
icon: '/icons/16/help.png',
text: _('Help')
},{
id: 'logout',
cls: 'x-btn-text-icon',
icon: '/icons/16/logout.png',
disabled: true,
text: _('Logout'),
handler: Deluge.ToolBar.onLogout
} }
], ],
listeners: {'render': Deluge.ToolBar.onToolbarRender, scope: Deluge.ToolBar} listeners: {'render': Deluge.ToolBar.onToolbarRender, scope: Deluge.ToolBar}
@ -148,7 +169,6 @@ Deluge.SideBar = {
}; };
Deluge.StatusBar = new Ext.StatusBar({ Deluge.StatusBar = new Ext.StatusBar({
statusAlign: 'left',
/*items: [{ /*items: [{
id: 'statusbar-connections', id: 'statusbar-connections',
text: '200 (200)', text: '200 (200)',