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-04-27 20:02:31 +0800
commitc309c0650b4e6b7de62464d282451963a3979ac6 (patch)
tree74d46f88ad92a8b250ad54f626cc657f8ee6421d /libempathy-gtk
parent9ffaedfdb3441ac259469a96cf671f2be5347d23 (diff)
downloadgsoc2013-empathy-c309c0650b4e6b7de62464d282451963a3979ac6.tar
gsoc2013-empathy-c309c0650b4e6b7de62464d282451963a3979ac6.tar.gz
gsoc2013-empathy-c309c0650b4e6b7de62464d282451963a3979ac6.tar.bz2
gsoc2013-empathy-c309c0650b4e6b7de62464d282451963a3979ac6.tar.lz
gsoc2013-empathy-c309c0650b4e6b7de62464d282451963a3979ac6.tar.xz
gsoc2013-empathy-c309c0650b4e6b7de62464d282451963a3979ac6.tar.zst
gsoc2013-empathy-c309c0650b4e6b7de62464d282451963a3979ac6.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 c943fec3e..ec8a27ec0 100644
--- a/libempathy-gtk/empathy-log-window.c
+++ b/libempathy-gtk/empathy-log-window.c
@@ -101,6 +101,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);
@@ -502,6 +506,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"));
@@ -524,6 +530,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);
@@ -1457,6 +1467,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
*/