r15080 - gnucash/trunk/src/gnome-utils - Make gnc-dense-cal:month_name to use g_date_strftime instead of strftime

Andreas Köhler andi5 at cvs.gnucash.org
Fri Nov 3 14:49:13 EST 2006


Author: andi5
Date: 2006-11-03 14:49:13 -0500 (Fri, 03 Nov 2006)
New Revision: 15080
Trac: http://svn.gnucash.org/trac/changeset/15080

Modified:
   gnucash/trunk/src/gnome-utils/gnc-dense-cal.c
Log:
Make gnc-dense-cal:month_name to use g_date_strftime instead of strftime
so that it returns a clean UTF-8 string.


Modified: gnucash/trunk/src/gnome-utils/gnc-dense-cal.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-dense-cal.c	2006-11-03 15:18:33 UTC (rev 15079)
+++ gnucash/trunk/src/gnome-utils/gnc-dense-cal.c	2006-11-03 19:49:13 UTC (rev 15080)
@@ -166,15 +166,16 @@
  * locale. (i18n'd version of the above static character array.) */
 static const gchar *month_name(int mon) 
 {
-    static gchar buf[MONTH_NAME_BUFSIZE];
-    struct tm my_tm;
-    int i;
+        static gchar buf[MONTH_NAME_BUFSIZE];
+        GDate *date;
 
-    memset( buf, 0, MONTH_NAME_BUFSIZE );
-    memset( &my_tm, 0, sizeof( struct tm ) );
-    my_tm.tm_mon = mon;
-    i = strftime (buf, MONTH_NAME_BUFSIZE-1, "%b", &my_tm);
-    return buf;
+        memset(buf, 0, MONTH_NAME_BUFSIZE);
+        date = g_date_new();
+        g_date_set_month(date, mon);
+        g_date_strftime(buf, MONTH_NAME_BUFSIZE-1, "%b", date);
+        g_date_free(date);
+
+        return buf;
 }
 /* FIXME: i18n 
    static const gchar *dayLabels[7] = {



More information about the gnucash-changes mailing list