[tracker] Replace SexyIconEntry by GtkEntry icon functionality (Closes GnomeBug:582970)



commit 66e7a6971ec5bcffc981f31c8c394a1d2cadb3ee
Author: Javier Jardón <javierjc1982 gmail com>
Date:   Wed Jun 24 04:56:05 2009 +0200

    Replace SexyIconEntry by GtkEntry icon functionality (Closes GnomeBug:582970)
    
    * src/tracker-search-tool/Makefile.am: remove unnecessary files
            * src/tracker-search-tool/tracker-search-tool-callbacks.c,
            * src/tracker-search-tool/sexy-icon-entry.h
            (search_entry_icon_press_cb), (search_entry_text_changed_cb)
            * src/tracker-search-tool/tracker-search-tool.c
            (gsearch_app_create)

 src/tracker-search-tool/Makefile.am                |    4 +-
 src/tracker-search-tool/sexy-icon-entry.c          |  969 --------------------
 src/tracker-search-tool/sexy-icon-entry.h          |  100 --
 .../tracker-search-tool-callbacks.c                |   20 +
 .../tracker-search-tool-callbacks.h                |    8 +
 src/tracker-search-tool/tracker-search-tool.c      |   19 +-
 6 files changed, 45 insertions(+), 1075 deletions(-)
---
diff --git a/src/tracker-search-tool/Makefile.am b/src/tracker-search-tool/Makefile.am
index 394a305..b733d26 100644
--- a/src/tracker-search-tool/Makefile.am
+++ b/src/tracker-search-tool/Makefile.am
@@ -26,9 +26,7 @@ tracker_search_tool_SOURCES =     				\
 	tracker-search-tool-callbacks.c 			\
 	tracker-search-tool-callbacks.h 			\
 	tracker-search-tool.c	        			\
-	tracker-search-tool.h					\
-	sexy-icon-entry.c					\
-	sexy-icon-entry.h
+	tracker-search-tool.h
 
 tracker_search_tool_LDADD =   					\
 	$(GLIB2_LIBS) 						\
diff --git a/src/tracker-search-tool/tracker-search-tool-callbacks.c b/src/tracker-search-tool/tracker-search-tool-callbacks.c
index e882dd9..7c671cd 100644
--- a/src/tracker-search-tool/tracker-search-tool-callbacks.c
+++ b/src/tracker-search-tool/tracker-search-tool-callbacks.c
@@ -243,6 +243,26 @@ constraint_update_info_cb (GtkWidget * widget,
 }
 
 void
+search_entry_icon_press_cb (GtkWidget * widget,
+			    GdkEventButton *event,
+			    gpointer data)
+{
+	gtk_entry_set_text (GTK_ENTRY (widget), "");
+}
+
+void
+search_entry_text_changed_cb (GtkWidget * widget,
+			      gpointer data)
+{
+  gboolean has_text;
+
+  has_text = gtk_entry_get_text_length (GTK_ENTRY (widget)) > 0;
+  gtk_entry_set_icon_sensitive (GTK_ENTRY (widget),
+                                GTK_ENTRY_ICON_SECONDARY,
+                                has_text);
+}
+
+void
 name_contains_activate_cb (GtkWidget * widget,
 			   gpointer data)
 {
diff --git a/src/tracker-search-tool/tracker-search-tool-callbacks.h b/src/tracker-search-tool/tracker-search-tool-callbacks.h
index 632612e..025260e 100644
--- a/src/tracker-search-tool/tracker-search-tool-callbacks.h
+++ b/src/tracker-search-tool/tracker-search-tool-callbacks.h
@@ -78,6 +78,14 @@ void
 constraint_update_info_cb (GtkWidget * widget,
 			   gpointer data);
 void
+search_entry_icon_press_cb (GtkWidget * widget,
+			    GdkEventButton *event,
+			    gpointer data);
+void
+search_entry_text_changed_cb (GtkWidget * widget,
+			      gpointer data);
+
+void
 name_contains_activate_cb (GtkWidget * widget,
 			   gpointer data);
 
diff --git a/src/tracker-search-tool/tracker-search-tool.c b/src/tracker-search-tool/tracker-search-tool.c
index 3aafcc4..64dd331 100644
--- a/src/tracker-search-tool/tracker-search-tool.c
+++ b/src/tracker-search-tool/tracker-search-tool.c
@@ -45,7 +45,6 @@
 #include "tracker-search-tool.h"
 #include "tracker-search-tool-callbacks.h"
 #include "tracker-search-tool-support.h"
-#include "sexy-icon-entry.h"
 #include <libtracker-gtk/tracker-metadata-tile.h>
 
 #define TRACKER_SEARCH_TOOL_DEFAULT_ICON_SIZE 32
@@ -2068,8 +2067,22 @@ gsearch_app_create (GSearchWindow * gsearch)
 
 	gtk_table_attach (GTK_TABLE (gsearch->name_and_folder_table), label, 0, 1, 0, 1, GTK_FILL, 0, 6, 1);
 
-	gsearch->search_entry = sexy_icon_entry_new ();
-	sexy_icon_entry_add_clear_button (SEXY_ICON_ENTRY (gsearch->search_entry));
+	gsearch->search_entry = gtk_entry_new ();
+	gtk_entry_set_icon_from_stock (GTK_ENTRY (gsearch->search_entry),
+				       GTK_ENTRY_ICON_SECONDARY,
+				       GTK_STOCK_CLEAR);
+	gtk_entry_set_icon_sensitive (GTK_ENTRY (gsearch->search_entry),
+				      GTK_ENTRY_ICON_SECONDARY,
+				      FALSE);
+	g_signal_connect (gsearch->search_entry, "icon-press",
+			  G_CALLBACK (search_entry_icon_press_cb), NULL);
+	g_signal_connect (gsearch->search_entry, "notify::text",
+			  G_CALLBACK (search_entry_text_changed_cb), NULL);
+
+	gtk_entry_set_icon_tooltip_text (GTK_ENTRY (gsearch->search_entry),
+					 GTK_ENTRY_ICON_SECONDARY,
+					 _("Clear the search text"));
+
 	gtk_table_attach (GTK_TABLE (gsearch->name_and_folder_table), gsearch->search_entry, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, 0, 0);
 	entry =  (gsearch->search_entry);
 	gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]