382
382
katze_array_action_tool_item_child_button_press_cb (GtkWidget* proxy,
383
GdkEventButton* event,
384
KatzeArrayAction* array_action)
383
GdkEventButton* event,
384
KatzeArrayAction* array_action)
386
386
GtkWidget* toolitem = gtk_widget_get_parent (proxy);
387
387
KatzeItem* item = g_object_get_data (G_OBJECT (toolitem), "KatzeItem");
393
393
return katze_array_action_activate_item_alt (array_action, item, event, proxy);
396
/* GtkToolItem does not emit the "clicked" event for middle-clicks, so handle them (but not
397
regular or ctrl-clicks) manually via the button-release-event signal. */
399
katze_array_action_tool_item_child_button_release_cb (GtkWidget* proxy,
400
GdkEventButton* event,
401
KatzeArrayAction* array_action)
403
GtkWidget* toolitem = gtk_widget_get_parent (proxy);
404
KatzeItem* item = g_object_get_data (G_OBJECT (toolitem), "KatzeItem");
406
if (event && MIDORI_EVENT_NEW_TAB (event))
407
katze_array_action_activate_item_new_tab (array_action, item);
397
413
katze_array_action_menu_item_select_cb (GtkWidget* proxy,
398
414
KatzeArrayAction* array_action);
570
586
KatzeArray* array;
571
587
gboolean handled = FALSE;
573
array = (KatzeArray*)g_object_get_data (G_OBJECT (proxy), "KatzeItem");
589
array = KATZE_ARRAY (g_object_get_data (G_OBJECT (proxy), "KatzeItem"));
575
591
if (GTK_IS_MENU_ITEM (proxy))
775
791
gtk_tool_item_set_tooltip_text (toolitem, uri);
777
793
g_object_set_data (G_OBJECT (toolitem), "KatzeItem", item);
778
g_signal_connect (toolitem, "clicked",
779
G_CALLBACK (katze_array_action_proxy_clicked_cb), array_action);
780
if (KATZE_IS_ITEM (item))
794
if (KATZE_ITEM_IS_FOLDER (item))
795
g_signal_connect (toolitem, "clicked",
796
G_CALLBACK (katze_array_action_proxy_clicked_cb), array_action);
797
else if (KATZE_IS_ITEM (item))
782
/* Tool items block the "button-press-event" but we can get it
799
/* Connect to "button-press-event" to handle right-clicks.
800
* Tool items block the "button-press-event" but we can get it
783
801
* when connecting it to the tool item's child widget
786
803
GtkWidget* child = gtk_bin_get_child (GTK_BIN (toolitem));
787
804
g_signal_connect (child, "button-press-event",
788
805
G_CALLBACK (katze_array_action_tool_item_child_button_press_cb), array_action);
807
/* Connect to the "clicked" signal to handle normal keyboard and mouse
808
* activations, checking the event to see if a new tab should be
810
g_signal_connect (toolitem, "clicked",
811
G_CALLBACK (katze_array_action_menu_activate_cb), array_action);
813
/* Connect to the "button-released-event" signal to handle middle clicks, since
814
* GtkToolButton does not emit "clicked" for middle-clicks. */
815
g_signal_connect (child, "button-release-event",
816
G_CALLBACK (katze_array_action_tool_item_child_button_release_cb), array_action);
791
819
g_object_set_data (G_OBJECT (toolitem), "KatzeArrayAction", array_action);