r15661 - gnucash/trunk/src - Keep track of auto-created transactions, and review them as well.

Josh Sled jsled at cvs.gnucash.org
Sun Feb 25 14:51:01 EST 2007


Author: jsled
Date: 2007-02-25 14:51:00 -0500 (Sun, 25 Feb 2007)
New Revision: 15661
Trac: http://svn.gnucash.org/trac/changeset/15661

Modified:
   gnucash/trunk/src/doc/sx.rst
   gnucash/trunk/src/gnome/dialog-sx-since-last-run.c
   gnucash/trunk/src/gnome/dialog-sx-since-last-run.h
   gnucash/trunk/src/gnome/gnc-plugin-basic-commands.c
Log:
Keep track of auto-created transactions, and review them as well.


Modified: gnucash/trunk/src/doc/sx.rst
===================================================================
--- gnucash/trunk/src/doc/sx.rst	2007-02-25 17:35:57 UTC (rev 15660)
+++ gnucash/trunk/src/doc/sx.rst	2007-02-25 19:51:00 UTC (rev 15661)
@@ -49,10 +49,15 @@
     - [x] display-using src/gnome-utils/test/test-sx.c
 
 - bugs
-! - [ ] auto-create (+notify) txns not in review list. [ve20070209]_
 
+! - [ ] parse from 1.8 file doesn't setup start date correctly;
+    daily-auto-yes-notify.xac has start date of 2006-09-26, but new TXN is
+    for $today.
+
 ! - [ ] with SLR open (with instances), add variables to SX; only newly-created instances will have appropriate variable tables.
 
+! - [x] auto-create (+notify) txns not in review list. [ve20070209]_
+
   - [x] sx-from-trans: "unknown get.type [3]" [dh20070120]_
 
 ! - [x] crash with two sx lists open and SX mutation

Modified: gnucash/trunk/src/gnome/dialog-sx-since-last-run.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-sx-since-last-run.c	2007-02-25 17:35:57 UTC (rev 15660)
+++ gnucash/trunk/src/gnome/dialog-sx-since-last-run.c	2007-02-25 19:51:00 UTC (rev 15661)
@@ -51,6 +51,7 @@
     GncSxSlrTreeModelAdapter *editing_model;
     GtkTreeView *instance_view;
     GtkToggleButton *review_created_txns_toggle;
+    GList *created_txns;
 };
 
 /* ------------------------------------------------------------ */
@@ -794,6 +795,7 @@
 void
 gnc_sx_sxsincelast_book_opened(void)
 {
+    GList *auto_created_txns = NULL;
     GncSxInstanceModel *inst_model;
     GncSxSummary summary;
 
@@ -803,11 +805,12 @@
     inst_model = gnc_sx_get_current_instances();
     gnc_sx_instance_model_summarize(inst_model, &summary);
     gnc_sx_summary_print(&summary);
-    gnc_sx_instance_model_effect_change(inst_model, TRUE, NULL, NULL);
+    gnc_sx_instance_model_effect_change(inst_model, TRUE, &auto_created_txns, NULL);
 
     if (summary.need_dialog)
     {
-        gnc_ui_sx_since_last_run_dialog(inst_model);
+        gnc_ui_sx_since_last_run_dialog(inst_model, auto_created_txns);
+        auto_created_txns = NULL;
     }
     else
     {
@@ -824,18 +827,10 @@
                  summary.num_auto_create_no_notify_instances);
         }
     }
+    g_list_free(auto_created_txns);
     g_object_unref(G_OBJECT(inst_model));
 }
 
-void
-gnc_ui_sxsincelast_dialog_create(void)
-{
-    GncSxInstanceModel *model = gnc_sx_get_current_instances();
-    gnc_sx_instance_model_effect_change(model, TRUE, NULL, NULL);
-    gnc_ui_sx_since_last_run_dialog(model);
-    g_object_unref(G_OBJECT(model));
-}
-
 static void
 instance_state_changed_cb(GtkCellRendererText *cell,
                           const gchar *path,
@@ -922,7 +917,7 @@
 }
 
 GncSxSinceLastRunDialog*
