]> spindle.queued.net Git - midori/commitdiff
Implement "Paste and proceed" menuitem in location context menu
authorChristian Dywan <christian@twotoasts.de>
Fri, 1 Jan 2010 22:01:56 +0000 (23:01 +0100)
committerChristian Dywan <christian@twotoasts.de>
Fri, 1 Jan 2010 22:01:56 +0000 (23:01 +0100)
midori/midori-locationaction.c

index a558997eb4613af7d5d9d6d2f5197f8217d90c07..6b00758a114b3411cdcf25b57d7c96eb5f55daba 100644 (file)
@@ -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