From ee6bc33ceaa06d73d78e2ebdacaadddc7438e579 Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Mon, 21 Nov 2011 14:16:51 +0100 Subject: [PATCH] PopupSwitchMenuItem: allow toggling without closing the menu Similar to what Gtk does, now toggling with Space does not close the menu. https://bugzilla.gnome.org/show_bug.cgi?id=664416 --- js/ui/popupMenu.js | 6 ++++++ js/ui/userMenu.js | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index aca4ae3de..58ca000fa 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -774,6 +774,12 @@ const PopupSwitchMenuItem = new Lang.Class({ this.toggle(); } + // we allow pressing space to toggle the switch + // without closing the menu + if (event.type() == Clutter.EventType.KEY_PRESS && + event.get_key_symbol() == Clutter.KEY_space) + return; + this.parent(event); }, diff --git a/js/ui/userMenu.js b/js/ui/userMenu.js index 7862477bf..6c7de8ed6 100644 --- a/js/ui/userMenu.js +++ b/js/ui/userMenu.js @@ -613,7 +613,7 @@ const UserMenuButton = new Lang.Class({ this._statusChooser = item; item = new PopupMenu.PopupSwitchMenuItem(_("Notifications")); - item.connect('activate', Lang.bind(this, this._updatePresenceStatus)); + item.connect('toggled', Lang.bind(this, this._updatePresenceStatus)); this.menu.addMenuItem(item); this._notificationsSwitch = item;