r14917 - gnucash/branches/sx-cleanup/src - Auto-create support.

Joshua Sled jsled at cvs.gnucash.org
Sun Oct 1 17:22:51 EDT 2006


Author: jsled
Date: 2006-10-01 17:22:50 -0400 (Sun, 01 Oct 2006)
New Revision: 14917
Trac: http://svn.gnucash.org/trac/changeset/14917

Modified:
   gnucash/branches/sx-cleanup/src/doc/sx.rst
   gnucash/branches/sx-cleanup/src/gnome/dialog-sx-since-last-run.c
   gnucash/branches/sx-cleanup/src/gnome/dialog-sx-since-last-run.h
   gnucash/branches/sx-cleanup/src/gnome/gnc-plugin-basic-commands.c
   gnucash/branches/sx-cleanup/src/gnome/gnc-plugin-page-sx-list.c
   gnucash/branches/sx-cleanup/src/gnome/gnc-plugin-page-sx-list.h
Log:
Auto-create support.
- add a 'created' state
- extend SLR model for instance-state sensitivity control (so 'Created'-state instances won't be changed)
- add a "SLR summary"
- hook-up menu and book-open hooks for appropriately displaying the SLR dialog or an info dialog.

Fix bug in temporal instance saving.


Modified: gnucash/branches/sx-cleanup/src/doc/sx.rst
===================================================================
--- gnucash/branches/sx-cleanup/src/doc/sx.rst	2006-10-01 21:14:28 UTC (rev 14916)
+++ gnucash/branches/sx-cleanup/src/doc/sx.rst	2006-10-01 21:22:50 UTC (rev 14917)
@@ -136,6 +136,7 @@
     postponed -> to-create
     to-create -> postponed
     to-create -> ignore
+    to-create -> created [terminal]
 
 Definitions:
 
@@ -145,6 +146,7 @@
     to-create: an upcoming SX instance that should be created.
     ignore: a scheduled instance the user has explicitly prevented the
         instantiation of.
+    created: the instance has been created in this interaction cycle.
 
 The SX need to store?
 - last state of *created* instance
@@ -200,3 +202,18 @@
 ignoring the first instance. We only want to incrment the
 counters for newly-discovered-as-to-be-created SXes."
 
+- auto-create 
+  - auto-create transactions can be created w/o user interaction
+    - their state is transitioned to 'created', which is not modifyable
+  
+  - auto-create (+notify) transactions should be displayed, even if they are
+    the only transactions created.
+  
+  - auto-create (-notify) transactions should not be displayed, unless there
+    are other transactions.
+  
+  - Scenarios
+    - only auto-create (-notify): no SLR, info dialog w/count (***)
+    - only auto-create (+notify): SLR dialog, already created
+    - others, auto-create (-notify): SLR dialog, incl. created 
+    - others, auto-create (+notify): SLR dialog, incl. created
\ No newline at end of file

Modified: gnucash/branches/sx-cleanup/src/gnome/dialog-sx-since-last-run.c
===================================================================
--- gnucash/branches/sx-cleanup/src/gnome/dialog-sx-since-last-run.c	2006-10-01 21:14:28 UTC (rev 14916)
+++ gnucash/branches/sx-cleanup/src/gnome/dialog-sx-since-last-run.c	2006-10-01 21:22:50 UTC (rev 14917)
@@ -41,15 +41,19 @@
 #include "gnc-plugin-page-register.h"
 #include "gnc-main-window.h"
 #include "gnc-component-manager.h"
+#include "gnc-gconf-utils.h"
+#include "gnc-gui-query.h"
 
 static QofLogModule log_module = GNC_MOD_GUI;
 
-typedef struct _GncSxSlrTreeModelAdapter GncSxSlrTreeModelAdapter;
+#define GCONF_SECTION "dialogs/scheduled_trans/since_last_run"
 
+//typedef struct _GncSxSlrTreeModelAdapter GncSxSlrTreeModelAdapter;
+
 struct _GncSxSinceLastRunDialog
 {
      GtkWidget *dialog;
-     GncSxInstanceModel *instances;
+     //GncSxInstanceModel *instances;
      GncSxSlrTreeModelAdapter *editing_model;
      GtkTreeView *instance_view;
      GtkToggleButton *review_created_txns_toggle;
@@ -85,6 +89,8 @@
 /** @return false if the iter is not actaully an GncSxInstance's variable. **/
 gboolean gnc_sx_slr_model_get_instance_and_variable(GncSxSlrTreeModelAdapter *model, GtkTreeIter *iter, GncSxInstance **instance_loc, GncSxVariable **var_loc);
 
+void gnc_sx_slr_model_summarize(GncSxSlrTreeModelAdapter *model, GncSxSlrSummary *summary);
+
 void gnc_sx_slr_model_change_instance_state(GncSxSlrTreeModelAdapter *model, GncSxInstance *instance, GncSxInstanceState new_state);
 void gnc_sx_slr_model_change_variable(GncSxSlrTreeModelAdapter *model, GncSxInstance *instance, GncSxVariable *variable, gnc_numeric *new_value);
 
@@ -338,18 +344,19 @@
      SLR_MODEL_COL_INSTANCE_STATE,
      SLR_MODEL_COL_VARAIBLE_VALUE,
      SLR_MODEL_COL_INSTANCE_VISIBILITY,
-     SLR_MODEL_COL_VARIABLE_VISIBILITY
+     SLR_MODEL_COL_VARIABLE_VISIBILITY,
+     SLR_MODEL_COL_INSTANCE_STATE_SENSITIVITY,
 };
 
 static void
 gnc_sx_slr_tree_model_adapter_init(GTypeInstance *instance, gpointer klass)
 {
      GncSxSlrTreeModelAdapter *adapter = GNC_SX_SLR_TREE_MODEL_ADAPTER(instance);
-     // columns:    thing-name, instance-state, variable-value, instance-visible, variable-visible
-     // at depth=0: <sx>,       N/A,            N/A,            N/A               N/A,
-     // at depth=1: <instance>, <state>,        N/A,            <valid>,          N/A,
-     // at depth=2: <variable>, N/A,            <value>,        N/A,              <valid>,
-     adapter->real = gtk_tree_store_new(5, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN);
+     // columns:    thing-name, instance-state, variable-value, instance-visible, variable-visible, instance_state_sensitivity
+     // at depth=0: <sx>,       N/A,            N/A,            N/A               N/A,              N/A
+     // at depth=1: <instance>, <state>,        N/A,            <valid>,          N/A,              <valid>
+     // at depth=2: <variable>, N/A,            <value>,        N/A,              <valid>,          N/A
+     adapter->real = gtk_tree_store_new(6, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN);
 
      g_signal_connect(adapter->real, "row-changed", G_CALLBACK(gsslrtma_proxy_row_changed), adapter);
      g_signal_connect(adapter->real, "row-deleted", G_CALLBACK(gsslrtma_proxy_row_deleted), adapter);
@@ -365,6 +372,7 @@
      ("Postponed"),
      ("To-Create"),
      ("Reminder"),
+     ("Created"),
      NULL
 };
 
@@ -379,7 +387,7 @@
           GtkTreeIter iter;
 
           _singleton_slr_state_model = GTK_TREE_MODEL(gtk_list_store_new(1, G_TYPE_STRING));
-          for (i = 0; gnc_sx_instance_state_names[i] != NULL; i++)
+          for (i = 0; i != SX_INSTANCE_STATE_CREATED; i++)
           {
                gtk_list_store_insert_with_values(GTK_LIST_STORE(_singleton_slr_state_model),
                                                  &iter,
@@ -431,6 +439,7 @@
                              SLR_MODEL_COL_VARAIBLE_VALUE, NULL,
                              SLR_MODEL_COL_INSTANCE_VISIBILITY, FALSE,
                              SLR_MODEL_COL_VARIABLE_VISIBILITY, FALSE,
+                             SLR_MODEL_COL_INSTANCE_STATE_SENSITIVITY, FALSE,
                              -1);
           g_string_free(frequency_str, TRUE);
 
@@ -451,6 +460,7 @@
                                        SLR_MODEL_COL_VARAIBLE_VALUE, NULL,
                                        SLR_MODEL_COL_INSTANCE_VISIBILITY, TRUE,
                                        SLR_MODEL_COL_VARIABLE_VISIBILITY, FALSE,
+                                       SLR_MODEL_COL_INSTANCE_STATE_SENSITIVITY, inst->state != SX_INSTANCE_STATE_CREATED,
                                        -1);
 
                     // Insert variable information
@@ -478,6 +488,7 @@
                                                  SLR_MODEL_COL_VARAIBLE_VALUE, tmp_str->str,
                                                  SLR_MODEL_COL_INSTANCE_VISIBILITY, FALSE,
                                                  SLR_MODEL_COL_VARIABLE_VISIBILITY, TRUE,
+                                                 SLR_MODEL_COL_INSTANCE_STATE_SENSITIVITY, FALSE
                                                  -1);
                               g_string_free(tmp_str, TRUE);
                          }
