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
This commit is contained in:
Giovanni Campagna 2011-11-21 14:16:51 +01:00
parent 5c730dc53d
commit ee6bc33cea
2 changed files with 7 additions and 1 deletions

View File

@ -774,6 +774,12 @@ const PopupSwitchMenuItem = new Lang.Class({
this.toggle(); 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); this.parent(event);
}, },

View File

@ -613,7 +613,7 @@ const UserMenuButton = new Lang.Class({
this._statusChooser = item; this._statusChooser = item;
item = new PopupMenu.PopupSwitchMenuItem(_("Notifications")); 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.menu.addMenuItem(item);
this._notificationsSwitch = item; this._notificationsSwitch = item;