-gnc_ui_sx_since_last_run_dialog(GncSxInstanceModel *sx_instances)
+gnc_ui_sx_since_last_run_dialog(GncSxInstanceModel *sx_instances, GList *auto_created_txn_guids)
 {
     GncSxSinceLastRunDialog *dialog;
     GladeXML *glade;
@@ -936,6 +931,8 @@
     g_object_ref(G_OBJECT(dialog->editing_model));
      
     dialog->review_created_txns_toggle = GTK_TOGGLE_BUTTON(glade_xml_get_widget(glade, "review_txn_toggle"));
+
+    dialog->created_txns = auto_created_txn_guids;
      
     {
         GtkCellRenderer *renderer;
@@ -1070,15 +1067,18 @@
         }
     }
     gnc_suspend_gui_refresh();
-    gnc_sx_slr_model_effect_change(app_dialog->editing_model, FALSE, &created_txns, NULL);
+    gnc_sx_slr_model_effect_change(app_dialog->editing_model, FALSE, &app_dialog->created_txns, NULL);
     gnc_resume_gui_refresh();
     if (gtk_toggle_button_get_active(app_dialog->review_created_txns_toggle)
-        && g_list_length(created_txns) > 0)
+        && g_list_length(app_dialog->created_txns) > 0)
     {
-        _show_created_transactions(app_dialog, created_txns);
+
+        _show_created_transactions(app_dialog, app_dialog->created_txns);
     }
-    g_list_free(created_txns);
-    created_txns = NULL;
+    g_list_foreach(app_dialog->created_txns, (GFunc)guid_free, NULL);
+    g_list_free(app_dialog->created_txns);
+    app_dialog->created_txns = NULL;
+
     /* FALLTHROUGH */
     case GTK_RESPONSE_CANCEL: 
     case GTK_RESPONSE_DELETE_EVENT:

Modified: gnucash/trunk/src/gnome/dialog-sx-since-last-run.h
===================================================================
--- gnucash/trunk/src/gnome/dialog-sx-since-last-run.h	2007-02-25 17:35:57 UTC (rev 15660)
+++ gnucash/trunk/src/gnome/dialog-sx-since-last-run.h	2007-02-25 19:51:00 UTC (rev 15661)
@@ -42,9 +42,7 @@
 /**
  * Create the since-last-run dialog.
  **/
-GncSxSinceLastRunDialog*  gnc_ui_sx_since_last_run_dialog(GncSxInstanceModel *sx_instances);
+GncSxSinceLastRunDialog*  gnc_ui_sx_since_last_run_dialog(GncSxInstanceModel *sx_instances,
+                                                          GList *auto_created_txn_guids);
 
-// eliminate...
-void gnc_ui_sxsincelast_dialog_create(void);
-
 #endif

Modified: gnucash/trunk/src/gnome/gnc-plugin-basic-commands.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-basic-commands.c	2007-02-25 17:35:57 UTC (rev 15660)
+++ gnucash/trunk/src/gnome/gnc-plugin-basic-commands.c	2007-02-25 19:51:00 UTC (rev 15661)
@@ -448,19 +448,21 @@
   GncMainWindow *window;
   GncSxInstanceModel *sx_instances;
   GncSxSummary summary;
+  GList *auto_created_txns = NULL;
   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;
-  
+
   sx_instances = gnc_sx_get_current_instances();
   gnc_sx_instance_model_summarize(sx_instances, &summary);
-  gnc_sx_instance_model_effect_change(sx_instances, TRUE, NULL, NULL);
+  gnc_sx_instance_model_effect_change(sx_instances, TRUE, &auto_created_txns, NULL);
   if (summary.need_dialog)
   {
-    gnc_ui_sx_since_last_run_dialog(sx_instances);
+    gnc_ui_sx_since_last_run_dialog(sx_instances, auto_created_txns);
+    auto_created_txns = NULL;
   }
   else
   {
@@ -481,6 +483,7 @@
                       summary.num_auto_create_no_notify_instances);
     }
   }
+  g_list_free(auto_created_txns);
   g_object_unref(G_OBJECT(sx_instances));
 }
 



More information about the gnucash-changes mailing list