diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmark-action.c | 39 |
2 files changed, 46 insertions, 1 deletions
@@ -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)) { |