[gimp] libgimpwidgets: set Clear icon sensitivity
- From: Sven Neumann <neo src gnome org>
- To: svn-commits-list gnome org
- Subject: [gimp] libgimpwidgets: set Clear icon sensitivity
- Date: Sun, 24 May 2009 11:23:57 -0400 (EDT)
commit 6c02aaa80294449c0d25eb77083e762ad15cb8eb
Author: Sven Neumann <sven gimp org>
Date: Sun May 24 17:24:28 2009 +0200
libgimpwidgets: set Clear icon sensitivity
Only set the Clear icon in the GimpBrowser Search entry sensitive if
there's text in the entry.
---
libgimpwidgets/gimpbrowser.c | 35 +++++++++++++++++++++++++++--------
1 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/libgimpwidgets/gimpbrowser.c b/libgimpwidgets/gimpbrowser.c
index 916afbd..327ba43 100644
--- a/libgimpwidgets/gimpbrowser.c
+++ b/libgimpwidgets/gimpbrowser.c
@@ -42,7 +42,9 @@ enum
static void gimp_browser_destroy (GtkObject *object);
-static void gimp_browser_entry_changed (GtkEditable *editable,
+static void gimp_browser_combo_changed (GtkComboBox *combo,
+ GimpBrowser *browser);
+static void gimp_browser_entry_changed (GtkEntry *entry,
GimpBrowser *browser);
static void gimp_browser_entry_icon_press (GtkEntry *entry,
GtkEntryIconPosition icon_pos,
@@ -113,11 +115,11 @@ gimp_browser_init (GimpBrowser *browser)
browser);
gtk_entry_set_icon_from_stock (GTK_ENTRY (browser->search_entry),
- GTK_ENTRY_ICON_SECONDARY,
- GTK_STOCK_CLEAR);
+ GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR);
gtk_entry_set_icon_activatable (GTK_ENTRY (browser->search_entry),
- GTK_ENTRY_ICON_SECONDARY,
- TRUE);
+ GTK_ENTRY_ICON_SECONDARY, TRUE);
+ gtk_entry_set_icon_sensitive (GTK_ENTRY (browser->search_entry),
+ GTK_ENTRY_ICON_SECONDARY, FALSE);
g_signal_connect (browser->search_entry, "icon-press",
G_CALLBACK (gimp_browser_entry_icon_press),
@@ -231,7 +233,7 @@ gimp_browser_add_search_types (GimpBrowser *browser,
&browser->search_type);
g_signal_connect (combo, "changed",
- G_CALLBACK (gimp_browser_entry_changed),
+ G_CALLBACK (gimp_browser_combo_changed),
browser);
}
else
@@ -315,8 +317,7 @@ gimp_browser_show_message (GimpBrowser *browser,
/* private functions */
static void
-gimp_browser_entry_changed (GtkEditable *editable,
- GimpBrowser *browser)
+gimp_browser_queue_search (GimpBrowser *browser)
{
if (browser->search_timeout_id)
g_source_remove (browser->search_timeout_id);
@@ -326,6 +327,24 @@ gimp_browser_entry_changed (GtkEditable *editable,
}
static void
+gimp_browser_combo_changed (GtkComboBox *combo,
+ GimpBrowser *browser)
+{
+ gimp_browser_queue_search (browser);
+}
+
+static void
+gimp_browser_entry_changed (GtkEntry *entry,
+ GimpBrowser *browser)
+{
+ gimp_browser_queue_search (browser);
+
+ gtk_entry_set_icon_sensitive (entry,
+ GTK_ENTRY_ICON_SECONDARY,
+ gtk_entry_get_text_length (entry) > 0);
+}
+
+static void
gimp_browser_entry_icon_press (GtkEntry *entry,
GtkEntryIconPosition icon_pos,
GdkEvent *event,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]