r14911 - gnucash/branches/sx-cleanup/src - Add "review created transactions" checkbox, support.
Joshua Sled
jsled at cvs.gnucash.org
Sat Sep 30 11:14:25 EDT 2006
Author: jsled
Date: 2006-09-30 11:14:23 -0400 (Sat, 30 Sep 2006)
New Revision: 14911
Trac: http://svn.gnucash.org/trac/changeset/14911
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/glade/sched-xact.glade
Log:
Add "review created transactions" checkbox, support.
Modified: gnucash/branches/sx-cleanup/src/doc/sx.rst
===================================================================
--- gnucash/branches/sx-cleanup/src/doc/sx.rst 2006-09-29 20:10:05 UTC (rev 14910)
+++ gnucash/branches/sx-cleanup/src/doc/sx.rst 2006-09-30 15:14:23 UTC (rev 14911)
@@ -51,12 +51,12 @@
- [x] add variable state to sx instance model
- [x] add sx_upcoming_instance_model()
- [ ] add effect_auto_create()
- - [ ] add some sort of "ready to go" flag and api
+ - [/] add some sort of "ready to go" flag and api
- [x] variable setting, primarily
- [/] some sort of commit_changes()
- ??? does effect_auto_create() imply or need commit_changes()?
- [/] add variable table to instances
- - [ ] ui: add 'review created transactions' checkbox to SLR dialog
+ - [x] ui: add 'review created transactions' checkbox to SLR dialog
using txn search.
- destroy/cleanup
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-09-29 20:10:05 UTC (rev 14910)
+++ gnucash/branches/sx-cleanup/src/gnome/dialog-sx-since-last-run.c 2006-09-30 15:14:23 UTC (rev 14911)
@@ -35,6 +35,11 @@
#include "Transaction.h"
#include "Account.h"
#include "Scrub.h"
+#include "Query.h"
+#include "QueryNew.h"
+#include "gnc-ledger-display.h"
+#include "gnc-plugin-page-register.h"
+#include "gnc-main-window.h"
static QofLogModule log_module = GNC_MOD_GUI;
@@ -46,6 +51,7 @@
GncSxInstanceModel *instances;
GncSxSlrTreeModelAdapter *editing_model;
GtkTreeView *instance_view;
+ GtkToggleButton *review_created_txns_toggle;
};
/* ------------------------------------------------------------ */
@@ -105,6 +111,8 @@
/* ------------------------------------------------------------ */
+static void _show_created_transactions(GncSxSinceLastRunDialog *app_dialog, GList *created_txn_guids);
+
static void dialog_response_cb(GtkDialog *dialog, gint response_id, GncSxSinceLastRunDialog *app_dialog);
/* ------------------------------------------------------------ */
@@ -822,6 +830,8 @@
gtk_paned_set_position(paned, 240);
}
+ dialog->review_created_txns_toggle = GTK_TOGGLE_BUTTON(glade_xml_get_widget(glade, "review_txn_toggle"));
+
{
GtkCellRenderer *renderer;
GtkTreeViewColumn *col;
@@ -879,13 +889,44 @@
}
static void
+_show_created_transactions(GncSxSinceLastRunDialog *app_dialog, GList *created_txn_guids)
+{
+ GNCLedgerDisplay *ledger;
+ GncPluginPage *page;
+ Query *book_query, *guid_query, *query;
+ GList *created_txn_guid_iter;
+
+ book_query = xaccMallocQuery();
+ guid_query = xaccMallocQuery();
+ xaccQuerySetBook(book_query, gnc_get_current_book());
+ for (created_txn_guid_iter = created_txn_guids;
+ created_txn_guid_iter != NULL;
+ created_txn_guid_iter = created_txn_guid_iter->next)
+ {
+ xaccQueryAddGUIDMatch(guid_query, (GUID*)created_txn_guid_iter->data, GNC_ID_TRANS, QUERY_OR);
+ }
+ query = xaccQueryMerge(book_query, guid_query, QUERY_AND);
+
+ // inspired by dialog-find-transactions:do_find_cb:
+ // do_find_cb (QueryNew *query, gpointer user_data, gpointer *result)
+ ledger = gnc_ledger_display_query(query, SEARCH_LEDGER, REG_STYLE_JOURNAL);
+ gnc_ledger_display_refresh(ledger);
+ page = gnc_plugin_page_register_new_ledger(ledger);
+ g_object_set(G_OBJECT(page), "page-name", _("Created Transactions"), NULL);
+ gnc_main_window_open_page(NULL, page);
+
+ xaccFreeQuery(query);
+ xaccFreeQuery(book_query);
+ xaccFreeQuery(guid_query);
+}
+
+static void
dialog_response_cb(GtkDialog *dialog, gint response_id, GncSxSinceLastRunDialog *app_dialog)
{
+ GList *created_txns = NULL;
switch (response_id)
{
case GTK_RESPONSE_OK:
- // @@fixme: create transactions
- printf("should effect change and stuff\n");
// @@fixme validate current state(GError *errs);
// - instance state constraints
// - required variable binding
@@ -903,9 +944,15 @@
return;
}
}
- gnc_sx_slr_model_effect_change(app_dialog->editing_model, FALSE, NULL, NULL);
+ gnc_sx_slr_model_effect_change(app_dialog->editing_model, FALSE, &created_txns, NULL);
+ if (gtk_toggle_button_get_active(app_dialog->review_created_txns_toggle))
+ {
+ _show_created_transactions(app_dialog, created_txns);
+ }
+ g_list_free(created_txns);
/* FALLTHROUGH */
case GTK_RESPONSE_CANCEL:
+ case GTK_RESPONSE_DELETE_EVENT:
gtk_widget_destroy(GTK_WIDGET(dialog));
// @@fixme: destroy models, &c.
break;
@@ -1324,6 +1371,10 @@
for (inst_iter = instances->list; inst_iter != NULL; inst_iter = inst_iter->next)
{
GncSxInstance *inst = (GncSxInstance*)inst_iter->data;
+
+ if (inst->state != SX_INSTANCE_STATE_TO_CREATE)
+ continue;
+
g_hash_table_foreach(inst->variable_bindings, (GHFunc)_list_from_hash_elts, &var_list);
for (var_iter = var_list; var_iter != NULL; var_iter = var_iter->next)
{
Modified: gnucash/branches/sx-cleanup/src/gnome/glade/sched-xact.glade
===================================================================
--- gnucash/branches/sx-cleanup/src/gnome/glade/sched-xact.glade 2006-09-29 20:10:05 UTC (rev 14910)
+++ gnucash/branches/sx-cleanup/src/gnome/glade/sched-xact.glade 2006-09-30 15:14:23 UTC (rev 14911)
@@ -8544,40 +8544,96 @@
</child>
<child>
- <widget class="GtkVPaned" id="paned">
+ <widget class="GtkVBox" id="vbox182">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="position">240</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
<child>
- <widget class="GtkScrolledWindow" id="scrolledwindow21">
+ <widget class="GtkVPaned" id="paned">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
- <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+ <property name="position">240</property>
<child>
- <widget class="GtkTreeView" id="instance_view">
+ <widget class="GtkScrolledWindow" id="scrolledwindow21">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="has_focus">True</property>
- <property name="headers_visible">True</property>
- <property name="rules_hint">False</property>
- <property name="reorderable">False</property>
- <property name="enable_search">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
+ <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <widget class="GtkTreeView" id="instance_view">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_focus">True</property>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">False</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ </widget>
+ </child>
</widget>
+ <packing>
+ <property name="shrink">True</property>
+ <property name="resize">False</property>
+ </packing>
</child>
+
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
- <property name="shrink">True</property>
- <property name="resize">False</property>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
</packing>
</child>
<child>
- <placeholder/>
+ <widget class="GtkHBox" id="hbox179">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkFixed" id="fixed1">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="review_txn_toggle">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Review created transactions</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
</child>
</widget>
<packing>
More information about the gnucash-changes
mailing list