[Xfce4-commits] <postler:master> Handle folder switching to same folder reliably

Christian Dywan noreply at xfce.org
Sun Jul 3 14:02:07 CEST 2011


Updating branch refs/heads/master
         to 4d2d4ead79a48e29b24d2de5f8cd5b5dcd8ef6e4 (commit)
       from 6738287d513dcb83d75f0ba440c6feec984c1d61 (commit)

commit 4d2d4ead79a48e29b24d2de5f8cd5b5dcd8ef6e4
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sun Jul 3 03:21:18 2011 +0200

    Handle folder switching to same folder reliably

 postler/postler-bureau.vala   |    2 +-
 postler/postler-folders.vala  |    5 ++++-
 postler/postler-messages.vala |   20 ++++++++------------
 3 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/postler/postler-bureau.vala b/postler/postler-bureau.vala
index 4dc80aa..f0366e5 100644
--- a/postler/postler-bureau.vala
+++ b/postler/postler-bureau.vala
@@ -885,7 +885,7 @@ public class Postler.Bureau : Gtk.Window {
         /* Never focus hidden widgets: assertion `WIDGET_REALIZED_FOR_EVENT */
         if (messages.visible) {
             messages.grab_focus ();
-            messages.populate ("file://%/INBOX/%", FolderType.INBOX);
+            folders.select_folder ("file://%/INBOX/%");
         }
     }
 }
diff --git a/postler/postler-folders.vala b/postler/postler-folders.vala
index 8497135..29f372b 100644
--- a/postler/postler-folders.vala
+++ b/postler/postler-folders.vala
@@ -76,7 +76,10 @@ public class Postler.Folders : Gtk.Toolbar {
             var button = child as Gtk.RadioToolButton;
             if (button.label == folder
              || button.get_data<string> ("uri") == folder) {
-                button.active = true;
+                if (!button.active)
+                    button.active = true;
+                else
+                    button.clicked ();
                 break;
             }
         }
diff --git a/postler/postler-messages.vala b/postler/postler-messages.vala
index b01838a..acd1955 100644
--- a/postler/postler-messages.vala
+++ b/postler/postler-messages.vala
@@ -393,21 +393,19 @@ public class Postler.Messages : Gtk.TreeView {
 
     public async bool populate (string location, FolderType folder_type,
         string? filter=null, string? header=null) {
-        clear ();
 
-        var now = GLib.Date ();
-        now.set_time_val (GLib.TimeVal ());
+        if (this.location == location)
+            return false;
 
+        clear ();
         selected_folder_type = folder_type;
         var messages = new GLib.List<Message> ();
 
         try {
-            if (location != this.location) {
-                client = new Client ();
-                /* FIXME: The client emits, the callback isn't called */
-                client.got_message.connect (got_message);
-                messages = yield client.get_messages (location);
-            }
+            client = new Client ();
+            /* FIXME: The client emits, the callback isn't called */
+            client.got_message.connect (got_message);
+            messages = yield client.get_messages (location);
 
             foreach (var message in messages) {
                 store.insert_with_values (null, null, 0,
@@ -433,9 +431,7 @@ public class Postler.Messages : Gtk.TreeView {
                 error.message);
         }
 
-        /* Avoid changing 'location' to not cause property notification */
-        if (this.location != location)
-            this.location = location;
+        this.location = location;
         return false;
     }
 



More information about the Xfce4-commits mailing list