[empathy] log-window: improve icons in the search entry



commit 0d24698c022b0050a6fbcd2803c93b12e8b9756a
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sat Sep 17 00:48:46 2011 -0400

    log-window: improve icons in the search entry
    
    There are a few improvements we can make to the search entry icons in
    the log window, which this patch tries to fix.
    - icons in entries are usually symbolic in GNOME 3, so I made the icons
      symbolic.
    - I merged the two icons in just one on the right using the shell-style,
      i.e. the search icon turns into a clear action once there's some text
      typed into the entry (Documents also uses the same style for its
      search entry).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=659298

 libempathy-gtk/empathy-log-window.c |   27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c
index 9ef1e16..cc3a906 100644
--- a/libempathy-gtk/empathy-log-window.c
+++ b/libempathy-gtk/empathy-log-window.c
@@ -703,10 +703,10 @@ empathy_log_window_init (EmpathyLogWindow *self)
   vbox = gtk_vbox_new (FALSE, 3);
 
   self->priv->search_entry = gtk_entry_new ();
-  gtk_entry_set_icon_from_stock (GTK_ENTRY (self->priv->search_entry),
-      GTK_ENTRY_ICON_PRIMARY, GTK_STOCK_FIND);
-  gtk_entry_set_icon_from_stock (GTK_ENTRY (self->priv->search_entry),
-      GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR);
+  gtk_entry_set_icon_from_icon_name (GTK_ENTRY (self->priv->search_entry),
+      GTK_ENTRY_ICON_SECONDARY, "edit-find-symbolic");
+  gtk_entry_set_icon_sensitive (GTK_ENTRY (self->priv->search_entry),
+                                GTK_ENTRY_ICON_SECONDARY, FALSE);
 
   label = gtk_label_new (_("Search"));
 
@@ -2025,6 +2025,25 @@ static void
 log_window_search_entry_changed_cb (GtkWidget *entry,
     EmpathyLogWindow *self)
 {
+  const gchar *str;
+
+  str = gtk_entry_get_text (GTK_ENTRY (self->priv->search_entry));
+
+  if (!tp_str_empty (str))
+    {
+      gtk_entry_set_icon_from_icon_name (GTK_ENTRY (self->priv->search_entry),
+          GTK_ENTRY_ICON_SECONDARY, "edit-clear-symbolic");
+      gtk_entry_set_icon_sensitive (GTK_ENTRY (self->priv->search_entry),
+          GTK_ENTRY_ICON_SECONDARY, TRUE);
+    }
+  else
+    {
+      gtk_entry_set_icon_from_icon_name (GTK_ENTRY (self->priv->search_entry),
+          GTK_ENTRY_ICON_SECONDARY, "edit-find-symbolic");
+      gtk_entry_set_icon_sensitive (GTK_ENTRY (self->priv->search_entry),
+          GTK_ENTRY_ICON_SECONDARY, FALSE);
+    }
+
   if (self->priv->source != 0)
     g_source_remove (self->priv->source);
   self->priv->source = g_timeout_add (500, (GSourceFunc) start_find_search,



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