r17374 - gnucash/branches/2.2 - [r17249, r17250, r17262] Bug #532405: Make the default strftime format use %#d instead of %e on win32 platforms

Andreas Köhler andi5 at cvs.gnucash.org
Tue Jul 22 18:31:42 EDT 2008


Author: andi5
Date: 2008-07-22 18:31:42 -0400 (Tue, 22 Jul 2008)
New Revision: 17374
Trac: http://svn.gnucash.org/trac/changeset/17374

Modified:
   gnucash/branches/2.2/lib/libqof/qof/gnc-date.c
   gnucash/branches/2.2/lib/libqof/qof/gnc-date.h
   gnucash/branches/2.2/po/POTFILES.in
   gnucash/branches/2.2/src/business/business-reports/easy-invoice.scm
   gnucash/branches/2.2/src/business/business-reports/fancy-invoice.scm
   gnucash/branches/2.2/src/business/business-reports/invoice.scm
   gnucash/branches/2.2/src/business/business-reports/owner-report.scm
   gnucash/branches/2.2/src/engine/engine.i
Log:
[r17249,r17250,r17262] Bug #532405: Make the default strftime format use %#d instead of %e on win32 platforms

Committed by cedayiv, warlord and cstim.


Modified: gnucash/branches/2.2/lib/libqof/qof/gnc-date.c
===================================================================
--- gnucash/branches/2.2/lib/libqof/qof/gnc-date.c	2008-07-22 22:31:29 UTC (rev 17373)
+++ gnucash/branches/2.2/lib/libqof/qof/gnc-date.c	2008-07-22 22:31:42 UTC (rev 17374)
@@ -41,6 +41,7 @@
 #include <time.h>
 
 #include <glib.h>
+#include <glib/gi18n.h>
 
 #include "gnc-date-p.h"
 #include "qof.h"
@@ -68,6 +69,15 @@
 #  define GNC_T_FMT "%r" 
 #endif
 
+/* The default date format for use with strftime. */
+const char *gnc_default_strftime_date_format =
+#ifdef G_OS_WIN32
+ N_("%B %#d, %Y")
+#else
+ N_("%B %e, %Y")
+#endif
+ ;
+
 /* This is now user configured through the gnome options system() */
 static QofDateFormat dateFormat = QOF_DATE_FORMAT_LOCALE;
 static QofDateFormat prevQofDateFormat = QOF_DATE_FORMAT_LOCALE;

Modified: gnucash/branches/2.2/lib/libqof/qof/gnc-date.h
===================================================================
--- gnucash/branches/2.2/lib/libqof/qof/gnc-date.h	2008-07-22 22:31:29 UTC (rev 17373)
+++ gnucash/branches/2.2/lib/libqof/qof/gnc-date.h	2008-07-22 22:31:42 UTC (rev 17374)
@@ -69,6 +69,9 @@
 
 #include <time.h>
 
+/** The default date format for use with strftime. */
+extern const char *gnc_default_strftime_date_format;
+
 /** The maximum length of a string created by the date printers */
 #define MAX_DATE_LENGTH 31
 
@@ -380,7 +383,7 @@
 size_t qof_print_date_buff (char * buff, size_t buflen, time_t secs);
 
 /** Convenience; calls through to qof_print_date_dmy_buff(). **/
