Author: damoxc

Revision: 6173

Log:
        use createDelegate and add the onHide method that stops updating the 
hosts grid

Diff:
Modified: trunk/deluge/ui/web/js/deluge-all/Deluge.ConnectionManager.js
===================================================================
--- trunk/deluge/ui/web/js/deluge-all/Deluge.ConnectionManager.js       
2010-02-10 23:16:17 UTC (rev 6172)
+++ trunk/deluge/ui/web/js/deluge-all/Deluge.ConnectionManager.js       
2010-02-17 01:34:42 UTC (rev 6173)
@@ -161,10 +161,8 @@
        
                initComponent: function() {
                        
Ext.deluge.ConnectionManager.superclass.initComponent.call(this);
-                       this.on({
-                               'hide': this.onHide,
-                               'show': this.onShow
-                       });
+                       this.on('hide',  this.onHide, this);
+                       this.on('show', this.onShow, this);
                        Deluge.Events.on('login', this.onLogin, this);
                        Deluge.Events.on('logout', this.onLogout, this);
        
@@ -243,6 +241,8 @@
                                        ]
                                })
                        });
+
+                       this.update = this.update.createDelegate(this);
                },
 
                disconnect: function() {
@@ -256,11 +256,11 @@
                        });
                },
        
-               update: function(self) {
-                       self.grid.getStore().each(function(r) {
+               update: function() {
+                       this.grid.getStore().each(function(r) {
                                Deluge.Client.web.get_host_status(r.id, {
-                                       success: self.onGetHostStatus,
-                                       scope: self
+                                       success: this.onGetHostStatus,
+                                       scope: this
                                });
                        }, this);
                },
@@ -337,7 +337,6 @@
                                                }, this, {single: true});
                                        }
                                });
-                               if (this.running) 
window.clearInterval(this.running);
                                this.hide();
                        }
                },
@@ -360,6 +359,10 @@
                        if (this.grid.getSelectionModel().getSelected() == 
record) this.updateButtons(record);
                },
 
+               onHide: function() {
+                       if (this.running) window.clearInterval(this.running);   
+               },
+
                onLogin: function() {
                        Deluge.Client.web.connected({
                                success: function(connected) {


-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to