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.
This commit is contained in:
Geert Janssens
2018-06-21 10:31:27 +02:00
parent d906ac4136
commit a2983935a2

View File

@@ -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);
}