AUDIT: r17151 - gnucash/trunk/src - Bug #489502: When changing the account separator, let registers pick up the new char.
Andreas Köhler
andi5 at cvs.gnucash.org
Sun May 11 13:31:24 EDT 2008
Author: andi5
Date: 2008-05-11 13:31:24 -0400 (Sun, 11 May 2008)
New Revision: 17151
Trac: http://svn.gnucash.org/trac/changeset/17151
Modified:
gnucash/trunk/src/business/business-ledger/gncEntryLedgerDisplay.c
gnucash/trunk/src/register/ledger-core/split-register-load.c
gnucash/trunk/src/register/ledger-core/split-register-p.h
gnucash/trunk/src/register/ledger-core/split-register-util.c
gnucash/trunk/src/register/ledger-core/split-register.c
Log:
Bug #489502: When changing the account separator, let registers pick up the new char.
BP
Modified: gnucash/trunk/src/business/business-ledger/gncEntryLedgerDisplay.c
===================================================================
--- gnucash/trunk/src/business/business-ledger/gncEntryLedgerDisplay.c 2008-05-11 16:56:34 UTC (rev 17150)
+++ gnucash/trunk/src/business/business-ledger/gncEntryLedgerDisplay.c 2008-05-11 17:31:24 UTC (rev 17151)
@@ -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"
@@ -71,6 +72,20 @@
}
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)
{
GList *node;
@@ -155,6 +170,9 @@
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 @@
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
Modified: gnucash/trunk/src/register/ledger-core/split-register-load.c
===================================================================
--- gnucash/trunk/src/register/ledger-core/split-register-load.c 2008-05-11 16:56:34 UTC (rev 17150)
+++ gnucash/trunk/src/register/ledger-core/split-register-load.c 2008-05-11 17:31:24 UTC (rev 17151)
@@ -363,24 +363,28 @@
}
}
+ /* 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());
-
+ (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());
-
+ (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);
+ (RecnCell *) gnc_table_layout_get_cell(table->layout, RECN_CELL),
+ gnc_split_register_recn_cell_confirm, reg);
}
table->model->dividing_row = -1;
Modified: gnucash/trunk/src/register/ledger-core/split-register-p.h
===================================================================
--- gnucash/trunk/src/register/ledger-core/split-register-p.h 2008-05-11 16:56:34 UTC (rev 17150)
+++ gnucash/trunk/src/register/ledger-core/split-register-p.h 2008-05-11 17:31:24 UTC (rev 17151)
@@ -108,6 +108,9 @@
char *credit_str;
char *tdebit_str;
char *tcredit_str;
+
+ /* true if the account separator has changed */
+ gboolean separator_changed;
};
Modified: gnucash/trunk/src/register/ledger-core/split-register-util.c
===================================================================
--- gnucash/trunk/src/register/ledger-core/split-register-util.c 2008-05-11 16:56:34 UTC (rev 17150)
+++ gnucash/trunk/src/register/ledger-core/split-register-util.c 2008-05-11 17:31:24 UTC (rev 17151)
@@ -55,6 +55,7 @@
info->first_pass = TRUE;
info->full_refresh = TRUE;
+ info->separator_changed = TRUE;
reg->sr_info = info;
}
Modified: gnucash/trunk/src/register/ledger-core/split-register.c
===================================================================
--- gnucash/trunk/src/register/ledger-core/split-register.c 2008-05-11 16:56:34 UTC (rev 17150)
+++ gnucash/trunk/src/register/ledger-core/split-register.c 2008-05-11 17:31:24 UTC (rev 17151)
@@ -2149,6 +2149,7 @@
SplitRegister * reg = user_data;
SRInfo *info;
+ g_return_if_fail(entry && entry->key);
if (reg == NULL)
return;
@@ -2156,16 +2157,23 @@
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_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_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);
More information about the gnucash-changes
mailing list