gnucash unstable: Multiple changes pushed
John Ralls
jralls at code.gnucash.org
Sat Mar 10 16:18:12 EST 2018
Updated via https://github.com/Gnucash/gnucash/commit/fc5dd9d2 (commit)
via https://github.com/Gnucash/gnucash/commit/25585de0 (commit)
via https://github.com/Gnucash/gnucash/commit/25fc4d9b (commit)
from https://github.com/Gnucash/gnucash/commit/21c52199 (commit)
commit fc5dd9d2c868042e8c58620259e08a6f8816b60e
Merge: 21c5219 25585de
Author: John Ralls <jralls at ceridwen.us>
Date: Sat Mar 10 13:12:54 2018 -0800
Merge Bob Fewell's two bug fixes, PR302, into unstable.
commit 25585de07792dd43f38af2d1ead350620814e045
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Tue Mar 6 14:42:43 2018 +0000
Bug 794031, enable placeholder toggle and provide callback
The text for this account tree view specifies "If you would like an
account to be a placeholder account, click the checkbox for that
account." but they were not enabled and no call back was defined so
enabled the toggle button and provide callback.
diff --git a/gnucash/gnome/assistant-hierarchy.c b/gnucash/gnome/assistant-hierarchy.c
index 5f9a873..ff5ff05 100644
--- a/gnucash/gnome/assistant-hierarchy.c
+++ b/gnucash/gnome/assistant-hierarchy.c
@@ -887,6 +887,34 @@ placeholder_cell_data_func (GtkTreeViewColumn *tree_column,
gtk_cell_renderer_toggle_set_active(GTK_CELL_RENDERER_TOGGLE(cell), willbe_placeholder);
}
+static void
+placeholder_cell_toggled (GtkCellRendererToggle *cell_renderer,
+ gchar *path, gpointer user_data)
+{
+ gboolean state;
+ Account *account;
+ GtkTreePath *treepath;
+ hierarchy_data *data = (hierarchy_data *)user_data;
+
+ g_return_if_fail(data != NULL);
+
+ treepath = gtk_tree_path_new_from_string (path);
+
+ account = gnc_tree_view_account_get_account_from_path (data->final_account_tree, treepath);
+
+ state = gtk_cell_renderer_toggle_get_active (cell_renderer);
+
+ if (account)
+ xaccAccountSetPlaceholder (account, !state);
+
+ // if placeholder set, set balance to zero
+ if (!state)
+ {
+ set_final_balance (data->balance_hash, account, gnc_numeric_zero());
+ qof_event_gen (QOF_INSTANCE(account), QOF_EVENT_MODIFY, NULL);
+ }
+ gtk_tree_path_free (treepath);
+}
static void
use_existing_account_data_func(GtkTreeViewColumn *tree_column,
@@ -985,9 +1013,14 @@ on_final_account_prepare (hierarchy_data *data)
{
renderer = gtk_cell_renderer_toggle_new();
g_object_set(G_OBJECT (renderer),
- "activatable", FALSE,
- "sensitive", FALSE,
+ "activatable", TRUE,
+ "sensitive", TRUE,
NULL);
+
+ g_signal_connect (G_OBJECT (renderer), "toggled",
+ G_CALLBACK (placeholder_cell_toggled),
+ data);
+
column = gtk_tree_view_column_new_with_attributes(_("Placeholder"),
renderer, NULL);
gtk_tree_view_column_set_cell_data_func (column, renderer,
commit 25fc4d9bbd5b2a9bd2073254847ebdf4284a00d4
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Tue Mar 6 14:40:32 2018 +0000
Bug 793699 - start_spath could be used uninitialised
Make sure the start_spath is declared within the while loop and also
freed.
diff --git a/gnucash/gnome-utils/gnc-tree-view-split-reg.c b/gnucash/gnome-utils/gnc-tree-view-split-reg.c
index 0506270..a309cbe 100644
--- a/gnucash/gnome-utils/gnc-tree-view-split-reg.c
+++ b/gnucash/gnome-utils/gnc-tree-view-split-reg.c
@@ -3812,13 +3812,11 @@ gtv_sr_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (widget);
GncTreeModelSplitReg *model;
GtkTreeViewColumn *col;
- GtkTreePath *spath, *start_spath;
+ GtkTreePath *spath;
GtkTreePath *start_path, *end_path;
gboolean editing = FALSE;
gboolean step_off = FALSE;
gboolean trans_changed = FALSE;
- gint *start_indices;
- gint *next_indices;
Transaction *btrans, *ctrans, *hetrans;
gboolean goto_blank = FALSE;
gboolean next_trans = TRUE;
@@ -4029,8 +4027,9 @@ gtv_sr_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
while (!editing && !step_off) // lets step over non editable columns
{
// Create a copy of the path we started with.
- start_spath = gtk_tree_path_copy (spath);
- start_indices = gtk_tree_path_get_indices (start_spath);
+ GtkTreePath *start_spath = gtk_tree_path_copy (spath);
+ gint *start_indices = gtk_tree_path_get_indices (start_spath);
+ gint *next_indices;
{
gchar *string = gtk_tree_path_to_string (start_spath);
@@ -4077,6 +4076,7 @@ gtv_sr_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
// Test for transaction changed.
if (gtv_sr_transaction_changed (view))
{
+ gtk_tree_path_free (start_spath);
gtk_tree_path_free (spath);
return TRUE;
}
@@ -4090,8 +4090,8 @@ gtv_sr_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
}
// Is this an editable cell ?
editing = gtv_sr_get_editing (col);
+ gtk_tree_path_free (start_spath);
}
- gtk_tree_path_free (start_spath);
gtk_tree_path_free (spath);
return TRUE;
break;
Summary of changes:
gnucash/gnome-utils/gnc-tree-view-split-reg.c | 12 ++++-----
gnucash/gnome/assistant-hierarchy.c | 37 +++++++++++++++++++++++++--
2 files changed, 41 insertions(+), 8 deletions(-)
More information about the gnucash-changes
mailing list