r23243 - gnucash/trunk/src - Gnc-Prefs: migrate account_separator preference (and associated GtkEntry widget)
Geert Janssens
gjanssens at code.gnucash.org
Mon Oct 7 10:15:30 EDT 2013
Author: gjanssens
Date: 2013-10-07 10:15:18 -0400 (Mon, 07 Oct 2013)
New Revision: 23243
Trac: http://svn.gnucash.org/trac/changeset/23243
Modified:
gnucash/trunk/src/app-utils/gnc-ui-util.c
gnucash/trunk/src/app-utils/gnc-ui-util.h
gnucash/trunk/src/business/business-ledger/gncEntryLedgerDisplay.c
gnucash/trunk/src/gnome-utils/account-quickfill.c
gnucash/trunk/src/gnome-utils/dialog-preferences.c
gnucash/trunk/src/gnome-utils/gnc-tree-model-split-reg.c
gnucash/trunk/src/gnome-utils/gtkbuilder/dialog-preferences.glade
gnucash/trunk/src/register/ledger-core/split-register.c
Log:
Gnc-Prefs: migrate account_separator preference (and associated GtkEntry widget)
All GtkEntries now use the new preferences backend
so drop the GtkEntry-Gconf wiring as well.
Modified: gnucash/trunk/src/app-utils/gnc-ui-util.c
===================================================================
--- gnucash/trunk/src/app-utils/gnc-ui-util.c 2013-10-07 14:14:27 UTC (rev 23242)
+++ gnucash/trunk/src/app-utils/gnc-ui-util.c 2013-10-07 14:15:18 UTC (rev 23243)
@@ -76,6 +76,25 @@
static gchar *user_default_currency = NULL;
static gchar *user_report_currency = NULL;
+gchar *gnc_normalize_account_separator (const gchar* separator)
+{
+ gchar *new_sep=NULL;
+
+ if (!separator || !*separator || g_strcmp0(separator, "colon") == 0)
+ new_sep = g_strdup (":");
+ else if (g_strcmp0(separator, "slash") == 0)
+ new_sep = g_strdup ("/");
+ else if (g_strcmp0(separator, "backslash") == 0)
+ new_sep = g_strdup ("\\");
+ else if (g_strcmp0(separator, "dash") == 0)
+ new_sep = g_strdup ("-");
+ else if (g_strcmp0(separator, "period") == 0)
+ new_sep = g_strdup (".");
+ else
+ new_sep = g_strdup (separator);
+
+ return new_sep;
+}
/********************************************************************\
* gnc_configure_account_separator *
* updates the current account separator character *
@@ -85,28 +104,16 @@
static void
gnc_configure_account_separator (void)
{
- const gchar *separator;
+ gchar *separator;
char *string;
string = gnc_prefs_get_string(GNC_PREFS_GROUP_GENERAL, GNC_PREF_ACCOUNT_SEPARATOR);
+ separator = gnc_normalize_account_separator (string);
- if (!string || !*string || g_strcmp0(string, "colon") == 0)
- separator = ":";
- else if (g_strcmp0(string, "slash") == 0)
- separator = "/";
- else if (g_strcmp0(string, "backslash") == 0)
- separator = "\\";
- else if (g_strcmp0(string, "dash") == 0)
- separator = "-";
- else if (g_strcmp0(string, "period") == 0)
- separator = ".";
- else
- separator = string;
-
gnc_set_account_separator(separator);
- if (string != NULL)
- free(string);
+ g_free(string);
+ g_free(separator);
}
Modified: gnucash/trunk/src/app-utils/gnc-ui-util.h
===================================================================
--- gnucash/trunk/src/app-utils/gnc-ui-util.h 2013-10-07 14:14:27 UTC (rev 23242)
+++ gnucash/trunk/src/app-utils/gnc-ui-util.h 2013-10-07 14:15:18 UTC (rev 23243)
@@ -43,6 +43,7 @@
typedef QofSession * (*QofSessionCB) (void);
+gchar *gnc_normalize_account_separator (const gchar* separator);
gboolean gnc_reverse_balance(const Account *account);
/* Default directory sections ***************************************/
Modified: gnucash/trunk/src/business/business-ledger/gncEntryLedgerDisplay.c
===================================================================
--- gnucash/trunk/src/business/business-ledger/gncEntryLedgerDisplay.c 2013-10-07 14:14:27 UTC (rev 23242)
+++ gnucash/trunk/src/business/business-ledger/gncEntryLedgerDisplay.c 2013-10-07 14:15:18 UTC (rev 23243)
@@ -28,7 +28,7 @@
#include "gnc-ui-util.h"
#include "gnc-component-manager.h"
#include "gnc-event.h"
-#include "gnc-gconf-utils.h"
+#include "gnc-prefs.h"
#include "gncEntry.h"
#include "gncEntryLedger.h"
@@ -73,19 +73,19 @@
}
static void
-gnc_entry_ledger_gconf_changed (GConfEntry *entry, gpointer user_data)
+gnc_entry_ledger_pref_changed (gpointer prefs, gchar *pref, gpointer user_data)
{
GncEntryLedger *ledger = user_data;
- g_return_if_fail (ledger && entry && entry->key);
+ g_return_if_fail (ledger && pref);
- if (g_str_has_suffix (entry->key, KEY_ACCOUNT_SEPARATOR))
+ if (g_str_has_suffix (pref, GNC_PREF_ACCOUNT_SEPARATOR))
{
gnc_entry_ledger_display_refresh (ledger);
}
else
{
- g_warning ("gnc_entry_gconf_changed: Unknown gconf key %s", entry->key);
+ g_warning ("gnc_entry_ledger_pref_changed: Unknown preference %s", pref);
}
}
@@ -182,8 +182,8 @@
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_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_ACCOUNT_SEPARATOR,
+ gnc_entry_ledger_pref_changed, ledger);
gnc_entry_ledger_display_refresh (ledger);
}
@@ -194,8 +194,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);
+ gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL, GNC_PREF_ACCOUNT_SEPARATOR,
+ gnc_entry_ledger_pref_changed, ledger);
}
void
Modified: gnucash/trunk/src/gnome-utils/account-quickfill.c
===================================================================
--- gnucash/trunk/src/gnome-utils/account-quickfill.c 2013-10-07 14:14:27 UTC (rev 23242)
+++ gnucash/trunk/src/gnome-utils/account-quickfill.c 2013-10-07 14:15:18 UTC (rev 23243)
@@ -23,7 +23,6 @@
#include "config.h"
#include "account-quickfill.h"
-#include "gnc-gconf-utils.h"
#include "gnc-engine.h"
#include "gnc-prefs.h"
#include "gnc-ui-util.h"
@@ -31,9 +30,6 @@
/* This static indicates the debugging module that this .o belongs to. */
static QofLogModule log_module = GNC_MOD_REGISTER;
-/* FIXME to delete when gconf conversion is complete */
-static void shared_quickfill_gconf_changed (GConfEntry *entry, gpointer qfb);
-/* FIXME delete until here */
static void shared_quickfill_pref_changed (gpointer prefs, gchar *pref, gpointer qfb);
static void listen_for_account_events (QofInstance *entity, QofEventId event_type,
gpointer user_data, gpointer event_data);
@@ -69,10 +65,11 @@
shared_quickfill_destroy (QofBook *book, gpointer key, gpointer user_data)
{
QFB *qfb = user_data;
- gnc_gconf_general_remove_cb(KEY_ACCOUNT_SEPARATOR,
- shared_quickfill_gconf_changed,
- qfb);
gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL_REGISTER,
+ GNC_PREF_ACCOUNT_SEPARATOR,
+ shared_quickfill_pref_changed,
+ qfb);
+ gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL_REGISTER,
GNC_PREF_SHOW_LEAF_ACCT_NAMES,
shared_quickfill_pref_changed,
qfb);
@@ -144,22 +141,7 @@
g_free(name);
}
-/* FIXME to delete when gconf conversion is complete */
-static void
-shared_quickfill_gconf_changed (GConfEntry *entry, gpointer user_data)
-{
- QFB *qfb = user_data;
- /* Reload the quickfill */
- gnc_quickfill_purge(qfb->qf);
- gtk_list_store_clear(qfb->list_store);
- qfb->load_list_store = TRUE;
- gnc_account_foreach_descendant(qfb->root, load_shared_qf_cb, qfb);
- qfb->load_list_store = FALSE;
-}
-/* FIXME delete until here */
-
-
static void
shared_quickfill_pref_changed (gpointer prefs, gchar *pref, gpointer user_data)
{
@@ -194,14 +176,15 @@
qfb->list_store =
gtk_list_store_new (NUM_ACCOUNT_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER);
- gnc_gconf_general_register_cb(KEY_ACCOUNT_SEPARATOR,
- shared_quickfill_gconf_changed,
- qfb);
+ gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
+ GNC_PREF_ACCOUNT_SEPARATOR,
+ shared_quickfill_pref_changed,
+ qfb);
- gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL_REGISTER,
- GNC_PREF_SHOW_LEAF_ACCT_NAMES,
- shared_quickfill_pref_changed,
- qfb);
+ gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL_REGISTER,
+ GNC_PREF_SHOW_LEAF_ACCT_NAMES,
+ shared_quickfill_pref_changed,
+ qfb);
gnc_account_foreach_descendant(root, load_shared_qf_cb, qfb);
qfb->load_list_store = FALSE;
Modified: gnucash/trunk/src/gnome-utils/dialog-preferences.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-preferences.c 2013-10-07 14:14:27 UTC (rev 23242)
+++ gnucash/trunk/src/gnome-utils/dialog-preferences.c 2013-10-07 14:15:18 UTC (rev 23243)
@@ -88,8 +88,9 @@
static QofLogModule log_module = GNC_MOD_PREFS;
void gnc_preferences_response_cb(GtkDialog *dialog, gint response, GtkDialog *unused);
+void gnc_account_separator_pref_changed_cb (GtkEntry *entry, GtkWidget *dialog);
+gboolean gnc_account_separator_validate_cb (GtkEntry *entry, GdkEvent *event, GtkWidget *dialog);
-
/** This data structure holds the information for a single addition to
* the preferences dialog. */
typedef struct addition_t
@@ -114,25 +115,43 @@
* structures. */
GSList *add_ins = NULL;
+static gchar *gnc_account_separator_is_valid (const gchar *separator,
+ gchar **normalized_separator)
+{
+ QofBook *book = gnc_get_current_book();
+ GList *conflict_accts = NULL;
+ gchar *message = NULL;
+ *normalized_separator = gnc_normalize_account_separator (separator);
+ conflict_accts = gnc_account_list_name_violations (book, *normalized_separator);
+ if (conflict_accts)
+ message = gnc_account_name_violations_errmsg (*normalized_separator,
+ conflict_accts);
+
+ g_list_free (conflict_accts);
+
+ return message;
+}
+
/** This function is called whenever the account separator is changed
- * in gconf. It updates the example label in the "Account" page of the
- * preferences dialog.
+ * in the preferences dialog. It updates the example label in the
+ * "Account" page of the preferences dialog.
*
* @internal
*
- * @param unused A pointer to the changed gconf entry.
+ * @param entry The text entry field for the account separator
*
* @param dialog A pointer to the preferences dialog.
*/
-static void
-gnc_account_separator_prefs_cb (GConfEntry *unused, GtkWidget *dialog)
+void
+gnc_account_separator_pref_changed_cb (GtkEntry *entry, GtkWidget *dialog)
{
GtkWidget *label, *image;
gchar *sample;
- GList *invalid_account_names;
- QofBook *book;
+ gchar *separator;
+ gchar *conflict_msg = gnc_account_separator_is_valid (gtk_entry_get_text (entry), &separator);
+
label = g_object_get_data(G_OBJECT(dialog), "sample_account");
DEBUG("Sample Account pointer is %p", label );
/* Translators: Both %s will be the account separator character; the
@@ -142,8 +161,7 @@
language - just keep in mind to have exactly two %s in your
translation. */
sample = g_strdup_printf(_("Income%sSalary%sTaxable"),
- gnc_get_account_separator_string(),
- gnc_get_account_separator_string());
+ separator, separator);
PINFO(" Label set to '%s'", sample);
gtk_label_set_text(GTK_LABEL(label), sample);
g_free(sample);
@@ -151,25 +169,38 @@
/* Check if the new separator clashes with existing account names */
image = g_object_get_data(G_OBJECT(dialog), "separator_error");
DEBUG("Separator Error Image pointer is %p", image );
- book = gnc_get_current_book();
- invalid_account_names = gnc_account_list_name_violations ( book,
- gnc_get_account_separator_string() );
- if ( invalid_account_names )
+
+ if (conflict_msg)
{
- gchar *message = gnc_account_name_violations_errmsg ( gnc_get_account_separator_string(),
- invalid_account_names );
- gnc_warning_dialog(dialog, "%s", message);
- gtk_widget_set_tooltip_text(GTK_WIDGET(image), message);
+ gtk_widget_set_tooltip_text(GTK_WIDGET(image), conflict_msg);
gtk_widget_show (GTK_WIDGET(image));
- g_free ( message );
+ g_free ( conflict_msg );
}
else
gtk_widget_hide (GTK_WIDGET(image));
- g_list_free ( invalid_account_names );
+ g_free (separator);
}
+gboolean
+gnc_account_separator_validate_cb (GtkEntry *entry, GdkEvent *event, GtkWidget *dialog)
+{
+ gchar *separator;
+ gchar *conflict_msg = gnc_account_separator_is_valid (gtk_entry_get_text (entry), &separator);
+
+ /* Check if the new separator clashes with existing account names */
+
+ if (conflict_msg)
+ {
+ gnc_warning_dialog(dialog, "%s", conflict_msg);
+ g_free ( conflict_msg );
+ }
+ g_free (separator);
+ return FALSE;
+}
+
+
/** This function compares two add-ins to see if they specify the same
* tab name.
*
@@ -864,74 +895,6 @@
/****************************************************************************/
-/** The user changed a gtk entry. Update gconf.
- *
- * @internal
- *
- * @param entry A pointer to the entry that was changed.
- *
- * @param user_data Unused.
- */
-static void
-gnc_prefs_entry_user_cb_gconf (GtkEntry *entry,
- gpointer user_data)
-{
- const gchar *name, *text;
-
- g_return_if_fail(GTK_IS_ENTRY(entry));
- name = gtk_buildable_get_name(GTK_BUILDABLE(entry)) + PREFIX_LEN;
- text = gtk_entry_get_text(entry);
- DEBUG("entry %s set to '%s'", name, text);
- gnc_gconf_set_string(name, NULL, text, NULL);
-}
-
-
-/** A gtk entry was updated in gconf. Update the user visible dialog.
- *
- * @internal
- *
- * @param entry A pointer to the gtk entry that changed.
- *
- * @param value The new value of the combo box.
- */
-static void
-gnc_prefs_entry_gconf_cb_gconf (GtkEntry *entry,
- const gchar *value)
-{
- g_return_if_fail(GTK_IS_ENTRY(entry));
- ENTER("entry %p, value '%s'", entry, value);
- g_signal_handlers_block_by_func(G_OBJECT(entry),
- G_CALLBACK(gnc_prefs_entry_user_cb_gconf), NULL);
- gtk_entry_set_text(entry, value);
- g_signal_handlers_unblock_by_func(G_OBJECT(entry),
- G_CALLBACK(gnc_prefs_entry_user_cb_gconf), NULL);
- LEAVE(" ");
-}
-
-
-/** Connect a entry widget to the user callback function. Set the
- * starting state of the entry from its value in gconf.
- *
- * @internal
- *
- * @param entry A pointer to the entry that should be connected.
- */
-static void
-gnc_prefs_connect_entry_gconf (GtkEntry *entry)
-{
- const gchar *name;
- gchar *text;
-
- g_return_if_fail(GTK_IS_ENTRY(entry));
- name = gtk_buildable_get_name(GTK_BUILDABLE(entry)) + PREFIX_LEN;
- text = gnc_gconf_get_string(name, NULL, NULL);
- gtk_entry_set_text(GTK_ENTRY(entry), text ? text : "");
- DEBUG(" Entry %s set to '%s'", name ? name : "(null)", text ? text : "(null)");
- g_free(text);
- g_signal_connect(G_OBJECT(entry), "changed",
- G_CALLBACK(gnc_prefs_entry_user_cb_gconf), NULL);
-}
-
/****************************************************************************/
/** The user changed a GncPeriodSelect widget. Update gconf.
@@ -1221,8 +1184,37 @@
g_free (pref);
}
+/****************************************************************************/
+/** Connect a GtkEntry widget to its stored value in the preferences database.
+ *
+ * @internal
+ *
+ * @param entry A pointer to the entry that should be connected.
+ */
+static void
+gnc_prefs_connect_entry (GtkEntry *entry)
+{
+ gchar *group, *pref;
+ gchar *text;
+ g_return_if_fail(GTK_IS_ENTRY(entry));
+
+ gnc_prefs_split_widget_name (gtk_buildable_get_name(GTK_BUILDABLE(entry)), &group, &pref);
+
+// text = gnc_prefs_get_string(group, pref);
+// gtk_entry_set_text(GTK_ENTRY(entry), text ? text : "");
+// DEBUG(" Entry %s/%s set to '%s'", group, pref, text ? text : "(null)");
+// g_free(text);
+
+ gnc_prefs_bind (group, pref, G_OBJECT (entry), "text");
+
+ g_free (group);
+ g_free (pref);
+}
+
+
+
/****************************************************************************/
/********************/
@@ -1255,10 +1247,6 @@
gnc_save_window_size(GNC_PREFS_GROUP, GTK_WINDOW(dialog));
gnc_unregister_gui_component_by_data(DIALOG_PREFERENCES_CM_CLASS,
dialog);
- gnc_gconf_general_remove_cb(
- KEY_ACCOUNT_SEPARATOR,
- (GncGconfGeneralCb)gnc_account_separator_prefs_cb,
- dialog);
gnc_gconf_remove_notification(G_OBJECT(dialog), NULL,
DIALOG_PREFERENCES_CM_CLASS);
gtk_widget_destroy(GTK_WIDGET(dialog));
@@ -1296,11 +1284,6 @@
DEBUG(" %s - radio button", name);
gnc_prefs_connect_radio_button_gconf(GTK_RADIO_BUTTON(widget));
}
- else if (GTK_IS_ENTRY(widget))
- {
- DEBUG(" %s - entry", name);
- gnc_prefs_connect_entry_gconf(GTK_ENTRY(widget));
- }
else if (GTK_IS_HBOX(widget))
{
/* Test custom widgets are all children of a hbox */
@@ -1374,6 +1357,11 @@
DEBUG(" %s - combo box", name);
gnc_prefs_connect_combo_box(GTK_COMBO_BOX(widget));
}
+ else if (GTK_IS_ENTRY(widget))
+ {
+ DEBUG(" %s - entry", name);
+ gnc_prefs_connect_entry(GTK_ENTRY(widget));
+ }
else
{
DEBUG(" %s - unsupported %s", name,
@@ -1421,6 +1409,12 @@
gnc_builder_add_from_file (builder, "dialog-preferences.glade", "GnuCash Preferences");
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "GnuCash Preferences"));
+ label = GTK_WIDGET(gtk_builder_get_object (builder, "sample_account"));
+ g_object_set_data(G_OBJECT(dialog), "sample_account", label);
+
+ image = GTK_WIDGET(gtk_builder_get_object (builder, "separator_error"));
+ g_object_set_data(G_OBJECT(dialog), "separator_error", image);
+
DEBUG("autoconnect");
gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, dialog);
@@ -1496,14 +1490,6 @@
label = GTK_WIDGET(gtk_builder_get_object (builder, "locale_currency2"));
gtk_label_set_label(GTK_LABEL(label), currency_name);
- label = GTK_WIDGET(gtk_builder_get_object (builder, "sample_account"));
- g_object_set_data(G_OBJECT(dialog), "sample_account", label);
-
- image = GTK_WIDGET(gtk_builder_get_object (builder, "separator_error"));
- g_object_set_data(G_OBJECT(dialog), "separator_error", image);
-
- gnc_account_separator_prefs_cb(NULL, dialog);
-
g_object_unref(G_OBJECT(builder));
LEAVE("dialog %p", dialog);
@@ -1627,12 +1613,6 @@
DEBUG("widget %p - radio button", widget);
gnc_prefs_radio_button_gconf_cb_gconf(GTK_RADIO_BUTTON(widget));
}
- else if (GTK_IS_ENTRY(widget))
- {
- DEBUG("widget %p - entry", widget);
- gnc_prefs_entry_gconf_cb_gconf(GTK_ENTRY(widget),
- gconf_value_get_string(entry->value));
- }
else if (GTK_IS_HBOX(widget))
{
/* Test custom widgets are all children of a hbox */
@@ -1744,9 +1724,6 @@
gnc_gconf_add_notification(G_OBJECT(dialog), NULL,
gnc_preferences_gconf_changed,
DIALOG_PREFERENCES_CM_CLASS);
- gnc_gconf_general_register_cb(KEY_ACCOUNT_SEPARATOR,
- (GncGconfGeneralCb)gnc_account_separator_prefs_cb,
- dialog);
gnc_register_gui_component(DIALOG_PREFERENCES_CM_CLASS,
NULL, close_handler, dialog);
Modified: gnucash/trunk/src/gnome-utils/gnc-tree-model-split-reg.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-tree-model-split-reg.c 2013-10-07 14:14:27 UTC (rev 23242)
+++ gnucash/trunk/src/gnome-utils/gnc-tree-model-split-reg.c 2013-10-07 14:15:18 UTC (rev 23243)
@@ -342,51 +342,26 @@
static void
-gnc_tree_model_split_reg_gconf_changed (GConfEntry *entry, gpointer user_data)
+gnc_tree_model_split_reg_prefs_changed (gpointer prefs, gchar *pref, gpointer user_data)
{
GncTreeModelSplitReg *model = user_data;
- g_return_if_fail (entry && entry->key);
+ g_return_if_fail (pref);
if (model == NULL)
return;
- if (g_str_has_suffix (entry->key, KEY_ACCOUNTING_LABELS))
+ if (g_str_has_suffix (pref, GNC_PREF_ACCOUNTING_LABELS))
{
- model->use_accounting_labels = gnc_gconf_get_bool (GCONF_GENERAL, KEY_ACCOUNTING_LABELS, NULL);
- }
- else if (g_str_has_suffix (entry->key, KEY_ACCOUNT_SEPARATOR))
- {
- model->separator_changed = TRUE;
- }
- else
- {
- g_warning("gnc_tree_model_split_reg_gconf_changed: Unknown gconf key %s", entry->key);
- }
-}
-
-
-static void
-gnc_tree_model_split_reg_prefs_changed (gpointer gsettings, gchar *key, gpointer user_data)
-{
- GncTreeModelSplitReg *model = user_data;
-
- g_return_if_fail (key);
-
- if (model == NULL)
- return;
-
- if (g_str_has_suffix (key, GNC_PREF_ACCOUNTING_LABELS))
- {
model->use_accounting_labels = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_ACCOUNTING_LABELS);
}
- else if (g_str_has_suffix (key, GNC_PREF_ACCOUNT_SEPARATOR))
+ else if (g_str_has_suffix (pref, GNC_PREF_ACCOUNT_SEPARATOR))
{
model->separator_changed = TRUE;
}
else
{
- g_warning("gnc_tree_model_split_reg_prefs_changed: Unknown gsettings key %s", key);
+ g_warning("gnc_tree_model_split_reg_prefs_changed: Unknown preference %s", pref);
}
}
@@ -408,9 +383,10 @@
GNC_PREF_ACCOUNTING_LABELS,
gnc_tree_model_split_reg_prefs_changed,
model);
- gnc_gconf_general_register_cb (KEY_ACCOUNT_SEPARATOR,
- gnc_tree_model_split_reg_gconf_changed,
- model);
+ gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
+ GNC_PREF_ACCOUNT_SEPARATOR,
+ gnc_tree_model_split_reg_prefs_changed,
+ model);
LEAVE(" ");
}
@@ -978,9 +954,10 @@
GNC_PREF_ACCOUNTING_LABELS,
gnc_tree_model_split_reg_prefs_changed,
model);
- gnc_gconf_general_remove_cb (KEY_ACCOUNT_SEPARATOR,
- gnc_tree_model_split_reg_gconf_changed,
- model);
+ gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL,
+ GNC_PREF_ACCOUNT_SEPARATOR,
+ gnc_tree_model_split_reg_prefs_changed,
+ model);
LEAVE(" ");
}
Modified: gnucash/trunk/src/gnome-utils/gtkbuilder/dialog-preferences.glade
===================================================================
--- gnucash/trunk/src/gnome-utils/gtkbuilder/dialog-preferences.glade 2013-10-07 14:14:27 UTC (rev 23242)
+++ gnucash/trunk/src/gnome-utils/gtkbuilder/dialog-preferences.glade 2013-10-07 14:15:18 UTC (rev 23243)
@@ -728,9 +728,10 @@
</packing>
</child>
<child>
- <object class="GtkEntry" id="gconf/general/account_separator">
+ <object class="GtkEntry" id="pref/general/account_separator">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="events">GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK</property>
<property name="has_tooltip">True</property>
<property name="tooltip_markup">The character that will be used between components of an account name. A legal value is any single character except letters and numbers, or any of the following strings: "colon" "slash", "backslash", "dash" and "period".</property>
<property name="tooltip_text" translatable="yes">The character that will be used between components of an account name. A legal value is any single character except letters and numbers, or any of the following strings: "colon" "slash", "backslash", "dash" and "period".</property>
@@ -740,6 +741,8 @@
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
+ <signal name="changed" handler="gnc_account_separator_pref_changed_cb" swapped="no"/>
+ <signal name="focus-out-event" handler="gnc_account_separator_validate_cb" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
@@ -1661,7 +1664,7 @@
<property name="xalign">0</property>
<property name="label" translatable="yes">_Retain log files:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">gconf/general/retain_days</property>
+ <property name="mnemonic_widget">pref/general/retain_days</property>
</object>
<packing>
<property name="right_attach">4</property>
Modified: gnucash/trunk/src/register/ledger-core/split-register.c
===================================================================
--- gnucash/trunk/src/register/ledger-core/split-register.c 2013-10-07 14:14:27 UTC (rev 23242)
+++ gnucash/trunk/src/register/ledger-core/split-register.c 2013-10-07 14:15:18 UTC (rev 23243)
@@ -33,9 +33,9 @@
#include "datecell.h"
#include "dialog-utils.h"
#include "gnc-component-manager.h"
-#include "gnc-gconf-utils.h"
#include "split-register-p.h"
#include "gnc-ledger-display.h"
+#include "gnc-prefs.h"
#include "gnc-ui.h"
#include "guile-util.h"
#include "numcell.h"
@@ -2526,12 +2526,12 @@
}
static void
-split_register_gconf_changed (GConfEntry *entry, gpointer user_data)
+split_register_pref_changed (gpointer prefs, gchar *pref, gpointer user_data)
{
SplitRegister * reg = user_data;
SRInfo *info;
- g_return_if_fail(entry && entry->key);
+ g_return_if_fail(pref);
if (reg == NULL)
return;
@@ -2539,7 +2539,7 @@
if (!info)
return;
- if (g_str_has_suffix(entry->key, KEY_ACCOUNTING_LABELS))
+ if (g_str_has_suffix(pref, GNC_PREF_ACCOUNTING_LABELS))
{
/* Release current strings. Will be reloaded at next reference. */
g_free (info->debit_str);
@@ -2553,13 +2553,13 @@
info->tcredit_str = NULL;
}
- else if (g_str_has_suffix(entry->key, KEY_ACCOUNT_SEPARATOR))
+ else if (g_str_has_suffix(pref, GNC_PREF_ACCOUNT_SEPARATOR))
{
info->separator_changed = TRUE;
}
else
{
- g_warning("split_register_gconf_changed: Unknown gconf key %s", entry->key);
+ g_warning("split_register_pref_changed: Unknown preference %s", pref);
}
}
@@ -2588,12 +2588,14 @@
TableControl *control;
/* Register 'destroy' callback */
- 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);
+ gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
+ GNC_PREF_ACCOUNTING_LABELS,
+ split_register_pref_changed,
+ reg);
+ gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
+ GNC_PREF_ACCOUNT_SEPARATOR,
+ split_register_pref_changed,
+ reg);
gnc_book_option_register_cb(OPTION_NAME_NUM_FIELD_SOURCE,
split_register_book_option_changed,
reg);
@@ -2849,12 +2851,14 @@
ENTER("reg=%p", 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_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL,
+ GNC_PREF_ACCOUNTING_LABELS,
+ split_register_pref_changed,
+ reg);
+ gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL,
+ GNC_PREF_ACCOUNT_SEPARATOR,
+ split_register_pref_changed,
+ reg);
gnc_book_option_remove_cb(OPTION_NAME_NUM_FIELD_SOURCE,
split_register_book_option_changed,
reg);
More information about the gnucash-changes
mailing list