]> git.0d.be Git - empathy.git/commitdiff
log-window: improve icons in the search entry
authorCosimo Cecchi <cosimoc@gnome.org>
Sat, 17 Sep 2011 04:48:46 +0000 (00:48 -0400)
committerCosimo Cecchi <cosimoc@gnome.org>
Mon, 19 Sep 2011 19:10:22 +0000 (15:10 -0400)
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

index 9ef1e16f5bdeb4050b82c57deca785c35ce0c935..cc3a9061493d8de6663ecfd7208e75d0cd3c7f67 100644 (file)
@@ -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,