@@ -611,6 +622,7 @@
 
      gtk_tree_store_set(model->real, &iter,
                         SLR_MODEL_COL_INSTANCE_STATE, gnc_sx_instance_state_names[instance->state],
+                        SLR_MODEL_COL_INSTANCE_STATE_SENSITIVITY, instance->state != SX_INSTANCE_STATE_CREATED,
                         -1);
 
      // ensure 'remind' constraints are met
@@ -633,6 +645,7 @@
                gtk_tree_path_free(path);
                gtk_tree_store_set(model->real, &iter,
                                   SLR_MODEL_COL_INSTANCE_STATE, gnc_sx_instance_state_names[prev_inst->state],
+                                  SLR_MODEL_COL_INSTANCE_STATE_SENSITIVITY, prev_inst->state != SX_INSTANCE_STATE_CREATED,
                                   -1);
           }
      }
@@ -653,6 +666,7 @@
                gtk_tree_path_free(path);
                gtk_tree_store_set(model->real, &iter,
                                   SLR_MODEL_COL_INSTANCE_STATE, gnc_sx_instance_state_names[next_inst->state],
+                                  SLR_MODEL_COL_INSTANCE_STATE_SENSITIVITY, next_inst->state != SX_INSTANCE_STATE_CREATED,
                                   -1);
           }
      }
