GNOME Bugzilla – Bug 733203
can't omit detailed_action to Gio::Menu::append()
Last modified: 2014-07-25 10:52:11 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.
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().
I do believe it is the same problem. Maybe we should have a conversion macro that deal with that (a different one)
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.
I have pushed the patch. https://git.gnome.org/browse/glibmm/commit/?id=3749314afd84bd2093a96b429daf3dc117ce5ca9