]> git.saurik.com Git - wxWidgets.git/commitdiff
Use gtk_menu_item_remove_submenu() with GTK2
authorPaul Cornett <paulcor@bullseye.com>
Fri, 28 Dec 2012 16:56:01 +0000 (16:56 +0000)
committerPaul Cornett <paulcor@bullseye.com>
Fri, 28 Dec 2012 16:56:01 +0000 (16:56 +0000)
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

src/gtk/menu.cpp

index 6a185f366593683869c89d4aebaa03678b184607..898fb2f5f72c411679282122ceda6e1a5b860c41 100644 (file)
@@ -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);