aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2004-07-02 18:24:37 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2004-07-02 18:24:37 +0800
commit7496a69745a356aa97df30d8cac0113bafd5792d (patch)
tree46402dbd148a72f56fc434e81a0b605ed28ad138 /src
parentabda398ba465f54fdf890177146c22260edef64b (diff)
downloadgsoc2013-epiphany-7496a69745a356aa97df30d8cac0113bafd5792d.tar
gsoc2013-epiphany-7496a69745a356aa97df30d8cac0113bafd5792d.tar.gz
gsoc2013-epiphany-7496a69745a356aa97df30d8cac0113bafd5792d.tar.bz2
gsoc2013-epiphany-7496a69745a356aa97df30d8cac0113bafd5792d.tar.lz
gsoc2013-epiphany-7496a69745a356aa97df30d8cac0113bafd5792d.tar.xz
gsoc2013-epiphany-7496a69745a356aa97df30d8cac0113bafd5792d.tar.zst
gsoc2013-epiphany-7496a69745a356aa97df30d8cac0113bafd5792d.zip
Follow popups keybindings.
2004-07-02 Marco Pesenti Gritti <marco@gnome.org> * src/bookmarks/ephy-bookmark-action.c: (show_context_menu), (popup_menu_cb), (button_press_cb), (connect_proxy): * src/bookmarks/ephy-topic-action.c: (show_context_menu), (popup_menu_cb), (button_press_cb), (connect_proxy): Follow popups keybindings.
Diffstat (limited to 'src')
-rw-r--r--src/bookmarks/ephy-bookmark-action.c19
-rw-r--r--src/bookmarks/ephy-topic-action.c22
2 files changed, 32 insertions, 9 deletions
diff --git a/src/bookmarks/ephy-bookmark-action.c b/src/bookmarks/ephy-bookmark-action.c
index 26b592a84..d0e1840ff 100644
--- a/src/bookmarks/ephy-bookmark-action.c
+++ b/src/bookmarks/ephy-bookmark-action.c
@@ -448,7 +448,8 @@ remove_activate_cb (GtkWidget *menu, GtkWidget *proxy)
}
static void
-show_context_menu (EphyBookmarkAction *action, GtkWidget *proxy)
+show_context_menu (EphyBookmarkAction *action, GtkWidget *proxy,
+ GtkMenuPositionFunc func)
{
GtkWidget *menu, *item;
@@ -476,10 +477,20 @@ show_context_menu (EphyBookmarkAction *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, EphyBookmarkAction *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,
@@ -488,7 +499,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;
}
else if (event->button == 2)
@@ -549,6 +560,8 @@ connect_proxy (GtkAction *action, GtkWidget *proxy)
{
button = GTK_WIDGET (g_object_get_data (G_OBJECT (proxy), "button"));
g_signal_connect (button, "clicked", G_CALLBACK (activate_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);
g_signal_connect (button, "button-release-event",
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);
}