GNOME Bugzilla – Bug 621356
Add subtitles to popup menus
Last modified: 2010-06-25 18:12:16 UTC
(This is part of bug 621017) You should add a generic API for creating non reactive menu items that are clearly distinguished from the others, like separators with text in them. What I am thinking about are "Wired networks" / "Wireless networks" in nm-applet or "Devices" in gnome-bluetooth.
Created attachment 163457 [details] [review] Add support for subtitles in popup menus Creates class PopupSubtitleMenuItem, which is a non-reactive menu item containg a label with class 'popup-subtitle-menu-item', plus adds convenience methods to PopupMenu.
Created attachment 163458 [details] [review] Corrected patch sorry, a comma was missing
Created attachment 163459 [details] [review] Another possibility Adds a second argument to the constructor, to override the default styling. Still, the method shorthand does not provide it, to accommodate the most common case.
This doesn't correspond to the style of anything in the mockups; in your NM patches you use it for, eg, "Wired networks". But in the mockups, that line is dimmed, not bold. And other items with the same style (eg, "Wi-Fi") have switches anyway, so there's not a one-to-one link between that text style and whether a menu item is selectable or not. It may turn out to be useful to add additional PopupMenuItem arguments to easily override things like reactive and style_class; we need to go through the mockups and figure out the set of features that are needed to implement all of the things there.
Except that they're not "easily override", as the label is not a public property, so you cannot (or should not) set the style_class on it. Secondly, my patch is focused on adding subtitles. Styling them is a matter for theme designers (I added bold just to make it clear they're different from the rest).
(In reply to comment #5) > Except that they're not "easily override", as the label is not a public > property, so you cannot (or should not) set the style_class on it. That's what I was saying. We may want to add support to PopupMenuItem so that you *can* override it, like what you did for the subtitle menu item. > Secondly, my patch is focused on adding subtitles. Styling them is a matter for > theme designers (I added bold just to make it clear they're different from the > rest). But "styled differently" and "non-reactive" are two completely separate axes in the design. That is, we need to have: 1. normally-styled menu items that are reactive 2. differently-styled menu items that are non-reactive 3. differently-styled menu items that are reactive It makes more sense to just make it easy to control the style and reactivity of PopupMenuItem, rather than introducing a separate subclass for #2, and then also needing another separate subclass for #3.