aboutsummaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2013-10-31 00:13:17 +0000
committerTarmac <Unknown>2013-10-31 00:13:17 +0000
commitb5ed574ecd4f8a1c84f0a0272bda4b0509877eae (patch)
tree0975152aae9c159e23f3cccb5d05fcf0137d8f2e /src/utils.c
parentbbc781d9e2afe500d9a5d09335f0954f25269be6 (diff)
parent668658f383ae43f175a70a0fdca983c64b84fe59 (diff)
downloadayatana-indicator-datetime-b5ed574ecd4f8a1c84f0a0272bda4b0509877eae.tar.gz
ayatana-indicator-datetime-b5ed574ecd4f8a1c84f0a0272bda4b0509877eae.tar.bz2
ayatana-indicator-datetime-b5ed574ecd4f8a1c84f0a0272bda4b0509877eae.zip
As per the spec, let users show the year in indicator-datetime. Fixes: https://bugs.launchpad.net/bugs/465689.
Approved by Ted Gould, PS Jenkins bot.
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/utils.c b/src/utils.c
index d1e1fbf..5539c5c 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -329,19 +329,31 @@ generate_terse_format_string_at_time (GDateTime * now, GDateTime * time)
***/
static const gchar *
-get_full_date_format_string (gboolean show_day, gboolean show_date)
+get_full_date_format_string (gboolean show_day, gboolean show_date, gboolean show_year)
{
- const gchar * fmt;
+ const char * fmt;
- if (show_date && show_day)
- /* TRANSLATORS: a strftime(3) format showing the date and weekday */
+ if (show_day && show_date && show_year)
+ /* TRANSLATORS: a strftime(3) format showing the weekday, date, and year */
+ fmt = T_("%a %b %e %Y");
+ else if (show_day && show_date)
+ /* TRANSLATORS: a strftime(3) format showing the weekday and date */
fmt = T_("%a %b %e");
+ else if (show_day && show_year)
+ /* TRANSLATORS: a strftime(3) format showing the weekday and year. */
+ fmt = T_("%a %Y");
+ else if (show_day)
+ /* TRANSLATORS: a strftime(3) format showing the weekday. */
+ fmt = T_("%a");
+ else if (show_date && show_year)
+ /* TRANSLATORS: a strftime(3) format showing the date and year */
+ fmt = T_("%b %e %Y");
else if (show_date)
/* TRANSLATORS: a strftime(3) format showing the date */
fmt = T_("%b %e");
- else if (show_day)
- /* TRANSLATORS: a strftime(3) format showing the weekday */
- fmt = T_("%a");
+ else if (show_year)
+ /* TRANSLATORS: a strftime(3) format showing the year */
+ fmt = T_("%Y");
else
fmt = NULL;
@@ -400,9 +412,9 @@ get_full_time_format_string (GSettings * settings)
}
gchar *
-generate_full_format_string (gboolean show_day, gboolean show_date, GSettings * settings)
+generate_full_format_string (gboolean show_day, gboolean show_date, gboolean show_year, GSettings * settings)
{
- const gchar * date_fmt = get_full_date_format_string (show_day, show_date);
+ const gchar * date_fmt = get_full_date_format_string (show_day, show_date, show_year);
const gchar * time_fmt = get_full_time_format_string (settings);
return join_date_and_time_format_strings (date_fmt, time_fmt);
}
@@ -436,6 +448,6 @@ generate_full_format_string_at_time (GDateTime * now, GDateTime * time, GSetting
break;
}
- return generate_full_format_string (show_day, show_date, settings);
+ return generate_full_format_string (show_day, show_date, FALSE, settings);
}