After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 698427 - Clean up remote menu code and use GtkMenuTracker
Clean up remote menu code and use GtkMenuTracker
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2013-04-20 03:00 UTC by Jasper St. Pierre (not reading bugmail)
Modified: 2013-04-23 19:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
popupMenu: Define the dot next to the menu as an "ornament" (6.73 KB, patch)
2013-04-20 03:00 UTC, Jasper St. Pierre (not reading bugmail)
none Details | Review
popupMenu: Use an icon for the ornament (4.39 KB, patch)
2013-04-20 03:00 UTC, Jasper St. Pierre (not reading bugmail)
none Details | Review
popupMenu: Add a check ornament (1.29 KB, patch)
2013-04-20 03:00 UTC, Jasper St. Pierre (not reading bugmail)
none Details | Review
popupMenu: Use a checkmark for boolean items (2.58 KB, patch)
2013-04-20 03:00 UTC, Jasper St. Pierre (not reading bugmail)
none Details | Review
popupMenu: Always use a PopupMenuItem (1.70 KB, patch)
2013-04-20 03:00 UTC, Jasper St. Pierre (not reading bugmail)
none Details | Review
popupMenu: Create and insert menu items that don't have actions yet (7.84 KB, patch)
2013-04-20 03:00 UTC, Jasper St. Pierre (not reading bugmail)
none Details | Review
popupMenu: Add and use GtkMenuTracker to build the remote menu (28.76 KB, patch)
2013-04-20 03:00 UTC, Jasper St. Pierre (not reading bugmail)
none Details | Review
popupMenu: Remove some now-unused code (1.31 KB, patch)
2013-04-20 03:01 UTC, Jasper St. Pierre (not reading bugmail)
none Details | Review
popupMenu: Define the dot next to the menu as an "ornament" (6.73 KB, patch)
2013-04-20 19:38 UTC, Jasper St. Pierre (not reading bugmail)
reviewed Details | Review
popupMenu: Use an icon for the ornament (4.39 KB, patch)
2013-04-20 19:38 UTC, Jasper St. Pierre (not reading bugmail)
accepted-commit_now Details | Review
popupMenu: Add a check ornament (1.29 KB, patch)
2013-04-20 19:38 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
popupMenu: Use a checkmark for boolean items (2.58 KB, patch)
2013-04-20 19:38 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
popupMenu: Always use a PopupMenuItem (1.70 KB, patch)
2013-04-20 19:38 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
popupMenu: Create and insert menu items that don't have actions yet (7.84 KB, patch)
2013-04-20 19:38 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
popupMenu: Add and use GtkMenuTracker to build the remote menu (34.46 KB, patch)
2013-04-20 19:38 UTC, Jasper St. Pierre (not reading bugmail)
needs-work Details | Review
popupMenu: Remove some now-unused code (1.31 KB, patch)
2013-04-20 19:38 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
popupMenu: Define the dot next to the menu as an "ornament" (6.87 KB, patch)
2013-04-23 19:52 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
popupMenu: Use a unicode character for the ornament (4.68 KB, patch)
2013-04-23 19:52 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
popupMenu: Add and use GtkMenuTracker to build the remote menu (34.46 KB, patch)
2013-04-23 19:52 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review

Description Jasper St. Pierre (not reading bugmail) 2013-04-20 03:00:32 UTC
Ryan convinced me today to look at GtkMenuTracker and copy/paste it into
gnome-shell to use here instead of our own custom item tracking code.
It seems to be a worthwhile cleanup, and helps us match GTK+ behavior,
and shift the maintenance burden of the complex tracking onto Ryan.

There's a bunch of other clean-ups here that might require design review
but were things that made us match GTK+, and I felt were more appropriate.
For instance, this patch set replaces switches with checkboxes. This is
actually sort of an important cleanup so we can have a popup menu item
even before it's added the action-group without removing and replacing
everything, but looking at the absurdity of switches in e.g. Totem made
me think this was a good idea anyway. Requires design ACK, though.

Anyway, I think this is a good cleanup, and if absolutely necessary I
can probably find a way to use GtkMenuTracker even if we decide to keep
switch items.

