r15498 - gnucash/trunk/src/gnome - Fix bug in next-occur formatting for instances that do not have a next-occur date.

Josh Sled jsled at cvs.gnucash.org
Sun Feb 4 10:21:10 EST 2007


Author: jsled
Date: 2007-02-04 10:21:10 -0500 (Sun, 04 Feb 2007)
New Revision: 15498
Trac: http://svn.gnucash.org/trac/changeset/15498

Modified:
   gnucash/trunk/src/gnome/gnc-sx-list-tree-model-adapter.c
Log:
Fix bug in next-occur formatting for instances that do not have a next-occur date.


Modified: gnucash/trunk/src/gnome/gnc-sx-list-tree-model-adapter.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-sx-list-tree-model-adapter.c	2007-02-04 15:11:32 UTC (rev 15497)
+++ gnucash/trunk/src/gnome/gnc-sx-list-tree-model-adapter.c	2007-02-04 15:21:10 UTC (rev 15498)
@@ -454,6 +454,19 @@
 }
 
 static void
+_format_conditional_date(GDate *date, char *date_buf, int buf_max_length)
+{
+     if (date == NULL || !g_date_valid(date))
+     {
+          g_stpcpy(date_buf, "never");
+     }
+     else
+     {
+          qof_print_gdate(date_buf, buf_max_length, date);
+     }
+}
+
+static void
 gsltma_populate_tree_store(GncSxListTreeModelAdapter *model)
 {
      GtkTreeIter iter;
@@ -471,22 +484,11 @@
           fs = xaccSchedXactionGetFreqSpec(instances->sx);
           xaccFreqSpecGetFreqStr(fs, frequency_str);
 
-          {
-               GDate *last_occur = xaccSchedXactionGetLastOccurDate(instances->sx);
-               if (last_occur == NULL || !g_date_valid(last_occur))
-               {
-                    g_stpcpy(last_occur_date_buf, "never");
-               }
-               else
-               {
-                    qof_print_gdate(last_occur_date_buf,
-                                    MAX_DATE_LENGTH,
-                                    last_occur);
-               }
-          }
+          _format_conditional_date(xaccSchedXactionGetLastOccurDate(instances->sx),
+                                   last_occur_date_buf, MAX_DATE_LENGTH);
+          _format_conditional_date(&instances->next_instance_date,
+                                   next_occur_date_buf, MAX_DATE_LENGTH);
 
-          qof_print_gdate(next_occur_date_buf, MAX_DATE_LENGTH, &instances->next_instance_date);
-
           gtk_tree_store_append(model->orig, &iter, NULL);
           gtk_tree_store_set(model->orig, &iter,
                              SXLTMA_COL_NAME, xaccSchedXactionGetName(instances->sx),



More information about the gnucash-changes mailing list