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 702456 - Empty first item in app menu fallback, when first item is section
Empty first item in app menu fallback, when first item is section
Status: RESOLVED FIXED
Product: gtkmm
Classification: Bindings
Component: general
unspecified
Other Linux
: Normal normal
: 3
Assigned To: gtkmm-forge
gtkmm-forge
Depends on: 686909
Blocks:
 
 
Reported: 2013-06-17 12:42 UTC by Aurimas Černius
Modified: 2013-09-03 21:43 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Aurimas Černius 2013-06-17 12:42:50 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.
Comment 1 Matthias Clasen 2013-08-31 20:57:10 UTC
Not seeing that, with the bloatpad example in gtk+.
Do you have an example ?
Comment 2 Aurimas Černius 2013-09-01 17:45:33 UTC
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).
Comment 3 Murray Cumming 2013-09-02 14:28:00 UTC
Exactly what API is this about? Maybe Gio::Menu::prepend_section() and append_section() and Gio::MenuItem::create() ?
Comment 4 Aurimas Černius 2013-09-03 18:32:42 UTC
(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()).
Comment 5 Murray Cumming 2013-09-03 20:55:03 UTC
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?
Comment 6 Aurimas Černius 2013-09-03 21:07:23 UTC
> 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.
Comment 7 Murray Cumming 2013-09-03 21:43:42 UTC
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