[evolution-patches] Re: 43485: strftime usage in e-cell-date



On Fri, 2003-05-23 at 12:51, Mike Kestner wrote:
> This converts the gettext provided fmt strings to locale string before
> calling e_strftime.
> 
> Mike
Index: gal/e-table/ChangeLog
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/ChangeLog,v
retrieving revision 1.901
diff -u -p -r1.901 ChangeLog
--- gal/e-table/ChangeLog	21 May 2003 16:02:59 -0000	1.901
+++ gal/e-table/ChangeLog	23 May 2003 17:46:25 -0000
@@ -1,3 +1,8 @@
+2003-05-23  Mike Kestner  <mkestner ximian com>
+
+	* e-cell-date.c (ecd_get_text): convert to locale string
+	before calling e_strftime.  [43485]
+
 2003-05-20  Ettore Perazzoli  <ettore ximian com>
 
 	* e-tree.c (tree_canvas_size_allocate): to really fix 42952
Index: gal/e-table/e-cell-date.c
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/e-cell-date.c,v
retrieving revision 1.13
diff -u -p -r1.13 e-cell-date.c
--- gal/e-table/e-cell-date.c	18 Mar 2003 20:49:59 -0000	1.13
+++ gal/e-table/e-cell-date.c	23 May 2003 17:46:26 -0000
@@ -44,7 +44,7 @@ ecd_get_text(ECellText *cell, ETableMode
 	time_t yesdate;
 	struct tm then, now, yesterday;
 	char buf[26];
-	char *temp, *ret_val;
+	char *temp, *ret_val, *fmt;
 	gboolean done = FALSE;
 
 	if (date == 0) {
@@ -55,7 +55,7 @@ ecd_get_text(ECellText *cell, ETableMode
 	localtime_r (&nowdate, &now);
 
 	if (nowdate - date < 60 * 60 * 8 && nowdate > date) {
-		e_strftime_fix_am_pm (buf, 26, _("%l:%M %p"), &then);
+		fmt = _("%l:%M %p");
 		done = TRUE;
 	}
 
@@ -63,7 +63,7 @@ ecd_get_text(ECellText *cell, ETableMode
 		if (then.tm_mday == now.tm_mday &&
 		    then.tm_mon == now.tm_mon &&
 		    then.tm_year == now.tm_year) {
-			e_strftime_fix_am_pm (buf, 26, _("Today %l:%M %p"), &then);
+			fmt = _("Today %l:%M %p");
 			done = TRUE;
 		}
 	}
@@ -73,15 +73,7 @@ ecd_get_text(ECellText *cell, ETableMode
 		if (then.tm_mday == yesterday.tm_mday &&
 		    then.tm_mon == yesterday.tm_mon &&
 		    then.tm_year == yesterday.tm_year) {
-#if 0
-			if (nowdate - date < 60 * 60 * 12) {
-				e_strftime_fix_am_pm (buf, 26, _("Late Yesterday %l:%M %p"), &then);
-			} else {
-#endif
-				e_strftime_fix_am_pm (buf, 26, _("Yesterday %l:%M %p"), &then);
-#if 0
-			}
-#endif
+			fmt = _("Yesterday %l:%M %p");
 			done = TRUE;
 		}
 	}
@@ -93,7 +85,7 @@ ecd_get_text(ECellText *cell, ETableMode
 			if (then.tm_mday == yesterday.tm_mday &&
 			    then.tm_mon == yesterday.tm_mon &&
 			    then.tm_year == yesterday.tm_year) {
-				e_strftime_fix_am_pm (buf, 26, _("%a %l:%M %p"), &then);
+				fmt = _("%a %l:%M %p");
 				done = TRUE;
 				break;
 			}
@@ -101,18 +93,15 @@ ecd_get_text(ECellText *cell, ETableMode
 	}
 	if (!done) {
 		if (then.tm_year == now.tm_year) {
-			e_strftime_fix_am_pm (buf, 26, _("%b %d %l:%M %p"), &then);
+			fmt = _("%b %d %l:%M %p");
 		} else {
-			e_strftime_fix_am_pm (buf, 26, _("%b %d %Y"), &then);
+			fmt = _("%b %d %Y");
 		}
 	}
-#if 0
-#ifdef CTIME_R_THREE_ARGS
-	ctime_r (&date, buf, 26);
-#else
-	ctime_r (&date, buf);
-#endif
-#endif
+
+	fmt = e_utf8_to_locale_string (fmt);
+	e_strftime_fix_am_pm (buf, 26, fmt, &then);
+	g_free (fmt);
 	temp = buf;
 	while ((temp = strstr (temp, "  "))) {
 		memmove (temp, temp + 1, strlen (temp));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]