From: Christian Dywan Date: Fri, 1 Jan 2010 22:01:56 +0000 (+0100) Subject: Implement "Paste and proceed" menuitem in location context menu X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f202f8020b1de16d60081e89dd6813370585f42;p=midori Implement "Paste and proceed" menuitem in location context menu --- diff --git a/midori/midori-locationaction.c b/midori/midori-locationaction.c index a558997e..6b00758a 100644 --- a/midori/midori-locationaction.c +++ b/midori/midori-locationaction.c @@ -1082,6 +1082,21 @@ midori_location_action_entry_changed_cb (GtkComboBox* combo_box, } } +static void +midori_location_action_paste_proceed_cb (GtkWidget* menuitem, + GtkWidget* location_action) +{ + GtkClipboard* clipboard = gtk_clipboard_get_for_display ( + gtk_widget_get_display (GTK_WIDGET (menuitem)),GDK_SELECTION_CLIPBOARD); + gchar* uri; + + if ((uri = gtk_clipboard_wait_for_text (clipboard))) + { + g_signal_emit (location_action, signals[SUBMIT_URI], 0, uri, FALSE); + g_free (uri); + } +} + static void midori_location_action_populate_popup_cb (GtkWidget* entry, GtkMenuShell* menu, @@ -1097,6 +1112,11 @@ midori_location_action_populate_popup_cb (GtkWidget* entry, menuitem = sokoke_action_create_popup_menu_item ( gtk_action_group_get_action (actions, "ManageSearchEngines")); gtk_menu_shell_append (menu, menuitem); + menuitem = gtk_menu_item_new_with_mnemonic (_("Paste and p_roceed")); + gtk_widget_show (menuitem); + gtk_menu_shell_append (menu, menuitem); + g_signal_connect (menuitem, "activate", + G_CALLBACK (midori_location_action_paste_proceed_cb), location_action); } static void