mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-25 18:30:23 -06:00
Bug #489502: When changing the account separator, let registers pick up the new char.
BP git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@17151 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
54f7aed224
commit
70efd54257
@ -28,6 +28,7 @@
|
||||
#include "gnc-ui-util.h"
|
||||
#include "gnc-component-manager.h"
|
||||
#include "gnc-event.h"
|
||||
#include "gnc-gconf-utils.h"
|
||||
|
||||
#include "gncEntry.h"
|
||||
#include "gncEntryLedger.h"
|
||||
@ -70,6 +71,20 @@ gnc_entry_ledger_refresh_internal (GncEntryLedger *ledger, GList *entries)
|
||||
ledger->loading = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_entry_ledger_gconf_changed (GConfEntry *entry, gpointer user_data)
|
||||
{
|
||||
GncEntryLedger *ledger = user_data;
|
||||
|
||||
g_return_if_fail (ledger && entry && entry->key);
|
||||
|
||||
if (g_str_has_suffix (entry->key, KEY_ACCOUNT_SEPARATOR)) {
|
||||
gnc_entry_ledger_display_refresh (ledger);
|
||||
} else {
|
||||
g_warning ("gnc_entry_gconf_changed: Unknown gconf key %s", entry->key);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_entry_ledger_set_watches (GncEntryLedger *ledger, GList *entries)
|
||||
{
|
||||
@ -155,6 +170,9 @@ gnc_entry_ledger_display_init (GncEntryLedger *ledger)
|
||||
ledger->component_id = gnc_register_gui_component (ENTRYLEDGER_CLASS,
|
||||
refresh_handler,
|
||||
NULL, ledger);
|
||||
gnc_gconf_general_register_cb(KEY_ACCOUNT_SEPARATOR,
|
||||
gnc_entry_ledger_gconf_changed, ledger);
|
||||
|
||||
gnc_entry_ledger_display_refresh (ledger);
|
||||
}
|
||||
|
||||
@ -164,6 +182,8 @@ gnc_entry_ledger_display_fini (GncEntryLedger *ledger)
|
||||
if (!ledger) return;
|
||||
|
||||
gnc_unregister_gui_component (ledger->component_id);
|
||||
gnc_gconf_general_remove_cb(KEY_ACCOUNT_SEPARATOR,
|
||||
gnc_entry_ledger_gconf_changed, ledger);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -363,26 +363,30 @@ gnc_split_register_load (SplitRegister *reg, GList * slist,
|
||||
}
|
||||
}
|
||||
|
||||
/* set the completion character for the xfer cells */
|
||||
gnc_combo_cell_set_complete_char(
|
||||
(ComboCell *) gnc_table_layout_get_cell(table->layout, MXFRM_CELL),
|
||||
gnc_get_account_separator());
|
||||
|
||||
gnc_combo_cell_set_complete_char(
|
||||
(ComboCell *) gnc_table_layout_get_cell(table->layout, XFRM_CELL),
|
||||
gnc_get_account_separator());
|
||||
|
||||
/* set the confirmation callback for the reconcile cell */
|
||||
gnc_recn_cell_set_confirm_cb(
|
||||
(RecnCell *) gnc_table_layout_get_cell(table->layout, RECN_CELL),
|
||||
gnc_split_register_recn_cell_confirm, reg);
|
||||
|
||||
/* load up account names into the transfer combobox menus */
|
||||
gnc_split_register_load_xfer_cells (reg, default_account);
|
||||
gnc_split_register_load_recn_cells (reg);
|
||||
gnc_split_register_load_type_cells (reg);
|
||||
}
|
||||
|
||||
if (info->separator_changed) {
|
||||
info->separator_changed = FALSE;
|
||||
|
||||
/* set the completion character for the xfer cells */
|
||||
gnc_combo_cell_set_complete_char(
|
||||
(ComboCell *) gnc_table_layout_get_cell(table->layout, MXFRM_CELL),
|
||||
gnc_get_account_separator());
|
||||
|
||||
gnc_combo_cell_set_complete_char(
|
||||
(ComboCell *) gnc_table_layout_get_cell(table->layout, XFRM_CELL),
|
||||
gnc_get_account_separator());
|
||||
|
||||
/* set the confirmation callback for the reconcile cell */
|
||||
gnc_recn_cell_set_confirm_cb(
|
||||
(RecnCell *) gnc_table_layout_get_cell(table->layout, RECN_CELL),
|
||||
gnc_split_register_recn_cell_confirm, reg);
|
||||
}
|
||||
|
||||
table->model->dividing_row = -1;
|
||||
|
||||
// Ensure that the transaction and splits being edited are in the split
|
||||
|
@ -108,6 +108,9 @@ struct sr_info
|
||||
char *credit_str;
|
||||
char *tdebit_str;
|
||||
char *tcredit_str;
|
||||
|
||||
/* true if the account separator has changed */
|
||||
gboolean separator_changed;
|
||||
};
|
||||
|
||||
|
||||
|
@ -55,6 +55,7 @@ gnc_split_register_init_info (SplitRegister *reg)
|
||||
|
||||
info->first_pass = TRUE;
|
||||
info->full_refresh = TRUE;
|
||||
info->separator_changed = TRUE;
|
||||
|
||||
reg->sr_info = info;
|
||||
}
|
||||
|
@ -2149,6 +2149,7 @@ split_register_gconf_changed (GConfEntry *entry, gpointer user_data)
|
||||
SplitRegister * reg = user_data;
|
||||
SRInfo *info;
|
||||
|
||||
g_return_if_fail(entry && entry->key);
|
||||
if (reg == NULL)
|
||||
return;
|
||||
|
||||
@ -2156,16 +2157,23 @@ split_register_gconf_changed (GConfEntry *entry, gpointer user_data)
|
||||
if (!info)
|
||||
return;
|
||||
|
||||
/* Release current strings. Will be reloaded at next reference. */
|
||||
g_free (info->debit_str);
|
||||
g_free (info->tdebit_str);
|
||||
g_free (info->credit_str);
|
||||
g_free (info->tcredit_str);
|
||||
if (g_str_has_suffix(entry->key, KEY_ACCOUNTING_LABELS)) {
|
||||
/* Release current strings. Will be reloaded at next reference. */
|
||||
g_free (info->debit_str);
|
||||
g_free (info->tdebit_str);
|
||||
g_free (info->credit_str);
|
||||
g_free (info->tcredit_str);
|
||||
|
||||
info->debit_str = NULL;
|
||||
info->tdebit_str = NULL;
|
||||
info->credit_str = NULL;
|
||||
info->tcredit_str = NULL;
|
||||
info->debit_str = NULL;
|
||||
info->tdebit_str = NULL;
|
||||
info->credit_str = NULL;
|
||||
info->tcredit_str = NULL;
|
||||
|
||||
} else if (g_str_has_suffix(entry->key, KEY_ACCOUNT_SEPARATOR)) {
|
||||
info->separator_changed = TRUE;
|
||||
} else {
|
||||
g_warning("split_register_gconf_changed: Unknown gconf key %s", entry->key);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2184,6 +2192,9 @@ gnc_split_register_init (SplitRegister *reg,
|
||||
gnc_gconf_general_register_cb(KEY_ACCOUNTING_LABELS,
|
||||
split_register_gconf_changed,
|
||||
reg);
|
||||
gnc_gconf_general_register_cb(KEY_ACCOUNT_SEPARATOR,
|
||||
split_register_gconf_changed,
|
||||
reg);
|
||||
|
||||
reg->sr_info = NULL;
|
||||
|
||||
@ -2415,6 +2426,9 @@ gnc_split_register_destroy (SplitRegister *reg)
|
||||
gnc_gconf_general_remove_cb(KEY_ACCOUNTING_LABELS,
|
||||
split_register_gconf_changed,
|
||||
reg);
|
||||
gnc_gconf_general_remove_cb(KEY_ACCOUNT_SEPARATOR,
|
||||
split_register_gconf_changed,
|
||||
reg);
|
||||
gnc_split_register_cleanup (reg);
|
||||
|
||||
gnc_table_destroy (reg->table);
|
||||
|
Loading…
Reference in New Issue
Block a user