Author: juha Date: 2008-04-29 20:23:38 +0000 (Tue, 29 Apr 2008) New Revision: 26901
Modified: xfcalendar/trunk/configure.in.in xfcalendar/trunk/panel-plugin/orageclock.c Log: fixed timing problem in orageclock panel plugin. If only hour or slower change clock was shown, the timer did not refresh it fast enough. version 4.5.13.8 ready for production except for documents. Modified: xfcalendar/trunk/configure.in.in =================================================================== --- xfcalendar/trunk/configure.in.in 2008-04-29 11:30:34 UTC (rev 26900) +++ xfcalendar/trunk/configure.in.in 2008-04-29 20:23:38 UTC (rev 26901) @@ -9,7 +9,7 @@ dnl dnl Version information -m4_define([orage_version], [4.5.13.7-svn]) +m4_define([orage_version], [4.5.13.8-svn]) m4_define([gtk_minimum_version], [2.6.0]) m4_define([xfce_minimum_version], [4.4.0]) Modified: xfcalendar/trunk/panel-plugin/orageclock.c =================================================================== --- xfcalendar/trunk/panel-plugin/orageclock.c 2008-04-29 11:30:34 UTC (rev 26900) +++ xfcalendar/trunk/panel-plugin/orageclock.c 2008-04-29 20:23:38 UTC (rev 26901) @@ -121,12 +121,20 @@ { time_t t; gint delay_time = 0; + /* if we are using longer than 1 minute (= 60000) interval, we need + * to delay the first start so that clock changes when minute or hour + * changes */ oc_get_time(clock); time(&t); localtime_r(&t, &clock->now); - if (clock->interval >= 60000) - delay_time = (clock->interval-clock->now.tm_sec*1000); + if (clock->interval >= 60000) { + if (clock->interval >= 3600000) /* match to next full hour */ + delay_time = (clock->interval - + (clock->now.tm_min*60000 + clock->now.tm_sec*1000)); + else /* match to next full minute */ + delay_time = (clock->interval - clock->now.tm_sec*1000); + } if (clock->delay_timeout_id) { g_source_remove(clock->delay_timeout_id); clock->delay_timeout_id = 0; @@ -137,21 +145,31 @@ } clock->delay_timeout_id = g_timeout_add_full(G_PRIORITY_DEFAULT_IDLE , delay_time, (GSourceFunc)oc_get_time_delay, clock, NULL); - return(TRUE); + /* if we have longer than 1 sec timer, we need to reschedule + * it regularly since it will fall down slowly but surely, so + * we keep this running. */ + if (clock->interval >= 60000) { + if (delay_time > 60000) + /* let's run it once in case we happened to kill it + just when it was supposed to start */ + oc_get_time(clock); + return(FALSE); + } + else + return(TRUE); } static gboolean oc_end_tuning(Clock *clock) { - /* if we have longer than 1 sec timer, we need to reschedule it regularly - * since it will fall down slowly but surely - * */ + /* if we have longer than 1 sec timer, we need to reschedule + * it regularly since it will fall down slowly but surely */ if (clock->adjust_timeout_id) { g_source_remove(clock->adjust_timeout_id); clock->adjust_timeout_id = 0; } - if (clock->interval >= 60000) { + if (clock->interval >= 60000) { /* resync it after each 6 hours */ clock->adjust_timeout_id = g_timeout_add_full(G_PRIORITY_DEFAULT_IDLE - , 60*60*1000, (GSourceFunc)oc_start_timer, clock, NULL); + , 6*60*60*1000, (GSourceFunc)oc_start_timer, clock, NULL); } g_free(clock->tune); clock->tune = NULL; _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org http://foo-projects.org/mailman/listinfo/xfce4-commits