@@ -725,26 +739,124 @@
      return rtn;
 }
 
+GncSxSlrTreeModelAdapter*
+gnc_sx_get_slr_model()
+{
+     GDate now;
+     GncSxInstanceModel *instance_model;
+     GncSxSlrTreeModelAdapter *slr_model;
+     g_date_clear(&now, 1);
+     g_date_set_time_t(&now, time(NULL));
+     instance_model = gnc_sx_get_instances(&now);
+     slr_model = gnc_sx_slr_tree_model_adapter_new(instance_model);
+     return slr_model;
+}
+
 void
+gnc_sx_slr_model_summarize(GncSxSlrTreeModelAdapter *model, GncSxSlrSummary *summary)
+{
+     GList *sx_iter, *inst_iter;
+
+     g_return_if_fail(model != NULL);
+     g_return_if_fail(summary != NULL);
+
+     summary->need_dialog = FALSE;
+     summary->num_instances = 0;
+     summary->num_to_create_instances = 0;
+     summary->num_auto_create_instances = 0;
+     summary->num_auto_create_no_notify_instances = 0;
+
+     for (sx_iter = model->instances->sx_instance_list; sx_iter != NULL; sx_iter = sx_iter->next)
+     {
+          GncSxInstances *instances = (GncSxInstances*)sx_iter->data;
+          gboolean sx_is_auto_create = FALSE, sx_notify = FALSE;
+          xaccSchedXactionGetAutoCreate(instances->sx, &sx_is_auto_create, &sx_notify);
+          for (inst_iter = instances->list; inst_iter != NULL; inst_iter = inst_iter->next)
+          {
+               GncSxInstance *inst = (GncSxInstance*)inst_iter->data;
+               summary->num_instances++;
+
+               if (inst->state == SX_INSTANCE_STATE_TO_CREATE)
+               {
+                    if (sx_is_auto_create)
+                    {
+                         if (!sx_notify)
+                         {
+                              summary->num_auto_create_no_notify_instances++;
+                         }
+                         else
+                         {
+                              summary->num_auto_create_instances++;
+                         }
+                    }
+                    else
+                    {
+                         summary->num_to_create_instances++;
+                    }
+               }
+          }
+     }
+
+     // if all the instances are 'auto-create, no-notify', then we don't need
+     // the dialog.
+     summary->need_dialog
+          = (summary->num_instances != 0
+             && summary->num_auto_create_no_notify_instances != summary->num_instances);
+}
+
+static void
+_print_summary(GncSxSlrSummary *summary)
+{
+     printf("num_instances: %d\n", summary->num_instances);
+     printf("num_to_create: %d\n", summary->num_to_create_instances);
+     printf("num_auto_create_instances: %d\n", summary->num_auto_create_instances);
+     printf("num_auto_create_no_notify_instances: %d\n", summary->num_auto_create_no_notify_instances);
+     printf("need dialog? %s\n", summary->need_dialog ? "true" : "false");
+}
+
+void
 gnc_sx_sxsincelast_book_opened(void)
 {
-     // Get the instance model
-     // check for mumble and futz
-     // maybe create dialog.
-     printf("not ready\n");
-     //gnc_ui_sxsincelast_dialog_create();
+     GncSxSlrTreeModelAdapter *slr_model;
+     GncSxSlrSummary summary;
+
+     if (!gnc_gconf_get_bool(GCONF_SECTION, "show_at_file_open", NULL))
+          return;
+
+     slr_model = gnc_sx_get_slr_model();
+     gnc_sx_slr_model_summarize(slr_model, &summary);
+     _print_summary(&summary);
+     gnc_sx_slr_model_effect_change(slr_model, TRUE, NULL, NULL);
+
+     if (summary.need_dialog)
+     {
+          gnc_ui_sx_since_last_run_dialog(slr_model);
+     }
+     else
+     {
+          if (summary.num_auto_create_no_notify_instances != 0)
+          {
+               gnc_info_dialog
+                    (NULL,
+                     ngettext 
+                     ("There are no Scheduled Transactions to be entered at this time. "
+                      "(%d transaction automatically created)",
+                      "There are no Scheduled Transactions to be entered at this time. "
+                      "(%d transactions automatically created)",
+                      summary.num_auto_create_no_notify_instances),
+                     summary.num_auto_create_no_notify_instances);
+               gnc_sx_slr_model_effect_change(slr_model, TRUE, NULL, NULL);
+          }
+     }
+     // @@fixme g_object_unref(G_OBJECT(slr_model))
 }
 
