From: Darren Date: Mon, 1 Oct 2012 13:57:02 +0000 (+0100) Subject: Panel model now .unbind()ing events X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ea033d12696ddd9aaf79f52b316121a87edf5659;p=KiwiIRC.git Panel model now .unbind()ing events --- diff --git a/client_backbone/dev/model_applet.js b/client_backbone/dev/model_applet.js index 36f548a..836c1d1 100755 --- a/client_backbone/dev/model_applet.js +++ b/client_backbone/dev/model_applet.js @@ -61,5 +61,14 @@ kiwi.model.Applet = kiwi.model.Panel.extend({ // Load a new instance of this applet that.load(new kiwi.applets[applet_name]()); }); + }, + + close: function () { + this.view.$el.remove(); + this.destroy(); + + this.view = undefined; + + this.closePanel(); } }); \ No newline at end of file diff --git a/client_backbone/dev/model_application.js b/client_backbone/dev/model_application.js index 0ff5bce..d3ec065 100755 --- a/client_backbone/dev/model_application.js +++ b/client_backbone/dev/model_application.js @@ -515,7 +515,7 @@ kiwi.model.Application = function () { kiwi.app.panels.add(panel); panel.view.show(); - + kiwi.app.channel_list = list; }); diff --git a/client_backbone/dev/model_panel.js b/client_backbone/dev/model_panel.js index 571ceb4..ac123d4 100755 --- a/client_backbone/dev/model_panel.js +++ b/client_backbone/dev/model_panel.js @@ -54,9 +54,11 @@ kiwi.model.Panel = Backbone.Model.extend({ this.trigger("msg", message_obj); }, - close: function () { - this.view.remove(); - delete this.view; + closePanel: function () { + if (this.view) { + this.view.remove(); + delete this.view; + } var members = this.get('members'); if (members) { @@ -64,6 +66,7 @@ kiwi.model.Panel = Backbone.Model.extend({ this.unset('members'); } + this.unbind(); this.destroy(); // If closing the active panel, switch to the server panel @@ -72,6 +75,11 @@ kiwi.model.Panel = Backbone.Model.extend({ } }, + // Alias to closePanel() for child objects to override + close: function () { + return this.closePanel(); + }, + isChannel: function () { var channel_prefix = kiwi.gateway.get('channel_prefix'), this_name = this.get('name');