aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-datetime.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-07-16 11:50:35 -0500
committerTed Gould <ted@gould.cx>2010-07-16 11:50:35 -0500
commit6ce780af71142b0de7bb5560cd0a5fb701938c5a (patch)
treea810262985c51bc0931b204f805001223f7ccdbd /src/indicator-datetime.c
parentfc454b3d1547e9ece9aa1c9296870f7c8c568aca (diff)
downloadayatana-indicator-datetime-6ce780af71142b0de7bb5560cd0a5fb701938c5a.tar.gz
ayatana-indicator-datetime-6ce780af71142b0de7bb5560cd0a5fb701938c5a.tar.bz2
ayatana-indicator-datetime-6ce780af71142b0de7bb5560cd0a5fb701938c5a.zip
Building up the date string.
Diffstat (limited to 'src/indicator-datetime.c')
-rw-r--r--src/indicator-datetime.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c
index 1867fda..f0681b1 100644
--- a/src/indicator-datetime.c
+++ b/src/indicator-datetime.c
@@ -660,9 +660,34 @@ generate_format_string (IndicatorDatetime * self)
/* Checkpoint, let's not fail */
g_return_val_if_fail(time_string != NULL, g_strdup(DEFAULT_TIME_FORMAT));
- /* TODO: Date */
+ /* If there's no date or day let's just leave now and
+ not worry about the rest of this code */
+ if (!self->priv->show_date && !self->priv->show_day) {
+ return g_strdup(time_string);
+ }
+
+ const gchar * date_string = NULL;
+ if (self->priv->show_date && self->priv->show_day) {
+ /* TRANSLATORS: This is a format string passed to strftime to represent
+ the day of the week, the month and the day of the month. */
+ date_string = _("%a %b %e");
+ } else if (self->priv->show_date) {
+ /* TRANSLATORS: This is a format string passed to strftime to represent
+ the month and the day of the month. */
+ date_string = _("%b %e");
+ } else if (self->priv->show_day) {
+ /* TRANSLATORS: This is a format string passed to strftime to represent
+ the day of the week. */
+ date_string = _("%a");
+ }
+
+ /* Check point, we should have a date string */
+ g_return_val_if_fail(date_string != NULL, g_strdup(time_string));
- return g_strdup(time_string);
+ /* TRANSLATORS: This is a format string passed to strftime to combine the
+ date and the time. The value of "%s, %s" would result in a string like
+ this in US English 12-hour time: 'Fri Jul 16, 11:50 AM' */
+ return g_strdup_printf(_("%s, %s"), date_string, time_string);
}
/* Grabs the label. Creates it if it doesn't