[Xfce4-commits] <postler:master> Only clear completion model when deleting characters

Christian Dywan noreply at xfce.org
Wed Dec 8 03:10:02 CET 2010


Updating branch refs/heads/master
         to 7b3484f137190b6085580ce0c713045fb2c3412f (commit)
       from acfca458aeeb2ceef87b6618ccda736a3e7bb9c0 (commit)

commit 7b3484f137190b6085580ce0c713045fb2c3412f
Author: Christian Dywan <christian at twotoasts.de>
Date:   Tue Dec 7 23:49:49 2010 +0100

    Only clear completion model when deleting characters
    
    Inline selection causes changed signals, so if that
    clears the model, completion doesn't work.
    
    There is no need to search with each stroke, matches
    can only be different after removing characters.

 postler/postler-composer.vala |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/postler/postler-composer.vala b/postler/postler-composer.vala
index 6226dc1..b1615ad 100644
--- a/postler/postler-composer.vala
+++ b/postler/postler-composer.vala
@@ -359,7 +359,8 @@ public class Postler.Composer : Gtk.Window {
             if (entry.text.length < 3)
                 return;
             var model = entry.get_completion ().model as Gtk.ListStore;
-            model.clear ();
+            if (model.iter_n_children (null) > 0)
+                return;
             string[] contacts = dexter.search_contacts (entry.text);
             foreach (string contact in contacts) {
                 Gtk.TreeIter iter;
@@ -367,6 +368,14 @@ public class Postler.Composer : Gtk.Window {
                 model.set (iter, 0, contact);
             }
         });
+        entry.backspace.connect ((entry) => {
+            var model = entry.get_completion ().model as Gtk.ListStore;
+            model.clear ();
+        });
+        entry.delete_from_cursor.connect ((entry, type, count) => {
+            var model = entry.get_completion ().model as Gtk.ListStore;
+            model.clear ();
+        });
         return entry;
     }
 



More information about the Xfce4-commits mailing list