gnucash maint: Use a comment to indicate full account name in saved register state
Geert Janssens
gjanssens at code.gnucash.org
Thu Jun 21 04:33:32 EDT 2018
Updated via https://github.com/Gnucash/gnucash/commit/a2983935 (commit)
from https://github.com/Gnucash/gnucash/commit/d906ac41 (commit)
commit a2983935a2ea1a6a20c2047fb807b3838364c882
Author: Geert Janssens <geert at kobaltwit.be>
Date: Thu Jun 21 10:31:27 2018 +0200
Use a comment to indicate full account name in saved register state
This replaces the 'account_name' key in the same state. Keys should only be used
data that's actually parsed when reading the state. Using a key for account_name here
can create the false impression this data can be modified. A comment makes it much more
clear the name is only informational while keeping the convenience.
diff --git a/gnucash/register/register-gnome/table-gnome.c b/gnucash/register/register-gnome/table-gnome.c
index 3650721..c03abde 100644
--- a/gnucash/register/register-gnome/table-gnome.c
+++ b/gnucash/register/register-gnome/table-gnome.c
@@ -61,8 +61,6 @@
#define UNUSED_VAR __attribute__ ((unused))
-#define KEY_ACCOUNT_NAME "account_name"
-
/* This static indicates the debugging module that this .o belongs to. */
static QofLogModule UNUSED_VAR log_module = GNC_MOD_REGISTER;
@@ -87,6 +85,10 @@ gnc_table_save_state (Table *table, gchar * state_section, gchar * account_fulln
if (!gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY))
return;
+ key = g_strdup_printf ("Register state for \"%s\"", account_fullname);
+ g_key_file_set_comment (state_file, state_section, NULL, key, NULL);
+ g_free (key);
+
sheet = GNUCASH_SHEET (table->ui_data);
widths = gnc_header_widths_new ();
@@ -111,7 +113,6 @@ gnc_table_save_state (Table *table, gchar * state_section, gchar * account_fulln
g_key_file_remove_key (state_file, state_section, key, NULL);
g_free (key);
}
- g_key_file_set_string (state_file, state_section, KEY_ACCOUNT_NAME, account_fullname);
gnc_header_widths_destroy (widths);
}
Summary of changes:
gnucash/register/register-gnome/table-gnome.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
More information about the gnucash-changes
mailing list