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 733203 - can't omit detailed_action to Gio::Menu::append()
can't omit detailed_action to Gio::Menu::append()
Status: RESOLVED FIXED
Product: glibmm
Classification: Bindings
Component: giomm
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2014-07-15 14:13 UTC by Hubert Figuiere (:hub)
Modified: 2014-07-25 10:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch: Gio::Menu: Allow detailed_action == null (2.16 KB, patch)
2014-07-21 09:05 UTC, Kjell Ahlstedt
none Details | Review

Description Hubert Figuiere (:hub) 2014-07-15 14:13:34 UTC
can't omit detailed_action to Gio::Menu::append()

The default argument is an empty string and Glib doesn't like that. It should defautl to nullptr. It seems to be a side effect of gmmproc generating the binding code.
Comment 1 Kjell Ahlstedt 2014-07-20 17:44:25 UTC
It's the same problem with detailed_action in
  Gio::Menu::insert()
  Gio::Menu::prepend()
  Gio::Menu::append()
isn't it?

What about label in
  Gio::Menu::insert()
  Gio::Menu::prepend()
  Gio::Menu::append()
  Gio::Menu::insert_submenu()
  Gio::Menu::prepend_submenu()
  Gio::Menu::append_submenu()
Is it a problem that an empty label is not replaced by a null pointer
when it's given to g_menu_xxx()?
An empty label _is_ replaced by a null pointer in insert_section(),
prepend_section() and append_section().
Comment 2 Hubert Figuiere (:hub) 2014-07-20 20:01:32 UTC
I do believe it is the same problem.

Maybe we should have a conversion macro that deal with that (a different one)
Comment 3 Kjell Ahlstedt 2014-07-21 09:05:20 UTC
Created attachment 281285 [details] [review]
patch: Gio::Menu: Allow detailed_action == null

Proposed patch.

I made some tests by modifying the example program in gtkmm-documentation/
examples/book/application/app_and_win_menus.

detailed_action == "" results in
GLib-GIO-ERROR **: g_menu_item_set_detailed_action: Detailed action name ''
                   has invalid format

detailed_action == 0 is accepted.

label == "" is accepted.

label == 0 is accepted in append_section().
label == 0 in append() and append_submenu() results in
Gtk-CRITICAL **: gtk_label_set_text_with_mnemonic: assertion 'str != NULL'
                 failed

Even though the glib documentation says that label can be 0 in all the g_menu
functions, it's probably not very useful, except in xxx_section().

For more info about label == 0 in the section functions, see bug 702456.
For a general discussion about empty strings, see bug 686909.
Comment 4 Kjell Ahlstedt 2014-07-25 10:52:11 UTC
I have pushed the patch.
https://git.gnome.org/browse/glibmm/commit/?id=3749314afd84bd2093a96b429daf3dc117ce5ca9