[blam] Refresh all channels at the same time on timeout



commit 2804c1458ab1c4dc0f77c63df317aab325762da3
Author: Carlos Martín Nieto <carlos cmartin tk>
Date:   Wed Jun 2 18:17:35 2010 +0200

    Refresh all channels at the same time on timeout
    
    Up to now, we checked each channel every 10s to see if any needed
    updating. In effect, each channel had its own timeout

 src/Application.cs |   35 ++++++++++-------------------------
 1 files changed, 10 insertions(+), 25 deletions(-)
---
diff --git a/src/Application.cs b/src/Application.cs
index 9492676..fc74a2f 100644
--- a/src/Application.cs
+++ b/src/Application.cs
@@ -172,13 +172,15 @@ namespace Imendio.Blam {
 
             PrepareGUI();
 
-            Conf.AddNotify (Conf.GetFullKey(Preference.AUTO_REFRESH), new NotifyEventHandler (ConfNotifyHandler));
-
-            GLib.Idle.Add (new GLib.IdleHandler (IdleRefreshAll));
-
-            if(Conf.Get(Preference.REFRESH_AT_START, false) == true){
-                mCollection.RefreshAll();
+            if(Conf.Get(Preference.AUTO_REFRESH, false) == true){
+                StartStopAutoRefresh();
+            } else {
+                if(Conf.Get(Preference.REFRESH_AT_START, false) == true){
+                    mCollection.RefreshAll();
+                }
             }
+
+            Conf.AddNotify (Conf.GetFullKey(Preference.AUTO_REFRESH), new NotifyEventHandler (ConfNotifyHandler));
         }
 
         private void PrepareGUI()
@@ -723,26 +725,9 @@ namespace Imendio.Blam {
             }
         }
 
-        public bool IdleRefreshAll ()
-        {
-            TimeoutRefreshAll ();
-
-            StartStopAutoRefresh ();
-            return false;
-        }
-
         private bool TimeoutRefreshAll ()
         {
-            int refreshRate;
-
-            if (Conf.Get (Preference.AUTO_REFRESH, false) == false) {
-                // User don't want auto refresh.
-                return false;
-            }
-
-            refreshRate = Conf.Get (Preference.AUTO_REFRESH_RATE, 15);
-
-            mCollection.RefreshAll (refreshRate);
+            mCollection.RefreshAll();
 
             /* Continue until source is removed */
             return true;
@@ -763,7 +748,7 @@ namespace Imendio.Blam {
             }
 
             // Check if any feeds require refresh every ten seconds
-            mAutoRefreshId = GLib.Timeout.Add ((uint) (10 * 1000),
+            mAutoRefreshId = GLib.Timeout.Add ((uint) Conf.Get(Preference.AUTO_REFRESH_RATE, 15) * 60 * 1000,
                                                new GLib.TimeoutHandler (TimeoutRefreshAll));
         }
 



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