]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/menu.cpp
trying to resolve GSocketManager API mess: the meaning of Install/Uninstall_Callback...
[wxWidgets.git] / src / gtk / menu.cpp
index 5511b9bae6336f8b43dc49fca5d0c56730e0c9c8..299de20d547afb18c67a87254faa856881d14696 100644 (file)
@@ -94,6 +94,8 @@ void wxMenuBar::Init(size_t n, wxMenu *menus[], const wxString titles[], long st
     ApplyWidgetStyle();
 #endif // wxUSE_LIBHILDON/!wxUSE_LIBHILDON
 
+    g_object_ref(m_widget);
+
     for (size_t i = 0; i < n; ++i )
         Append(menus[i], titles[i]);
 }
@@ -693,6 +695,16 @@ static void menu_hide(GtkWidget*, wxMenu* menu)
 }
 }
 
+// "can_activate_accel" from menu item
+extern "C" {
+static gboolean can_activate_accel(GtkWidget*, guint, wxMenu* menu)
+{
+    menu->UpdateUI();
+    // always allow our "activate" handler to be called
+    return true;
+}
+}
+
 IMPLEMENT_DYNAMIC_CLASS(wxMenu,wxEvtHandler)
 
 void wxMenu::Init()
@@ -830,6 +842,8 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem, int pos)
         }
         else
         {
+            g_signal_connect(menuItem, "can_activate_accel",
+                G_CALLBACK(can_activate_accel), this);
             g_signal_connect (menuItem, "activate",
                               G_CALLBACK(menuitem_activate),
                               mitem);