cvs commit: patches/gal gal-1.99.9-date-format-1.patch

tushar at linuxfromscratch.org tushar at linuxfromscratch.org
Thu Oct 9 11:39:10 PDT 2003


tushar      03/10/09 12:39:10

  Added:       gal      gal-1.99.9-date-format-1.patch
  Log:
  Added Patch gal-1.99.9-date-format-1.patch
  
  Revision  Changes    Path
  1.1                  patches/gal/gal-1.99.9-date-format-1.patch
  
  Index: gal-1.99.9-date-format-1.patch
  ===================================================================
  Submitted By: Gerard Beekmans <gerard at linuxfromscratch.org>
  Date: 2003-10-08
  Initial Package Version: 1.99.9
  Origin: Gerard Beekmans
  Description:	The problem and rationale of this patch is explained in
  		detail at:
  		http://www.linuxfromscratch.org/pipermail/blfs-dev/2003-October/004079.html
  		To summarize: libgal's default date formatting is to be
  		intelligent. This is evident in programs such as Evolution
  		(which inspired me to write this patch). The "Date" field
  		lists terms like "Yesterday", "Today" and so forth
  		depending on when a message was received. I couldn't find
  		a way to change the formatting without hacking the source,
  		so here's a patch to get rid of the intelligence behind
  		the date formatting.
  
  		The new hard-coded date format is: %a %b %d %k:%M
  		Example: Wed Oct 08 21:15
  
  		If you replace %k with %l you get the hour component
  		in 12-hour format. Then you could add %p to the end of the
  		string in order for AM or PM to be inserted.
  
  diff -Naur gal-1.99.9.orig/gal/e-table/e-cell-date.c gal-1.99.9/gal/e-table/e-cell-date.c
  --- gal-1.99.9.orig/gal/e-table/e-cell-date.c	2003-05-28 15:32:52.000000000 -0600
  +++ gal-1.99.9/gal/e-table/e-cell-date.c	2003-10-08 18:51:32.000000000 -0600
  @@ -40,9 +40,7 @@
   ecd_get_text(ECellText *cell, ETableModel *model, int col, int row)
   {
   	time_t date = GPOINTER_TO_INT (e_table_model_value_at(model, col, row));
  -	time_t nowdate = time(NULL);
  -	time_t yesdate;
  -	struct tm then, now, yesterday;
  +	struct tm then;
   	char buf[100];
   	char *temp;
   	gboolean done = FALSE;
  @@ -52,52 +50,9 @@
   	}
   
   	localtime_r (&date, &then);
  -	localtime_r (&nowdate, &now);
   
  -	if (nowdate - date < 60 * 60 * 8 && nowdate > date) {
  -		e_utf8_strftime_fix_am_pm (buf, 100, _("%l:%M %p"), &then);
  -		done = TRUE;
  -	}
  +	e_utf8_strftime_fix_am_pm (buf, 100, _("%a %b %d %k:%M"), &then);
   
  -	if (!done) {
  -		if (then.tm_mday == now.tm_mday &&
  -		    then.tm_mon == now.tm_mon &&
  -		    then.tm_year == now.tm_year) {
  -			e_utf8_strftime_fix_am_pm (buf, 100, _("Today %l:%M %p"), &then);
  -			done = TRUE;
  -		}
  -	}
  -	if (!done) {
  -		yesdate = nowdate - 60 * 60 * 24;
  -		localtime_r (&yesdate, &yesterday);
  -		if (then.tm_mday == yesterday.tm_mday &&
  -		    then.tm_mon == yesterday.tm_mon &&
  -		    then.tm_year == yesterday.tm_year) {
  -			e_utf8_strftime_fix_am_pm (buf, 100, _("Yesterday %l:%M %p"), &then);
  -			done = TRUE;
  -		}
  -	}
  -	if (!done) {
  -		int i;
  -		for (i = 2; i < 7; i++) {
  -			yesdate = nowdate - 60 * 60 * 24 * i;
  -			localtime_r (&yesdate, &yesterday);
  -			if (then.tm_mday == yesterday.tm_mday &&
  -			    then.tm_mon == yesterday.tm_mon &&
  -			    then.tm_year == yesterday.tm_year) {
  -				e_utf8_strftime_fix_am_pm (buf, 100, _("%a %l:%M %p"), &then);
  -				done = TRUE;
  -				break;
  -			}
  -		}
  -	}
  -	if (!done) {
  -		if (then.tm_year == now.tm_year) {
  -			e_utf8_strftime_fix_am_pm (buf, 100, _("%b %d %l:%M %p"), &then);
  -		} else {
  -			e_utf8_strftime_fix_am_pm (buf, 100, _("%b %d %Y"), &then);
  -		}
  -	}
   	temp = buf;
   	while ((temp = strstr (temp, "  "))) {
   		memmove (temp, temp + 1, strlen (temp));
  
  
  



More information about the patches mailing list