gnucash maint: Multiple changes pushed
John Ralls
jralls at code.gnucash.org
Tue Dec 25 14:15:13 EST 2018
Updated via https://github.com/Gnucash/gnucash/commit/53680e61 (commit)
via https://github.com/Gnucash/gnucash/commit/db663a29 (commit)
via https://github.com/Gnucash/gnucash/commit/3363736f (commit)
via https://github.com/Gnucash/gnucash/commit/9e3f50f9 (commit)
via https://github.com/Gnucash/gnucash/commit/ca57ff50 (commit)
via https://github.com/Gnucash/gnucash/commit/0ac2aa80 (commit)
via https://github.com/Gnucash/gnucash/commit/c47e6aef (commit)
via https://github.com/Gnucash/gnucash/commit/82d0fa18 (commit)
via https://github.com/Gnucash/gnucash/commit/bd0e5324 (commit)
via https://github.com/Gnucash/gnucash/commit/952761af (commit)
via https://github.com/Gnucash/gnucash/commit/a8d0270e (commit)
via https://github.com/Gnucash/gnucash/commit/5c524c31 (commit)
via https://github.com/Gnucash/gnucash/commit/43beeca0 (commit)
via https://github.com/Gnucash/gnucash/commit/7a1f981b (commit)
via https://github.com/Gnucash/gnucash/commit/fad17da7 (commit)
from https://github.com/Gnucash/gnucash/commit/0621abf3 (commit)
commit 53680e6100b4efff54e6512c17f498908f0b7373
Merge: 0621abf db663a2
Author: John Ralls <jralls at ceridwen.us>
Date: Tue Dec 25 11:11:27 2018 -0800
Merge Bob Fewell's 'fixes03' into maint.
commit db663a298eeacc9ddedcf363a5229d73ca8b9784
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Thu Dec 20 14:36:11 2018 +0000
If you use the autocomplete and cancel other registers are not refreshed
When the autocomplete is used the blank transaction gets the copy of
the originating transaction and if you decide to cancel this any other
open register that had a split in the new transaction is left with
blank rows where the transaction was. Add a test for the pending and
blank transaction being equal and refresh all registers if so.
diff --git a/gnucash/register/ledger-core/split-register.c b/gnucash/register/ledger-core/split-register.c
index c874365..575c621 100644
--- a/gnucash/register/ledger-core/split-register.c
+++ b/gnucash/register/ledger-core/split-register.c
@@ -1365,11 +1365,17 @@ void
gnc_split_register_cancel_cursor_trans_changes (SplitRegister *reg)
{
SRInfo *info = gnc_split_register_get_info (reg);
- Transaction *pending_trans;
+ Transaction *pending_trans, *blank_trans;
+ gboolean refresh_all = FALSE;
pending_trans = xaccTransLookup (&info->pending_trans_guid,
gnc_get_current_book ());
+ blank_trans = xaccSplitGetParent (gnc_split_register_get_blank_split (reg));
+
+ if (pending_trans == blank_trans)
+ refresh_all = TRUE;
+
/* Get the currently open transaction, rollback the edits on it, and
* then repaint everything. To repaint everything, make a note of
* all of the accounts that will be affected by this rollback. */
@@ -1389,7 +1395,11 @@ gnc_split_register_cancel_cursor_trans_changes (SplitRegister *reg)
info->pending_trans_guid = *guid_null ();
gnc_resume_gui_refresh ();
- gnc_split_register_redraw(reg);
+
+ if (refresh_all)
+ gnc_gui_refresh_all (); // force a refresh of all registers
+ else
+ gnc_split_register_redraw (reg);
}
void
commit 3363736f9c70b1620042819e4363da2e37651e21
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Thu Dec 20 10:58:28 2018 +0000
Bug 796978 - Deleting a split of same account as register cancels the transaction without warning
When autocomplete is used, one of the splits takes on the reference to
the blank_split and if you delete this split the whole transaction is
removed. This change compares the split that is about to be deleted to
the blank_split and if the same moves the reference to another split.
diff --git a/gnucash/gnome/gnc-split-reg.c b/gnucash/gnome/gnc-split-reg.c
index 85996e1..97ecec1 100644
--- a/gnucash/gnome/gnc-split-reg.c
+++ b/gnucash/gnome/gnc-split-reg.c
@@ -1305,6 +1305,10 @@ gsr_default_delete_handler( GNCSplitReg *gsr, gpointer data )
trans = xaccSplitGetParent(split);
cursor_class = gnc_split_register_get_current_cursor_class (reg);
+ /* test for blank_split reference pointing to split */
+ if (gnc_split_register_is_blank_split (reg, split))
+ gnc_split_register_change_blank_split_ref (reg, split);
+
/* Deleting the blank split just cancels */
{
Split *blank_split = gnc_split_register_get_blank_split (reg);
diff --git a/gnucash/register/ledger-core/split-register.c b/gnucash/register/ledger-core/split-register.c
index c3bfd49..c874365 100644
--- a/gnucash/register/ledger-core/split-register.c
+++ b/gnucash/register/ledger-core/split-register.c
@@ -1024,6 +1024,49 @@ gnc_split_register_paste_current (SplitRegister *reg)
LEAVE(" ");
}
+gboolean
+gnc_split_register_is_blank_split (SplitRegister *reg, Split *split)
+{
+ SRInfo *info = gnc_split_register_get_info (reg);
+ Split *current_blank_split = xaccSplitLookup (&info->blank_split_guid, gnc_get_current_book ());
+
+ if (split == current_blank_split)
+ return TRUE;
+
+ return FALSE;
+}
+
+void
+gnc_split_register_change_blank_split_ref (SplitRegister *reg, Split *split)
+{
+ SRInfo *info = gnc_split_register_get_info (reg);
+ Split *current_blank_split = xaccSplitLookup (&info->blank_split_guid, gnc_get_current_book ());
+ Split *pref_split = NULL; // has the same account as incoming split
+ Split *other_split = NULL; // other split
+ Split *s;
+ Account *blank_split_account = xaccSplitGetAccount (current_blank_split);
+ Transaction *trans = xaccSplitGetParent (split);
+ int i = 0;
+
+ // loop through splitlist looking for splits other than the blank_split
+ while ((s = xaccTransGetSplit (trans, i)) != NULL)
+ {
+ if (s != current_blank_split)
+ {
+ if (blank_split_account == xaccSplitGetAccount (s))
+ pref_split = s; // prefer same account
+ else
+ other_split = s; // any other split
+ }
+ i++;
+ }
+ // now change the saved blank split reference
+ if (pref_split != NULL)
+ info->blank_split_guid = *xaccSplitGetGUID (pref_split);
+ else if (other_split != NULL)
+ info->blank_split_guid = *xaccSplitGetGUID (other_split);
+}
+
void
gnc_split_register_delete_current_split (SplitRegister *reg)
{
diff --git a/gnucash/register/ledger-core/split-register.h b/gnucash/register/ledger-core/split-register.h
index 5aa3a37..68a2918 100644
--- a/gnucash/register/ledger-core/split-register.h
+++ b/gnucash/register/ledger-core/split-register.h
@@ -539,6 +539,14 @@ const char * gnc_split_register_get_debit_string (SplitRegister *reg);
/** Return the credit string used in the register. */
const char * gnc_split_register_get_credit_string (SplitRegister *reg);
+/** Return TRUE if split is the blank_split. */
+gboolean gnc_split_register_is_blank_split (SplitRegister *reg, Split *split);
+
+/** Change the blank_split reference from pointing to split to another
+ * split of the transaction. This is used when deleting a split after an
+ * autocomplete as the blank_split reference will be pointing to one of
+ * the splits so it does not cancel the whole transaction */
+void gnc_split_register_change_blank_split_ref (SplitRegister *reg, Split *split);
/** Pop up the exchange-rate dialog, maybe, for the current split.
* If force_dialog is TRUE, the forces the dialog to to be called.
commit 9e3f50f9e739cc901d3169c46d9a35d2006ae25e
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Wed Dec 19 17:25:20 2018 +0000
The preference, use formal accounting labels does not update the header
With a register open and you change preference 'use formal accounting
labels' it does not update the register header so add a call back for
the preference.
diff --git a/gnucash/gnome/gnc-split-reg.c b/gnucash/gnome/gnc-split-reg.c
index 56b1257..85996e1 100644
--- a/gnucash/gnome/gnc-split-reg.c
+++ b/gnucash/gnome/gnc-split-reg.c
@@ -359,6 +359,13 @@ gnc_split_reg_init( GNCSplitReg *gsr )
}
static void
+gnc_split_reg_pref_acc_labels (gpointer prefs, gchar *pref, gpointer user_data)
+{
+ GNCSplitReg *gsr = user_data;
+ gnucash_register_refresh_from_prefs (gsr->reg);
+}
+
+static void
gnc_split_reg_init2( GNCSplitReg *gsr )
{
if ( !gsr ) return;
@@ -369,6 +376,11 @@ gnc_split_reg_init2( GNCSplitReg *gsr )
/* ordering is important here... setup_status before create_table */
gsr_create_table( gsr );
gsr_setup_table( gsr );
+
+ gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
+ GNC_PREF_ACCOUNTING_LABELS,
+ gnc_split_reg_pref_acc_labels,
+ gsr);
}
static
@@ -451,6 +463,11 @@ gnc_split_reg_dispose(GObject *obj)
g_free (gsr->filter_text);
gsr->filter_text = NULL;
+ gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL,
+ GNC_PREF_ACCOUNTING_LABELS,
+ gnc_split_reg_pref_acc_labels,
+ gsr);
+
if (gsr->reg)
{
g_signal_handlers_disconnect_by_data (gsr->reg, gsr);
commit ca57ff50438967c89289631cd84c40a14ad74785
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Thu Dec 13 13:28:25 2018 +0000
Make the grid lines of totals Budget tree view track the preferences
Make the grid lines of the totals tree view track the preferences to
match the account tree view above it.
diff --git a/gnucash/gnome/gnc-budget-view.c b/gnucash/gnome/gnc-budget-view.c
index 5aed86e..0b36e96 100644
--- a/gnucash/gnome/gnc-budget-view.c
+++ b/gnucash/gnome/gnc-budget-view.c
@@ -54,6 +54,7 @@
#include "gnc-gobject-utils.h"
#include "gnc-gtk-utils.h"
#include "gnc-icons.h"
+#include "gnc-prefs.h"
#include "gnc-session.h"
#include "gnc-tree-view-account.h"
@@ -215,7 +216,6 @@ gnc_budget_view_class_init(GncBudgetViewClass *klass)
g_type_class_add_private(klass, sizeof(GncBudgetViewPrivate));
}
-
static void
gnc_budget_view_init(GncBudgetView *budget_view)
{
@@ -262,16 +262,30 @@ gnc_budget_view_init(GncBudgetView *budget_view)
LEAVE("");
}
+static void
+gbv_treeview_update_grid_lines (gpointer prefs, gchar* pref, gpointer user_data)
+{
+ GtkTreeView *view = user_data;
+ gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(view), gnc_tree_view_get_grid_lines_pref ());
+}
static void
gnc_budget_view_finalize(GObject *object)
{
GncBudgetView *view;
+ GncBudgetViewPrivate *priv;
ENTER("object %p", object);
view = GNC_BUDGET_VIEW(object);
g_return_if_fail(GNC_IS_BUDGET_VIEW(view));
+ priv = GNC_BUDGET_VIEW_GET_PRIVATE(view);
+
+ gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL, GNC_PREF_GRID_LINES_HORIZONTAL,
+ gbv_treeview_update_grid_lines, priv->totals_tree_view);
+ gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL, GNC_PREF_GRID_LINES_VERTICAL,
+ gbv_treeview_update_grid_lines, priv->totals_tree_view);
+
G_OBJECT_CLASS(gnc_budget_view_parent_class)->finalize(object);
LEAVE(" ");
}
@@ -457,6 +471,10 @@ gbv_create_widget(GncBudgetView *view)
// Set grid lines option to preference
gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(totals_tree_view), gnc_tree_view_get_grid_lines_pref ());
+ gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_GRID_LINES_HORIZONTAL,
+ gbv_treeview_update_grid_lines, totals_tree_view);
+ gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_GRID_LINES_VERTICAL,
+ gbv_treeview_update_grid_lines, totals_tree_view);
PINFO("Number of Created totals columns is %d", gtk_tree_view_get_n_columns (totals_tree_view));
commit 0ac2aa802138518d43c83f17e91c7f5477d5fae8
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Thu Dec 13 13:23:51 2018 +0000
Enable the GncTreeView to track the grid line preferences
With these changes when the preferences for showing horizontal or
vertical grid lines are changed it will update the GncTreeView
immediately.
diff --git a/gnucash/gnome-utils/gnc-tree-view.c b/gnucash/gnome-utils/gnc-tree-view.c
index cd93a18..de8a0f6 100644
--- a/gnucash/gnome-utils/gnc-tree-view.c
+++ b/gnucash/gnome-utils/gnc-tree-view.c
@@ -44,6 +44,7 @@
#include "gnc-gobject-utils.h"
#include "gnc-cell-renderer-date.h"
#include "gnc-state.h"
+#include "gnc-prefs.h"
#include "dialog-utils.h"
/* The actual state key for a particular column visibility. This is
@@ -223,6 +224,13 @@ gnc_tree_view_class_init (GncTreeViewClass *klass)
gtkwidget_class->destroy = gnc_tree_view_destroy;
}
+static void
+gnc_tree_view_update_grid_lines (gpointer prefs, gchar* pref, gpointer user_data)
+{
+ GncTreeView *view = user_data;
+ gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(view), gnc_tree_view_get_grid_lines_pref ());
+}
+
/** Initialize a new instance of a base gnucash tree view. This
* function allocates and initializes the object private storage
* space. It also adds the new object to a list (for memory tracking
@@ -274,6 +282,10 @@ gnc_tree_view_init (GncTreeView *view, GncTreeViewClass *klass)
// Set grid lines option to preference
gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(view), gnc_tree_view_get_grid_lines_pref ());
+ gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_GRID_LINES_HORIZONTAL,
+ gnc_tree_view_update_grid_lines, view);
+ gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_GRID_LINES_VERTICAL,
+ gnc_tree_view_update_grid_lines, view);
/* Create the last column which contains the column selection
* widget. gnc_tree_view_add_text_column will do most of the
@@ -348,6 +360,11 @@ gnc_tree_view_destroy (GtkWidget *widget)
view = GNC_TREE_VIEW (widget);
+ gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL, GNC_PREF_GRID_LINES_HORIZONTAL,
+ gnc_tree_view_update_grid_lines, view);
+ gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL, GNC_PREF_GRID_LINES_VERTICAL,
+ gnc_tree_view_update_grid_lines, view);
+
priv = GNC_TREE_VIEW_GET_PRIVATE(view);
if (priv->state_section)
commit c47e6aefe30991e5fd7447e4cf2cf47208974a97
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Thu Dec 13 13:23:04 2018 +0000
Add a couple of defines for the tree view grid lines
diff --git a/gnucash/gnome-utils/dialog-utils.c b/gnucash/gnome-utils/dialog-utils.c
index d4de396..caf2b26 100644
--- a/gnucash/gnome-utils/dialog-utils.c
+++ b/gnucash/gnome-utils/dialog-utils.c
@@ -337,8 +337,8 @@ GtkTreeViewGridLines
gnc_tree_view_get_grid_lines_pref (void)
{
GtkTreeViewGridLines grid_lines;
- gboolean h_lines = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, "grid-lines-horizontal");
- gboolean v_lines = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, "grid-lines-vertical");
+ gboolean h_lines = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_GRID_LINES_HORIZONTAL);
+ gboolean v_lines = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_GRID_LINES_VERTICAL);
if (h_lines)
{
diff --git a/gnucash/gnome-utils/dialog-utils.h b/gnucash/gnome-utils/dialog-utils.h
index 1a93f79..908b7e6 100644
--- a/gnucash/gnome-utils/dialog-utils.h
+++ b/gnucash/gnome-utils/dialog-utils.h
@@ -29,6 +29,9 @@
#include <gtk/gtk.h>
#include "qof.h"
+#define GNC_PREF_GRID_LINES_HORIZONTAL "grid-lines-horizontal"
+#define GNC_PREF_GRID_LINES_VERTICAL "grid-lines-vertical"
+
void gnc_set_label_color (GtkWidget *label, gnc_numeric value);
/********************************************************************\
commit 82d0fa187bc25e66b2f4b7d2e8c741cc40c4d021
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Thu Dec 13 13:20:00 2018 +0000
Add some space to the budget options
Add some space to the budget options on the left so they are not right
next to the border. Also add a note to specify where the visibility of
accounts is found.
diff --git a/gnucash/gtkbuilder/gnc-plugin-page-budget.glade b/gnucash/gtkbuilder/gnc-plugin-page-budget.glade
index 1a313c3..da3c11e 100644
--- a/gnucash/gtkbuilder/gnc-plugin-page-budget.glade
+++ b/gnucash/gtkbuilder/gnc-plugin-page-budget.glade
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.20.4 -->
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkAdjustment" id="DigitsToRound_Adj">
@@ -245,6 +245,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
+ <property name="margin_left">5</property>
<property name="label" translatable="yes">Budget Name:</property>
</object>
<packing>
@@ -271,6 +272,7 @@
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="valign">start</property>
+ <property name="margin_left">5</property>
<property name="label" translatable="yes">Notes:</property>
</object>
<packing>
@@ -318,6 +320,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
+ <property name="margin_left">5</property>
<property name="label" translatable="yes">Number of Periods:</property>
</object>
<packing>
@@ -346,6 +349,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
+ <property name="margin_left">5</property>
<property name="label" translatable="yes">Budget Period:</property>
</object>
<packing>
@@ -384,6 +388,18 @@
<property name="position">0</property>
</packing>
</child>
+ <child>
+ <object class="GtkLabel" id="budget_note">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Note: Use View->'Filter By...' to control visible accounts.</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</object>
</child>
<action-widgets>
commit bd0e532415f87a6f93a96df221e57ef6547aee1f
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Thu Dec 13 13:14:12 2018 +0000
Remove some white space and tabs in dialog-search.c
diff --git a/gnucash/gnome-search/dialog-search.c b/gnucash/gnome-search/dialog-search.c
index aa4c703..a77099d 100644
--- a/gnucash/gnome-search/dialog-search.c
+++ b/gnucash/gnome-search/dialog-search.c
@@ -40,7 +40,7 @@
#include "engine-helpers.h"
#include "qofbookslots.h"
-#include "Transaction.h" /* for the SPLIT_* and TRANS_* */
+#include "Transaction.h" /* for the SPLIT_* and TRANS_* */
#include "dialog-search.h"
#include "search-core-type.h"
@@ -166,7 +166,6 @@ gnc_search_callback_button_execute (GNCSearchCallbackButton *cb,
}
}
-
static void
gnc_search_dialog_result_clicked (GtkButton *button, GNCSearchWindow *sw)
{
@@ -176,7 +175,6 @@ gnc_search_dialog_result_clicked (GtkButton *button, GNCSearchWindow *sw)
gnc_search_callback_button_execute (cb, sw);
}
-
static void
gnc_search_dialog_select_buttons_enable (GNCSearchWindow *sw, gint selected)
{
@@ -219,7 +217,6 @@ gnc_search_dialog_select_buttons_enable (GNCSearchWindow *sw, gint selected)
}
}
-
static void
gnc_search_dialog_select_cb (GtkButton *button, GNCSearchWindow *sw)
{
@@ -238,7 +235,6 @@ gnc_search_dialog_select_cb (GtkButton *button, GNCSearchWindow *sw)
gnc_search_dialog_destroy (sw);
}
-
static void
gnc_search_dialog_select_row_cb (GNCQueryView *qview,
gpointer item,
@@ -249,7 +245,6 @@ gnc_search_dialog_select_row_cb (GNCQueryView *qview,
gnc_search_dialog_select_buttons_enable(sw, number_of_rows);
}
-
static void
gnc_search_dialog_double_click_cb (GNCQueryView *qview,
gpointer item,
@@ -267,7 +262,6 @@ gnc_search_dialog_double_click_cb (GNCQueryView *qview,
/* If we get here, then nothing to do for a double-click */
}
-
static void
gnc_search_dialog_init_result_view (GNCSearchWindow *sw)
{
@@ -290,7 +284,6 @@ gnc_search_dialog_init_result_view (GNCSearchWindow *sw)
G_CALLBACK(gnc_search_dialog_double_click_cb), sw);
}
-
static void
gnc_search_dialog_display_results (GNCSearchWindow *sw)
{
@@ -376,14 +369,12 @@ gnc_search_dialog_display_results (GNCSearchWindow *sw)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (sw->new_rb), TRUE);
}
-
static void
match_combo_changed (GtkComboBoxText *combo_box, GNCSearchWindow *sw)
{
sw->grouping = gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box));
}
-
static void
search_type_cb (GtkToggleButton *button, GNCSearchWindow *sw)
{
@@ -396,7 +387,6 @@ search_type_cb (GtkToggleButton *button, GNCSearchWindow *sw)
}
}
-
static void
search_active_only_cb (GtkToggleButton *button, GNCSearchWindow *sw)
{
@@ -410,24 +400,24 @@ create_query_fragment (QofIdTypeConst search_for, GNCSearchParam *param, QofQuer
{
GNCSearchParamKind kind = gnc_search_param_get_kind (param);
QofQuery *q = qof_query_create_for (search_for);
-
+
if (kind == SEARCH_PARAM_ELEM)
{
/* The "op" parameter below will be ignored since q has no terms. */
qof_query_add_term (q, gnc_search_param_get_param_path (GNC_SEARCH_PARAM_SIMPLE (param)),
pdata, QOF_QUERY_OR);
- }
+ }
else
{
GList *plist = gnc_search_param_get_search (GNC_SEARCH_PARAM_COMPOUND (param));
-
+
for ( ; plist; plist = plist->next)
{
QofQuery *new_q;
GNCSearchParam *param2 = plist->data;
- QofQuery *q2 = create_query_fragment (search_for, param2,
+ QofQuery *q2 = create_query_fragment (search_for, param2,
qof_query_core_predicate_copy (pdata));
- new_q = qof_query_merge (q, q2, kind == SEARCH_PARAM_ANY ?
+ new_q = qof_query_merge (q, q2, kind == SEARCH_PARAM_ANY ?
QOF_QUERY_OR : QOF_QUERY_AND);
qof_query_destroy (q);
qof_query_destroy (q2);
@@ -490,19 +480,19 @@ search_update_query (GNCSearchWindow *sw)
switch (sw->search_type)
{
- case 0: /* New */
+ case 0: /* New */
new_q = qof_query_merge (sw->start_q, q, QOF_QUERY_AND);
qof_query_destroy (q);
break;
- case 1: /* Refine */
+ case 1: /* Refine */
new_q = qof_query_merge (sw->q, q, QOF_QUERY_AND);
qof_query_destroy (q);
break;
- case 2: /* Add */
+ case 2: /* Add */
new_q = qof_query_merge (sw->q, q, QOF_QUERY_OR);
qof_query_destroy (q);
break;
- case 3: /* Delete */
+ case 3: /* Delete */
q2 = qof_query_invert (q);
new_q = qof_query_merge (sw->q, q2, QOF_QUERY_AND);
qof_query_destroy (q2);
@@ -528,7 +518,6 @@ search_update_query (GNCSearchWindow *sw)
sw->q = new_q;
}
-
static void
gnc_search_dialog_show_close_cancel (GNCSearchWindow *sw)
{
@@ -544,7 +533,6 @@ gnc_search_dialog_show_close_cancel (GNCSearchWindow *sw)
}
}
-
static void
gnc_search_dialog_reset_widgets (GNCSearchWindow *sw)
{
@@ -589,7 +577,6 @@ gnc_search_dialog_crit_ok (GNCSearchWindow *sw)
return ret;
}
-
static void
search_find_cb (GtkButton *button, GNCSearchWindow *sw)
{
@@ -614,7 +601,6 @@ search_find_cb (GtkButton *button, GNCSearchWindow *sw)
gnc_search_dialog_display_results (sw);
}
-
static void
search_new_item_cb (GtkButton *button, GNCSearchWindow *sw)
{
@@ -648,7 +634,6 @@ search_new_item_cb (GtkButton *button, GNCSearchWindow *sw)
}
}
-
static void
search_cancel_cb (GtkButton *button, GNCSearchWindow *sw)
{
@@ -656,14 +641,12 @@ search_cancel_cb (GtkButton *button, GNCSearchWindow *sw)
gnc_search_dialog_destroy (sw);
}
-
static void
search_help_cb (GtkButton *button, GNCSearchWindow *sw)
{
gnc_gnome_help (HF_HELP, HL_FIND_TRANSACTIONS);
}
-
static void
remove_element (GtkWidget *button, GNCSearchWindow *sw)
{
@@ -692,7 +675,6 @@ remove_element (GtkWidget *button, GNCSearchWindow *sw)
}
}
-
static void
attach_element (GtkWidget *element, GNCSearchWindow *sw, int row)
{
@@ -718,10 +700,9 @@ attach_element (GtkWidget *element, GNCSearchWindow *sw, int row)
g_object_set (remove, "margin", 0, NULL);
gtk_widget_show (remove);
- data->button = remove; /* Save the button for later */
+ data->button = remove; /* Save the button for later */
}
-
static void
combo_box_changed (GtkComboBox *combo_box, struct _crit_data *data)
{
@@ -774,7 +755,6 @@ combo_box_changed (GtkComboBox *combo_box, struct _crit_data *data)
gnc_search_core_type_editable_enters (newelem);
}
-
static void
search_clear_criteria (GNCSearchWindow *sw)
{
@@ -790,7 +770,6 @@ search_clear_criteria (GNCSearchWindow *sw)
}
}
-
static GtkWidget *
get_comb_box_widget (GNCSearchWindow *sw, struct _crit_data *data)
{
@@ -1009,14 +988,12 @@ gnc_search_dialog_add_criterion (GNCSearchWindow *sw)
}
}
-
static void
add_criterion (GtkWidget *button, GNCSearchWindow *sw)
{
gnc_search_dialog_add_criterion (sw);
}
-
static int
gnc_search_dialog_close_cb (GtkDialog *dialog, GNCSearchWindow *sw)
{
@@ -1049,7 +1026,6 @@ gnc_search_dialog_close_cb (GtkDialog *dialog, GNCSearchWindow *sw)
return FALSE;
}
-
static void
refresh_handler (GHashTable *changes, gpointer data)
{
@@ -1062,7 +1038,6 @@ refresh_handler (GHashTable *changes, gpointer data)
gnc_search_dialog_display_results (sw);
}
-
static void
close_handler (gpointer data)
{
@@ -1073,7 +1048,6 @@ close_handler (gpointer data)
/* DRH: should sw be freed here? */
}
-
static const gchar *
type_label_to_new_button(const gchar* type_label)
{
@@ -1125,7 +1099,6 @@ type_label_to_new_button(const gchar* type_label)
}
}
-
static void
gnc_search_dialog_init_widgets (GNCSearchWindow *sw, const gchar *title)
{
@@ -1272,7 +1245,6 @@ gnc_search_dialog_init_widgets (GNCSearchWindow *sw, const gchar *title)
g_object_unref(G_OBJECT(builder));
}
-
void
gnc_search_dialog_destroy (GNCSearchWindow *sw)
{
@@ -1282,7 +1254,6 @@ gnc_search_dialog_destroy (GNCSearchWindow *sw)
gnc_close_gui_component (sw->component_id);
}
-
void
gnc_search_dialog_raise (GNCSearchWindow *sw)
{
@@ -1356,7 +1327,6 @@ gnc_search_dialog_create (GtkWindow *parent,
return sw;
}
-
/* Register an on-close signal with the Search Dialog */
guint gnc_search_dialog_connect_on_close (GNCSearchWindow *sw,
GCallback func,
@@ -1371,7 +1341,6 @@ guint gnc_search_dialog_connect_on_close (GNCSearchWindow *sw,
}
-
/* Un-register the signal handlers with the Search Dialog */
void gnc_search_dialog_disconnect (GNCSearchWindow *sw, gpointer user_data)
{
@@ -1382,7 +1351,6 @@ void gnc_search_dialog_disconnect (GNCSearchWindow *sw, gpointer user_data)
0, 0, NULL, NULL, user_data);
}
-
/* Clear all callbacks with this Search Window */
void gnc_search_dialog_set_select_cb (GNCSearchWindow *sw,
GNCSearchSelectedCB selected_cb,
@@ -1441,7 +1409,6 @@ get_params_list (QofIdTypeConst type)
return list;
}
-
static GList *
get_display_list (QofIdTypeConst type)
{
@@ -1463,7 +1430,6 @@ do_nothing (GtkWindow *dialog, gpointer *a, gpointer b)
return;
}
-
void
gnc_search_dialog_test (void)
{
@@ -1490,8 +1456,7 @@ gnc_search_dialog_test (void)
/* (keep the line break below to avoid a translator comment) */
gnc_search_dialog_create (NULL, GNC_ID_SPLIT,
_("Find Transaction"),
- params, display,
- NULL, NULL, buttons, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL);
+ params, display,
+ NULL, NULL, buttons, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL);
}
-
commit 952761afa61fade522e1b9dc04aae0c34634ad0b
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Thu Dec 13 13:11:33 2018 +0000
Bug 796945 - Search Search Criteria window does not scroll when added criteria exceed a certain amount
Add the criteria grid to a viewport and scroll window as suggested in
bug report. Also needed to add the hiding of the new scroll window as
required.
diff --git a/gnucash/gnome-search/dialog-search.c b/gnucash/gnome-search/dialog-search.c
index 7db05bb..aa4c703 100644
--- a/gnucash/gnome-search/dialog-search.c
+++ b/gnucash/gnome-search/dialog-search.c
@@ -73,6 +73,7 @@ struct _GNCSearchWindow
GtkWidget *grouping_combo;
GtkWidget *match_all_label;
GtkWidget *criteria_table;
+ GtkWidget *criteria_scroll_window;
GtkWidget *result_hbox;
/* The "results" sub-window widgets */
@@ -548,6 +549,7 @@ static void
gnc_search_dialog_reset_widgets (GNCSearchWindow *sw)
{
gboolean sens = (sw->q != NULL);
+ gboolean crit_list_vis = FALSE;
gtk_widget_set_sensitive(GTK_WIDGET(sw->narrow_rb), sens);
gtk_widget_set_sensitive(GTK_WIDGET(sw->add_rb), sens);
@@ -560,17 +562,12 @@ gnc_search_dialog_reset_widgets (GNCSearchWindow *sw)
}
if (sw->crit_list)
- {
- gtk_widget_set_sensitive(sw->grouping_combo, TRUE);
- gtk_widget_hide(sw->match_all_label);
- }
- else
- {
- gtk_widget_set_sensitive(sw->grouping_combo, FALSE);
- gtk_widget_show(sw->match_all_label);
- }
-}
+ crit_list_vis = TRUE;
+ gtk_widget_set_sensitive(sw->grouping_combo, crit_list_vis);
+ gtk_widget_set_visible (sw->criteria_scroll_window, crit_list_vis);
+ gtk_widget_set_visible (sw->match_all_label, !crit_list_vis);
+}
static gboolean
gnc_search_dialog_crit_ok (GNCSearchWindow *sw)
@@ -691,6 +688,7 @@ remove_element (GtkWidget *button, GNCSearchWindow *sw)
{
gtk_widget_set_sensitive(sw->grouping_combo, FALSE);
gtk_widget_show(sw->match_all_label);
+ gtk_widget_hide(sw->criteria_scroll_window);
}
}
@@ -986,6 +984,7 @@ gnc_search_dialog_add_criterion (GNCSearchWindow *sw)
/* no match-all situation anymore */
gtk_widget_set_sensitive(sw->grouping_combo, TRUE);
gtk_widget_hide(sw->match_all_label);
+ gtk_widget_show(sw->criteria_scroll_window);
}
/* create a new criterion element */
new_sct = gnc_search_core_type_new_type_name
@@ -1154,6 +1153,7 @@ gnc_search_dialog_init_widgets (GNCSearchWindow *sw, const gchar *title)
/* Grab the search-table widget */
sw->criteria_table = GTK_WIDGET(gtk_builder_get_object (builder, "criteria_table"));
+ sw->criteria_scroll_window = GTK_WIDGET(gtk_builder_get_object (builder, "criteria_scroll_window"));
/* Set the type label */
label = GTK_WIDGET(gtk_builder_get_object (builder, "type_label"));
diff --git a/gnucash/gtkbuilder/dialog-search.glade b/gnucash/gtkbuilder/dialog-search.glade
index 64fd788..400e8e1 100644
--- a/gnucash/gtkbuilder/dialog-search.glade
+++ b/gnucash/gtkbuilder/dialog-search.glade
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.20.4 -->
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkDialog" id="search_dialog">
@@ -235,36 +235,51 @@
</packing>
</child>
<child>
- <object class="GtkGrid" id="criteria_table">
+ <object class="GtkScrolledWindow" id="criteria_scroll_window">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">3</property>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="shadow_type">etched-in</property>
<child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
+ <object class="GtkViewport" id="criteria_viewport">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="shadow_type">etched-in</property>
+ <child>
+ <object class="GtkGrid" id="criteria_table">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">3</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ </object>
</child>
</object>
<packing>
@@ -284,8 +299,8 @@
</child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
@@ -298,6 +313,7 @@
<object class="GtkBox" id="hboxXXX">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="valign">start</property>
<child>
<object class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
@@ -441,8 +457,8 @@
</child>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
commit a8d0270e5adf87093b843d84beac5c04103e3fdf
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Tue Dec 11 12:57:30 2018 +0000
Disallow tabs in GtkTextView in glade files
Disallow the use of tabs in all glade GtkTextView's. This is mainly
used for notes fields and showing log entries. Some views were not
editable but for consistency the setting was also added to them.
diff --git a/gnucash/gtkbuilder/assistant-csv-account-import.glade b/gnucash/gtkbuilder/assistant-csv-account-import.glade
index 4d2a5bd..17aa12f 100644
--- a/gnucash/gtkbuilder/assistant-csv-account-import.glade
+++ b/gnucash/gtkbuilder/assistant-csv-account-import.glade
@@ -329,6 +329,7 @@ Cancel to abort.</property>
<property name="can_focus">False</property>
<property name="left_margin">2</property>
<property name="right_margin">2</property>
+ <property name="accepts_tab">False</property>
</object>
</child>
</object>
diff --git a/gnucash/gtkbuilder/dialog-customer.glade b/gnucash/gtkbuilder/dialog-customer.glade
index 39be977..382da5e 100644
--- a/gnucash/gtkbuilder/dialog-customer.glade
+++ b/gnucash/gtkbuilder/dialog-customer.glade
@@ -541,6 +541,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="wrap_mode">word</property>
+ <property name="accepts_tab">False</property>
</object>
</child>
</object>
diff --git a/gnucash/gtkbuilder/dialog-invoice.glade b/gnucash/gtkbuilder/dialog-invoice.glade
index d06ffc1..602dacc 100644
--- a/gnucash/gtkbuilder/dialog-invoice.glade
+++ b/gnucash/gtkbuilder/dialog-invoice.glade
@@ -475,6 +475,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="wrap_mode">word</property>
+ <property name="accepts_tab">False</property>
<signal name="focus-out-event" handler="gnc_invoice_window_leave_notes_cb" swapped="no"/>
</object>
</child>
@@ -1247,6 +1248,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="wrap_mode">word</property>
+ <property name="accepts_tab">False</property>
</object>
</child>
</object>
diff --git a/gnucash/gtkbuilder/dialog-lot-viewer.glade b/gnucash/gtkbuilder/dialog-lot-viewer.glade
index c8c1062..556fccc 100644
--- a/gnucash/gtkbuilder/dialog-lot-viewer.glade
+++ b/gnucash/gtkbuilder/dialog-lot-viewer.glade
@@ -169,6 +169,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Enter any notes you want to make about this lot.</property>
+ <property name="accepts_tab">False</property>
<property name="wrap_mode">word</property>
</object>
</child>
diff --git a/gnucash/gtkbuilder/dialog-order.glade b/gnucash/gtkbuilder/dialog-order.glade
index f1f584d..e9707a0 100644
--- a/gnucash/gtkbuilder/dialog-order.glade
+++ b/gnucash/gtkbuilder/dialog-order.glade
@@ -446,6 +446,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="wrap_mode">word</property>
+ <property name="accepts_tab">False</property>
<property name="buffer">notes_buffer</property>
</object>
</child>
@@ -847,6 +848,7 @@
<property name="can_focus">True</property>
<property name="editable">False</property>
<property name="wrap_mode">word</property>
+ <property name="accepts_tab">False</property>
<property name="buffer">text_buffer</property>
</object>
</child>
diff --git a/gnucash/gtkbuilder/dialog-tax-info.glade b/gnucash/gtkbuilder/dialog-tax-info.glade
index b3f85b8..c9774ab 100644
--- a/gnucash/gtkbuilder/dialog-tax-info.glade
+++ b/gnucash/gtkbuilder/dialog-tax-info.glade
@@ -604,6 +604,7 @@
<property name="vexpand">True</property>
<property name="editable">False</property>
<property name="wrap_mode">word</property>
+ <property name="accepts_tab">False</property>
</object>
</child>
</object>
diff --git a/gnucash/gtkbuilder/dialog-totd.glade b/gnucash/gtkbuilder/dialog-totd.glade
index 2206248..17896d6 100644
--- a/gnucash/gtkbuilder/dialog-totd.glade
+++ b/gnucash/gtkbuilder/dialog-totd.glade
@@ -125,6 +125,7 @@
<property name="border_width">6</property>
<property name="editable">False</property>
<property name="wrap_mode">word</property>
+ <property name="accepts_tab">False</property>
<property name="left_margin">5</property>
<property name="right_margin">5</property>
<property name="cursor_visible">False</property>
diff --git a/gnucash/gtkbuilder/dialog-vendor.glade b/gnucash/gtkbuilder/dialog-vendor.glade
index 15643d3..56050ba 100644
--- a/gnucash/gtkbuilder/dialog-vendor.glade
+++ b/gnucash/gtkbuilder/dialog-vendor.glade
@@ -536,6 +536,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="wrap_mode">word</property>
+ <property name="accepts_tab">False</property>
</object>
</child>
</object>
diff --git a/gnucash/gtkbuilder/gnc-plugin-page-budget.glade b/gnucash/gtkbuilder/gnc-plugin-page-budget.glade
index aa2b171..1a313c3 100644
--- a/gnucash/gtkbuilder/gnc-plugin-page-budget.glade
+++ b/gnucash/gtkbuilder/gnc-plugin-page-budget.glade
@@ -291,6 +291,7 @@
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="wrap_mode">word</property>
+ <property name="accepts_tab">False</property>
</object>
</child>
</object>
diff --git a/gnucash/import-export/aqb/dialog-ab.glade b/gnucash/import-export/aqb/dialog-ab.glade
index b17e235..a6a4dbf 100644
--- a/gnucash/import-export/aqb/dialog-ab.glade
+++ b/gnucash/import-export/aqb/dialog-ab.glade
@@ -242,6 +242,7 @@
<property name="can_focus">True</property>
<property name="editable">False</property>
<property name="wrap_mode">word</property>
+ <property name="accepts_tab">False</property>
</object>
</child>
</object>
commit 5c524c31b2c953087b70305c24547960e0d5e585
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Sat Dec 22 18:07:55 2018 +0000
Add routine to fix Account Color being set to "Not Set"
Previously the account color slot has been populated with "Not Set"
when any field for the account has been edited and saved. This routine
should run once and remove all such entries.
diff --git a/gnucash/gnome-utils/gnc-file.c b/gnucash/gnome-utils/gnc-file.c
index 2eefc34..0f8e0e4 100644
--- a/gnucash/gnome-utils/gnc-file.c
+++ b/gnucash/gnome-utils/gnc-file.c
@@ -45,6 +45,7 @@
#include "gnc-window.h"
#include "gnc-plugin-file-history.h"
#include "qof.h"
+#include "Scrub.h"
#include "TransLog.h"
#include "gnc-session.h"
#include "gnc-state.h"
@@ -1023,6 +1024,12 @@ RESTART:
gnc_warning_dialog(parent, "%s", message);
g_free ( message );
}
+
+ // Fix account color slots being set to 'Not Set', should run once on a book
+ qof_event_suspend();
+ xaccAccountScrubColorNotSet (gnc_get_current_book());
+ qof_event_resume();
+
return TRUE;
}
diff --git a/libgnucash/engine/Scrub.c b/libgnucash/engine/Scrub.c
index d6ff107..38aa240 100644
--- a/libgnucash/engine/Scrub.c
+++ b/libgnucash/engine/Scrub.c
@@ -1114,15 +1114,15 @@ xaccTransScrubCurrency (Transaction *trans)
}
else
{
- gnc_commodity *currency = xaccAccountGetCommodity(split->acc);
+ gnc_commodity *currency = xaccAccountGetCommodity(split->acc);
PWARN ("setting to split=\"%s\" account=\"%s\" commodity=\"%s\"",
split->memo, xaccAccountGetName(split->acc),
gnc_commodity_get_mnemonic(currency));
- xaccTransBeginEdit (trans);
- xaccTransSetCurrency (trans, currency);
- xaccTransCommitEdit (trans);
- return;
+ xaccTransBeginEdit (trans);
+ xaccTransSetCurrency (trans, currency);
+ xaccTransCommitEdit (trans);
+ return;
}
}
}
@@ -1354,6 +1354,42 @@ xaccAccountScrubKvp (Account *account)
/* ================================================================ */
+void
+xaccAccountScrubColorNotSet (QofBook *book)
+{
+ GValue value_s = G_VALUE_INIT;
+
+ // get the run-once value
+ qof_instance_get_kvp (QOF_INSTANCE (book), &value_s, 1, "remove-color-not-set-slots");
+
+ if (G_VALUE_HOLDS_STRING (&value_s) && (strcmp(g_value_get_string (&value_s), "true") == 0))
+ return;
+ else
+ {
+ GValue value_b = G_VALUE_INIT;
+ Account *root = gnc_book_get_root_account (book);
+ GList *accts = gnc_account_get_descendants_sorted (root);
+ GList *ptr;
+
+ for (ptr = accts; ptr; ptr = g_list_next (ptr))
+ {
+ const gchar *color = xaccAccountGetColor (ptr->data);
+
+ if (g_strcmp0 (color, "Not Set") == 0)
+ xaccAccountSetColor (ptr->data, "");
+ }
+ g_list_free (accts);
+
+ g_value_init (&value_b, G_TYPE_BOOLEAN);
+ g_value_set_boolean (&value_b, TRUE);
+
+ // set the run-once value
+ qof_instance_set_kvp (QOF_INSTANCE (book), &value_b, 1, "remove-color-not-set-slots");
+ }
+}
+
+/* ================================================================ */
+
Account *
xaccScrubUtilityGetOrMakeAccount (Account *root, gnc_commodity * currency,
const char *accname, GNCAccountType acctype,
diff --git a/libgnucash/engine/Scrub.h b/libgnucash/engine/Scrub.h
index d57fadf..9536f8c 100644
--- a/libgnucash/engine/Scrub.h
+++ b/libgnucash/engine/Scrub.h
@@ -145,6 +145,11 @@ void xaccAccountTreeScrubQuoteSources (Account *root, gnc_commodity_table *table
/** Removes empty "notes", "placeholder", and "hbci" KVP slots from Accounts. */
void xaccAccountScrubKvp (Account *account);
+/** Remove color slots that have a "Not Set" value, since 2.4.0, fixed in 3.4
+ * This should only be run once on a book
+ */
+void xaccAccountScrubColorNotSet (QofBook *book);
+
/** Changes Transaction date_posted timestamps from 00:00 local to 11:00 UTC.
* 11:00 UTC is the same day local time in almost all timezones, the exceptions
* being the -12, +13, and +14 timezones along the International Date Line. If
commit 43beeca079725d1193d06feb686724b61d2fc76e
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Tue Dec 11 10:47:15 2018 +0000
Change the way colours are imported by the CSV account tree importer
When importing the account tree CSV file, change the importing of
colours so that only valid colours for accounts are updated, invalid
colours will result in the account color key slot being removed.
diff --git a/gnucash/import-export/csv-imp/csv-account-import.c b/gnucash/import-export/csv-imp/csv-account-import.c
index e0affa3..804f119 100644
--- a/gnucash/import-export/csv-imp/csv-account-import.c
+++ b/gnucash/import-export/csv-imp/csv-account-import.c
@@ -283,6 +283,8 @@ csv_account_import (CsvImportInfo *info)
{
if (gdk_rgba_parse (&testcolor, color))
xaccAccountSetColor (acc, color);
+ else
+ xaccAccountSetColor (acc, "");
}
if (g_strcmp0 (hidden, "T") == 0)
@@ -323,6 +325,8 @@ csv_account_import (CsvImportInfo *info)
{
if (gdk_rgba_parse (&testcolor, color))
xaccAccountSetColor (acc, color);
+ else
+ xaccAccountSetColor (acc, "");
}
if (g_strcmp0 (notes, "") != 0)
commit 7a1f981b0c180ec678870d1c26126393a81661bf
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Tue Dec 11 10:45:14 2018 +0000
Change the sensitivity of the Cascade colour menu option
Enable the cascade colour menu setting only when the account being
cascaded from has sub-accounts.
diff --git a/gnucash/gnome/gnc-plugin-page-account-tree.c b/gnucash/gnome/gnc-plugin-page-account-tree.c
index 529c4a5..41a28cc 100644
--- a/gnucash/gnome/gnc-plugin-page-account-tree.c
+++ b/gnucash/gnome/gnc-plugin-page-account-tree.c
@@ -228,7 +228,7 @@ static GtkActionEntry gnc_plugin_page_account_tree_actions [] =
G_CALLBACK (gnc_plugin_page_account_tree_cmd_delete_account)
},
{
- "ColorCascadeAccountAction", NULL, N_("_Cascade Account Color..."), NULL,
+ "EditColorCascadeAccountAction", NULL, N_("_Cascade Account Color..."), NULL,
N_("Cascade selected account color"),
G_CALLBACK (gnc_plugin_page_account_tree_cmd_cascade_color_account)
},
@@ -1072,6 +1072,9 @@ gnc_plugin_page_account_tree_selection_changed_cb (GtkTreeSelection *selection,
g_object_set (G_OBJECT(action), "sensitive",
is_readwrite && sensitive && subaccounts, NULL);
+ action = gtk_action_group_get_action (action_group, "EditColorCascadeAccountAction");
+ g_object_set (G_OBJECT(action), "sensitive", subaccounts, NULL);
+
gnc_plugin_update_actions (action_group, actions_requiring_account_rw,
"sensitive", is_readwrite && sensitive);
gnc_plugin_update_actions (action_group, actions_requiring_account_always,
diff --git a/gnucash/ui/gnc-plugin-page-account-tree-ui.xml b/gnucash/ui/gnc-plugin-page-account-tree-ui.xml
index c07f440..2584cce 100644
--- a/gnucash/ui/gnc-plugin-page-account-tree-ui.xml
+++ b/gnucash/ui/gnc-plugin-page-account-tree-ui.xml
@@ -5,7 +5,7 @@
<menuitem name="EditEditAccount" action="EditEditAccountAction"/>
<menuitem name="EditDeleteAccount" action="EditDeleteAccountAction"/>
<menuitem name="EditAccountFindAccount" action="EditFindAccountAction"/>
- <menuitem name="AccountColorCascade" action="ColorCascadeAccountAction"/>
+ <menuitem name="AccountColorCascade" action="EditColorCascadeAccountAction"/>
<menuitem name="EditRenumberSubaccounts" action="EditRenumberSubaccountsAction"/>
<separator name="EditSep2"/>
<menuitem name="FileOpenAccount" action="FileOpenAccountAction"/>
@@ -46,7 +46,7 @@
<menuitem name="AccountOpenAccount" action="FileOpenAccountAction"/>
<menuitem name="AccountOpenSubaccounts" action="FileOpenSubaccountsAction"/>
<menuitem name="AccountEditAccount" action="EditEditAccountAction"/>
- <menuitem name="AccountColorCascade" action="ColorCascadeAccountAction"/>
+ <menuitem name="AccountColorCascade" action="EditColorCascadeAccountAction"/>
<menuitem name="AccountFindAccountPopup" action="EditFindAccountPopupAction"/>
<separator name="AccountSep1"/>
<menuitem name="AccountReconcile" action="ActionsReconcileAction"/>
commit fad17da72b7f90a185cbe1381e17c7b51a5e0052
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Tue Dec 11 10:38:59 2018 +0000
Bug 796887 - Remove account slot key color if there is no valid color
If an existing account colour was specified and subsequently removed
the color key would be "Not Set". Change this to remove the key when
the colour is changed to default, i.e. removed.
diff --git a/gnucash/gnome-utils/dialog-account.c b/gnucash/gnome-utils/dialog-account.c
index a23429e..e3c075d 100644
--- a/gnucash/gnome-utils/dialog-account.c
+++ b/gnucash/gnome-utils/dialog-account.c
@@ -230,12 +230,13 @@ gnc_account_to_ui(AccountWindow *aw)
string = xaccAccountGetColor (account);
- if ((string == NULL) || (g_strcmp0 ("Not Set", string) == 0))
+ if (!string)
string = DEFAULT_COLOR;
- if (gdk_rgba_parse(&color, string))
- {
- gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(aw->color_entry_button), &color);
- }
+
+ if (!gdk_rgba_parse (&color, string))
+ gdk_rgba_parse (&color, DEFAULT_COLOR);
+
+ gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(aw->color_entry_button), &color);
commodity = xaccAccountGetCommodity (account);
gnc_general_select_set_selected (GNC_GENERAL_SELECT (aw->commodity_edit),
@@ -380,12 +381,19 @@ gnc_ui_to_account(AccountWindow *aw)
gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(aw->color_entry_button), &color );
string = gdk_rgba_to_string(&color);
+
if (g_strcmp0 (string, DEFAULT_COLOR) == 0)
- string = "Not Set";
+ string = NULL;
old_string = xaccAccountGetColor (account);
- if (g_strcmp0 (string, old_string) != 0)
- xaccAccountSetColor (account, string);
+
+ if (!string && old_string)
+ xaccAccountSetColor (account, ""); // remove entry
+ else
+ {
+ if (g_strcmp0 (string, old_string) != 0)
+ xaccAccountSetColor (account, string); // update entry
+ }
commodity = (gnc_commodity *)
gnc_general_select_get_selected (GNC_GENERAL_SELECT (aw->commodity_edit));
@@ -2094,16 +2102,24 @@ default_color_button_cb (GtkButton *button, gpointer user_data)
static void
update_account_color (Account *acc, const gchar *old_color, const gchar *new_color, gboolean replace)
{
- // check to see if the color has been changed
- if (g_strcmp0 (new_color, old_color) != 0)
+ PINFO("Account is '%s', old_color is '%s', new_color is '%s', replace is %d",
+ xaccAccountGetName (acc), old_color, new_color, replace);
+
+ // have a new color, update if we can
+ if (new_color)
{
- if ((old_color == NULL) || (g_strcmp0 (old_color, "Not Set") == 0) || (replace == TRUE))
+ if (!old_color || replace)
{
- xaccAccountBeginEdit (acc);
- xaccAccountSetColor (acc, new_color);
- xaccAccountCommitEdit (acc);
+ // check to see if the color is different from old one
+ if (g_strcmp0 (new_color, old_color) != 0)
+ xaccAccountSetColor (acc, new_color);
}
}
+ else // change from a color to default one, remove color entry if we can
+ {
+ if (old_color && replace)
+ xaccAccountSetColor (acc, ""); // remove entry
+ }
}
void
@@ -2114,7 +2130,7 @@ gnc_account_cascade_color_dialog (GtkWidget *window, Account *account)
GtkWidget *color_label, *color_button, *over_write, *color_button_default;
gchar *string;
const char *color_string;
- gchar *old_color_string;
+ gchar *old_color_string = NULL;
GdkRGBA color;
gint response;
@@ -2144,14 +2160,16 @@ gnc_account_cascade_color_dialog (GtkWidget *window, Account *account)
color_string = xaccAccountGetColor (account); // get existing account color
- old_color_string = g_strdup (color_string); // save the old color string
-
- if ((color_string == NULL) || (g_strcmp0 (color_string, "Not Set") == 0))
+ if (!color_string)
color_string = DEFAULT_COLOR;
+ else
+ old_color_string = g_strdup (color_string); // save the old color string
+
+ if (!gdk_rgba_parse (&color, color_string))
+ gdk_rgba_parse (&color, DEFAULT_COLOR);
// set the color chooser to account color
- if (gdk_rgba_parse (&color, color_string))
- gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER(color_button), &color);
+ gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER(color_button), &color);
/* default to cancel */
gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_CANCEL);
@@ -2175,18 +2193,18 @@ gnc_account_cascade_color_dialog (GtkWidget *window, Account *account)
new_color_string = gdk_rgba_to_string (&new_color);
if (g_strcmp0 (new_color_string, DEFAULT_COLOR) == 0)
- new_color_string = "Not Set";
+ new_color_string = NULL;
// check/update selected account
update_account_color (account, old_color_string, new_color_string, replace);
- if (accounts != NULL)
+ if (accounts)
{
for (acct = accounts; acct; acct = g_list_next(acct))
{
const char *string = xaccAccountGetColor (acct->data);
- // check/update sub-account
+ // check/update sub-accounts
update_account_color (acct->data, string, new_color_string, replace);
}
g_list_free (accounts);
Summary of changes:
gnucash/gnome-search/dialog-search.c | 83 +++++++---------------
gnucash/gnome-utils/dialog-account.c | 64 +++++++++++------
gnucash/gnome-utils/dialog-utils.c | 4 +-
gnucash/gnome-utils/dialog-utils.h | 3 +
gnucash/gnome-utils/gnc-file.c | 7 ++
gnucash/gnome-utils/gnc-tree-view.c | 17 +++++
gnucash/gnome/gnc-budget-view.c | 20 +++++-
gnucash/gnome/gnc-plugin-page-account-tree.c | 5 +-
gnucash/gnome/gnc-split-reg.c | 21 ++++++
.../gtkbuilder/assistant-csv-account-import.glade | 1 +
gnucash/gtkbuilder/dialog-customer.glade | 1 +
gnucash/gtkbuilder/dialog-invoice.glade | 2 +
gnucash/gtkbuilder/dialog-lot-viewer.glade | 1 +
gnucash/gtkbuilder/dialog-order.glade | 2 +
gnucash/gtkbuilder/dialog-search.glade | 82 ++++++++++++---------
gnucash/gtkbuilder/dialog-tax-info.glade | 1 +
gnucash/gtkbuilder/dialog-totd.glade | 1 +
gnucash/gtkbuilder/dialog-vendor.glade | 1 +
gnucash/gtkbuilder/gnc-plugin-page-budget.glade | 19 ++++-
gnucash/import-export/aqb/dialog-ab.glade | 1 +
gnucash/import-export/csv-imp/csv-account-import.c | 4 ++
gnucash/register/ledger-core/split-register.c | 57 ++++++++++++++-
gnucash/register/ledger-core/split-register.h | 8 +++
gnucash/ui/gnc-plugin-page-account-tree-ui.xml | 4 +-
libgnucash/engine/Scrub.c | 46 ++++++++++--
libgnucash/engine/Scrub.h | 5 ++
26 files changed, 331 insertions(+), 129 deletions(-)
More information about the gnucash-changes
mailing list