From 4759453356cfa0590b2f117aeb266bca8675bbbe Mon Sep 17 00:00:00 2001 From: goodvibes2 Date: Sat, 2 May 2020 16:10:19 +1000 Subject: [PATCH 1/3] Revert "Use Doxygen format for function comment" This reverts commit d2986559de203471ecd2280eb1a61afb0b5c6934. --- gnucash/gnome/reconcile-view.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/gnucash/gnome/reconcile-view.c b/gnucash/gnome/reconcile-view.c index d600bca9c7..6f406befb0 100644 --- a/gnucash/gnome/reconcile-view.c +++ b/gnucash/gnome/reconcile-view.c @@ -524,17 +524,18 @@ gnc_reconcile_view_toggle_split (GNCReconcileView *view, Split *split) } -/** Insert or remove a split from the list of splits to be reconciled - * (view->reconciled) so that all other splits in the same transaction - * for the account being reconciled (including children), are the same - * reconciliation state as the split that has been toggled. - * - * @param view The view to use. - * - * @param split The split to be inserted or removed - * - * @param reconcile TRUE=insert, FALSE=remove - */ +/*****************************************************************************\ + * gnc_reconcile_view_rec_or_unrec_split * + * insert or remove a child split from the list of splits to be reconciled * + * (view->reconciled) so that all other splits in the same transaction * + * for the account being reconciled (including children), are the same * + * reconciliation state as the split that has been toggled * + * * + * Args: view - the view to use * + * split - the split to be inserted or removed * + * reconcile - TRUE=insert, FALSE=remove * + * Returns: void * +\*****************************************************************************/ static void gnc_reconcile_view_rec_or_unrec_split (GNCReconcileView *view, Split *split, gboolean reconcile) { From 327544e6c048057f2675b223fd2679e688e0a063 Mon Sep 17 00:00:00 2001 From: goodvibes2 Date: Sat, 2 May 2020 16:11:50 +1000 Subject: [PATCH 2/3] Revert "Bug 797648 - Fix problem reconciling multiple splits in a transaction" This reverts commit dd589060a3580456d5dfd079e7f0f75cc7252a9b. --- gnucash/gnome/reconcile-view.c | 56 ++++++---------------------------- 1 file changed, 9 insertions(+), 47 deletions(-) diff --git a/gnucash/gnome/reconcile-view.c b/gnucash/gnome/reconcile-view.c index 6f406befb0..7815e32ab6 100644 --- a/gnucash/gnome/reconcile-view.c +++ b/gnucash/gnome/reconcile-view.c @@ -501,43 +501,8 @@ gnc_reconcile_view_class_init (GNCReconcileViewClass *klass) } -static gboolean -gnc_reconcile_view_toggle_split (GNCReconcileView *view, Split *split) -{ - Split *current; - - g_return_val_if_fail (GNC_IS_RECONCILE_VIEW (view), FALSE); - g_return_val_if_fail (view->reconciled != NULL, FALSE); - - current = g_hash_table_lookup (view->reconciled, split); - - if (current == NULL) - { - g_hash_table_insert (view->reconciled, split, split); - return TRUE; - } - else - { - g_hash_table_remove (view->reconciled, split); - return FALSE; - } -} - - -/*****************************************************************************\ - * gnc_reconcile_view_rec_or_unrec_split * - * insert or remove a child split from the list of splits to be reconciled * - * (view->reconciled) so that all other splits in the same transaction * - * for the account being reconciled (including children), are the same * - * reconciliation state as the split that has been toggled * - * * - * Args: view - the view to use * - * split - the split to be inserted or removed * - * reconcile - TRUE=insert, FALSE=remove * - * Returns: void * -\*****************************************************************************/ static void -gnc_reconcile_view_rec_or_unrec_split (GNCReconcileView *view, Split *split, gboolean reconcile) +gnc_reconcile_view_toggle_split (GNCReconcileView *view, Split *split) { Split *current; @@ -546,15 +511,15 @@ gnc_reconcile_view_rec_or_unrec_split (GNCReconcileView *view, Split *split, gbo current = g_hash_table_lookup (view->reconciled, split); - if (current == NULL && reconcile) + if (current == NULL) g_hash_table_insert (view->reconciled, split, split); - if ((current != NULL) && (!reconcile)) + else g_hash_table_remove (view->reconciled, split); } static void -gnc_reconcile_view_toggle_children (Account *account, GNCReconcileView *view, Split *split, gboolean reconcile) +gnc_reconcile_view_toggle_children (Account *account, GNCReconcileView *view, Split *split) { GList *child_accounts, *node; Transaction *transaction; @@ -564,8 +529,7 @@ gnc_reconcile_view_toggle_children (Account *account, GNCReconcileView *view, Sp * in the same hierarchy as the account being reconciled (not necessarily * the account this split is from.) * - * For each of these splits set them to the same state as the split whose - * checkbox was toggled. + * For each of these splits toggle them all to the same state. */ child_accounts = gnc_account_get_descendants (account); child_accounts = g_list_prepend (child_accounts, account); @@ -614,8 +578,7 @@ gnc_reconcile_view_toggle_children (Account *account, GNCReconcileView *view, Sp { gboolean toggled; gtk_tree_model_get (model, &iter, REC_RECN, &toggled, -1); - if (toggled != reconcile) - gtk_list_store_set (GTK_LIST_STORE (model), &iter, REC_RECN, reconcile, -1); + gtk_list_store_set (GTK_LIST_STORE (model), &iter, REC_RECN, !toggled, -1); break; } @@ -623,7 +586,7 @@ gnc_reconcile_view_toggle_children (Account *account, GNCReconcileView *view, Sp } /* ...and toggle its reconciled state in the internal hash */ - gnc_reconcile_view_rec_or_unrec_split (current_view, other_split, reconcile); + gnc_reconcile_view_toggle_split (current_view, other_split); } g_list_free (child_accounts); } @@ -633,16 +596,15 @@ static void gnc_reconcile_view_toggle (GNCReconcileView *view, Split *split) { gboolean include_children; - gboolean is_reconciled; g_return_if_fail (GNC_IS_RECONCILE_VIEW (view)); g_return_if_fail (view->reconciled != NULL); - is_reconciled = gnc_reconcile_view_toggle_split (view, split); + gnc_reconcile_view_toggle_split (view, split); include_children = xaccAccountGetReconcileChildrenStatus (view->account); if (include_children) - gnc_reconcile_view_toggle_children (view->account, view, split, is_reconciled); + gnc_reconcile_view_toggle_children (view->account, view, split); g_signal_emit (G_OBJECT (view), reconcile_view_signals[TOGGLE_RECONCILED], 0, split); From f1c2e339fc9bf7df3487057fbe6fc06d872ac1a9 Mon Sep 17 00:00:00 2001 From: goodvibes2 Date: Sat, 2 May 2020 16:43:49 +1000 Subject: [PATCH 3/3] Bug 797648 Redo - Reconciliation - Treat each split independently The previous change under this bug which propagated the status change (reconcile or unreconcile) of any split for the account to be reconciled (and its subaccounts) in a transaction, to all splits for the account to be reconciled (and its subaccounts) in the transaction, is incorrect. Each split needs to be able to be checked or unchecked independently of any other split in the transaction. --- gnucash/gnome/reconcile-view.c | 80 ---------------------------------- 1 file changed, 80 deletions(-) diff --git a/gnucash/gnome/reconcile-view.c b/gnucash/gnome/reconcile-view.c index 7815e32ab6..165e784568 100644 --- a/gnucash/gnome/reconcile-view.c +++ b/gnucash/gnome/reconcile-view.c @@ -518,94 +518,14 @@ gnc_reconcile_view_toggle_split (GNCReconcileView *view, Split *split) } -static void -gnc_reconcile_view_toggle_children (Account *account, GNCReconcileView *view, Split *split) -{ - GList *child_accounts, *node; - Transaction *transaction; - - /* - * Need to get all splits in this transaction and identify any that are - * in the same hierarchy as the account being reconciled (not necessarily - * the account this split is from.) - * - * For each of these splits toggle them all to the same state. - */ - child_accounts = gnc_account_get_descendants (account); - child_accounts = g_list_prepend (child_accounts, account); - transaction = xaccSplitGetParent (split); - for (node = xaccTransGetSplitList (transaction); node; node = node->next) - { - Split *other_split; - Account *other_account; - GNCReconcileView *current_view; - - GtkTreeModel *model; - GtkTreeIter iter; - gboolean valid; - gpointer pointer; - - other_split = node->data; - other_account = xaccSplitGetAccount (other_split); - if (other_split == split) - continue; - /* Check this 'other' account is in the same hierarchy */ - if (!g_list_find (child_accounts, other_account)) - continue; - /* Search our sibling view for this split first. We search the - * sibling list first because that it where it is most likely to be. - */ - current_view = view->sibling; - if (!gnc_query_view_item_in_view (GNC_QUERY_VIEW (current_view), other_split)) - { - /* Not in the sibling view, try this view */ - current_view = view; - if (!gnc_query_view_item_in_view (GNC_QUERY_VIEW (current_view), other_split)) - /* We can't find it, nothing more I can do about it */ - continue; - } - - /* Found the other split. Toggle the reconciled check mark in the view... */ - model = gtk_tree_view_get_model (GTK_TREE_VIEW (current_view)); - valid = gtk_tree_model_get_iter_first (model, &iter); - - while (valid) - { - // Walk through the list, reading each row - gtk_tree_model_get (model, &iter, REC_POINTER, &pointer, -1); - - if(pointer == other_split) - { - gboolean toggled; - gtk_tree_model_get (model, &iter, REC_RECN, &toggled, -1); - gtk_list_store_set (GTK_LIST_STORE (model), &iter, REC_RECN, !toggled, -1); - break; - } - - valid = gtk_tree_model_iter_next (model, &iter); - } - - /* ...and toggle its reconciled state in the internal hash */ - gnc_reconcile_view_toggle_split (current_view, other_split); - } - g_list_free (child_accounts); -} - - static void gnc_reconcile_view_toggle (GNCReconcileView *view, Split *split) { - gboolean include_children; - g_return_if_fail (GNC_IS_RECONCILE_VIEW (view)); g_return_if_fail (view->reconciled != NULL); gnc_reconcile_view_toggle_split (view, split); - include_children = xaccAccountGetReconcileChildrenStatus (view->account); - if (include_children) - gnc_reconcile_view_toggle_children (view->account, view, split); - g_signal_emit (G_OBJECT (view), reconcile_view_signals[TOGGLE_RECONCILED], 0, split); }