GNOME Bugzilla – Bug 702456
Empty first item in app menu fallback, when first item is section
Last modified: 2013-09-03 21:43:42 UTC
If I have application menu, that consists only of sections (so individual items at top level), in Gnome Shell I get the menu where sections are separated from each other by separator. In fallback (menu in window) each section is preceded with an empty item, including the first one. As I understand, these items would show section label, but when there is no label, it looks very strage for the first section, entire menu seems to start with empty item.
Not seeing that, with the bloatpad example in gtk+. Do you have an example ?
Looks like this is Gtkmm bug, not GTK+. Passing NULL for section name works fine, but that's not possible in Gtkmm. There empty string is passed in, so empty items are shown (which are supposed to be section names).
Exactly what API is this about? Maybe Gio::Menu::prepend_section() and append_section() and Gio::MenuItem::create() ?
(In reply to comment #3) > Exactly what API is this about? Maybe Gio::Menu::prepend_section() and > append_section() and Gio::MenuItem::create() ? My encounter was Gio::Menu::append_section(), but I think others should be reviewed as well (prepend_section(), insert_section()).
The commits from bug #686909 should fix this. The generated code now looks like this: void Menu::append_section(const Glib::ustring& label, const Glib::RefPtr<MenuModel>& section) { g_menu_append_section(gobj(), ((label).empty() ? 0 : label.c_str()), const_cast<GMenuModel*>(Glib::unwrap(section))); } I'm trying to understand what effect the NULL really has, so I can add a more explictly named method for it. Don't you also need to pass a NULL MenuModel?
> I'm trying to understand what effect the NULL really has, so I can add a more > explictly named method for it. Don't you also need to pass a NULL MenuModel? Sections are menu items grouped together. Section can have a label, which is an inactive item at the top of actual items. When sections have no labels, they are separated from each other by separator. Passing empty string as label creates empty menu item (section title), which looks rather strange. Gnome Shell handles this, but when not in Shell the regular menu is used. MenuModel passed as last argument is the section menu items themselves.
OK. Thanks. It seems simpler than how the C API describes it. This commit adds method overloads without the label parameter: https://git.gnome.org/browse/glibmm/commit/?id=295bb0c0b54e4a16eda0e2033909fde70f46765f