]> spindle.queued.net Git - midori/commitdiff
Make Paste and Proceed insensitive if nothing to paste
authorChristian Dywan <christian@twotoasts.de>
Tue, 22 Nov 2011 20:56:10 +0000 (21:56 +0100)
committerChristian Dywan <christian@twotoasts.de>
Tue, 22 Nov 2011 20:57:20 +0000 (21:57 +0100)
midori/midori-locationaction.c

index 36fe369d4406fdcca6a1c50202182f0db93a32f4..bbb7c6cac3420a1bcf049a9030233e3b8c007c85 100644 (file)
@@ -1274,6 +1274,8 @@ midori_location_action_populate_popup_cb (GtkWidget*            entry,
     MidoriBrowser* browser = midori_browser_get_for_widget (entry);
     GtkActionGroup* actions = midori_browser_get_action_group (browser);
     GtkWidget* menuitem;
+    GtkClipboard* clipboard = gtk_clipboard_get_for_display (
+        gtk_widget_get_display (entry),GDK_SELECTION_CLIPBOARD);
 
     menuitem = gtk_separator_menu_item_new ();
     gtk_widget_show (menuitem);
@@ -1288,6 +1290,8 @@ midori_location_action_populate_popup_cb (GtkWidget*            entry,
     gtk_menu_shell_insert (menu, menuitem, 3);
     g_signal_connect (menuitem, "activate",
         G_CALLBACK (midori_location_action_paste_proceed_cb), location_action);
+    if (!gtk_clipboard_wait_is_text_available (clipboard))
+        gtk_widget_set_sensitive (menuitem, FALSE);
 }
 
 static void