aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-04-27 20:02:31 +0800
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-06-09 19:34:56 +0800
commit0fecd9297170528afedbb3e8c3da92debbc41136 (patch)
treeff7acfada9ced2acbe0c9ea8edf059d48a3fedb3 /libempathy-gtk
parenta5a993d4b067029c8fc6c904762c12aec6740831 (diff)
downloadgsoc2013-empathy-0fecd9297170528afedbb3e8c3da92debbc41136.tar
gsoc2013-empathy-0fecd9297170528afedbb3e8c3da92debbc41136.tar.gz
gsoc2013-empathy-0fecd9297170528afedbb3e8c3da92debbc41136.tar.bz2
gsoc2013-empathy-0fecd9297170528afedbb3e8c3da92debbc41136.tar.lz
gsoc2013-empathy-0fecd9297170528afedbb3e8c3da92debbc41136.tar.xz
gsoc2013-empathy-0fecd9297170528afedbb3e8c3da92debbc41136.tar.zst
gsoc2013-empathy-0fecd9297170528afedbb3e8c3da92debbc41136.zip
Add a clear icon to the search entry
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-log-window.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c
index c56427650..95c8ceab7 100644
--- a/libempathy-gtk/empathy-log-window.c
+++ b/libempathy-gtk/empathy-log-window.c
@@ -102,6 +102,10 @@ static void log_window_search_entry_changed_cb (GtkWidget *entry,
EmpathyLogWindow *window);
static void log_window_search_entry_activate_cb (GtkWidget *widget,
EmpathyLogWindow *window);
+static void log_window_search_entry_icon_pressed_cb (GtkEntry *entry,
+ GtkEntryIconPosition icon_pos,
+ GdkEvent *event,
+ gpointer user_data);
static void log_window_who_populate (EmpathyLogWindow *window);
static void log_window_who_setup (EmpathyLogWindow *window);
static void log_window_when_setup (EmpathyLogWindow *window);
@@ -503,6 +507,8 @@ empathy_log_window_show (TpAccount *account,
window->search_entry = gtk_entry_new ();
gtk_entry_set_icon_from_stock (GTK_ENTRY (window->search_entry),
GTK_ENTRY_ICON_PRIMARY, GTK_STOCK_FIND);
+ gtk_entry_set_icon_from_stock (GTK_ENTRY (window->search_entry),
+ GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR);
label = gtk_label_new (_("Search"));
@@ -525,6 +531,10 @@ empathy_log_window_show (TpAccount *account,
G_CALLBACK (log_window_search_entry_activate_cb),
window);
+ g_signal_connect (window->search_entry, "icon-press",
+ G_CALLBACK (log_window_search_entry_icon_pressed_cb),
+ window);
+
/* Contacts */
log_window_events_setup (window);
log_window_who_setup (window);
@@ -1461,6 +1471,19 @@ log_window_search_entry_activate_cb (GtkWidget *entry,
start_find_search (self);
}
+static void
+log_window_search_entry_icon_pressed_cb (GtkEntry *entry,
+ GtkEntryIconPosition icon_pos,
+ GdkEvent *event,
+ gpointer user_data)
+{
+ if (icon_pos != GTK_ENTRY_ICON_SECONDARY)
+ return;
+
+ gtk_entry_buffer_set_text (gtk_entry_get_buffer (entry),
+ "", -1);
+}
+
/*
* Chats Code
*/