[blam] Show the time of next update



commit 8d754cd471057e91d21f73492044082fee3e584b
Author: Carlos Martín Nieto <carlos cmartin tk>
Date:   Fri Jun 4 16:30:36 2010 +0200

    Show the time of next update
    
    Every time we update, move the next refresh time back and show the
    time when we next expect to update in the status bar

 src/Application.cs |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/src/Application.cs b/src/Application.cs
index fc74a2f..a2373df 100644
--- a/src/Application.cs
+++ b/src/Application.cs
@@ -174,6 +174,7 @@ namespace Imendio.Blam {
 
             if(Conf.Get(Preference.AUTO_REFRESH, false) == true){
                 StartStopAutoRefresh();
+                ShowNextUpdateTime();
             } else {
                 if(Conf.Get(Preference.REFRESH_AT_START, false) == true){
                     mCollection.RefreshAll();
@@ -650,7 +651,10 @@ namespace Imendio.Blam {
 
         public void RefreshAllActivated(object obj, EventArgs args)
         {
-            mCollection.RefreshAll ();
+            /* First move the refresh back */
+            StartStopAutoRefresh();
+            /* And pretend a timeout occurred */
+            TimeoutRefreshAll();
         }
 
         private void DragDataReceivedCb(object o, DragDataReceivedArgs args)
@@ -725,8 +729,23 @@ namespace Imendio.Blam {
             }
         }
 
+        private void ShowNextUpdateTime()
+        {
+            uint contextId = statusbar.GetContextId("update-time");
+
+            statusbar.Pop(contextId);
+
+            int update_time = Conf.Get(Preference.AUTO_REFRESH_RATE, 15);
+            DateTime NextUpdate = DateTime.Now.AddMinutes(update_time);
+
+            String StatusString = String.Format(Catalog.GetString("Next update at {0}"), NextUpdate.ToShortTimeString());
+
+            statusbar.Push(contextId, StatusString);
+        }
+
         private bool TimeoutRefreshAll ()
         {
+            ShowNextUpdateTime();
             mCollection.RefreshAll();
 
             /* Continue until source is removed */



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