}
}
});
+
+ this.model.panels.on('remove', function(panel) {
+ // If closing the active panel, switch to the last-accessed panel
+ if (panel_access[0] === panel.cid) {
+ panel_access.shift();
+
+ //Get the last-accessed panel model now that we removed the closed one
+ var model = _.find(_kiwi.app.panels('applets').concat(_kiwi.app.panels('connections')), {cid: panel_access[0]});
+
+ if (model) {
+ model.view.show();
+ }
+ }
+ });
}
});
var connection = _kiwi.app.connections.active_connection;
panel.tab.remove();
-
delete panel.tab;
+ _kiwi.app.panels.trigger('remove', this);
+
_kiwi.app.view.doLayout();
},