~midori/midori/trunk

« back to all changes in this revision

Viewing changes to katze/katze-arrayaction.c

  • Committer: gue5t
  • Date: 2015-06-30 21:19:55 UTC
  • mto: This revision was merged to the branch mainline in revision 6993.
  • Revision ID: gue5t@midori.launchpad-20150630211955-16fz54z269e3sucn
Fix middle/ctrl/normal clicking bookmarks (not folders) in the bookmarkbar.

Show diffs side-by-side

added added

removed removed

Lines of Context:
380
380
 
381
381
static gboolean
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)
385
385
{
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);
394
394
}
395
395
 
 
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. */
 
398
static gboolean
 
399
katze_array_action_tool_item_child_button_release_cb (GtkWidget*        proxy,
 
400
                                                      GdkEventButton*   event,
 
401
                                                      KatzeArrayAction* array_action)
 
402
{
 
403
    GtkWidget* toolitem = gtk_widget_get_parent (proxy);
 
404
    KatzeItem* item = g_object_get_data (G_OBJECT (toolitem), "KatzeItem");
 
405
 
 
406
    if (event && MIDORI_EVENT_NEW_TAB (event))
 
407
        katze_array_action_activate_item_new_tab (array_action, item);
 
408
 
 
409
    return TRUE;
 
410
}
 
411
 
396
412
static void
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;
572
588
 
573
 
    array = (KatzeArray*)g_object_get_data (G_OBJECT (proxy), "KatzeItem");
 
589
    array = KATZE_ARRAY (g_object_get_data (G_OBJECT (proxy), "KatzeItem"));
574
590
 
575
591
    if (GTK_IS_MENU_ITEM (proxy))
576
592
    {
775
791
        gtk_tool_item_set_tooltip_text (toolitem, uri);
776
792
 
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))
781
798
    {
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
784
802
         */
785
 
 
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);
 
806
 
 
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
 
809
         * opened. */
 
810
        g_signal_connect (toolitem, "clicked",
 
811
            G_CALLBACK (katze_array_action_menu_activate_cb), array_action);
 
812
 
 
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);
789
817
    }
790
818
 
791
819
    g_object_set_data (G_OBJECT (toolitem), "KatzeArrayAction", array_action);