[gnome-shell-extensions/gnome-3-2] alternative-status-menu: disconnect signals on enable() too
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell-extensions/gnome-3-2] alternative-status-menu: disconnect signals on enable() too
- Date: Thu, 8 Dec 2011 00:04:08 +0000 (UTC)
commit a585fa111ab19b10639a0144aaf6ac23b815669a
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Thu Dec 8 01:00:50 2011 +0100
alternative-status-menu: disconnect signals on enable() too
We need to disconnect the signals every time we destroy the
IMStatusChooserItem, that is, both at enable() and at disable().
(In particular, disconnecting at disable() doesn't matter much, since
those signals are emitted only very early after login - which is why
enabling in the middle of session worked before)
extensions/alternative-status-menu/extension.js | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/extensions/alternative-status-menu/extension.js b/extensions/alternative-status-menu/extension.js
index 9b04ea6..08c2f9e 100644
--- a/extensions/alternative-status-menu/extension.js
+++ b/extensions/alternative-status-menu/extension.js
@@ -103,6 +103,13 @@ function init(metadata) {
imports.gettext.bindtextdomain('gnome-shell-extensions', GLib.build_filenamev([metadata.path, 'locale']));
}
+function predestroy(statusMenu) {
+ // HACK! disconnect signals to avoid references to destroyed objects
+ let imstatusitem = statusMenu.menu._getMenuItems()[0];
+ imstatusitem._user.disconnect(imstatusitem._userLoadedId);
+ imstatusitem._user.disconnect(imstatusitem._userChangedId);
+}
+
function reset(statusMenu) {
statusMenu._updateSwitchUser();
statusMenu._updateLogout();
@@ -116,7 +123,10 @@ function reset(statusMenu) {
function enable() {
let statusMenu = Main.panel._statusArea.userMenu;
+
+ predestroy(statusMenu);
statusMenu.menu.removeAll();
+
createSubMenu.call(statusMenu);
reset(statusMenu);
}
@@ -125,11 +135,7 @@ function disable() {
// not guarranteed to work, if more extensions operate in the same place
let statusMenu = Main.panel._statusArea.userMenu;
- // HACK! disconnect signals to avoid references to destroyed objects
- let imstatusitem = statusMenu.menu._getMenuItems()[0];
- imstatusitem._user.disconnect(imstatusitem._userLoadedId);
- imstatusitem._user.disconnect(imstatusitem._userChangedId);
-
+ predestroy(statusMenu);
statusMenu.menu.removeAll();
statusMenu._createSubMenu();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]