aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCrispin Flowerday <gnome@flowerday.cx>2006-01-29 22:28:34 +0800
committerCrispin Flowerday <crispin@src.gnome.org>2006-01-29 22:28:34 +0800
commit6f200baa28dffcd7799e17fc2cc29f53d0e23d88 (patch)
tree09301dacbe3fda353b7fbf0d2088350332595ed0
parent77ea0aa0fe35b80b69219c2ccceed3f573cae025 (diff)
downloadgsoc2013-epiphany-6f200baa28dffcd7799e17fc2cc29f53d0e23d88.tar
gsoc2013-epiphany-6f200baa28dffcd7799e17fc2cc29f53d0e23d88.tar.gz
gsoc2013-epiphany-6f200baa28dffcd7799e17fc2cc29f53d0e23d88.tar.bz2
gsoc2013-epiphany-6f200baa28dffcd7799e17fc2cc29f53d0e23d88.tar.lz
gsoc2013-epiphany-6f200baa28dffcd7799e17fc2cc29f53d0e23d88.tar.xz
gsoc2013-epiphany-6f200baa28dffcd7799e17fc2cc29f53d0e23d88.tar.zst
gsoc2013-epiphany-6f200baa28dffcd7799e17fc2cc29f53d0e23d88.zip
Open smart bookmark url in new tabs when using Ctrl+Enter (part of bug
2006-01-29 Crispin Flowerday <gnome@flowerday.cx> * src/bookmarks/ephy-bookmark-action.c: (activate_cb), (entry_key_press_cb), (connect_proxy): Open smart bookmark url in new tabs when using Ctrl+Enter (part of bug #310814)
-rw-r--r--ChangeLog8
-rw-r--r--src/bookmarks/ephy-bookmark-action.c39
2 files changed, 46 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index e4d56cb60..5fba3cb07 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-01-29 Crispin Flowerday <gnome@flowerday.cx>
+
+ * src/bookmarks/ephy-bookmark-action.c: (activate_cb),
+ (entry_key_press_cb), (connect_proxy):
+
+ Open smart bookmark url in new tabs when using Ctrl+Enter
+ (part of bug #310814)
+
2006-01-29 Peter Harvey <peter.a.harvey@gmail.com>
* src/bookmarks/ephy-topics-entry.c
diff --git a/src/bookmarks/ephy-bookmark-action.c b/src/bookmarks/ephy-bookmark-action.c
index 888b3b4ce..55ef0ac71 100644
--- a/src/bookmarks/ephy-bookmark-action.c
+++ b/src/bookmarks/ephy-bookmark-action.c
@@ -348,8 +348,44 @@ static void
activate_cb (GtkWidget *widget,
EphyBookmarkAction *action)
{
+ gboolean control = FALSE;
+ GdkEvent *event;
+
+ event = gtk_get_current_event ();
+ if (event)
+ {
+ if (event->type == GDK_KEY_PRESS ||
+ event->type == GDK_KEY_RELEASE)
+ {
+ control = (event->key.state & gtk_accelerator_get_default_mod_mask ()) == GDK_CONTROL_MASK;
+ }
+
+ gdk_event_free (event);
+ }
+
ephy_bookmark_action_activate
- (action, widget, ephy_gui_is_middle_click () ? EPHY_LINK_NEW_TAB : 0);
+ (action, widget, (control || ephy_gui_is_middle_click ()) ? EPHY_LINK_NEW_TAB : 0);
+}
+
+static gboolean
+entry_key_press_cb (GtkEntry *entry,
+ GdkEventKey *event,
+ EphyBookmarkAction *action)
+{
+ guint state = event->state & gtk_accelerator_get_default_mod_mask ();
+
+ if ((event->keyval == GDK_Return ||
+ event->keyval == GDK_KP_Enter ||
+ event->keyval == GDK_ISO_Enter) &&
+ state == GDK_CONTROL_MASK)
+ {
+ gtk_im_context_reset (entry->im_context);
+
+ g_signal_emit_by_name (entry, "activate");
+
+ return TRUE;
+ }
+ return FALSE;
}
static gboolean
@@ -411,6 +447,7 @@ connect_proxy (GtkAction *action, GtkWidget *proxy)
entry = GTK_WIDGET (g_object_get_data (G_OBJECT (proxy), "entry"));
g_signal_connect (entry, "activate", G_CALLBACK (activate_cb), action);
+ g_signal_connect (entry, "key-press-event", G_CALLBACK (entry_key_press_cb), action);
}
else if (GTK_IS_MENU_ITEM (proxy))
{