Note that the GtkMenuTracker has had modifications to be more introspectable.
These modifications are being tracked towards putting them back upstream in
bug #698425.
Comment 1 Jasper St. Pierre (not reading bugmail) 2013-04-20 03:00:36 UTC
Created attachment 241964 [details] [review]
popupMenu: Define the dot next to the menu as an "ornament"

We want to remove switches in remote menus, so make way for
a checkmark ornament for the popup menu item.
Comment 2 Jasper St. Pierre (not reading bugmail) 2013-04-20 03:00:40 UTC
Created attachment 241965 [details] [review]
popupMenu: Use an icon for the ornament

This makes it easy to replace the dot with another icon in the future.
Comment 3 Jasper St. Pierre (not reading bugmail) 2013-04-20 03:00:44 UTC
Created attachment 241966 [details] [review]
popupMenu: Add a check ornament

This will be used to replace switches in the remote menu
Comment 4 Jasper St. Pierre (not reading bugmail) 2013-04-20 03:00:47 UTC
Created attachment 241967 [details] [review]
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.
Comment 5 Jasper St. Pierre (not reading bugmail) 2013-04-20 03:00:51 UTC
Created attachment 241968 [details] [review]
popupMenu: Always use a PopupMenuItem

By this point, we'll know we'll always have a PopupMenuItem.
Comment 6 Jasper St. Pierre (not reading bugmail) 2013-04-20 03:00:55 UTC
Created attachment 241969 [details] [review]
popupMenu: Create and insert menu items that don't have actions yet

Instead of recreating the entire model, which can be expensive... but
keep them insensitive for now. This also matches what GTK+ does.
Comment 7 Jasper St. Pierre (not reading bugmail) 2013-04-20 03:00:59 UTC
Created attachment 241970 [details] [review]
popupMenu: Add and use GtkMenuTracker to build the remote menu

This simplifies the code required to build remote menus and
put all the items in the right place, and makes us share our
implementation with GTK+.
Comment 8 Jasper St. Pierre (not reading bugmail) 2013-04-20 03:01:04 UTC
Created attachment 241971 [details] [review]
popupMenu: Remove some now-unused code

We don't have any sections with separators, so don't bother
tracking them.
Comment 9 Jasper St. Pierre (not reading bugmail) 2013-04-20 19:38:06 UTC
Created attachment 242015 [details] [review]
popupMenu: Define the dot next to the menu as an "ornament"

We want to remove switches in remote menus, so make way for
a checkmark ornament for the popup menu item.
Comment 10 Jasper St. Pierre (not reading bugmail) 2013-04-20 19:38:10 UTC
Created attachment 242016 [details] [review]
popupMenu: Use an icon for the ornament

This makes it easy to replace the dot with another icon in the future.
Comment 11 Jasper St. Pierre (not reading bugmail) 2013-04-20 19:38:14 UTC
Created attachment 242018 [details] [review]
popupMenu: Add a check ornament

This will be used to replace switches in the remote menu
Comment 12 Jasper St. Pierre (not reading bugmail) 2013-04-20 19:38:18 UTC
Created attachment 242019 [details] [review]
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.
Comment 13 Jasper St. Pierre (not reading bugmail) 2013-04-20 19:38:22 UTC
Created attachment 242020 [details] [review]
popupMenu: Always use a PopupMenuItem

By this point, we'll know we'll always have a PopupMenuItem.
Comment 14 Jasper St. Pierre (not reading bugmail) 2013-04-20 19:38:26 UTC
Created attachment 242021 [details] [review]
popupMenu: Create and insert menu items that don't have actions yet

Instead of recreating the entire model, which can be expensive... but
keep them insensitive for now. This also matches what GTK+ does.
Comment 15 Jasper St. Pierre (not reading bugmail) 2013-04-20 19:38:31 UTC
Created attachment 242022 [details] [review]
popupMenu: Add and use GtkMenuTracker to build the remote menu

This simplifies the code required to build remote menus and
put all the items in the right place, and makes us share our
implementation with GTK+.
Comment 16 Jasper St. Pierre (not reading bugmail) 2013-04-20 19:38:35 UTC
Created attachment 242023 [details] [review]
popupMenu: Remove some now-unused code

