[gnome-shell] popupMenu: Use a checkmark for boolean items



commit b03e480dbff5790e63b22241fc311e0caeca1706
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Apr 19 21:16:19 2013 -0400

    popupMenu: Use a checkmark for boolean items
    
    This matches GTK+'s styling, and it makes most boolean switches
    look more natural, as a lot of booleans are not meant for hardware
    switches.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=698427

 js/ui/popupMenu.js |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index 9844baf..041434e 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -1869,18 +1869,20 @@ const RemoteMenu = new Lang.Class({
             // always returns null
             // Funny :)
 
+            item = new PopupMenuItem(label);
+
             switch (String.fromCharCode(action.state.classify())) {
             case 'b':
-                item = new PopupSwitchMenuItem(label, action.state.get_boolean());
                 action.items.push(item);
-                specificSignalId = item.connect('toggled', Lang.bind(this, function(item) {
+                item.setOrnament(action.state.get_boolean() ?
+                                 Ornament.CHECK : Ornament.NONE);
+                specificSignalId = item.connect('activate', Lang.bind(this, function(item) {
                     this.actionGroup.activate_action(action_id, null);
                 }));
                 break;
             case 's':
-                item = new PopupMenuItem(label);
-                item._remoteTarget = model.get_item_attribute_value(index, Gio.MENU_ATTRIBUTE_TARGET, 
null).deep_unpack();
                 action.items.push(item);
+                item._remoteTarget = model.get_item_attribute_value(index, Gio.MENU_ATTRIBUTE_TARGET, 
null).deep_unpack();
                 item.setOrnament(action.state.deep_unpack() == item._remoteTarget ?
                                  Ornament.DOT : Ornament.NONE);
                 specificSignalId = item.connect('activate', Lang.bind(this, function(item) {
@@ -2010,7 +2012,8 @@ const RemoteMenu = new Lang.Class({
             switch (String.fromCharCode(action.state.classify())) {
             case 'b':
                 for (let i = 0; i < action.items.length; i++)
-                    action.items[i].setToggleState(action.state.get_boolean());
+                    action.items[i].setOrnament(action.state.get_boolean() ?
+                                                Ornament.CHECK : Ornament.NONE);
                 break;
             case 'd':
                 for (let i = 0; i < action.items.length; i++)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]