From 0d24698c022b0050a6fbcd2803c93b12e8b9756a Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Sat, 17 Sep 2011 00:48:46 -0400 Subject: 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 file changed, 23 insertions(+), 4 deletions(-) (limited to 'libempathy-gtk/empathy-log-window.c') diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c index 9ef1e16f5..cc3a90614 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, -- cgit v1.2.3