← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~karl-qdh/indicator-datetime/fixappointmentformat into lp:indicator-datetime

 

Karl Lattimer has proposed merging lp:~karl-qdh/indicator-datetime/fixappointmentformat into lp:indicator-datetime with lp:~karl-qdh/indicator-datetime/calendarmenuitemsignals as a prerequisite.

Requested reviews:
  Ted Gould (ted)
Related bugs:
  Bug #727100 in Indicator Date and Time: "Appointments' time format doesn't respect the settings"
  https://bugs.launchpad.net/indicator-datetime/+bug/727100

For more details, see:
https://code.launchpad.net/~karl-qdh/indicator-datetime/fixappointmentformat/+merge/53215

Fixes bug #727100
-- 
https://code.launchpad.net/~karl-qdh/indicator-datetime/fixappointmentformat/+merge/53215
Your team ayatana-commits is subscribed to branch lp:indicator-datetime.
=== modified file 'src/datetime-service.c'
--- src/datetime-service.c	2011-03-14 10:27:57 +0000
+++ src/datetime-service.c	2011-03-14 10:27:57 +0000
@@ -626,6 +626,17 @@
 	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;
@@ -676,11 +687,23 @@
 		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);
 		

=== modified file 'src/settings-shared.h'
--- src/settings-shared.h	2011-02-25 14:18:57 +0000
+++ src/settings-shared.h	2011-03-14 10:27:57 +0000
@@ -51,5 +51,9 @@
 #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


Follow ups