aboutsummaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2013-12-13 09:44:05 -0600
committerCharles Kerr <charles.kerr@canonical.com>2013-12-13 09:44:05 -0600
commit5ed0920a13fcd87192f2567b0046037db85c885d (patch)
treeb7d4d5c212ce44b2ab9a9b8340c06941099fabd5 /src/utils.c
parent171d8c455f8dcd00e3e0eb37d02b0ffa82f06cb7 (diff)
downloadayatana-indicator-datetime-5ed0920a13fcd87192f2567b0046037db85c885d.tar.gz
ayatana-indicator-datetime-5ed0920a13fcd87192f2567b0046037db85c885d.tar.bz2
ayatana-indicator-datetime-5ed0920a13fcd87192f2567b0046037db85c885d.zip
move the phone & desktop common elements of header time format into a private util, get_default_header_time_format(), and have the phone & desktop functions call it.
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 *