From 621f199bb54a6da98a33885b383589cdd6187766 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 16 Jul 2010 14:45:39 -0500 Subject: Bring in the measuring tape. --- src/indicator-datetime.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c index 2afe597..adce0b2 100644 --- a/src/indicator-datetime.c +++ b/src/indicator-datetime.c @@ -698,7 +698,19 @@ guess_label_size (IndicatorDatetime * self) GArray * timevals = g_array_new(FALSE, TRUE, sizeof(struct tm)); build_timeval_array(timevals, posibilitymask); - /* TODO: Check 'em all */ + gint check_time; + for (check_time = 0; check_time < timevals->len; check_time++) { + gchar longstr[128]; + strftime(longstr, 128, self->priv->time_string, &(g_array_index(timevals, struct tm, check_time))); + + gchar * utf8 = g_locale_to_utf8(longstr, -1, NULL, NULL, NULL); + gint length = measure_string(style, context, utf8); + g_free(utf8); + + if (length > *max_width) { + *max_width = length; + } + } g_array_free(timevals, TRUE); -- cgit v1.2.3