Keep track of auto-created transactions, and review them as well.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15661 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Joshua Sled 2007-02-25 19:51:00 +00:00
parent 47d18a2618
commit 4afde76e83
4 changed files with 31 additions and 25 deletions

View File

@ -49,10 +49,15 @@ TODO
- [x] display-using src/gnome-utils/test/test-sx.c - [x] display-using src/gnome-utils/test/test-sx.c
- bugs - 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. ! - [ ] 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] sx-from-trans: "unknown get.type [3]" [dh20070120]_
! - [x] crash with two sx lists open and SX mutation ! - [x] crash with two sx lists open and SX mutation

View File

@ -51,6 +51,7 @@ struct _GncSxSinceLastRunDialog
GncSxSlrTreeModelAdapter *editing_model; GncSxSlrTreeModelAdapter *editing_model;
GtkTreeView *instance_view; GtkTreeView *instance_view;
GtkToggleButton *review_created_txns_toggle; GtkToggleButton *review_created_txns_toggle;
GList *created_txns;
}; };
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
@ -794,6 +795,7 @@ gnc_sx_slr_tree_model_adapter_new(GncSxInstanceModel *instances)
void void
gnc_sx_sxsincelast_book_opened(void) gnc_sx_sxsincelast_book_opened(void)
{ {
GList *auto_created_txns = NULL;
GncSxInstanceModel *inst_model; GncSxInstanceModel *inst_model;
GncSxSummary summary; GncSxSummary summary;
@ -803,11 +805,12 @@ gnc_sx_sxsincelast_book_opened(void)
inst_model = gnc_sx_get_current_instances(); inst_model = gnc_sx_get_current_instances();
gnc_sx_instance_model_summarize(inst_model, &summary); gnc_sx_instance_model_summarize(inst_model, &summary);
gnc_sx_summary_print(&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) 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 else
{ {
@ -824,18 +827,10 @@ gnc_sx_sxsincelast_book_opened(void)
summary.num_auto_create_no_notify_instances); summary.num_auto_create_no_notify_instances);
} }
} }
g_list_free(auto_created_txns);
g_object_unref(G_OBJECT(inst_model)); 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 static void
instance_state_changed_cb(GtkCellRendererText *cell, instance_state_changed_cb(GtkCellRendererText *cell,
const gchar *path, const gchar *path,
@ -922,7 +917,7 @@ variable_value_changed_cb(GtkCellRendererText *cell,
} }
GncSxSinceLastRunDialog* 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; GncSxSinceLastRunDialog *dialog;
GladeXML *glade; GladeXML *glade;
@ -937,6 +932,8 @@ gnc_ui_sx_since_last_run_dialog(GncSxInstanceModel *sx_instances)
dialog->review_created_txns_toggle = GTK_TOGGLE_BUTTON(glade_xml_get_widget(glade, "review_txn_toggle")); 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; GtkCellRenderer *renderer;
GtkTreeViewColumn *col; GtkTreeViewColumn *col;
@ -1070,15 +1067,18 @@ dialog_response_cb(GtkDialog *dialog, gint response_id, GncSxSinceLastRunDialog
} }
} }
gnc_suspend_gui_refresh(); 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(); gnc_resume_gui_refresh();
if (gtk_toggle_button_get_active(app_dialog->review_created_txns_toggle) 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); g_list_foreach(app_dialog->created_txns, (GFunc)guid_free, NULL);
created_txns = NULL; g_list_free(app_dialog->created_txns);
app_dialog->created_txns = NULL;
/* FALLTHROUGH */ /* FALLTHROUGH */
case GTK_RESPONSE_CANCEL: case GTK_RESPONSE_CANCEL:
case GTK_RESPONSE_DELETE_EVENT: case GTK_RESPONSE_DELETE_EVENT:

View File

@ -42,9 +42,7 @@ void gnc_sx_sxsincelast_book_opened(void);
/** /**
* Create the since-last-run dialog. * 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 #endif

View File

@ -448,6 +448,7 @@ gnc_main_window_cmd_actions_since_last_run (GtkAction *action, GncMainWindowActi
GncMainWindow *window; GncMainWindow *window;
GncSxInstanceModel *sx_instances; GncSxInstanceModel *sx_instances;
GncSxSummary summary; GncSxSummary summary;
GList *auto_created_txns = NULL;
const char *nothing_to_do_msg = const char *nothing_to_do_msg =
_( "There are no Scheduled Transactions to be entered at this time." ); _( "There are no Scheduled Transactions to be entered at this time." );
@ -457,10 +458,11 @@ gnc_main_window_cmd_actions_since_last_run (GtkAction *action, GncMainWindowActi
sx_instances = gnc_sx_get_current_instances(); sx_instances = gnc_sx_get_current_instances();
gnc_sx_instance_model_summarize(sx_instances, &summary); 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) 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 else
{ {
@ -481,6 +483,7 @@ gnc_main_window_cmd_actions_since_last_run (GtkAction *action, GncMainWindowActi
summary.num_auto_create_no_notify_instances); summary.num_auto_create_no_notify_instances);
} }
} }
g_list_free(auto_created_txns);
g_object_unref(G_OBJECT(sx_instances)); g_object_unref(G_OBJECT(sx_instances));
} }