[Xfce4-commits] <postler:master> Only check once for the certificate file

Christian Dywan noreply at xfce.org
Fri Aug 12 22:06:03 CEST 2011


Updating branch refs/heads/master
         to 70687e40b7083612196b006ca4e1a589971e38ef (commit)
       from d5056bb1c52c7515cb4c60a05056125d1fe44311 (commit)

commit 70687e40b7083612196b006ca4e1a589971e38ef
Author: Christian Dywan <christian at twotoasts.de>
Date:   Fri Aug 12 21:34:56 2011 +0200

    Only check once for the certificate file

 postler/postler-accounts.vala |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/postler/postler-accounts.vala b/postler/postler-accounts.vala
index 5247b03..d186f8b 100644
--- a/postler/postler-accounts.vala
+++ b/postler/postler-accounts.vala
@@ -146,6 +146,7 @@ public class Postler.Accounts : GLib.Object {
     string account_file;
     string data_path;
     string? certificate_file;
+    static bool certificate_checked = false;
     GLib.KeyFile keyfile;
     GLib.List<AccountInfo> infos;
 
@@ -164,12 +165,17 @@ public class Postler.Accounts : GLib.Object {
         unowned string data_dir = Environment.get_user_data_dir ();
         data_path = data_dir + "/" + Config.PACKAGE_NAME + "/mail/";
 
-        foreach (unowned string file in root_certificate_files) {
-            if (FileUtils.test (file, FileTest.EXISTS))
-                certificate_file = file;
+        if (!certificate_checked) {
+            foreach (unowned string file in root_certificate_files) {
+                if (FileUtils.test (file, FileTest.EXISTS)) {
+                    certificate_file = file;
+                    break;
+                }
+            }
+            if (certificate_file == null)
+                GLib.warning (_("Failed to find a root certificate file."));
+            certificate_checked = true;
         }
-        if (certificate_file == null)
-            GLib.warning (_("Failed to find a root certificate file."));
 
         reload ();
     }


More information about the Xfce4-commits mailing list