aboutsummaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2013-12-13 19:39:47 +0000
committerTarmac <Unknown>2013-12-13 19:39:47 +0000
commit79972de2f13e9886330f87c3f7ce3a24f641c46d (patch)
tree23dae184a48b6ee3659cf2c7163d31fcf8d56f6c /src/utils.c
parent171d8c455f8dcd00e3e0eb37d02b0ffa82f06cb7 (diff)
parentb91dc2ac50d421d29e22bac9c9564029ba64350d (diff)
downloadayatana-indicator-datetime-79972de2f13e9886330f87c3f7ce3a24f641c46d.tar.gz
ayatana-indicator-datetime-79972de2f13e9886330f87c3f7ce3a24f641c46d.tar.bz2
ayatana-indicator-datetime-79972de2f13e9886330f87c3f7ce3a24f641c46d.zip
Make the phone profile's header format sensitive to whether the phone is running in a 12h or 24h locale, and use a 12h or 24h notation accordingly. Fixes: https://bugs.launchpad.net/bugs/1256061.
Approved by PS Jenkins bot, Ted Gould.
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c47
1 files changed, 30 insertions, 17 deletions
diff --git a/src/utils.c b/src/utils.c
index 5539c5c..c90f2e7 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -188,6 +188,31 @@ join_date_and_time_format_strings (const char * date_string,
****
***/
+static const gchar *
+get_default_header_time_format (gboolean twelvehour, gboolean show_seconds)
+{
+ const gchar * fmt;
+
+ if (twelvehour && show_seconds)
+ /* TRANSLATORS: a strftime(3) format for 12hr time w/seconds */
+ fmt = T_("%l:%M:%S %p");
+ else if (twelvehour)
+ /* TRANSLATORS: a strftime(3) format for 12hr time */
+ fmt = T_("%l:%M %p");
+ else if (show_seconds)
+ /* TRANSLATORS: a strftime(3) format for 24hr time w/seconds */
+ fmt = T_("%H:%M:%S");
+ else
+ /* TRANSLATORS: a strftime(3) format for 24hr time */
+ fmt = T_("%H:%M");
+
+ return fmt;
+}
+
+/***
+****
+***/
+
typedef enum
{
DATE_PROXIMITY_TODAY,
@@ -293,8 +318,10 @@ get_terse_date_format_string (date_proximity_t proximity)
const gchar*
get_terse_header_time_format_string (void)
{
- /* a strftime(3) fmt string for a H:MM 12 hour time, eg "6:59 PM" */
- return T_("%l:%M %p");
+ const gboolean twelvehour = is_locale_12h ();
+ const gboolean show_seconds = FALSE;
+
+ return get_default_header_time_format (twelvehour, show_seconds);
}
const gchar *
@@ -374,7 +401,6 @@ get_full_time_format_string (GSettings * settings)
{
gboolean twelvehour;
gboolean show_seconds;
- const gchar * fmt;
g_return_val_if_fail (settings != NULL, NULL);
@@ -395,20 +421,7 @@ get_full_time_format_string (GSettings * settings)
break;
}
- if (twelvehour && show_seconds)
- /* TRANSLATORS: a strftime(3) format for 12hr time w/seconds */
- fmt = T_("%l:%M:%S %p");
- else if (twelvehour)
- /* TRANSLATORS: a strftime(3) format for 12hr time */
- fmt = T_("%l:%M %p");
- else if (show_seconds)
- /* TRANSLATORS: a strftime(3) format for 24hr time w/seconds */
- fmt = T_("%H:%M:%S");
- else
- /* TRANSLATORS: a strftime(3) format for 24hr time */
- fmt = T_("%H:%M");
-
- return fmt;
+ return get_default_header_time_format (twelvehour, show_seconds);
}
gchar *