mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add the full account name to the saved register settings
If you need to delete the layout for a register in the settings file, the only thing identifying it is the account guid. To make it easier for humans, add the full account name also.
This commit is contained in:
parent
709f69db32
commit
04836eb671
@ -586,11 +586,16 @@ gnc_split_reg_ld_destroy( GNCLedgerDisplay *ledger )
|
|||||||
const GncGUID * guid = xaccAccountGetGUID(account);
|
const GncGUID * guid = xaccAccountGetGUID(account);
|
||||||
gchar guidstr[GUID_ENCODING_LENGTH+1];
|
gchar guidstr[GUID_ENCODING_LENGTH+1];
|
||||||
gchar *state_section;
|
gchar *state_section;
|
||||||
|
gchar *acct_fullname;
|
||||||
guid_to_string_buff(guid, guidstr);
|
guid_to_string_buff(guid, guidstr);
|
||||||
|
|
||||||
state_section = g_strconcat (STATE_SECTION_REG_PREFIX, " ", guidstr, NULL);
|
state_section = g_strconcat (STATE_SECTION_REG_PREFIX, " ", guidstr, NULL);
|
||||||
|
|
||||||
|
if (g_strcmp0(guidstr, "00000000000000000000000000000000") == 0)
|
||||||
|
acct_fullname = g_strdup(_("General Journal"));
|
||||||
|
else
|
||||||
|
acct_fullname = gnc_account_get_full_name(account);
|
||||||
|
|
||||||
if (gsr)
|
if (gsr)
|
||||||
{
|
{
|
||||||
SplitRegister *reg;
|
SplitRegister *reg;
|
||||||
@ -598,7 +603,7 @@ gnc_split_reg_ld_destroy( GNCLedgerDisplay *ledger )
|
|||||||
reg = gnc_ledger_display_get_split_register (ledger);
|
reg = gnc_ledger_display_get_split_register (ledger);
|
||||||
|
|
||||||
if (reg && reg->table)
|
if (reg && reg->table)
|
||||||
gnc_table_save_state (reg->table, state_section);
|
gnc_table_save_state (reg->table, state_section, acct_fullname);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Don't destroy the window here any more. The register no longer
|
* Don't destroy the window here any more. The register no longer
|
||||||
@ -606,6 +611,7 @@ gnc_split_reg_ld_destroy( GNCLedgerDisplay *ledger )
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
g_free (state_section);
|
g_free (state_section);
|
||||||
|
g_free (acct_fullname);
|
||||||
gnc_ledger_display_set_user_data (ledger, NULL);
|
gnc_ledger_display_set_user_data (ledger, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ Table * gnc_table_new (TableLayout *layout,
|
|||||||
TableControl *control);
|
TableControl *control);
|
||||||
void gnc_virtual_location_init (VirtualLocation *vloc);
|
void gnc_virtual_location_init (VirtualLocation *vloc);
|
||||||
|
|
||||||
void gnc_table_save_state (Table *table, gchar *state_section);
|
void gnc_table_save_state (Table *table, gchar *state_section, gchar *account_fullname);
|
||||||
void gnc_table_destroy (Table *table);
|
void gnc_table_destroy (Table *table);
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,6 +61,8 @@
|
|||||||
|
|
||||||
#define UNUSED_VAR __attribute__ ((unused))
|
#define UNUSED_VAR __attribute__ ((unused))
|
||||||
|
|
||||||
|
#define KEY_ACCOUNT_NAME "account_name"
|
||||||
|
|
||||||
/* This static indicates the debugging module that this .o belongs to. */
|
/* This static indicates the debugging module that this .o belongs to. */
|
||||||
static QofLogModule UNUSED_VAR log_module = GNC_MOD_REGISTER;
|
static QofLogModule UNUSED_VAR log_module = GNC_MOD_REGISTER;
|
||||||
|
|
||||||
@ -68,14 +70,14 @@ static QofLogModule UNUSED_VAR log_module = GNC_MOD_REGISTER;
|
|||||||
/** Implementation *****************************************************/
|
/** Implementation *****************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
gnc_table_save_state (Table *table, gchar * state_section)
|
gnc_table_save_state (Table *table, gchar * state_section, gchar * account_fullname)
|
||||||
{
|
{
|
||||||
GnucashSheet *sheet;
|
GnucashSheet *sheet;
|
||||||
GNCHeaderWidths widths;
|
GNCHeaderWidths widths;
|
||||||
GList *node;
|
GList *node;
|
||||||
gchar *key;
|
gchar *key;
|
||||||
GKeyFile *state_file = gnc_state_get_current();
|
GKeyFile *state_file = gnc_state_get_current();
|
||||||
|
|
||||||
if (!table)
|
if (!table)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -109,7 +111,7 @@ gnc_table_save_state (Table *table, gchar * state_section)
|
|||||||
g_key_file_remove_key (state_file, state_section, key, NULL);
|
g_key_file_remove_key (state_file, state_section, key, NULL);
|
||||||
g_free (key);
|
g_free (key);
|
||||||
}
|
}
|
||||||
|
g_key_file_set_string (state_file, state_section, KEY_ACCOUNT_NAME, account_fullname);
|
||||||
gnc_header_widths_destroy (widths);
|
gnc_header_widths_destroy (widths);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user