diff options
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | lib/widgets/ephy-node-view.c | 25 | ||||
-rw-r--r-- | lib/widgets/ephy-node-view.h | 3 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks-editor.c | 8 | ||||
-rw-r--r-- | src/ephy-history-window.c | 4 |
5 files changed, 47 insertions, 9 deletions
@@ -1,3 +1,19 @@ +2004-09-15 Marco Pesenti Gritti <marco@gnome.org> + + * lib/widgets/ephy-node-view.c: (ephy_node_view_add_toggle), + (ephy_node_view_popup): + * lib/widgets/ephy-node-view.h: + + Add api to show a context menu. Useful to make distinction + between key and mouse events. + + * src/bookmarks/ephy-bookmarks-editor.c: + (ephy_bookmarks_editor_show_popup_cb), + (keyword_node_show_popup_cb): + * src/ephy-history-window.c: (ephy_history_window_show_popup_cb): + + Use it. Fix #152431 + 2004-09-13 Marco Pesenti Gritti <marco@gnome.org> * lib/ephy-guy.c: diff --git a/lib/widgets/ephy-node-view.c b/lib/widgets/ephy-node-view.c index 0afbb9844..dc23e5efa 100644 --- a/lib/widgets/ephy-node-view.c +++ b/lib/widgets/ephy-node-view.c @@ -29,6 +29,7 @@ #include <gtk/gtkcellrenderertoggle.h> #include <gtk/gtktreemodelfilter.h> #include <gtk/gtkwindow.h> +#include <gtk/gtkmain.h> #include <gdk/gdkkeysyms.h> #include "ephy-node-view.h" @@ -1577,6 +1578,30 @@ ephy_node_view_add_toggle (EphyNodeView *view, EphyTreeModelNodeValueFunc value_ gtk_tree_view_append_column (GTK_TREE_VIEW (view), col); } +void +ephy_node_view_popup (EphyNodeView *view, GtkWidget *menu) +{ + GdkEvent *event; + + event = gtk_get_current_event (); + if (event) + { + if (event->type == GDK_KEY_PRESS) + { + gtk_menu_popup (GTK_MENU (menu), NULL, NULL, + ephy_gui_menu_position_tree_selection, + view, 2, gtk_get_current_event_time ()); + } + else + { + gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, + NULL, 2, gtk_get_current_event_time ()); + } + + gdk_event_free (event); + } +} + static void ephy_node_view_class_init (EphyNodeViewClass *klass) { diff --git a/lib/widgets/ephy-node-view.h b/lib/widgets/ephy-node-view.h index 0779e9d5c..339eb5c62 100644 --- a/lib/widgets/ephy-node-view.h +++ b/lib/widgets/ephy-node-view.h @@ -128,6 +128,9 @@ void ephy_node_view_edit (EphyNodeView *view, gboolean ephy_node_view_is_target (EphyNodeView *view); +void ephy_node_view_popup (EphyNodeView *view, + GtkWidget *menu); + G_END_DECLS #endif /* EPHY_NODE_VIEW_H */ diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c index 3a6cd2db0..71ca3934a 100644 --- a/src/bookmarks/ephy-bookmarks-editor.c +++ b/src/bookmarks/ephy-bookmarks-editor.c @@ -1137,9 +1137,7 @@ ephy_bookmarks_editor_show_popup_cb (GtkWidget *view, widget = gtk_ui_manager_get_widget (editor->priv->ui_merge, "/EphyBookmarkEditorPopup"); - gtk_menu_popup (GTK_MENU (widget), NULL, NULL, - ephy_gui_menu_position_tree_selection, view, 2, - gtk_get_current_event_time ()); + ephy_node_view_popup (EPHY_NODE_VIEW (view), widget); return TRUE; } @@ -1229,9 +1227,7 @@ keyword_node_show_popup_cb (GtkWidget *view, EphyBookmarksEditor *editor) widget = gtk_ui_manager_get_widget (editor->priv->ui_merge, "/EphyBookmarkKeywordPopup"); - gtk_menu_popup (GTK_MENU (widget), NULL, NULL, - ephy_gui_menu_position_tree_selection, view, 2, - gtk_get_current_event_time ()); + ephy_node_view_popup (EPHY_NODE_VIEW (view), widget); return TRUE; } diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c index b28a792cd..c0054d1e6 100644 --- a/src/ephy-history-window.c +++ b/src/ephy-history-window.c @@ -842,9 +842,7 @@ ephy_history_window_show_popup_cb (GtkWidget *view, widget = gtk_ui_manager_get_widget (editor->priv->ui_merge, "/EphyHistoryWindowPopup"); - gtk_menu_popup (GTK_MENU (widget), NULL, NULL, - ephy_gui_menu_position_tree_selection, view, 2, - gtk_get_current_event_time ()); + ephy_node_view_popup (EPHY_NODE_VIEW (view), widget); return TRUE; } |