From 6dadef323fb59daefac69200014b1d5f238a911a Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Fri, 2 Jul 2004 09:03:42 +0000 Subject: Move in the bookmarks dir. 2004-07-02 Marco Pesenti Gritti * src/bookmarks/ephy-favorites-menu.c: * src/bookmarks/ephy-favorites-menu.h: Move in the bookmarks dir. * lib/ephy-gui.c: (ephy_gui_select_row_by_key), (ephy_gui_is_middle_click): * lib/ephy-gui.h: Add a function to check if menus was activated by a middle or a ctrl+click (which is equivalent in epiphany) * lib/ephy-marshal.list: * src/Makefile.am: * src/bookmarks/Makefile.am: * src/bookmarks/ephy-bookmark-action.c: (activate_cb), (ephy_bookmark_action_class_init): * src/bookmarks/ephy-bookmark-action.h: * src/bookmarks/ephy-bookmarks-menu.c: (open_bookmark_cb), (create_menu): * src/bookmarks/ephy-bookmarksbar.c: (bookmark_open_in_tab_cb), (bookmark_open_cb), (ephy_bookmarksbar_action_request): * src/bookmarks/ephy-topic-action.c: (menu_activate_cb), (ephy_topic_action_class_init): * src/bookmarks/ephy-topic-action.h: Add signals to open bookmarks in new window/tab. I'll need them for context menus. Use them for middle/ctrl click. --- lib/ephy-gui.c | 32 ++++++++++++++++++++++++++++++++ lib/ephy-gui.h | 2 ++ lib/ephy-marshal.list | 1 + 3 files changed, 35 insertions(+) (limited to 'lib') diff --git a/lib/ephy-gui.c b/lib/ephy-gui.c index 09ef4ef4a..88460dc78 100644 --- a/lib/ephy-gui.c +++ b/lib/ephy-gui.c @@ -35,6 +35,7 @@ #include #include #include +#include /* Styles for tab labels */ GtkStyle *loading_text_style = NULL; @@ -214,3 +215,34 @@ ephy_gui_select_row_by_key (GtkTreeView *treeview, gint column, guint32 unicode) return TRUE; } + +gboolean +ephy_gui_is_middle_click (void) +{ + gboolean new_tab = FALSE; + GdkEvent *event; + + event = gtk_get_current_event (); + if (event != NULL) + { + if (event->type == GDK_BUTTON_RELEASE) + { + guint modifiers, button, state; + + modifiers = gtk_accelerator_get_default_mod_mask (); + button = event->button.button; + state = event->button.state; + + /* middle-click or control-click */ + if ((button == 1 && ((state & modifiers) == GDK_CONTROL_MASK)) || + (button == 2)) + { + new_tab = TRUE; + } + } + + gdk_event_free (event); + } + + return new_tab; +} diff --git a/lib/ephy-gui.h b/lib/ephy-gui.h index 685b70613..8c3846d10 100644 --- a/lib/ephy-gui.h +++ b/lib/ephy-gui.h @@ -36,6 +36,8 @@ void ephy_gui_menu_position_under_widget (GtkMenu *menu, gboolean *push_in, gpointer user_data); +gboolean ephy_gui_is_middle_click (void); + gboolean ephy_gui_select_row_by_key (GtkTreeView *treeview, gint column, guint32 unicode); diff --git a/lib/ephy-marshal.list b/lib/ephy-marshal.list index cf7a58c32..425418825 100644 --- a/lib/ephy-marshal.list +++ b/lib/ephy-marshal.list @@ -7,3 +7,4 @@ VOID:POINTER,POINTER VOID:STRING,INT VOID:STRING,INT,INT VOID:STRING,STRING +VOID:STRING,BOOLEAN -- cgit v1.2.3