-gint
+void
 gnc_ui_sxsincelast_dialog_create(void)
 {
-     GDate now;
-     GncSxInstanceModel *model;
-     g_date_clear(&now, 1);
-     g_date_set_time_t(&now, time(NULL));
-     model = gnc_sx_get_instances(&now);
-     gnc_ui_sx_since_last_run_dialog(model);
-     return 1;
+     GncSxSlrTreeModelAdapter *slr_model = gnc_sx_get_slr_model();
+     gnc_sx_slr_model_effect_change(slr_model, TRUE, NULL, NULL);
+     gnc_ui_sx_since_last_run_dialog(slr_model);
 }
 
 static void
@@ -758,12 +870,12 @@
      int i;
      GncSxInstanceState new_state;
      
-     for (i = 0; i < SX_INSTANCE_STATE_MAX_STATE; i++)
+     for (i = 0; i < SX_INSTANCE_STATE_CREATED; i++)
      {
           if (strcmp(value, gnc_sx_instance_state_names[i]) == 0)
                break;
      }
-     if (i == SX_INSTANCE_STATE_MAX_STATE)
+     if (i == SX_INSTANCE_STATE_CREATED)
      {
           printf("unknown value [%s]\n", value);
           return;
@@ -822,19 +934,17 @@
 }
 
 GncSxSinceLastRunDialog*
