[gnome-contacts] Add clear icon for the entry



commit 2c60c6f096a857d3a5309de54a021f0658d65c8e
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Jun 17 13:43:20 2011 +0200

    Add clear icon for the entry

 src/contacts-list-pane.vala |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/contacts-list-pane.vala b/src/contacts-list-pane.vala
index b81090b..561e9a4 100644
--- a/src/contacts-list-pane.vala
+++ b/src/contacts-list-pane.vala
@@ -132,6 +132,15 @@ public class Contacts.ListPane : Frame {
       Source.remove (filter_entry_changed_id);
 
     filter_entry_changed_id = Timeout.add (300, filter_entry_changed_timeout);
+    
+    if (filter_entry.get_text () == "")
+      filter_entry.set_icon_from_icon_name (EntryIconPosition.SECONDARY, "edit-find-symbolic");
+    else
+      filter_entry.set_icon_from_icon_name (EntryIconPosition.SECONDARY, "edit-clear-symbolic");
+  }
+
+  private void filter_entry_clear (EntryIconPosition position) {
+    filter_entry.set_text ("");
   }
 
   private void contacts_selection_changed (TreeSelection selection) {
@@ -174,6 +183,7 @@ public class Contacts.ListPane : Frame {
     filter_entry.set ("placeholder-text", _("Type to search..."));
     filter_entry.set_icon_from_icon_name (EntryIconPosition.SECONDARY, "edit-find-symbolic");
     filter_entry.changed.connect (filter_entry_changed);
+    filter_entry.icon_press.connect (filter_entry_clear);
 
     var search_entry_item = new ToolItem ();
     search_entry_item.is_important = false;



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