[Goodies-commits] r5007 - in xfce4-datetime-plugin/trunk: . panel-plugin
Diego Ongaro
ongardie at xfce.org
Sat Jun 28 00:27:47 CEST 2008
Author: ongardie
Date: 2008-06-27 22:27:47 +0000 (Fri, 27 Jun 2008)
New Revision: 5007
Modified:
xfce4-datetime-plugin/trunk/ChangeLog
xfce4-datetime-plugin/trunk/panel-plugin/datetime.c
Log:
Really fix Bug #4157 - update interval depends on both layout and formats.
Modified: xfce4-datetime-plugin/trunk/ChangeLog
===================================================================
--- xfce4-datetime-plugin/trunk/ChangeLog 2008-06-27 19:46:27 UTC (rev 5006)
+++ xfce4-datetime-plugin/trunk/ChangeLog 2008-06-27 22:27:47 UTC (rev 5007)
@@ -1,3 +1,8 @@
+2008-06-26 Diego Ongaro <ongardie at gmail.com>
+
+ * panel-plugin/datetime.c: Really fix Bug #4157 - update interval
+ depends on both layout and formats.
+
2008-06-21 Diego Ongaro <ongardie at gmail.com>
* panel-plugin/datetime.c: Pulling code from Steve Tyler's
@@ -3,6 +8,6 @@
Attachment #1697 in Bug #4145.
- Update tooltip at the top of the second (fixes Bug #4145).
- - Only gsource_remove valid timeouts, add pre-processor if to the
- tooltips timeout.
+ - Only gsource_remove valid timeouts (Bug #4151), add pre-processor
+ if to the tooltips timeout.
- Fix Bug #4157 - updates occur once a second when datetime plugin
shows date only.
Modified: xfce4-datetime-plugin/trunk/panel-plugin/datetime.c
===================================================================
--- xfce4-datetime-plugin/trunk/panel-plugin/datetime.c 2008-06-27 19:46:27 UTC (rev 5006)
+++ xfce4-datetime-plugin/trunk/panel-plugin/datetime.c 2008-06-27 22:27:47 UTC (rev 5007)
@@ -108,6 +108,9 @@
gchar buf1[DATETIME_MAX_STRLEN];
gchar buf2[DATETIME_MAX_STRLEN];
+ if (format == NULL)
+ return FALSE;
+
time_struct.tm_sec = 1;
len1 = strftime(buf1, sizeof(buf1)-1, format, &time_struct);
if (len1 == 0)
@@ -439,6 +442,31 @@
}
}
+static void datetime_set_update_interval(t_datetime *datetime)
+{
+ /* a custom date format could specify seconds */
+ gboolean date_has_seconds = datetime_format_has_seconds(datetime->date_format);
+ gboolean time_has_seconds = datetime_format_has_seconds(datetime->time_format);
+ gboolean has_seconds;
+
+ /* set update interval for the date/time displayed in the panel */
+ switch(datetime->layout)
+ {
+ case LAYOUT_DATE:
+ has_seconds = date_has_seconds;
+ break;
+ case LAYOUT_TIME:
+ has_seconds = time_has_seconds;
+ break;
+ default:
+ has_seconds = date_has_seconds || time_has_seconds;
+ break;
+ }
+
+ /* 1000 ms in 1 second */
+ datetime->update_interval = 1000 * (has_seconds ? 1 : 60);
+}
+
/*
* set layout after doing some checks
*/
@@ -499,6 +527,8 @@
gtk_box_reorder_child(GTK_BOX(datetime->vbox), datetime->time_label, 1);
gtk_box_reorder_child(GTK_BOX(datetime->vbox), datetime->date_label, 0);
}
+
+ datetime_set_update_interval(datetime);
}
/*
@@ -523,31 +553,6 @@
}
}
-static void datetime_set_update_interval(t_datetime *datetime)
-{
- /* a custom date format could specify seconds */
- gboolean date_has_seconds = datetime_format_has_seconds(datetime->date_format);
- gboolean time_has_seconds = datetime_format_has_seconds(datetime->time_format);
- gboolean has_seconds;
-
- /* set update interval for the date/time displayed in the panel */
- switch(datetime->layout)
- {
- case LAYOUT_DATE:
- has_seconds = date_has_seconds;
- break;
- case LAYOUT_TIME:
- has_seconds = time_has_seconds;
- break;
- default:
- has_seconds = date_has_seconds || time_has_seconds;
- break;
- }
-
- /* 1000 ms in 1 second */
- datetime->update_interval = 1000 * (has_seconds ? 1 : 60);
-}
-
/*
* set the date and time format
*/
More information about the Goodies-commits
mailing list