From: Paul Cornett Date: Fri, 28 Dec 2012 16:56:01 +0000 (+0000) Subject: Use gtk_menu_item_remove_submenu() with GTK2 X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/9166fbf48a5d8a5a5f9d6cb033ad11c6c8a2f136 Use gtk_menu_item_remove_submenu() with GTK2 because gtk_menu_item_set_submenu() with NULL menu argument does not work before GTK 2.12 and there is no need to avoid calling it on later GTK2 versions git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73296 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index 6a185f3665..898fb2f5f7 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -337,7 +337,11 @@ wxMenu *wxMenuBar::Remove(size_t pos) // warnings from Ubuntu libdbusmenu gtk_container_remove(GTK_CONTAINER(m_menubar), menu->m_owner); // remove submenu to avoid destroying it when item is destroyed +#ifdef __WXGTK3__ gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu->m_owner), NULL); +#else + gtk_menu_item_remove_submenu(GTK_MENU_ITEM(menu->m_owner)); +#endif gtk_widget_destroy( menu->m_owner ); g_object_unref(menu->m_owner); @@ -931,20 +935,7 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item) #ifdef __WXGTK3__ gtk_menu_item_set_submenu(GTK_MENU_ITEM(mitem), NULL); #else - if (!gtk_check_version(2,12,0)) - { - // gtk_menu_item_remove_submenu() is deprecated since 2.12, but - // gtk_menu_item_set_submenu() can now be used with NULL submenu now so - // just do use it. - gtk_menu_item_set_submenu(GTK_MENU_ITEM(mitem), NULL); - } - else // GTK+ < 2.12 - { - // In 2.10 calling gtk_menu_item_set_submenu() with NULL submenu - // results in critical GTK+ error messages so use the old function - // instead. - gtk_menu_item_remove_submenu(GTK_MENU_ITEM(mitem)); - } + gtk_menu_item_remove_submenu(GTK_MENU_ITEM(mitem)); #endif gtk_widget_destroy(mitem);