Desensitize "Select All" when GtkEntry is empty

This avoids possible confusion in some situations, and
selecting an empty string is not very useful.

https://bugzilla.gnome.org/show_bug.cgi?id=647962
This commit is contained in:
Matthew Barnes 2011-04-26 07:56:09 -04:00 committed by Matthias Clasen
parent 7d3693b82b
commit 54c3f05848
2 changed files with 3 additions and 0 deletions

View File

@ -8866,6 +8866,7 @@ popup_targets_received (GtkClipboard *clipboard,
gtk_menu_shell_append (GTK_MENU_SHELL (info_entry_priv->popup_menu), menuitem);
menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_SELECT_ALL, NULL);
gtk_widget_set_sensitive (menuitem, gtk_entry_buffer_get_length (info_entry_priv->buffer) > 0);
g_signal_connect_swapped (menuitem, "activate",
G_CALLBACK (gtk_entry_select_all), entry);
gtk_widget_show (menuitem);

View File

@ -8266,6 +8266,8 @@ popup_targets_received (GtkClipboard *clipboard,
gtk_menu_shell_append (GTK_MENU_SHELL (priv->popup_menu), menuitem);
menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_SELECT_ALL, NULL);
gtk_widget_set_sensitive (menuitem,
gtk_text_buffer_get_char_count (priv->buffer) > 0);
g_signal_connect (menuitem, "activate",
G_CALLBACK (select_all_cb), text_view);
gtk_widget_show (menuitem);