r20749 - gnucash/branches/2.4/src/gnome-utils - [20746] Bug #652193 - Upcoming Scheduled Transactions Calendar Starting Month

Geert Janssens gjanssens at code.gnucash.org
Fri Jun 10 16:05:26 EDT 2011


Author: gjanssens
Date: 2011-06-10 16:05:26 -0400 (Fri, 10 Jun 2011)
New Revision: 20749
Trac: http://svn.gnucash.org/trac/changeset/20749

Modified:
   gnucash/branches/2.4/src/gnome-utils/gnc-dense-cal.c
Log:
[20746] Bug #652193 - Upcoming Scheduled Transactions Calendar Starting Month
Error

Patch by Rich

Modified: gnucash/branches/2.4/src/gnome-utils/gnc-dense-cal.c
===================================================================
--- gnucash/branches/2.4/src/gnome-utils/gnc-dense-cal.c	2011-06-10 18:14:36 UTC (rev 20748)
+++ gnucash/branches/2.4/src/gnome-utils/gnc-dense-cal.c	2011-06-10 20:05:26 UTC (rev 20749)
@@ -1724,6 +1724,7 @@
     gchar *name, *info;
     gint num_marks, idx;
     GDate **dates;
+    GDate *calDate;
 
     // copy the values into the old marking function.
     name = gnc_dense_cal_model_get_name(cal->model, tag);
@@ -1734,14 +1735,19 @@
         goto cleanup;
 
     dates = g_new0(GDate*, num_marks);
+    calDate = g_date_new_dmy(1, cal->month, cal->year);
+    
     for (idx = 0; idx < num_marks; idx++)
     {
         dates[idx] = g_date_new();
         gnc_dense_cal_model_get_instance(cal->model, tag, idx, dates[idx]);
     }
 
-    _gnc_dense_cal_set_month(cal, g_date_get_month(dates[0]), FALSE);
-    _gnc_dense_cal_set_year(cal, g_date_get_year(dates[0]), FALSE);
+    if(g_date_get_julian(dates[0]) < g_date_get_julian(calDate))
+    {
+        _gnc_dense_cal_set_month(cal, g_date_get_month(dates[0]), FALSE);
+        _gnc_dense_cal_set_year(cal, g_date_get_year(dates[0]), FALSE);
+    }
 
     gdc_mark_add(cal, tag, name, info, num_marks, dates);
 
@@ -1750,7 +1756,8 @@
         g_date_free(dates[idx]);
     }
     g_free(dates);
-
+    g_date_free(calDate);
+    
 cleanup:
     g_free(info);
 }



More information about the gnucash-changes mailing list