[Xfce4-commits] <postler:master> Only show Search Clear when there is text at all

Christian Dywan noreply at xfce.org
Tue Nov 9 01:04:01 CET 2010


Updating branch refs/heads/master
         to 82c6c4b8960798188010bf597b06ea238b1c1059 (commit)
       from 4a33b5572d0d9f1ca5e6084ac1fc609e36d94d62 (commit)

commit 82c6c4b8960798188010bf597b06ea238b1c1059
Author: Daniel P. Fore <Daniel.P.Fore at gmail.com>
Date:   Tue Nov 9 00:58:44 2010 +0100

    Only show Search Clear when there is text at all

 postler/postler-bureau.vala |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/postler/postler-bureau.vala b/postler/postler-bureau.vala
index 5c420aa..7cf10f4 100644
--- a/postler/postler-bureau.vala
+++ b/postler/postler-bureau.vala
@@ -216,6 +216,14 @@ public class Postler.Bureau : Gtk.Window {
         search_options.show ();
     }
 
+    void search_entry_changed () {
+        if (search.text != "")
+            search.set_icon_from_stock (Gtk.EntryIconPosition.SECONDARY,
+                                        STOCK_EDIT_CLEAR_SYMBOLIC);
+        else
+            search.set_icon_from_stock (Gtk.EntryIconPosition.SECONDARY, null);
+    }
+
     void action_save_search () {
         var account_info = new AccountInfo ();
         account_info.name = search.text;
@@ -433,10 +441,9 @@ public class Postler.Bureau : Gtk.Window {
         var toolitem = new Gtk.ToolItem ();
         toolbar.insert (toolitem, -1);
         search = new Gtk.Entry ();
-        /* FIXME: icons are available since GTK+ 2.16 */
         search.set_icon_from_stock (Gtk.EntryIconPosition.PRIMARY, STOCK_EDIT_FIND_SYMBOLIC);
         search.activate.connect (search_entry_activated);
-        search.set_icon_from_stock (Gtk.EntryIconPosition.SECONDARY, STOCK_EDIT_CLEAR_SYMBOLIC);
+        search.changed.connect (search_entry_changed);
         search.icon_release.connect ((position, event) => {
             search.text = "";
             search.activate ();



More information about the Xfce4-commits mailing list