-gnc_ui_sx_since_last_run_dialog(GncSxInstanceModel *model)
+gnc_ui_sx_since_last_run_dialog(GncSxSlrTreeModelAdapter *slr_model)
 {
      GncSxSinceLastRunDialog *dialog;
      GladeXML *glade;
 
      dialog = g_new0(GncSxSinceLastRunDialog, 1);
-     dialog->instances = model;
-
      glade = gnc_glade_xml_new("sched-xact.glade", "since-last-run-dialog");
      dialog->dialog = glade_xml_get_widget(glade, "since-last-run-dialog");
 
-     dialog->editing_model = gnc_sx_slr_tree_model_adapter_new(model);
-
+     dialog->editing_model = slr_model;
+     
      {
           GtkPaned *paned;
 
@@ -872,6 +982,7 @@
           col = gtk_tree_view_column_new_with_attributes("Instance State", renderer,
                                                          "text", SLR_MODEL_COL_INSTANCE_STATE,
                                                          "visible", SLR_MODEL_COL_INSTANCE_VISIBILITY,
+                                                         "sensitive", SLR_MODEL_COL_INSTANCE_STATE_SENSITIVITY,
                                                          NULL);
           gtk_tree_view_append_column(dialog->instance_view, col);
 
@@ -1325,15 +1436,16 @@
           for (instance_list = instances->list; instance_list != NULL; instance_list = instance_list->next)
           {
                GncSxInstance *inst = (GncSxInstance*)instance_list->data;
-               gboolean sx_is_auto_create, sx_is_notify;
+               gboolean sx_is_auto_create;
 
-               xaccSchedXactionGetAutoCreate(inst->parent->sx, &sx_is_auto_create, &sx_is_notify);
-               if (auto_create_only
-                   && sx_is_auto_create
-                   && inst->state != SX_INSTANCE_STATE_TO_CREATE)
+               xaccSchedXactionGetAutoCreate(inst->parent->sx, &sx_is_auto_create, NULL);
+               if (auto_create_only && !sx_is_auto_create)
                {
-                    printf("@@fixme: auto-create behavior\n");
-                    break;
+                    if (inst->state != SX_INSTANCE_STATE_TO_CREATE)
+                    {
+                         break;
+                    }
+                    continue;
                }
 
                if (inst->orig_state == SX_INSTANCE_STATE_POSTPONED
@@ -1346,6 +1458,9 @@
 
                switch (inst->state)
                {
+               case SX_INSTANCE_STATE_CREATED:
+                    // nop: we've already processed this.
+                    break;
                case SX_INSTANCE_STATE_IGNORED:
                     increment_sx_state(inst, &last_occur_date, &instance_count, &remain_occur_count);
                     break;
@@ -1359,6 +1474,7 @@
                case SX_INSTANCE_STATE_TO_CREATE:
                     create_transactions_for_instance(inst, created_transaction_guids, creation_errors);
                     increment_sx_state(inst, &last_occur_date, &instance_count, &remain_occur_count);
+                    gnc_sx_slr_model_change_instance_state(model, inst, SX_INSTANCE_STATE_CREATED);
                     break;
                case SX_INSTANCE_STATE_REMINDER:
                     // do nothing

Modified: gnucash/branches/sx-cleanup/src/gnome/dialog-sx-since-last-run.h
===================================================================
--- gnucash/branches/sx-cleanup/src/gnome/dialog-sx-since-last-run.h	2006-10-01 21:14:28 UTC (rev 14916)
+++ gnucash/branches/sx-cleanup/src/gnome/dialog-sx-since-last-run.h	2006-10-01 21:22:50 UTC (rev 14917)
@@ -30,21 +30,41 @@
 #include "SchedXaction.h"
 #include "gnc-plugin-page-sx-list.h"
 
+typedef struct _GncSxSlrTreeModelAdapter GncSxSlrTreeModelAdapter;
 typedef struct _GncSxSinceLastRunDialog GncSxSinceLastRunDialog;
+typedef struct _GncSxSlrSummary
+{
+     gboolean need_dialog; /**< If the dialog needs to be displayed. **/
 
+     gint num_instances; /**< The number of total instances (all states). **/
+     gint num_to_create_instances; /**< The number of (not-auto-create) to-create instances. **/
+     gint num_auto_create_instances;  /**< The total number of auto-create instances. **/
+     gint num_auto_create_no_notify_instances; /**< The number of automatically-created instances that do no request notification. **/
+} GncSxSlrSummary;
+
+GncSxSlrTreeModelAdapter* gnc_sx_get_slr_model(void);
+
 /**
+ * @param summary Caller-provided, populated with a summarization of the
+ * state of the model.  Specifically, used to determine if there are SLR SXes
+ * that need either auto-creation or user-interaction.
+ **/
+void gnc_sx_slr_model_summarize(GncSxSlrTreeModelAdapter *model, GncSxSlrSummary *summary);
+
+/**
  * This encapsulates the "run when file opened" application logic.  As such,
  * it should probably move to a non-ui file.
  **/
 void gnc_sx_sxsincelast_book_opened(void);
 
 /**
- * Create the since-last-run dialog from the given instance-model.
+ * Create the since-last-run dialog.
  **/
-GncSxSinceLastRunDialog*  gnc_ui_sx_since_last_run_dialog(GncSxInstanceModel *model);
+GncSxSinceLastRunDialog*  gnc_ui_sx_since_last_run_dialog(GncSxSlrTreeModelAdapter *model);
 
-// @@fixme: resurect, fix return type.
-gint gnc_ui_sxsincelast_dialog_create( void );
+// eliminate...
+void gnc_ui_sxsincelast_dialog_create(void);
 
+void gnc_sx_slr_model_effect_change(GncSxSlrTreeModelAdapter *model, gboolean auto_create_only, GList **created_transaction_guids, GList **creation_errors);
 
 #endif

Modified: gnucash/branches/sx-cleanup/src/gnome/gnc-plugin-basic-commands.c
===================================================================
--- gnucash/branches/sx-cleanup/src/gnome/gnc-plugin-basic-commands.c	2006-10-01 21:14:28 UTC (rev 14916)
+++ gnucash/branches/sx-cleanup/src/gnome/gnc-plugin-basic-commands.c	2006-10-01 21:22:50 UTC (rev 14917)
@@ -445,28 +445,42 @@
 gnc_main_window_cmd_actions_since_last_run (GtkAction *action, GncMainWindowActionData *data)
 {
   GncMainWindow *window;
-  gint ret;
+  GncSxSlrTreeModelAdapter *slr_model;
+  GncSxSlrSummary summary;
   const char *nothing_to_do_msg =
     _( "There are no Scheduled Transactions to be entered at this time." );
 	
   g_return_if_fail (data != NULL);
 
   window = data->window;
-  ret = gnc_ui_sxsincelast_dialog_create ();
-  if ( ret == 0 ) {
-    gnc_info_dialog (GTK_WIDGET(&window->gtk_window), nothing_to_do_msg);
-  } else if ( ret < 0 ) {
-    gnc_info_dialog (GTK_WIDGET(&window->gtk_window), ngettext
-		     /* Translators: %d is the number of transactions. This is a
-			ngettext(3) message. */
-		     ("There are no Scheduled Transactions to be entered at this time. "
-		      "(%d transaction automatically created)",
-		      "There are no Scheduled Transactions to be entered at this time. "
-		      "(%d transactions automatically created)",
-		      -(ret)),
-		     -(ret));
-  } /* else { this else [>0 means dialog was created] intentionally left
-     * blank. } */	       
+
+  slr_model = gnc_sx_get_slr_model();
+  gnc_sx_slr_model_summarize(slr_model, &summary);
+  gnc_sx_slr_model_effect_change(slr_model, TRUE, NULL, NULL);
+  if (summary.need_dialog)
+  {
+    gnc_ui_sx_since_last_run_dialog(slr_model);
+  }
+  else
+  {
+    if (summary.num_auto_create_no_notify_instances == 0)
+    {
+      gnc_info_dialog(GTK_WIDGET(&window->gtk_window), nothing_to_do_msg);
+    }
+    else
+    {
+      gnc_info_dialog(GTK_WIDGET(&window->gtk_window), ngettext
+                      /* Translators: %d is the number of transactions. This is a
+                         ngettext(3) message. */
+                      ("There are no Scheduled Transactions to be entered at this time. "
+                       "(%d transaction automatically created)",
+                       "There are no Scheduled Transactions to be entered at this time. "
+                       "(%d transactions automatically created)",
+                       summary.num_auto_create_no_notify_instances),
+                      summary.num_auto_create_no_notify_instances);
+    }
+  }
+  // @fixme g_object_unref(G_OBJECT(slr_model));
 }
 
 static void

Modified: gnucash/branches/sx-cleanup/src/gnome/gnc-plugin-page-sx-list.c
===================================================================
--- gnucash/branches/sx-cleanup/src/gnome/gnc-plugin-page-sx-list.c	2006-10-01 21:14:28 UTC (rev 14916)
+++ gnucash/branches/sx-cleanup/src/gnome/gnc-plugin-page-sx-list.c	2006-10-01 21:22:50 UTC (rev 14917)
@@ -975,6 +975,7 @@
      rtn->state = state;
      g_date_clear(&rtn->date, 1);
      rtn->date = *date;
+     rtn->temporal_state = gnc_sx_clone_temporal_state(temporal_state);
 
      if (! parent->variable_names_parsed)
      {
@@ -1028,16 +1029,17 @@
      /* postponed */
      {
           GList *postponed = gnc_sx_get_defer_instances(sx);
-          for ( ; postponed != NULL; postponed = g_list_next(postponed))
+          for ( ; postponed != NULL; postponed = postponed->next)
           {
                GDate inst_date;
                int seq_num;
                GncSxInstance *inst;
 
+               g_date_clear(&inst_date, 1);
                inst_date = xaccSchedXactionGetNextInstance(sx, postponed->data);
                seq_num = gnc_sx_get_instance_count(sx, postponed->data);
                inst = gnc_sx_instance_new(instances, SX_INSTANCE_STATE_POSTPONED, &inst_date, postponed->data, seq_num);
-               //inst->sx_temporal_state = postponed->data;
+               //inst->temporal_state = postponed->data;
                instances->list = g_list_append(instances->list, inst);
           }
      }

Modified: gnucash/branches/sx-cleanup/src/gnome/gnc-plugin-page-sx-list.h
===================================================================
--- gnucash/branches/sx-cleanup/src/gnome/gnc-plugin-page-sx-list.h	2006-10-01 21:14:28 UTC (rev 14916)
+++ gnucash/branches/sx-cleanup/src/gnome/gnc-plugin-page-sx-list.h	2006-10-01 21:22:50 UTC (rev 14917)
@@ -126,6 +126,7 @@
      SX_INSTANCE_STATE_POSTPONED,
      SX_INSTANCE_STATE_TO_CREATE,
      SX_INSTANCE_STATE_REMINDER,
+     SX_INSTANCE_STATE_CREATED,
      SX_INSTANCE_STATE_MAX_STATE
 } GncSxInstanceState;
 



More information about the gnucash-changes mailing list