aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-07-16 14:45:39 -0500
committerTed Gould <ted@gould.cx>2010-07-16 14:45:39 -0500
commit621f199bb54a6da98a33885b383589cdd6187766 (patch)
treec7ca7ec80f468d71a06b9dbe801ab0efeafc453d
parentd231f790295d72b462ae56fcfaa211a11aeac838 (diff)
downloadayatana-indicator-datetime-621f199bb54a6da98a33885b383589cdd6187766.tar.gz
ayatana-indicator-datetime-621f199bb54a6da98a33885b383589cdd6187766.tar.bz2
ayatana-indicator-datetime-621f199bb54a6da98a33885b383589cdd6187766.zip
Bring in the measuring tape.
-rw-r--r--src/indicator-datetime.c14
1 files changed, 13 insertions, 1 deletions
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);