-size_t qof_print_gdate( char *buf, size_t bufflen, GDate *gd );
+size_t qof_print_gdate(char *buf, size_t bufflen, GDate *gd);
 
 /** Convenience; calls through to qof_print_date_dmy_buff(). 
  *  Return: string, which should be freed when no longer needed.

Modified: gnucash/branches/2.2/po/POTFILES.in
===================================================================
--- gnucash/branches/2.2/po/POTFILES.in	2008-07-22 22:31:29 UTC (rev 17373)
+++ gnucash/branches/2.2/po/POTFILES.in	2008-07-22 22:31:42 UTC (rev 17374)
@@ -448,5 +448,6 @@
 src/report/utility-reports/gncmod-utility-reports.c
 src/tax/us/gncmod-tax-us.c
 lib/libqof/backend/file/qsf-backend.c
+lib/libqof/qof/gnc-date.c
 intl-scm/guile-strings.c
 doc/tip_of_the_day.list.in

Modified: gnucash/branches/2.2/src/business/business-reports/easy-invoice.scm
===================================================================
--- gnucash/branches/2.2/src/business/business-reports/easy-invoice.scm	2008-07-22 22:31:29 UTC (rev 17373)
+++ gnucash/branches/2.2/src/business/business-reports/easy-invoice.scm	2008-07-22 22:31:42 UTC (rev 17374)
@@ -361,7 +361,7 @@
    (gnc:make-string-option
     (N_ "Text") (N_ "Today Date Format")
     "x" (N_ "The format for the date->string conversion for today's date.")
-    "%B %e, %Y"))
+    (gnc-default-strftime-date-format)))
 
 
   (gnc:options-set-default-section gnc:*report-options* "General")

Modified: gnucash/branches/2.2/src/business/business-reports/fancy-invoice.scm
===================================================================
--- gnucash/branches/2.2/src/business/business-reports/fancy-invoice.scm	2008-07-22 22:31:29 UTC (rev 17373)
+++ gnucash/branches/2.2/src/business/business-reports/fancy-invoice.scm	2008-07-22 22:31:42 UTC (rev 17374)
@@ -375,7 +375,7 @@
 ;   (gnc:make-string-option
 ;    (N_ "Display") (N_ "Today Date Format")
 ;    "v" (N_ "The format for the date->string conversion for today's date.")
-;    "%B %e, %Y"))
+;    (gnc-default-strftime-date-format)))
 
   (gnc:options-set-default-section gnc:*report-options* "General")
 
@@ -647,7 +647,9 @@
     ;; oli-custom - modified to display a custom format
     ;; for the invoice date/due date fields
     ;; I could have taken the format from the report options, but... ;)
-    (string-expand (strftime "%B %e, %Y" (localtime (car date))) #\space "&nbsp;")
+    (string-expand (strftime (gnc-default-strftime-date-format)
+                             (localtime (car date)))
+                   #\space "&nbsp;")
     ;;(string-expand (gnc-print-date date) #\space "&nbsp;")
     )))
 

Modified: gnucash/branches/2.2/src/business/business-reports/invoice.scm
===================================================================
--- gnucash/branches/2.2/src/business/business-reports/invoice.scm	2008-07-22 22:31:29 UTC (rev 17373)
+++ gnucash/branches/2.2/src/business/business-reports/invoice.scm	2008-07-22 22:31:42 UTC (rev 17374)
@@ -328,7 +328,7 @@
    (gnc:make-string-option
     (N_ "Display") (N_ "Today Date Format")
     "v" (N_ "The format for the date->string conversion for today's date.")
-    "%B %e, %Y"))
+    (gnc-default-strftime-date-format)))
 
   (gnc:options-set-default-section gnc:*report-options* "General")
 

Modified: gnucash/branches/2.2/src/business/business-reports/owner-report.scm
===================================================================
--- gnucash/branches/2.2/src/business/business-reports/owner-report.scm	2008-07-22 22:31:29 UTC (rev 17373)
+++ gnucash/branches/2.2/src/business/business-reports/owner-report.scm	2008-07-22 22:31:42 UTC (rev 17374)
@@ -413,7 +413,7 @@
    (gnc:make-string-option
     gnc:pagename-general (N_ "Today Date Format")
     "p" (N_ "The format for the date->string conversion for today's date.")
-    "%B %e, %Y"))
+    (gnc-default-strftime-date-format)))
 
   (gnc:options-set-default-section gnc:*report-options* "General")
 

Modified: gnucash/branches/2.2/src/engine/engine.i
===================================================================
--- gnucash/branches/2.2/src/engine/engine.i	2008-07-22 22:31:29 UTC (rev 17373)
+++ gnucash/branches/2.2/src/engine/engine.i	2008-07-22 22:31:42 UTC (rev 17374)
@@ -106,6 +106,7 @@
 // TODO: Unroll/remove
 const char *qof_session_get_url (QofSession *session);
 
+extern const char *gnc_default_strftime_date_format;
 const char *gnc_print_date (Timespec ts);
 
 GUID guid_new_return(void);



More information about the gnucash-changes mailing list