aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-datetime.c
diff options
context:
space:
mode:
authorKen VanDine <ken.vandine@canonical.com>2011-09-29 16:43:39 -0400
committerKen VanDine <ken.vandine@canonical.com>2011-09-29 16:43:39 -0400
commit31bf779fb487a859ff21910a652faeae2f116b63 (patch)
tree3d1cfc3904bb3e0e7a2a92c1a28520c3a1301e15 /src/indicator-datetime.c
parent95fcdc5a0e1e2d4184149e2354f0cb33d6755d48 (diff)
parente569f3e9744146d5e9d3bfee21092def7350043b (diff)
downloadayatana-indicator-datetime-31bf779fb487a859ff21910a652faeae2f116b63.tar.gz
ayatana-indicator-datetime-31bf779fb487a859ff21910a652faeae2f116b63.tar.bz2
ayatana-indicator-datetime-31bf779fb487a859ff21910a652faeae2f116b63.zip
* New upstream release.
* Fix corrupt environment when LANGUAGE not set (LP: #861123) * Measure string size with GLib (LP: #730476) * Free ECals when they have errors (LP: #774071) * Fix untranslated string (LP: #853130)
Diffstat (limited to 'src/indicator-datetime.c')
-rw-r--r--src/indicator-datetime.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c
index 339ea2f..8e5f421 100644
--- a/src/indicator-datetime.c
+++ b/src/indicator-datetime.c
@@ -1092,12 +1092,14 @@ guess_label_size (IndicatorDatetime * self)
g_debug("Checking against %d possible times", timevals->len);
gint check_time;
for (check_time = 0; check_time < timevals->len; check_time++) {
- gchar longstr[256];
- strftime(longstr, 256, self->priv->time_string, &(g_array_index(timevals, struct tm, check_time)));
+ struct tm * timeval = &g_array_index(timevals, struct tm, check_time);
+ GDateTime * dt = g_date_time_new_local(timeval->tm_year, timeval->tm_mon, timeval->tm_mday, timeval->tm_hour, timeval->tm_min, timeval->tm_sec);
+ gchar * timestr = g_date_time_format(dt, self->priv->time_string);
- gchar * utf8 = g_locale_to_utf8(longstr, -1, NULL, NULL, NULL);
- gint length = measure_string(style, context, utf8);
- g_free(utf8);
+ gint length = measure_string(style, context, timestr);
+
+ g_free(timestr);
+ g_date_time_unref(dt);
if (length > *max_width) {
*max_width = length;