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:
Andreas Köhler 2008-05-11 17:31:24 +00:00
parent 54f7aed224
commit 70efd54257
5 changed files with 65 additions and 23 deletions

View File

@ -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

View File

@ -363,6 +363,15 @@ gnc_split_register_load (SplitRegister *reg, GList * slist,
}
}
/* 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),
@ -376,11 +385,6 @@ gnc_split_register_load (SplitRegister *reg, GList * slist,
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);
}
table->model->dividing_row = -1;

View File

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

View File

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

View File

@ -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,6 +2157,7 @@ split_register_gconf_changed (GConfEntry *entry, gpointer user_data)
if (!info)
return;
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);
@ -2166,6 +2168,12 @@ split_register_gconf_changed (GConfEntry *entry, gpointer user_data)
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);