prepare for allowing parts of the ui to subscribe to connect/disconnect events

This commit is contained in:
Damien Churchill 2009-02-19 01:22:32 +00:00
parent 7344d0b1a3
commit 9e19ae79c8
1 changed files with 24 additions and 6 deletions

View File

@ -1,4 +1,7 @@
Deluge.Connections = { Deluge.Connections = {
connects: new Array(),
disconnects: new Array()
onClose: function(e) { onClose: function(e) {
$clear(Deluge.Connections.running); $clear(Deluge.Connections.running);
Deluge.Connections.Window.hide(); Deluge.Connections.Window.hide();
@ -19,6 +22,12 @@ Deluge.Connections = {
}); });
}, },
onGetHosts: function(hosts) {
Deluge.Connections.Store.loadData(hosts);
var selection = Deluge.Connections.Grid.getSelectionModel();
selection.selectRow(Deluge.Connections.selectedRow);
},
onSelect: function(selModel, rowIndex, record) { onSelect: function(selModel, rowIndex, record) {
Deluge.Connections.selectedRow = rowIndex; Deluge.Connections.selectedRow = rowIndex;
}, },
@ -28,16 +37,25 @@ Deluge.Connections = {
Deluge.Connections.runCheck(); Deluge.Connections.runCheck();
}, },
addConnect: function(fn) {
},
removeConnect: function(fn) {
},
addDisconnect: function(fn) {
},
removeDisconnect: function(fn) {
},
runCheck: function() { runCheck: function() {
Deluge.Client.web.get_hosts({ Deluge.Client.web.get_hosts({
onSuccess: Deluge.Connections.onGetHosts onSuccess: Deluge.Connections.onGetHosts
}); });
},
onGetHosts: function(hosts) {
Deluge.Connections.Store.loadData(hosts);
var selection = Deluge.Connections.Grid.getSelectionModel();
selection.selectRow(Deluge.Connections.selectedRow);
} }
} }