[gtk+] Desensitize "Select All" when GtkEntry is empty
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Desensitize "Select All" when GtkEntry is empty
- Date: Tue, 26 Apr 2011 11:57:30 +0000 (UTC)
commit 54c3f05848967cc30356d69d4f34b5d112fe8aeb
Author: Matthew Barnes <mbarnes redhat com>
Date: Tue Apr 26 07:56:09 2011 -0400
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
gtk/gtkentry.c | 1 +
gtk/gtktextview.c | 2 ++
2 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 9820e53..b95fd8b 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -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);
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index d327934..b859e0b 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]