[Xfce4-commits] <postler:master> Make Receive() take an optional account name

Christian Dywan noreply at xfce.org
Sat Dec 11 20:08:03 CET 2010


Updating branch refs/heads/master
         to 1f5e16d64afb9f3c6bc8b3c8339bc86326a7c061 (commit)
       from 008ce471ae18d36004670a40700586edc7ffc36e (commit)

commit 1f5e16d64afb9f3c6bc8b3c8339bc86326a7c061
Author: Christian Dywan <christian at twotoasts.de>
Date:   Fri Dec 10 23:44:13 2010 +0100

    Make Receive() take an optional account name

 postler/postler-bureau.vala  |    4 ++--
 postler/postler-client.vala  |   10 ++++++----
 postler/postler-service.vala |   15 +++++++++++++--
 3 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/postler/postler-bureau.vala b/postler/postler-bureau.vala
index b0c12d7..6ef4fa2 100644
--- a/postler/postler-bureau.vala
+++ b/postler/postler-bureau.vala
@@ -93,13 +93,13 @@ public class Postler.Bureau : Gtk.Window {
     """;
 
     private bool new_message_timer () {
-        client.receive_mail ();
+        client.receive ();
         folders.display_notify = true;
         return true;
     }
 
     void action_mail_receive () {
-        client.receive_mail ();
+        client.receive ();
         folders.display_notify = true;
     }
 
diff --git a/postler/postler-client.vala b/postler/postler-client.vala
index d5386a2..b72f435 100644
--- a/postler/postler-client.vala
+++ b/postler/postler-client.vala
@@ -13,7 +13,7 @@ namespace Postler {
 
     [DBus (name = "org.elementary.Postler")]
     interface PostlerClient : Object {
-        public abstract void receive_mail () throws IOError;
+        public abstract bool receive (string account) throws IOError;
         public abstract bool send (string account, string filename) throws IOError;
     }
 
@@ -35,10 +35,12 @@ namespace Postler {
             } catch (GLib.Error error) { }
         }
 
-        public void receive_mail () {
+        public bool receive (string account="") {
             try {
-                client.receive_mail ();
-            } catch (GLib.Error error) { }
+                return client.receive (account);
+            } catch (GLib.Error error) {
+                return false;
+            }
         }
 
         public bool send (string account, string filename) {
diff --git a/postler/postler-service.vala b/postler/postler-service.vala
index 1a7faef..28054e9 100644
--- a/postler/postler-service.vala
+++ b/postler/postler-service.vala
@@ -13,9 +13,20 @@ namespace Postler {
 
     [DBus (name = "org.elementary.Postler")]
     class PostlerService : Object {
-        public void receive_mail () {
+        public bool receive (string account) {
             var accounts = new Accounts ();
-            accounts.receive (null);
+            if (account == "") {
+                accounts.receive (null);
+                return true;
+            }
+
+            foreach (var info in accounts.get_infos ())
+                if (info.name == account) {
+                    accounts.receive (info);
+                    return true;
+                }
+
+            return false;
         }
 
         public bool send (string account, string filename) {



More information about the Xfce4-commits mailing list