[Xfce4-commits] <postler:master> Show number of unread messages below message list

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


Updating branch refs/heads/master
         to 866af036a722f4c8db9c1db4692e1a3ce75249f1 (commit)
       from d3919a10800431953476d93cc52e5b5a7d498a0a (commit)

commit 866af036a722f4c8db9c1db4692e1a3ce75249f1
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sun Jul 3 02:40:07 2011 +0200

    Show number of unread messages below message list

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

diff --git a/postler/postler-bureau.vala b/postler/postler-bureau.vala
index 1553699..4dc80aa 100644
--- a/postler/postler-bureau.vala
+++ b/postler/postler-bureau.vala
@@ -27,6 +27,7 @@ public class Postler.Bureau : Gtk.Window {
     Gtk.ProgressBar progressbar;
     Gtk.Label statuslabel;
     Gtk.VBox messages_box;
+    Gtk.Label messages_label;
     Gtk.InfoBar? trash_action_infobar = null;
     public Postler.Messages messages;
     Postler.Content content;
@@ -496,7 +497,19 @@ public class Postler.Bureau : Gtk.Window {
         return infobar;
     }
 
+    async void update_messages_label () {
+        try {
+            /* FIXME: Show total number of messages */
+            int64 unread = yield client.unread_messages (messages.location);
+            messages_label.label = _("%d Unread").printf ((int)unread);
+        } catch (GLib.Error error) {
+            messages_label.label = error.message;
+        }
+    }
+
     void client_received (string account, string? error_message) {
+        update_messages_label ();
+
         if (error_message == null)
             return;
 
@@ -741,6 +754,9 @@ public class Postler.Bureau : Gtk.Window {
         var scrolled = new Postler.ScrolledWindow (messages);
         messages_box.pack_end (scrolled, true, true, 0);
 
+        messages_label = new Gtk.Label (null);
+        shelf.pack_end (messages_label, false, false, 0);
+
         /* Welcome the new user with an account form embedded in the window */
         if (accounts.get_infos ().length () == 0) {
             var welcome = new AccountWidget ();
@@ -817,6 +833,7 @@ public class Postler.Bureau : Gtk.Window {
         viewer.set_no_show_all (true);
         viewer.hide ();
         messages.notify["location"].connect ((object, pspec) => {
+            update_messages_label ();
             viewer.hide ();
         });
         messages.notify["selected-message"].connect ((object, pspec) => {
@@ -868,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 ("%INBOX", FolderType.INBOX);
+            messages.populate ("file://%/INBOX/%", FolderType.INBOX);
         }
     }
 }
diff --git a/postler/postler-folders.vala b/postler/postler-folders.vala
index 9c1b1bf..8497135 100644
--- a/postler/postler-folders.vala
+++ b/postler/postler-folders.vala
@@ -28,7 +28,7 @@ public class Postler.Folders : Gtk.Toolbar {
         for (int type = 0; type < FolderType.GENERIC; type++) {
             var folder = (FolderType)type;
             var button = folder_button (group, folder.get_label (),
-                "%" + folder.get_role (), folder);
+                "file://%/" + folder.get_role () + "/%", folder);
             insert (button, -1);
             group = button.get_group ();
         }
diff --git a/postler/postler-messages.vala b/postler/postler-messages.vala
index 9d06ffd..b01838a 100644
--- a/postler/postler-messages.vala
+++ b/postler/postler-messages.vala
@@ -406,10 +406,7 @@ public class Postler.Messages : Gtk.TreeView {
                 client = new Client ();
                 /* FIXME: The client emits, the callback isn't called */
                 client.got_message.connect (got_message);
-                if (location.has_prefix ("search:"))
-                    messages = yield client.get_messages (location);
-                else
-                    messages = yield client.get_messages ("file://" + location + "%");
+                messages = yield client.get_messages (location);
             }
 
             foreach (var message in messages) {



More information about the Xfce4-commits mailing list