We don't have any sections with separators, so don't bother
tracking them.
Comment 17 Giovanni Campagna 2013-04-21 13:20:38 UTC
Review of attachment 242022 [details] [review]:

::: js/ui/popupMenu.js
@@ +1902,2 @@
             let item = new PopupSubMenuMenuItem(label);
+            this._trackMenu(submenuModel, item);

This one needs to be item.menu, or it fails in _insertItem.
Comment 18 Giovanni Campagna 2013-04-21 13:21:50 UTC
I didn't review the whole thing, I just applied it locally and started testing it.
It's a big change, so I hope you don't mind if I take a few days.
Comment 19 Giovanni Campagna 2013-04-23 19:20:15 UTC
Review of attachment 242015 [details] [review]:

::: js/ui/popupMenu.js
@@ +197,1 @@
             if (!this._dot)

This condition can't happen now.
Comment 20 Giovanni Campagna 2013-04-23 19:23:42 UTC
Review of attachment 242016 [details] [review]:

Looks good.
Comment 21 Giovanni Campagna 2013-04-23 19:24:39 UTC
Review of attachment 242018 [details] [review]:

Yes.
Comment 22 Giovanni Campagna 2013-04-23 19:25:02 UTC
Review of attachment 242019 [details] [review]:

Yes.
Comment 23 Giovanni Campagna 2013-04-23 19:25:03 UTC
Review of attachment 242019 [details] [review]:

Yes.
Comment 24 Giovanni Campagna 2013-04-23 19:25:31 UTC
Review of attachment 242020 [details] [review]:

Yes.
Comment 25 Giovanni Campagna 2013-04-23 19:26:12 UTC
Review of attachment 242021 [details] [review]:

Looks good.
Comment 26 Giovanni Campagna 2013-04-23 19:26:44 UTC
Review of attachment 242023 [details] [review]:

Ok
Comment 27 Jasper St. Pierre (not reading bugmail) 2013-04-23 19:52:21 UTC
Created attachment 242289 [details] [review]
popupMenu: Define the dot next to the menu as an "ornament"

We want to remove switches in remote menus, so make way for
a checkmark ornament for the popup menu item.
Comment 28 Jasper St. Pierre (not reading bugmail) 2013-04-23 19:52:32 UTC
Created attachment 242290 [details] [review]
popupMenu: Use a unicode character for the ornament

This makes it easy to replace the dot with another label in the future.
Change the allocation logic, as text layout is more complicated than
simple icon logic.
Comment 29 Jasper St. Pierre (not reading bugmail) 2013-04-23 19:52:58 UTC
Created attachment 242291 [details] [review]
popupMenu: Add and use GtkMenuTracker to build the remote menu

This simplifies the code required to build remote menus and
put all the items in the right place, and makes us share our
implementation with GTK+.
Comment 30 Giovanni Campagna 2013-04-23 19:54:01 UTC
Review of attachment 242289 [details] [review]:

Yes.
Comment 31 Giovanni Campagna 2013-04-23 19:54:44 UTC
Review of attachment 242290 [details] [review]:

Yes
Comment 32 Giovanni Campagna 2013-04-23 19:55:35 UTC
Review of attachment 242291 [details] [review]:

Looks good.
Comment 33 Jasper St. Pierre (not reading bugmail) 2013-04-23 19:57:40 UTC
Attachment 242018 [details] pushed as 8430353 - popupMenu: Add a check ornament
Attachment 242019 [details] pushed as b03e480 - popupMenu: Use a checkmark for boolean items
Attachment 242020 [details] pushed as 099c870 - popupMenu: Always use a PopupMenuItem
Attachment 242021 [details] pushed as c0afe72 - popupMenu: Create and insert menu items that don't have actions yet
Attachment 242023 [details] pushed as d210399 - popupMenu: Remove some now-unused code
Attachment 242289 [details] pushed as 4a2f54f - popupMenu: Define the dot next to the menu as an "ornament"
Attachment 242290 [details] pushed as a123ec9 - popupMenu: Use a unicode character for the ornament
Attachment 242291 [details] pushed as 196fb0f - popupMenu: Add and use GtkMenuTracker to build the remote menu