]> spindle.queued.net Git - midori/commitdiff
Fix missing keyboard events for bookmark menu items
authorEnrico Tröger <enrico.troeger@uvena.de>
Thu, 14 May 2009 18:52:55 +0000 (20:52 +0200)
committerChristian Dywan <christian@twotoasts.de>
Thu, 14 May 2009 18:52:55 +0000 (20:52 +0200)
katze/katze-arrayaction.c

index 0969c5d7677d15836c5fdb16bc62d80710596cf0..c7909d20f72c61f50f4fd5795020099688b49b4b 100644 (file)
@@ -232,6 +232,14 @@ katze_array_action_activate (GtkAction* action)
         GTK_ACTION_CLASS (katze_array_action_parent_class)->activate (action);
 }
 
+static void
+katze_array_action_menu_activate_cb  (GtkWidget*        proxy,
+                                      KatzeArrayAction* array_action)
+{
+    KatzeItem* item = g_object_get_data (G_OBJECT (proxy), "KatzeItem");
+    g_signal_emit (array_action, signals[ACTIVATE_ITEM], 0, item);
+}
+
 static gboolean
 katze_array_action_menu_button_press_cb (GtkWidget*        proxy,
                                          GdkEventButton*   event,
@@ -240,11 +248,17 @@ katze_array_action_menu_button_press_cb (GtkWidget*        proxy,
     KatzeItem* item = g_object_get_data (G_OBJECT (proxy), "KatzeItem");
     gboolean handled;
 
-    g_signal_emit (array_action, signals[ACTIVATE_ITEM_ALT], 0, item, event->button, &handled);
+    g_signal_emit (array_action, signals[ACTIVATE_ITEM_ALT], 0, item,
+        event->button, &handled);
 
     if (!handled)
         g_signal_emit (array_action, signals[ACTIVATE_ITEM], 0, item);
 
+    /* we need to block the 'activate' handler which would be called
+     * otherwise as well */
+    g_signal_handlers_block_by_func (proxy,
+        katze_array_action_menu_activate_cb, array_action);
+
     return TRUE;
 }
 
@@ -306,6 +320,9 @@ katze_array_action_generate_menu (KatzeArrayAction* array_action,
         {
             g_signal_connect (menuitem, "button-press-event",
                 G_CALLBACK (katze_array_action_menu_button_press_cb), array_action);
+            /* we need the 'activate' signal as well for keyboard events */
+            g_signal_connect (menuitem, "activate",
+                G_CALLBACK (katze_array_action_menu_activate_cb), array_action);
         }
         gtk_widget_show (menuitem);
     }