aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkarl-qdh <karl@qdh.org.uk>2011-03-14 10:11:33 +0000
committerkarl-qdh <karl@qdh.org.uk>2011-03-14 10:11:33 +0000
commit0de507c31bbbadd9b0036486d5b58dcbf6533fb9 (patch)
tree617d643ba6d50353803caf414a22bb65a3fd1b97 /src
parent3cf4b8aea38d62a047b609d13909d79d5c246d65 (diff)
parent6ff10245dca9d00474b8fd25052cde4b0ed619bd (diff)
downloadayatana-indicator-datetime-0de507c31bbbadd9b0036486d5b58dcbf6533fb9.tar.gz
ayatana-indicator-datetime-0de507c31bbbadd9b0036486d5b58dcbf6533fb9.tar.bz2
ayatana-indicator-datetime-0de507c31bbbadd9b0036486d5b58dcbf6533fb9.zip
Merged back with the pre-requisite branch and updated to include ted's suggested _()'s in strftime
Diffstat (limited to 'src')
-rw-r--r--src/datetime-service.c33
-rw-r--r--src/settings-shared.h4
2 files changed, 32 insertions, 5 deletions
diff --git a/src/datetime-service.c b/src/datetime-service.c
index 5616d1c..13dc057 100644
--- a/src/datetime-service.c
+++ b/src/datetime-service.c
@@ -628,6 +628,17 @@ update_appointment_menu_items (gpointer user_data)
if (height <= 0) height = 12;
if (width > 30) width = 12;
if (height > 30) height = 12;
+
+ gchar *time_format_str = g_settings_get_string(conf, SETTINGS_TIME_FORMAT_S);
+ gint apt_output;
+ if (g_strcmp0(time_format_str, "12-hour") == 0) {
+ apt_output = SETTINGS_TIME_12_HOUR;
+ } else if (g_strcmp0(time_format_str, "24-hour") == 0) {
+ apt_output = SETTINGS_TIME_24_HOUR;
+ } else {
+ apt_output = SETTINGS_TIME_LOCALE;
+ }
+
i = 0;
for (l = sorted_comp_instances; l; l = l->next) {
struct comp_instance *ci = l->data;
@@ -678,11 +689,23 @@ update_appointment_menu_items (gpointer user_data)
int dmon = due->tm_mon;
int dyear = due->tm_year;
- if ((mday == dmday) && (mon == dmon) && (year == dyear))
- strftime(right, 20, "%l:%M %p", due);
- else
- strftime(right, 20, "%a %l:%M %p", due);
-
+ if (apt_output == SETTINGS_TIME_12_HOUR) {
+ if ((mday == dmday) && (mon == dmon) && (year == dyear))
+ strftime(right, 20, _(DEFAULT_TIME_12_FORMAT), due);
+ else
+ strftime(right, 20, _(DEFAULT_TIME_12_FORMAT_WITH_DAY), due);
+ } else if (apt_output == SETTINGS_TIME_24_HOUR) {
+ if ((mday == dmday) && (mon == dmon) && (year == dyear))
+ strftime(right, 20, _(DEFAULT_TIME_24_FORMAT), due);
+ else
+ strftime(right, 20, _(DEFAULT_TIME_24_FORMAT_WITH_DAY), due);
+ } else {
+ if ((mday == dmday) && (mon == dmon) && (year == dyear))
+ strftime(right, 20, _(DEFAULT_TIME_FORMAT), due);
+ else
+ strftime(right, 20, _(DEFAULT_TIME_FORMAT_WITH_DAY), due);
+ }
+
g_debug("Appointment time: %s, for date %s", right, asctime(due));
dbusmenu_menuitem_property_set (item, APPOINTMENT_MENUITEM_PROP_RIGHT, right);
diff --git a/src/settings-shared.h b/src/settings-shared.h
index df2260e..ef1183c 100644
--- a/src/settings-shared.h
+++ b/src/settings-shared.h
@@ -51,5 +51,9 @@ enum {
#define DEFAULT_TIME_24_FORMAT N_("%H:%M")
#define DEFAULT_TIME_FORMAT DEFAULT_TIME_12_FORMAT
+#define DEFAULT_TIME_FORMAT_WITH_DAY DEFAULT_TIME_12_FORMAT
+
+#define DEFAULT_TIME_12_FORMAT_WITH_DAY N_("%a %l:%M %p")
+#define DEFAULT_TIME_24_FORMAT_WITH_DAY N_("%a %H:%M")
#endif