[Xfce4-commits] <postler:master> Receive should only be sensitive if accounts exist

Christian Dywan noreply at xfce.org
Wed Nov 24 00:02:01 CET 2010


Updating branch refs/heads/master
         to f48fdcb393f5e1b1556bfad3b275a4c4fb747c6f (commit)
       from d84b7d716e6acdc6e81bf26cb3e539bba1738519 (commit)

commit f48fdcb393f5e1b1556bfad3b275a4c4fb747c6f
Author: Christian Dywan <christian at twotoasts.de>
Date:   Wed Nov 24 00:01:06 2010 +0100

    Receive should only be sensitive if accounts exist

 postler/postler-accounts.vala |    4 ++--
 postler/postler-bureau.vala   |   13 +++++++++++++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/postler/postler-accounts.vala b/postler/postler-accounts.vala
index 35d1f49..3bb53a3 100644
--- a/postler/postler-accounts.vala
+++ b/postler/postler-accounts.vala
@@ -248,14 +248,14 @@ public class Postler.Accounts : GLib.Object {
         return infos;
     }
 
-    public void add_info (AccountInfo info) {
+    public virtual signal void add_info (AccountInfo info) {
         if (info.type == AccountType.IMAP)
             info.path = data_path + info.name;
         infos.append (info);
         /* TODO: Update accountrc file */
     }
 
-    public void remove_info (AccountInfo info) {
+    public virtual signal void remove_info (AccountInfo info) {
         infos.remove (info);
         /* TODO: Update accountrc file */
     }
diff --git a/postler/postler-bureau.vala b/postler/postler-bureau.vala
index 1969202..db28740 100644
--- a/postler/postler-bureau.vala
+++ b/postler/postler-bureau.vala
@@ -406,6 +406,14 @@ public class Postler.Bureau : Gtk.Window {
           N_("Search the full message text"), 3}
     };
 
+    void account_check (AccountInfo? account_info) {
+        foreach (var account_info in accounts.get_infos ())
+            if (account_info.type == AccountType.IMAP) {
+                actions.get_action ("MailReceive").sensitive = true;
+                break;
+            }
+    }
+
     public Bureau () {
         GLib.Object (icon_name: STOCK_INTERNET_MAIL,
                      title: GLib.Environment.get_application_name ());
@@ -452,6 +460,11 @@ public class Postler.Bureau : Gtk.Window {
         }
         ui.insert_action_group (folder_actions, 0);
 
+        actions.get_action ("MailReceive").sensitive = false;
+        accounts.add_info.connect_after (account_check);
+        accounts.remove_info.connect_after (account_check);
+        account_check (null);
+
         shelf = new Gtk.VBox (false, 0);
         add (shelf);
         var menubar = ui.get_widget ("/menubar");



More information about the Xfce4-commits mailing list