[gnome-calculator/wip/currency-conversion-plugins: 19/19] Use async provider downloads by default




commit aecf053b3e8a9827402c1139bb6298ef60e54667
Author: Robert Roth <robert roth off gmail com>
Date:   Thu Jan 14 14:58:26 2021 +0200

    Use async provider downloads by default

 lib/currency-provider.vala | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/lib/currency-provider.vala b/lib/currency-provider.vala
index 8dde4386..5625a9ee 100644
--- a/lib/currency-provider.vala
+++ b/lib/currency-provider.vala
@@ -2,7 +2,7 @@ public interface CurrencyProvider : Object {
 
     public signal void updated ();
 
-    public abstract void update_rates (bool asyncLoad = false);
+    public abstract void update_rates (bool asyncLoad = true);
 
     public abstract void set_refresh_interval (int interval);
 }
@@ -34,15 +34,20 @@ abstract class AbstractCurrencyProvider : Object, CurrencyProvider {
 
         debug ("Checking %s rates ".printf(source_name));
 
-        if (!file_needs_update (rate_filepath, refresh_interval )) return;
+        if (!file_needs_update (rate_filepath, refresh_interval )) {
+            do_load_rates ();
+            return;
+        }
 
         debug ("Loading %s rates ".printf(source_name));
 
         loading = true;
 
-        if (asyncLoad)
+        if (asyncLoad) {
+            debug ("Downloading %s rates async".printf(source_name));
             download_file_async.begin (rate_source_url, rate_filepath, source_name);
-        else {
+        } else {
+            debug ("Downloading %s rates sync".printf(source_name));
             download_file_sync (rate_source_url, rate_filepath, source_name);
             do_load_rates ();
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]