diff options
Diffstat (limited to 'src/bookmarks/ephy-topic-action.c')
-rw-r--r-- | src/bookmarks/ephy-topic-action.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/bookmarks/ephy-topic-action.c b/src/bookmarks/ephy-topic-action.c index 436b1f5ca..013f54c6d 100644 --- a/src/bookmarks/ephy-topic-action.c +++ b/src/bookmarks/ephy-topic-action.c @@ -562,7 +562,8 @@ create_menu_item (GtkAction *action) } static void -show_context_menu (EphyTopicAction *action, GtkWidget *proxy) +show_context_menu (EphyTopicAction *action, GtkWidget *proxy, + GtkMenuPositionFunc func) { GtkWidget *menu, *item; @@ -580,10 +581,20 @@ show_context_menu (EphyTopicAction *action, GtkWidget *proxy) g_signal_connect (item, "activate", G_CALLBACK (remove_activate_cb), proxy); - gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 3, + gtk_menu_popup (GTK_MENU (menu), NULL, NULL, func, proxy, 3, gtk_get_current_event_time ()); } +static void +popup_menu_cb (GtkWidget *widget, EphyTopicAction *action) +{ + if (gtk_widget_get_ancestor (widget, EPHY_TYPE_BOOKMARKSBAR)) + { + show_context_menu (action, widget, + ephy_gui_menu_position_under_widget); + } +} + static gboolean button_press_cb (GtkWidget *widget, GdkEventButton *event, @@ -592,7 +603,7 @@ button_press_cb (GtkWidget *widget, if (event->button == 3 && gtk_widget_get_ancestor (widget, EPHY_TYPE_BOOKMARKSBAR)) { - show_context_menu (action, widget); + show_context_menu (action, widget, NULL); return TRUE; } @@ -617,11 +628,10 @@ connect_proxy (GtkAction *action, GtkWidget *proxy) button = GTK_WIDGET (g_object_get_data (G_OBJECT (proxy), "button")); g_signal_connect (button, "toggled", G_CALLBACK (button_toggled_cb), action); - + g_signal_connect (button, "popup_menu", + G_CALLBACK (popup_menu_cb), action); g_signal_connect (button, "button-press-event", G_CALLBACK (button_press_cb), action); - - /* We want the menu to popup up on mouse down */ g_signal_connect (button, "pressed", G_CALLBACK (button_pressed_cb), action); } |