Author: juha
Date: 2007-10-29 22:05:29 +0000 (Mon, 29 Oct 2007)
New Revision: 26220

Modified:
   xfcalendar/trunk/src/reminder.c
Log:
Adjusted tooltip timer to fire on full minutes.


Modified: xfcalendar/trunk/src/reminder.c
===================================================================
--- xfcalendar/trunk/src/reminder.c     2007-10-29 20:43:38 UTC (rev 26219)
+++ xfcalendar/trunk/src/reminder.c     2007-10-29 22:05:29 UTC (rev 26220)
@@ -416,7 +416,7 @@
         current_year  = t->tm_year + 1900;
         current_month = t->tm_mon;
         current_day   = t->tm_mday;
-      /* Get the selected data from calendar */
+      /* Get the selected date from calendar */
         xfcal = g_par.xfcal;
         gtk_calendar_get_date(GTK_CALENDAR (xfcal->mCalendar),
                  &selected_year, &selected_month, &selected_day);
@@ -525,7 +525,8 @@
     return(FALSE); /* only once */
 }
 
-gboolean reset_orage_tooltip_update()
+/* start timer to fire every minute to keep tooltip accurate */
+gboolean start_orage_tooltip_update(gpointer user_data)
 {
     if (g_par.tooltip_timer) { /* need to stop it if running */
         g_source_remove(g_par.tooltip_timer);
@@ -537,6 +538,26 @@
     return(FALSE);
 }
 
+/* adjust the call t happen when minute changes */
+gboolean reset_orage_tooltip_update()
+{
+    struct tm *t;
+    gint secs_left;
+
+    t = orage_localtime();
+    secs_left = 60 - t->tm_sec;
+    if (secs_left > 10) 
+        orage_tooltip_update(NULL);
+    /* FIXME: do not start this, if it is already in progress.
+     * Minor thing and does not cause any real trouble and happens
+     * only when appoinments are updated in less than 1 minute apart. 
+     * Perhaps not worth fixing. 
+     * Should add another timer or static time to keep track of this */
+    g_timeout_add(secs_left*1000
+            , (GtkFunction) start_orage_tooltip_update, NULL);
+    return(FALSE);
+}
+
 /* refresh trayicon tooltip once per minute */
 gboolean orage_tooltip_update(gpointer user_data)
 {

_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to