diff --git a/src/business/business-gnome/dialog-invoice.c b/src/business/business-gnome/dialog-invoice.c index 253c0b814c..42fc3196aa 100644 --- a/src/business/business-gnome/dialog-invoice.c +++ b/src/business/business-gnome/dialog-invoice.c @@ -38,6 +38,7 @@ #include "gnc-ui.h" #include "gnc-gconf-utils.h" #include "gnc-gui-query.h" +#include "gnc-prefs.h" #include "gnc-ui-util.h" #include "gnc-date-edit.h" #include "gnc-amount-edit.h" @@ -85,7 +86,9 @@ #define DIALOG_NEW_INVOICE_CM_CLASS "dialog-new-invoice" #define DIALOG_VIEW_INVOICE_CM_CLASS "dialog-view-invoice" -#define GNC_PREFS_GROUP_SEARCH "dialogs.business.invoice_search" +#define GNC_PREFS_GROUP_SEARCH "dialogs.business.invoice_search" +#define GNC_PREF_NOTIFY_WHEN_DUE "notify_when_due" +#define GNC_PREF_ACCUM_SPLITS "accumulate_splits" #define LAST_POSTED_TO_ACCT "last-posted-to-acct" @@ -726,7 +729,7 @@ gnc_dialog_post_invoice(InvoiceWindow *iw, char *message, iw->book); /* Get the default for the accumulate option */ - *accumulate = gnc_gconf_get_bool(GCONF_SECTION_INVOICE, "accumulate_splits", NULL); + *accumulate = gnc_prefs_get_bool(GNC_PREFS_GROUP_INVOICE, GNC_PREF_ACCUM_SPLITS); if (!gnc_dialog_dates_acct_question_parented (iw_get_window(iw), message, ddue_label, post_label, acct_label, question_label, TRUE, TRUE, @@ -2185,7 +2188,7 @@ gnc_invoice_create_page (InvoiceWindow *iw, gpointer page) GncEntryLedger *entry_ledger = NULL; GncOwnerType owner_type; GncEntryLedgerType ledger_type; - const gchar *gconf_section = NULL; + const gchar *prefs_group = NULL; gboolean is_credit_note = FALSE; invoice = gncInvoiceLookup (iw->book, &iw->invoice_guid); @@ -2292,17 +2295,17 @@ gnc_invoice_create_page (InvoiceWindow *iw, gpointer page) case GNC_OWNER_CUSTOMER: ledger_type = is_credit_note ? GNCENTRY_CUST_CREDIT_NOTE_VIEWER : GNCENTRY_INVOICE_VIEWER; - gconf_section = GCONF_SECTION_INVOICE; + prefs_group = GNC_PREFS_GROUP_INVOICE; break; case GNC_OWNER_VENDOR: ledger_type = is_credit_note ? GNCENTRY_VEND_CREDIT_NOTE_VIEWER : GNCENTRY_BILL_VIEWER; - gconf_section = GCONF_SECTION_BILL; + prefs_group = GNC_PREFS_GROUP_BILL; break; case GNC_OWNER_EMPLOYEE: ledger_type = is_credit_note ? GNCENTRY_EMPL_CREDIT_NOTE_VIEWER : GNCENTRY_EXPVOUCHER_VIEWER; - gconf_section = GCONF_SECTION_BILL; + prefs_group = GNC_PREFS_GROUP_BILL; break; default: g_warning ("Invalid owner type"); @@ -2319,8 +2322,8 @@ gnc_invoice_create_page (InvoiceWindow *iw, gpointer page) /* Set the entry_ledger's invoice */ gnc_entry_ledger_set_default_invoice (entry_ledger, invoice); - /* Set the gconf section */ - gnc_entry_ledger_set_gconf_section (entry_ledger, gconf_section); + /* Set the preferences group */ + gnc_entry_ledger_set_prefs_group (entry_ledger, prefs_group); /* Setup initial values */ iw->component_id = @@ -3222,7 +3225,7 @@ gnc_invoice_remind_bills_due (void) void gnc_invoice_remind_bills_due_cb (void) { - if (!gnc_gconf_get_bool(GCONF_SECTION_BILL, "notify_when_due", NULL)) + if (!gnc_prefs_get_bool(GNC_PREFS_GROUP_BILL, GNC_PREF_NOTIFY_WHEN_DUE)) return; gnc_invoice_remind_bills_due(); diff --git a/src/business/business-gnome/dialog-invoice.h b/src/business/business-gnome/dialog-invoice.h index d0aed32e27..a87b08a79d 100644 --- a/src/business/business-gnome/dialog-invoice.h +++ b/src/business/business-gnome/dialog-invoice.h @@ -49,6 +49,9 @@ typedef enum #define GCONF_SECTION_INVOICE "dialogs/business/invoice" #define GCONF_SECTION_BILL "dialogs/business/bill" #define GCONF_SECTION_VOUCHER "dialogs/business/voucher" +#define GNC_PREFS_GROUP_INVOICE "dialogs.business.invoice" +#define GNC_PREFS_GROUP_BILL "dialogs.business.bill" +#define GNC_PREFS_GROUP_VOUCHER "dialogs.business.voucher" /* Create and edit an invoice */ diff --git a/src/business/business-gnome/gnc-plugin-page-invoice.c b/src/business/business-gnome/gnc-plugin-page-invoice.c index 48d8a0e66e..437313cd87 100644 --- a/src/business/business-gnome/gnc-plugin-page-invoice.c +++ b/src/business/business-gnome/gnc-plugin-page-invoice.c @@ -38,6 +38,7 @@ #include "gnc-gnome-utils.h" #include "gnc-icons.h" #include "gnucash-sheet.h" +#include "gnc-prefs.h" #include "gnc-ui-util.h" #include "gnc-window.h" @@ -377,7 +378,7 @@ gnc_plugin_page_invoice_init (GncPluginPageInvoice *plugin_page) /* Init parent declared variables */ parent = GNC_PLUGIN_PAGE(plugin_page); - use_new = gnc_gconf_get_bool(GCONF_SECTION_INVOICE, KEY_USE_NEW, NULL); + use_new = gnc_prefs_get_bool (GNC_PREFS_GROUP_INVOICE, GNC_PREF_USE_NEW); g_object_set(G_OBJECT(plugin_page), "page-name", _("Invoice"), "page-uri", "default:", diff --git a/src/business/business-gnome/gtkbuilder/business-prefs.glade b/src/business/business-gnome/gtkbuilder/business-prefs.glade index 74fe2e7b77..41c09b874c 100644 --- a/src/business/business-gnome/gtkbuilder/business-prefs.glade +++ b/src/business/business-gnome/gtkbuilder/business-prefs.glade @@ -44,7 +44,7 @@ - + Ta_x included True True @@ -109,7 +109,7 @@ - + _Notify when due True True @@ -160,7 +160,7 @@ - + _Tax included True True @@ -182,7 +182,7 @@ - + _Accumulate splits on post True True @@ -204,7 +204,7 @@ - + _Open in new window True True diff --git a/src/business/business-ledger/gncEntryLedger.c b/src/business/business-ledger/gncEntryLedger.c index 510ccad2b4..cea7bc0d16 100644 --- a/src/business/business-ledger/gncEntryLedger.c +++ b/src/business/business-ledger/gncEntryLedger.c @@ -289,7 +289,7 @@ GncEntryLedger * gnc_entry_ledger_new (QofBook *book, GncEntryLedgerType type) ledger->type = type; ledger->book = book; ledger->traverse_to_new = TRUE; - ledger->gconf_section = NULL; + ledger->prefs_group = NULL; /* Orders and Invoices are "invoices" for lookups */ switch (type) @@ -956,12 +956,12 @@ gnc_entry_ledger_get_query (GncEntryLedger *ledger) } void -gnc_entry_ledger_set_gconf_section (GncEntryLedger *ledger, const gchar *string) +gnc_entry_ledger_set_prefs_group (GncEntryLedger *ledger, const gchar *string) { if (!ledger) return; - ledger->gconf_section = string; + ledger->prefs_group = string; } void gnc_entry_ledger_move_current_entry_updown (GncEntryLedger *ledger, diff --git a/src/business/business-ledger/gncEntryLedger.h b/src/business/business-ledger/gncEntryLedger.h index 7dc39752a0..0270e0ac2c 100644 --- a/src/business/business-ledger/gncEntryLedger.h +++ b/src/business/business-ledger/gncEntryLedger.h @@ -156,6 +156,6 @@ void gnc_entry_ledger_move_current_entry_updown (GncEntryLedger *ledger, QofQuery * gnc_entry_ledger_get_query (GncEntryLedger *ledger); -void gnc_entry_ledger_set_gconf_section (GncEntryLedger *ledger, const gchar *string); +void gnc_entry_ledger_set_prefs_group (GncEntryLedger *ledger, const gchar *string); #endif /* GNC_ENTRY_LEDGER_H */ diff --git a/src/business/business-ledger/gncEntryLedgerLoad.c b/src/business/business-ledger/gncEntryLedgerLoad.c index e7f8eb778a..f7a424d470 100644 --- a/src/business/business-ledger/gncEntryLedgerLoad.c +++ b/src/business/business-ledger/gncEntryLedgerLoad.c @@ -30,7 +30,7 @@ #include "account-quickfill.h" #include "combocell.h" #include "gnc-component-manager.h" -#include "gnc-gconf-utils.h" +#include "gnc-prefs.h" #include "gnc-ui-util.h" #include "recncell.h" @@ -42,6 +42,7 @@ #include "quickfillcell.h" #include "app-utils/gnc-entry-quickfill.h" +#define GNC_PREF_TAX_INCL "tax_included" /* XXX: This should go elsewhere */ const char * gnc_entry_ledger_type_string_getter (char flag) @@ -398,9 +399,9 @@ void gnc_entry_ledger_load (GncEntryLedger *ledger, GList *entry_list) taxincluded = FALSE; break; case GNC_TAXINCLUDED_USEGLOBAL: - if (ledger->gconf_section) + if (ledger->prefs_group) { - taxincluded = gnc_gconf_get_bool(ledger->gconf_section, "tax_included", NULL); + taxincluded = gnc_prefs_get_bool (ledger->prefs_group, GNC_PREF_TAX_INCL); } else { diff --git a/src/business/business-ledger/gncEntryLedgerP.h b/src/business/business-ledger/gncEntryLedgerP.h index 1a9b64e9c3..612897bda7 100644 --- a/src/business/business-ledger/gncEntryLedgerP.h +++ b/src/business/business-ledger/gncEntryLedgerP.h @@ -54,7 +54,7 @@ struct GncEntryLedger_s gboolean is_cust_doc; /* is this document customer or vendor related ? */ gboolean is_credit_note; /* is this an invoice (or a bill)? */ - const gchar * gconf_section; + const gchar * prefs_group; }; GncEntry * gnc_entry_ledger_get_entry (GncEntryLedger *ledger, diff --git a/src/gnome-utils/dialog-preferences.c b/src/gnome-utils/dialog-preferences.c index 1eded6c763..52942bbc55 100644 --- a/src/gnome-utils/dialog-preferences.c +++ b/src/gnome-utils/dialog-preferences.c @@ -752,78 +752,6 @@ gnc_prefs_connect_radio_button_gconf (GtkRadioButton *button) /****************************************************************************/ -/** The user clicked on a check button. Update gconf. Check button - * choices are stored as a boolean - * - * @internal - * - * @param button A pointer to the check button that was clicked. - * - * @param user_data Unused. - */ -static void -gnc_prefs_check_button_user_cb_gconf (GtkCheckButton *button, - gpointer user_data) -{ - const gchar *name; - gboolean active; - - g_return_if_fail(GTK_IS_CHECK_BUTTON(button)); - name = gtk_buildable_get_name(GTK_BUILDABLE(button)) + PREFIX_LEN; - active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); - DEBUG("Checkbox %s now %sactive", name, active ? "" : "in"); - gnc_gconf_set_bool(name, NULL, active, NULL); -} - - -/** A check button choice was updated in gconf. Update the user - * visible dialog. - * - * @internal - * - * @param button A pointer to the check button that changed. - * - * @param active The new state of the check button. - */ -static void -gnc_prefs_check_button_gconf_cb_gconf (GtkCheckButton *button, - gboolean active) -{ - g_return_if_fail(GTK_IS_CHECK_BUTTON(button)); - ENTER("button %p, active %d", button, active); - g_signal_handlers_block_by_func(G_OBJECT(button), - G_CALLBACK(gnc_prefs_check_button_user_cb_gconf), NULL); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), active); - g_signal_handlers_unblock_by_func(G_OBJECT(button), - G_CALLBACK(gnc_prefs_check_button_user_cb_gconf), NULL); - LEAVE(" "); -} - - -/** Connect a check button widget to the user callback function. Set - * the starting state of the button from its value in gconf. - * - * @internal - * - * @param button A pointer to the check button that should be - * connected. - */ -static void -gnc_prefs_connect_check_button_gconf (GtkCheckButton *button) -{ - const gchar *name; - gboolean active; - - name = gtk_buildable_get_name(GTK_BUILDABLE(button)) + PREFIX_LEN; - active = gnc_gconf_get_bool(name, NULL, NULL); - DEBUG(" Checkbox %s initially %sactive", name, active ? "" : "in"); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), active); - g_signal_connect(G_OBJECT(button), "toggled", - G_CALLBACK(gnc_prefs_check_button_user_cb_gconf), NULL); -} - -/****************************************************************************/ - /** The user updated a spin button. Update gconf. Spin button * choices are stored as a float. * @@ -1454,11 +1382,6 @@ gnc_prefs_connect_one_gconf (const gchar *name, DEBUG(" %s - radio button", name); gnc_prefs_connect_radio_button_gconf(GTK_RADIO_BUTTON(widget)); } - else if (GTK_IS_CHECK_BUTTON(widget)) - { - DEBUG(" %s - check button", name); - gnc_prefs_connect_check_button_gconf(GTK_CHECK_BUTTON(widget)); - } else if (GTK_IS_SPIN_BUTTON(widget)) { DEBUG(" %s - spin button", name); @@ -1790,12 +1713,6 @@ gnc_preferences_gconf_changed (GConfClient *client, DEBUG("widget %p - radio button", widget); gnc_prefs_radio_button_gconf_cb_gconf(GTK_RADIO_BUTTON(widget)); } - else if (GTK_IS_CHECK_BUTTON(widget)) - { - DEBUG("widget %p - check button", widget); - gnc_prefs_check_button_gconf_cb_gconf(GTK_CHECK_BUTTON(widget), - gconf_value_get_bool(entry->value)); - } else if (GTK_IS_SPIN_BUTTON(widget)) { DEBUG("widget %p - spin button", widget); diff --git a/src/gnome-utils/dialog-utils.c b/src/gnome-utils/dialog-utils.c index aac8577bc5..cfb74d29f3 100644 --- a/src/gnome-utils/dialog-utils.c +++ b/src/gnome-utils/dialog-utils.c @@ -161,7 +161,7 @@ gnc_restore_window_size(const char *group, GtkWindow *window) g_return_if_fail(group != NULL); g_return_if_fail(window != NULL); - if (!gnc_gconf_get_bool(GCONF_GENERAL, KEY_SAVE_GEOMETRY, NULL)) + if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY)) return; geometry = gnc_prefs_get_value (group, GNC_PREF_LAST_GEOMETRY); @@ -219,7 +219,7 @@ gnc_save_window_size(const char *group, GtkWindow *window) g_return_if_fail(group != NULL); g_return_if_fail(window != NULL); - if (!gnc_gconf_get_bool(GCONF_GENERAL, KEY_SAVE_GEOMETRY, NULL)) + if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY)) return; gtk_window_get_position(GTK_WINDOW(window), &wpos[0], &wpos[1]); diff --git a/src/gnome-utils/gnc-main-window.c b/src/gnome-utils/gnc-main-window.c index 864f7faa7e..d99b26ccf1 100644 --- a/src/gnome-utils/gnc-main-window.c +++ b/src/gnome-utils/gnc-main-window.c @@ -93,8 +93,8 @@ enum #define PLUGIN_PAGE_CLOSE_BUTTON "close-button" #define PLUGIN_PAGE_TAB_LABEL "label" -#define KEY_SHOW_CLOSE_BUTTON "tab_close_buttons" -#define KEY_TAB_NEXT_RECENT "tab_next_recent" +#define GNC_PREF_SHOW_CLOSE_BUTTON "tab_close_buttons" +#define GNC_PREF_TAB_NEXT_RECENT "tab_next_recent" #define KEY_TAB_POSITION "tab_position" #define KEY_TAB_WIDTH "tab_width" #define GNC_PREF_TAB_COLOR "show_account_color_tabs" @@ -1889,12 +1889,12 @@ gnc_main_window_update_tab_close_one_page (GncPluginPage *page, * @param user_data Unused. */ static void -gnc_main_window_update_tab_close (GConfEntry *entry, gpointer user_data) +gnc_main_window_update_tab_close (gpointer prefs, gchar *pref, gpointer user_data) { gboolean new_value; ENTER(" "); - new_value = gconf_value_get_bool(entry->value); + new_value = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_SHOW_CLOSE_BUTTON); gnc_main_window_foreach_page( gnc_main_window_update_tab_close_one_page, &new_value); @@ -2431,9 +2431,10 @@ gnc_main_window_class_init (GncMainWindowClass *klass) G_TYPE_NONE, 1, G_TYPE_OBJECT); - gnc_gconf_general_register_cb (KEY_SHOW_CLOSE_BUTTON, - gnc_main_window_update_tab_close, - NULL); + gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, + GNC_PREF_SHOW_CLOSE_BUTTON, + gnc_main_window_update_tab_close, + NULL); gnc_gconf_general_register_cb (KEY_TAB_WIDTH, gnc_main_window_update_tab_width, NULL); @@ -2712,7 +2713,7 @@ gnc_main_window_disconnect (GncMainWindow *window, /* Switch to the last recently used page */ notebook = GTK_NOTEBOOK (priv->notebook); - if (gnc_gconf_get_bool(GCONF_GENERAL, KEY_TAB_NEXT_RECENT, NULL)) + if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_TAB_NEXT_RECENT)) { new_page = g_list_nth_data (priv->usage_order, 0); if (new_page) @@ -2904,7 +2905,7 @@ gnc_main_window_open_page (GncMainWindow *window, requisition.height + 2); gtk_button_set_alignment(GTK_BUTTON(close_button), 0.5, 0.5); gtk_container_add(GTK_CONTAINER(close_button), close_image); - if (gnc_gconf_get_bool(GCONF_GENERAL, KEY_SHOW_CLOSE_BUTTON, NULL)) + if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SHOW_CLOSE_BUTTON)) gtk_widget_show (close_button); else gtk_widget_hide (close_button); diff --git a/src/gnome-utils/gtkbuilder/dialog-preferences.glade b/src/gnome-utils/gtkbuilder/dialog-preferences.glade index 6ccc36e225..cd4b1c03f6 100644 --- a/src/gnome-utils/gtkbuilder/dialog-preferences.glade +++ b/src/gnome-utils/gtkbuilder/dialog-preferences.glade @@ -3278,7 +3278,7 @@ many months before the current month: - + Report opens in a new _window True True @@ -3539,7 +3539,7 @@ many months before the current month: - + _Save window size and position True True @@ -3560,7 +3560,7 @@ many months before the current month: - + Bring the most _recent tab to the front True True @@ -3790,7 +3790,7 @@ many months before the current month: - + Show close button on _notebook tabs True True diff --git a/src/gnome/dialog-commodities.c b/src/gnome/dialog-commodities.c index ad32f4ba98..6d0427ad8f 100644 --- a/src/gnome/dialog-commodities.c +++ b/src/gnome/dialog-commodities.c @@ -33,16 +33,17 @@ #include "gnc-component-manager.h" #include "qof.h" #include "gnc-tree-view-commodity.h" +#include "gnc-prefs.h" #include "gnc-ui.h" #include "gnc-ui-util.h" -#include "gnc-gconf-utils.h" #include "gnc-gnome-utils.h" #include "gnc-session.h" #define DIALOG_COMMODITIES_CM_CLASS "dialog-commodities" #define GCONF_SECTION "dialogs/edit_commodities" -#define GNC_PREFS_GROUP "dialogs.edit_commodities" +#define GNC_PREFS_GROUP "dialogs.edit_commodities" +#define GNC_PREF_INCL_ISO "include_iso" /* This static indicates the debugging module that this .o belongs to. */ /* static short module = MOD_GUI; */ @@ -319,7 +320,7 @@ gnc_commodities_dialog_create (GtkWidget * parent, CommoditiesDialog *cd) cd->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "Securities Dialog")); cd->session = gnc_get_current_session(); cd->book = qof_session_get_book(cd->session); - cd->show_currencies = gnc_gconf_get_bool(GCONF_SECTION, "include_iso", NULL); + cd->show_currencies = gnc_prefs_get_bool(GNC_PREFS_GROUP, GNC_PREF_INCL_ISO); gtk_builder_connect_signals(builder, cd); @@ -367,7 +368,7 @@ close_handler (gpointer user_data) gnc_save_window_size(GNC_PREFS_GROUP, GTK_WINDOW(cd->dialog)); - gnc_gconf_set_bool(GCONF_SECTION, "include_iso", cd->show_currencies, NULL); + gnc_prefs_set_bool(GNC_PREFS_GROUP, GNC_PREF_INCL_ISO, cd->show_currencies); gtk_widget_destroy(cd->dialog); } diff --git a/src/gnome/dialog-sx-editor.c b/src/gnome/dialog-sx-editor.c index 245d7cd816..703841b967 100644 --- a/src/gnome/dialog-sx-editor.c +++ b/src/gnome/dialog-sx-editor.c @@ -60,6 +60,7 @@ #include "gnc-ledger-display.h" #include "gnc-plugin-page.h" #include "gnc-plugin-page-register.h" +#include "gnc-prefs.h" #include "gnc-ui.h" #include "gnc-ui-util.h" #include "gnucash-sheet.h" @@ -145,7 +146,6 @@ struct _GncSxEditorDialog static void schedXact_editor_create_freq_sel( GncSxEditorDialog *sxed ); static void schedXact_editor_create_ledger( GncSxEditorDialog *sxed ); static void schedXact_editor_populate( GncSxEditorDialog * ); -static void gnc_sxed_record_size( GncSxEditorDialog *sxed ); static void endgroup_rb_toggled_cb( GtkButton *b, gpointer d ); static void set_endgroup_toggle_states( GncSxEditorDialog *sxed, EndType t ); static void advance_toggled_cb( GtkButton *b, GncSxEditorDialog *sxed ); @@ -180,7 +180,7 @@ sxed_close_handler(gpointer user_data) GncSxEditorDialog *sxed = user_data; gnc_sxed_reg_check_close(sxed); - gnc_sxed_record_size(sxed); + gnc_save_window_size( GNC_PREFS_GROUP_SXED, GTK_WINDOW(sxed->dialog) ); gtk_widget_destroy(sxed->dialog); /* The data will be cleaned up in the destroy handler. */ } @@ -1267,14 +1267,6 @@ gnc_ui_scheduled_xaction_editor_dialog_create (SchedXaction *sx, } -static -void -gnc_sxed_record_size( GncSxEditorDialog *sxed ) -{ - gnc_save_window_size( GNC_PREFS_GROUP_SXED, GTK_WINDOW(sxed->dialog) ); -} - - static void schedXact_editor_create_freq_sel( GncSxEditorDialog *sxed ) @@ -1416,9 +1408,9 @@ schedXact_editor_populate( GncSxEditorDialog *sxed ) if ( sxed->newsxP ) { autoCreateState = - gnc_gconf_get_bool( SXED_GCONF_SECTION, KEY_CREATE_AUTO, NULL ); + gnc_prefs_get_bool (GNC_PREFS_GROUP_SXED, GNC_PREF_CREATE_AUTO); notifyState = - gnc_gconf_get_bool( SXED_GCONF_SECTION, KEY_NOTIFY, NULL ); + gnc_prefs_get_bool (GNC_PREFS_GROUP_SXED, GNC_PREF_NOTIFY); } else { @@ -1668,23 +1660,19 @@ sxed_excal_update_adapt_cb(GtkObject *o, gpointer ud) void -on_sx_check_toggled_cb (GtkWidget *togglebutton, - gpointer user_data) +on_sx_check_toggled_cb (GtkWidget *togglebutton, gpointer user_data) { - GtkWidget *widget_create, *widget_notify; - gboolean active; // , notify; + GtkWidget *widget_notify; GHashTable *table; PINFO("Togglebutton is %p and user_data is %p", togglebutton, user_data); PINFO("Togglebutton builder name is %s", gtk_buildable_get_name(GTK_BUILDABLE(togglebutton))); /* We need to use the hash table to find the required widget to activate. */ - table = g_object_get_data(G_OBJECT(user_data), "widget_hash"); - widget_create = g_hash_table_lookup(table, "gconf/dialogs/scheduled_trans/transaction_editor/create_auto"); - widget_notify = g_hash_table_lookup(table, "gconf/dialogs/scheduled_trans/transaction_editor/notify"); + table = g_object_get_data(G_OBJECT(user_data), "prefs_widget_hash"); + widget_notify = g_hash_table_lookup(table, "pref/" GNC_PREFS_GROUP_SXED "/" GNC_PREF_NOTIFY); - active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget_create)); - if (active) + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(togglebutton))) gtk_widget_set_sensitive(widget_notify, TRUE); else gtk_widget_set_sensitive(widget_notify, FALSE); @@ -1797,7 +1785,7 @@ gnc_ui_sx_initialize (void) gnc_hook_add_dangler(HOOK_BOOK_OPENED, (GFunc)gnc_sx_sxsincelast_book_opened, NULL); - /* Add page to preferences page for Sheduled Transactions */ + /* Add page to preferences page for Scheduled Transactions */ /* The parameters are; glade file, items to add from glade file - last being the dialog, preference tab name */ gnc_preferences_add_page ("dialog-sx.glade", "create_days_adj,remind_days_adj,sx_prefs", diff --git a/src/gnome/dialog-sx-editor.h b/src/gnome/dialog-sx-editor.h index 4ef4acb052..47c7581e1a 100644 --- a/src/gnome/dialog-sx-editor.h +++ b/src/gnome/dialog-sx-editor.h @@ -29,11 +29,11 @@ #define DIALOG_SCHEDXACTION_EDITOR_CM_CLASS "dialog-scheduledtransaction-editor" #define SXED_GCONF_SECTION "dialogs/scheduled_trans/transaction_editor" -#define KEY_CREATE_AUTO "create_auto" -#define KEY_NOTIFY "notify" #define KEY_CREATE_DAYS "create_days" #define KEY_REMIND_DAYS "remind_days" #define GNC_PREFS_GROUP_SXED "dialogs.sxs.transaction_editor" +#define GNC_PREF_CREATE_AUTO "create_auto" +#define GNC_PREF_NOTIFY "notify" typedef struct _GncSxEditorDialog GncSxEditorDialog; diff --git a/src/gnome/dialog-sx-editor2.c b/src/gnome/dialog-sx-editor2.c index 9409e70c24..b9705bfc86 100644 --- a/src/gnome/dialog-sx-editor2.c +++ b/src/gnome/dialog-sx-editor2.c @@ -60,6 +60,7 @@ #include "gnc-ledger-display.h" #include "gnc-plugin-page.h" #include "gnc-plugin-page-register2.h" +#include "gnc-prefs.h" #include "gnc-ui.h" #include "gnc-ui-util.h" #include "gnc-tree-model-split-reg.h" @@ -144,7 +145,6 @@ struct _GncSxEditorDialog2 static void schedXact_editor_create_freq_sel (GncSxEditorDialog2 *sxed); static void schedXact_editor_create_ledger (GncSxEditorDialog2 *sxed); static void schedXact_editor_populate (GncSxEditorDialog2 *); -static void gnc_sxed_record_size (GncSxEditorDialog2 *sxed); static void endgroup_rb_toggled_cb (GtkButton *b, gpointer d); static void set_endgroup_toggle_states (GncSxEditorDialog2 *sxed, EndType t); static void advance_toggled_cb (GtkButton *b, GncSxEditorDialog2 *sxed); @@ -179,7 +179,7 @@ sxed_close_handler(gpointer user_data) GncSxEditorDialog2 *sxed = user_data; gnc_sxed_reg_check_close(sxed); - gnc_sxed_record_size(sxed); + gnc_save_window_size( GNC_PREFS_GROUP_SXED, GTK_WINDOW(sxed->dialog) ); gtk_widget_destroy(sxed->dialog); /* The data will be cleaned up in the destroy handler. */ } @@ -1229,7 +1229,7 @@ gnc_ui_scheduled_xaction_editor_dialog_create2 (SchedXaction *sx, /* Allow resize */ gtk_window_set_resizable (GTK_WINDOW (sxed->dialog), TRUE); - gnc_restore_window_size (SXED_GCONF_SECTION, GTK_WINDOW (sxed->dialog)); + gnc_restore_window_size (GNC_PREFS_GROUP_SXED, GTK_WINDOW (sxed->dialog)); /* create the frequency-selection widget and example [dense-]calendar. */ schedXact_editor_create_freq_sel (sxed); @@ -1259,14 +1259,6 @@ gnc_ui_scheduled_xaction_editor_dialog_create2 (SchedXaction *sx, } -static -void -gnc_sxed_record_size (GncSxEditorDialog2 *sxed) -{ - gnc_save_window_size (SXED_GCONF_SECTION, GTK_WINDOW (sxed->dialog)); -} - - static void schedXact_editor_create_freq_sel (GncSxEditorDialog2 *sxed) @@ -1408,9 +1400,9 @@ schedXact_editor_populate (GncSxEditorDialog2 *sxed) if (sxed->newsxP) { autoCreateState = - gnc_gconf_get_bool (SXED_GCONF_SECTION, KEY_CREATE_AUTO, NULL); + gnc_prefs_get_bool (GNC_PREFS_GROUP_SXED, GNC_PREF_CREATE_AUTO); notifyState = - gnc_gconf_get_bool (SXED_GCONF_SECTION, KEY_NOTIFY, NULL); + gnc_prefs_get_bool (GNC_PREFS_GROUP_SXED, GNC_PREF_NOTIFY); } else { @@ -1661,23 +1653,19 @@ sxed_excal_update_adapt_cb (GtkObject *o, gpointer ud) static void -on_sx_check_toggled_cb (GtkWidget *togglebutton, - gpointer user_data) +on_sx_check_toggled_cb (GtkWidget *togglebutton, gpointer user_data) { - GtkWidget *widget_create, *widget_notify; - gboolean active; // , notify; + GtkWidget *widget_notify; GHashTable *table; PINFO("Togglebutton is %p and user_data is %p", togglebutton, user_data); PINFO("Togglebutton builder name is %s", gtk_buildable_get_name (GTK_BUILDABLE (togglebutton))); /* We need to use the hash table to find the required widget to activate. */ - table = g_object_get_data (G_OBJECT (user_data), "widget_hash"); - widget_create = g_hash_table_lookup (table, "gconf/dialogs/scheduled_trans/transaction_editor/create_auto"); - widget_notify = g_hash_table_lookup (table, "gconf/dialogs/scheduled_trans/transaction_editor/notify"); + table = g_object_get_data(G_OBJECT(user_data), "prefs_widget_hash"); + widget_notify = g_hash_table_lookup(table, "pref/" GNC_PREFS_GROUP_SXED "/" GNC_PREF_NOTIFY); - active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget_create)); - if (active) + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(togglebutton))) gtk_widget_set_sensitive (widget_notify, TRUE); else gtk_widget_set_sensitive (widget_notify, FALSE); diff --git a/src/gnome/dialog-sx-editor2.h b/src/gnome/dialog-sx-editor2.h index 05dc91562e..9aac936534 100644 --- a/src/gnome/dialog-sx-editor2.h +++ b/src/gnome/dialog-sx-editor2.h @@ -29,10 +29,11 @@ #define DIALOG_SCHEDXACTION2_EDITOR_CM_CLASS "dialog-scheduledtransaction-editor" #define SXED_GCONF_SECTION "dialogs/scheduled_trans/transaction_editor" -#define KEY_CREATE_AUTO "create_auto" -#define KEY_NOTIFY "notify" #define KEY_CREATE_DAYS "create_days" #define KEY_REMIND_DAYS "remind_days" +#define GNC_PREFS_GROUP_SXED "dialogs.sxs.transaction_editor" +#define GNC_PREF_CREATE_AUTO "create_auto" +#define GNC_PREF_NOTIFY "notify" typedef struct _GncSxEditorDialog2 GncSxEditorDialog2; diff --git a/src/gnome/dialog-sx-from-trans.c b/src/gnome/dialog-sx-from-trans.c index 4c2918bc2f..9f506eb60a 100644 --- a/src/gnome/dialog-sx-from-trans.c +++ b/src/gnome/dialog-sx-from-trans.c @@ -37,6 +37,7 @@ #include "gnc-engine.h" #include "engine-helpers.h" #include "gnc-gconf-utils.h" +#include "gnc-prefs.h" #include "gnc-ui-util.h" #include "gnc-ui.h" #include "qof.h" @@ -498,9 +499,9 @@ sxftd_compute_sx(SXFromTransInfo *sxfti) gint daysInAdvance; autoCreateState = - gnc_gconf_get_bool( SXED_GCONF_SECTION, KEY_CREATE_AUTO, NULL ); + gnc_prefs_get_bool (GNC_PREFS_GROUP_SXED, GNC_PREF_CREATE_AUTO); notifyState = - gnc_gconf_get_bool( SXED_GCONF_SECTION, KEY_NOTIFY, NULL ); + gnc_prefs_get_bool (GNC_PREFS_GROUP_SXED, GNC_PREF_NOTIFY); xaccSchedXactionSetAutoCreate( sx, autoCreateState, (autoCreateState & notifyState) ); diff --git a/src/gnome/dialog-sx-since-last-run.c b/src/gnome/dialog-sx-since-last-run.c index a1eec642c0..2b48e507db 100644 --- a/src/gnome/dialog-sx-since-last-run.c +++ b/src/gnome/dialog-sx-since-last-run.c @@ -41,6 +41,7 @@ #include "gnc-sx-instance-model.h" #include "dialog-sx-since-last-run.h" +#include "gnc-prefs.h" #include "gnc-ui-util.h" #include "Query.h" #include "qof.h" @@ -50,7 +51,6 @@ /*################## Added for Reg2 #################*/ #include "gnc-main-window.h" #include "gnc-component-manager.h" -#include "gnc-gconf-utils.h" #include "gnc-gui-query.h" #include "gnc-session.h" @@ -60,8 +60,9 @@ G_GNUC_UNUSED static QofLogModule log_module = GNC_MOD_GUI_SX; #define DIALOG_SX_SINCE_LAST_RUN_CM_CLASS "dialog-sx-since-last-run" -#define GCONF_SECTION "dialogs/scheduled_trans/since_last_run" -#define GNC_PREFS_GROUP "dialogs.sxs.since_last_run" + +#define GNC_PREFS_GROUP "dialogs.sxs.since_last_run" +#define GNC_PREF_SHOW_AT_FOPEN "show_at_file_open" struct _GncSxSinceLastRunDialog { @@ -799,7 +800,7 @@ gnc_sx_sxsincelast_book_opened(void) GncSxInstanceModel *inst_model; GncSxSummary summary; - if (!gnc_gconf_get_bool(GCONF_SECTION, "show_at_file_open", NULL)) + if (!gnc_prefs_get_bool (GNC_PREFS_GROUP, GNC_PREF_SHOW_AT_FOPEN)) return; inst_model = gnc_sx_get_current_instances(); diff --git a/src/gnome/dialog-tax-info.c b/src/gnome/dialog-tax-info.c index c6049e4bd3..0f9061567d 100644 --- a/src/gnome/dialog-tax-info.c +++ b/src/gnome/dialog-tax-info.c @@ -37,6 +37,7 @@ #include "gnc-ui-util.h" #include "dialog-utils.h" #include "gnc-gconf-utils.h" +#include "gnc-prefs.h" #include "gnc-tree-view-account.h" #include "gnc-component-manager.h" #include "gnc-session.h" @@ -1462,7 +1463,7 @@ gnc_tax_info_dialog_create (GtkWidget * parent, TaxInfoDialog *ti_dialog) ti_dialog->paned = GTK_WIDGET(gtk_builder_get_object (builder, "paned")); - if (gnc_gconf_get_bool(GCONF_GENERAL, KEY_SAVE_GEOMETRY, NULL)) + if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY)) { gint position = gnc_gconf_get_int(GCONF_SECTION, PANED_POSITION, NULL); gtk_paned_set_position(GTK_PANED(ti_dialog->paned), position); @@ -1475,7 +1476,7 @@ close_handler (gpointer user_data) { TaxInfoDialog *ti_dialog = user_data; - if (gnc_gconf_get_bool(GCONF_GENERAL, KEY_SAVE_GEOMETRY, NULL)) + if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY)) { gnc_gconf_set_int(GCONF_SECTION, PANED_POSITION, gtk_paned_get_position(GTK_PANED(ti_dialog->paned)), NULL); diff --git a/src/gnome/gtkbuilder/dialog-sx.glade b/src/gnome/gtkbuilder/dialog-sx.glade index d5ade35e07..9cde42fc76 100644 --- a/src/gnome/gtkbuilder/dialog-sx.glade +++ b/src/gnome/gtkbuilder/dialog-sx.glade @@ -150,7 +150,7 @@ - + _Run when data file opened True True @@ -170,7 +170,7 @@ - + _Auto-create new transactions True True @@ -328,7 +328,7 @@ - + _Notify before transactions are created True False @@ -338,7 +338,6 @@ False True True - 4 diff --git a/src/import-export/aqbanking/dialog-ab.glade b/src/import-export/aqbanking/dialog-ab.glade index 11e49e1c5e..b30938e0f6 100644 --- a/src/import-export/aqbanking/dialog-ab.glade +++ b/src/import-export/aqbanking/dialog-ab.glade @@ -815,7 +815,7 @@ - + _Close log window when finished True True @@ -834,7 +834,7 @@ - + Remember _PIN True True diff --git a/src/import-export/aqbanking/gnc-ab-utils.c b/src/import-export/aqbanking/gnc-ab-utils.c index 5c154e64e8..6cc2d7fd60 100644 --- a/src/import-export/aqbanking/gnc-ab-utils.c +++ b/src/import-export/aqbanking/gnc-ab-utils.c @@ -38,9 +38,9 @@ #include "dialog-ab-trans.h" #include "gnc-ab-kvp.h" #include "gnc-ab-utils.h" -#include "gnc-gconf-utils.h" #include "gnc-glib-utils.h" #include "gnc-gwen-gui.h" +#include "gnc-prefs.h" #include "gnc-ui.h" #include "import-account-matcher.h" #include "import-main-matcher.h" @@ -93,7 +93,7 @@ gnc_GWEN_Init(void) GWEN_Init(); /* Initialize gwen logging */ - if (gnc_gconf_get_bool(GCONF_SECTION_AQBANKING, KEY_VERBOSE_DEBUG, NULL)) + if (gnc_prefs_get_bool(GNC_PREFS_GROUP_AQBANKING, GNC_PREF_VERBOSE_DEBUG)) { if (!gwen_logging) { diff --git a/src/import-export/aqbanking/gnc-ab-utils.h b/src/import-export/aqbanking/gnc-ab-utils.h index 77ddf6049f..1a140521ba 100644 --- a/src/import-export/aqbanking/gnc-ab-utils.h +++ b/src/import-export/aqbanking/gnc-ab-utils.h @@ -75,7 +75,7 @@ G_BEGIN_DECLS #define KEY_FORMAT_SWIFT940 "format_swift_mt940" #define KEY_FORMAT_SWIFT942 "format_swift_mt942" #define KEY_FORMAT_DTAUS "format_dtaus" -#define KEY_VERBOSE_DEBUG "verbose_debug" +#define GNC_PREF_VERBOSE_DEBUG "verbose_debug" typedef struct _GncABImExContextImport GncABImExContextImport; diff --git a/src/import-export/aqbanking/gnc-gwen-gui.c b/src/import-export/aqbanking/gnc-gwen-gui.c index 1c331f49f3..3137f987aa 100644 --- a/src/import-export/aqbanking/gnc-gwen-gui.c +++ b/src/import-export/aqbanking/gnc-gwen-gui.c @@ -38,9 +38,9 @@ #include "dialog-utils.h" #include "gnc-ab-utils.h" #include "gnc-component-manager.h" -#include "gnc-gconf-utils.h" #include "gnc-gwen-gui.h" #include "gnc-session.h" +#include "gnc-prefs.h" #include "gnc-ui.h" #include "gnc-plugin-aqbanking.h" #include "md5.h" @@ -57,8 +57,8 @@ #define GWEN_GUI_CM_CLASS "dialog-hbcilog" #define GNC_PREFS_GROUP_CONNECTION GNC_PREFS_GROUP_AQBANKING ".connection_dialog" -#define KEY_CLOSE_ON_FINISH "close_on_finish" -#define KEY_REMEMBER_PIN "remember_pin" +#define GNC_PREF_CLOSE_ON_FINISH "close_on_finish" +#define GNC_PREF_REMEMBER_PIN "remember_pin" #ifdef USING_GWENHYWFAR_GTK2_GUI # include @@ -103,15 +103,14 @@ void gnc_GWEN_Gui_shutdown(void) void gnc_GWEN_Gui_set_close_flag(gboolean close_when_finished) { - gnc_gconf_set_bool( - GCONF_SECTION_AQBANKING, KEY_CLOSE_ON_FINISH, - close_when_finished, - NULL); + gnc_prefs_set_bool( + GNC_PREFS_GROUP_AQBANKING, GNC_PREF_CLOSE_ON_FINISH, + close_when_finished); } gboolean gnc_GWEN_Gui_get_close_flag() { - return gnc_gconf_get_bool(GCONF_SECTION_AQBANKING, KEY_CLOSE_ON_FINISH, NULL); + return gnc_prefs_get_bool (GNC_PREFS_GROUP_AQBANKING, GNC_PREF_CLOSE_ON_FINISH); } gboolean @@ -392,10 +391,9 @@ gnc_GWEN_Gui_shutdown(void) void gnc_GWEN_Gui_set_close_flag(gboolean close_when_finished) { - gnc_gconf_set_bool( - GCONF_SECTION_AQBANKING, KEY_CLOSE_ON_FINISH, - close_when_finished, - NULL); + gnc_prefs_set_bool( + GNC_PREFS_GROUP_AQBANKING, GNC_PREF_CLOSE_ON_FINISH, + close_when_finished); if (full_gui) { @@ -412,7 +410,7 @@ gnc_GWEN_Gui_set_close_flag(gboolean close_when_finished) gboolean gnc_GWEN_Gui_get_close_flag() { - return gnc_gconf_get_bool(GCONF_SECTION_AQBANKING, KEY_CLOSE_ON_FINISH, NULL); + return gnc_prefs_get_bool (GNC_PREFS_GROUP_AQBANKING, GNC_PREF_CLOSE_ON_FINISH); } gboolean @@ -433,7 +431,7 @@ gnc_GWEN_Gui_show_dialog() } gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(gui->close_checkbutton), - gnc_gconf_get_bool(GCONF_SECTION_AQBANKING, KEY_CLOSE_ON_FINISH, NULL)); + gnc_prefs_get_bool (GNC_PREFS_GROUP_AQBANKING, GNC_PREF_CLOSE_ON_FINISH)); show_dialog(gui, FALSE); @@ -547,7 +545,7 @@ setup_dialog(GncGWENGui *gui) gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(gui->close_checkbutton), - gnc_gconf_get_bool(GCONF_SECTION_AQBANKING, KEY_CLOSE_ON_FINISH, NULL)); + gnc_prefs_get_bool (GNC_PREFS_GROUP_AQBANKING, GNC_PREF_CLOSE_ON_FINISH)); component_id = gnc_register_gui_component(GWEN_GUI_CM_CLASS, NULL, cm_close_handler, gui); @@ -620,8 +618,8 @@ reset_dialog(GncGWENGui *gui) gui->state = INIT; gui->min_loglevel = GWEN_LoggerLevel_Verbous; - cache_passwords = gnc_gconf_get_bool(GCONF_SECTION_AQBANKING, - KEY_REMEMBER_PIN, NULL); + cache_passwords = gnc_prefs_get_bool(GNC_PREFS_GROUP_AQBANKING, + GNC_PREF_REMEMBER_PIN); enable_password_cache(gui, cache_passwords); if (!gui->accepted_certs) @@ -719,10 +717,9 @@ hide_dialog(GncGWENGui *gui) gnc_plugin_aqbanking_set_logwindow_visible(FALSE); /* Remember whether the dialog is to be closed when finished */ - gnc_gconf_set_bool( - GCONF_SECTION_AQBANKING, KEY_CLOSE_ON_FINISH, - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gui->close_checkbutton)), - NULL); + gnc_prefs_set_bool( + GNC_PREFS_GROUP_AQBANKING, GNC_PREF_CLOSE_ON_FINISH, + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gui->close_checkbutton))); /* Remember size and position of the dialog */ gnc_save_window_size(GNC_PREFS_GROUP_CONNECTION, GTK_WINDOW(gui->dialog)); @@ -1060,8 +1057,8 @@ get_input(GncGWENGui *gui, guint32 flags, const gchar *title, const gchar *text, remember_pin = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(remember_pin_checkbutton)); enable_password_cache(gui, remember_pin); - gnc_gconf_set_bool(GCONF_SECTION_AQBANKING, KEY_REMEMBER_PIN, - remember_pin, NULL); + gnc_prefs_set_bool(GNC_PREFS_GROUP_AQBANKING, GNC_PREF_REMEMBER_PIN, + remember_pin); } internal_input = gtk_entry_get_text(GTK_ENTRY(input_entry)); @@ -1618,10 +1615,9 @@ ggg_close_toggled_cb(GtkToggleButton *button, gpointer user_data) ENTER("gui=%p", gui); - gnc_gconf_set_bool( - GCONF_SECTION_AQBANKING, KEY_CLOSE_ON_FINISH, - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)), - NULL); + gnc_prefs_set_bool( + GNC_PREFS_GROUP_AQBANKING, GNC_PREF_CLOSE_ON_FINISH, + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))); LEAVE(" "); } diff --git a/src/import-export/csv-export/assistant-csv-export.c b/src/import-export/csv-export/assistant-csv-export.c index 3f9a0acfa2..f1bcc02861 100644 --- a/src/import-export/csv-export/assistant-csv-export.c +++ b/src/import-export/csv-export/assistant-csv-export.c @@ -35,6 +35,7 @@ #include "gnc-component-manager.h" #include "gnc-date-edit.h" #include "gnc-gconf-utils.h" +#include "gnc-prefs.h" #include "gnc-tree-view-account.h" #include "dialog-utils.h" #include "Query.h" @@ -747,8 +748,11 @@ csv_export_assistant_summary_page_prepare (GtkAssistant *assistant, gchar *text, *mtext; /* Save the Window size, paned position and directory */ - gnc_gconf_set_int(GCONF_SECTION, PANED_POSITION, - gtk_paned_get_position(GTK_PANED(info->csva.paned)), NULL); + if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY)) + { + gnc_gconf_set_int(GCONF_SECTION, PANED_POSITION, + gtk_paned_get_position(GTK_PANED(info->csva.paned)), NULL); + } gnc_set_default_directory(GNC_PREFS_GROUP, info->starting_dir); if (info->failed) @@ -1008,7 +1012,7 @@ csv_export_assistant_create (CsvExportInfo *info) info->csva.paned = GTK_WIDGET(gtk_builder_get_object (builder, "paned")); - if (gnc_gconf_get_bool(GCONF_SECTION, KEY_SAVE_GEOMETRY, NULL)) + if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY)) { gint position = gnc_gconf_get_int(GCONF_SECTION, PANED_POSITION, NULL); gtk_paned_set_position(GTK_PANED(info->csva.paned), position); diff --git a/src/import-export/dialog-import.glade b/src/import-export/dialog-import.glade index 4568e80e2d..b20d17c6ea 100644 --- a/src/import-export/dialog-import.glade +++ b/src/import-export/dialog-import.glade @@ -13,7 +13,7 @@ 10 4 - + Enable skip transaction action True True @@ -35,7 +35,7 @@ - + Enable update match action True True @@ -248,7 +248,7 @@ - + Use _bayesian matching True True @@ -270,7 +270,7 @@ - + Automatically create new commodities True True diff --git a/src/import-export/import-backend.c b/src/import-export/import-backend.c index 958f454047..2eeb2ac8ce 100644 --- a/src/import-export/import-backend.c +++ b/src/import-export/import-backend.c @@ -35,17 +35,15 @@ #include -#include "gnc-gconf-utils.h" #include "import-backend.h" #include "import-utilities.h" #include "Account.h" #include "Query.h" #include "gnc-engine.h" #include "engine-helpers.h" +#include "gnc-prefs.h" #include "gnc-ui-util.h" -#define GCONF_SECTION "dialogs/import/generic_matcher" -#define BAYES_OPTION "use_bayes" /********************************************************************\ * Constants * @@ -477,7 +475,7 @@ matchmap_find_destination (GncImportMatchMap *matchmap, GNCImportTransInfo *info (xaccSplitGetAccount (gnc_import_TransInfo_get_fsplit (info)))); - useBayes = gnc_gconf_get_bool(GCONF_SECTION, BAYES_OPTION, NULL); + useBayes = gnc_prefs_get_bool (GNC_PREFS_GROUP_IMPORT, GNC_PREF_USE_BAYES); if (useBayes) { /* get the tokens for this transaction* */ @@ -548,7 +546,7 @@ matchmap_store_destination (GncImportMatchMap *matchmap, (gnc_import_TransInfo_get_fsplit (trans_info)))); /* see what matching system we are currently using */ - useBayes = gnc_gconf_get_bool(GCONF_SECTION, BAYES_OPTION, NULL); + useBayes = gnc_prefs_get_bool (GNC_PREFS_GROUP_IMPORT, GNC_PREF_USE_BAYES); if (useBayes) { /* tokenize this transaction */ diff --git a/src/import-export/import-settings.c b/src/import-export/import-settings.c index 72a551c2ee..96d37b5772 100644 --- a/src/import-export/import-settings.c +++ b/src/import-export/import-settings.c @@ -30,6 +30,7 @@ #include "import-settings.h" #include "gnc-gconf-utils.h" +#include "gnc-prefs.h" /********************************************************************\ * Default values for user prefs (or values for unimplemented prefs.* @@ -83,9 +84,9 @@ gnc_import_Settings_new (void) settings->action_skip_enabled = - gnc_gconf_get_bool(GCONF_IMPORT_SECTION, "enable_skip", NULL); + gnc_prefs_get_bool (GNC_PREFS_GROUP_IMPORT, GNC_PREF_ENABLE_SKIP); settings->action_update_enabled = - gnc_gconf_get_bool(GCONF_IMPORT_SECTION, "enable_update", NULL); + gnc_prefs_get_bool (GNC_PREFS_GROUP_IMPORT, GNC_PREF_ENABLE_UPDATE); settings->action_add_enabled = DEFAULT_ACTION_ADD_ENABLED; settings->action_clear_enabled = DEFAULT_ACTION_CLEAR_ENABLED; settings->clear_threshold = diff --git a/src/import-export/import-settings.h b/src/import-export/import-settings.h index 416d619084..c1a442dde9 100644 --- a/src/import-export/import-settings.h +++ b/src/import-export/import-settings.h @@ -28,15 +28,14 @@ #ifndef GNC_GEN_SETTINGS_H #define GNC_GEN_SETTINGS_H +#include "import-utilities.h" + typedef struct _genimportsettings GNCImportSettings; /************************************************************************ * Getter/Setter Functions for the Data Types. ************************************************************************/ -/** The GConf section of the importer */ -#define GCONF_IMPORT_SECTION "dialogs/import/generic_matcher" - /** Allocates a new GNCImportSettings object, and initialize it with * the appropriate user prefs. diff --git a/src/import-export/import-utilities.h b/src/import-export/import-utilities.h index 7d6afda29c..b940e83ba4 100644 --- a/src/import-export/import-utilities.h +++ b/src/import-export/import-utilities.h @@ -25,6 +25,15 @@ #ifndef IMPORT_UTILITIES_H #define IMPORT_UTILITIES_H + +/** The GConf section of the importer */ +#define GCONF_IMPORT_SECTION "dialogs/import/generic_matcher" +#define GNC_PREFS_GROUP_IMPORT "dialogs.import.generic" +#define GNC_PREF_ENABLE_SKIP "enable_skip" +#define GNC_PREF_ENABLE_UPDATE "enable_update" +#define GNC_PREF_USE_BAYES "use_bayes" + + #include "Account.h" /** @name Setter-getters diff --git a/src/import-export/ofx/gnc-ofx-import.c b/src/import-export/ofx/gnc-ofx-import.c index 6b4bff48d1..2a934a063a 100644 --- a/src/import-export/ofx/gnc-ofx-import.c +++ b/src/import-export/ofx/gnc-ofx-import.c @@ -46,7 +46,7 @@ #include "gnc-engine.h" #include "gnc-ui-util.h" #include "gnc-glib-utils.h" -#include "gnc-gconf-utils.h" +#include "gnc-prefs.h" #include "gnome-utils/gnc-ui.h" #include "gnome-utils/dialog-account.h" #include "dialog-utils.h" @@ -54,6 +54,7 @@ #include "gnc-ofx-kvp.h" #define GNC_PREFS_GROUP "dialogs.import.ofx" +#define GNC_PREF_AUTO_COMMODITY "auto_create_commodity" static QofLogModule log_module = GNC_MOD_IMPORT; @@ -953,9 +954,9 @@ void gnc_file_ofx_import (void) /* Create the Generic transaction importer GUI. */ gnc_ofx_importer_gui = gnc_gen_trans_list_new(NULL, NULL, FALSE, 42); - /* Look up the needed gconf options */ + /* Look up the needed preferences */ auto_create_commodity = - gnc_gconf_get_bool(GCONF_IMPORT_SECTION, "auto_create_commodity", NULL); + gnc_prefs_get_bool (GNC_PREFS_GROUP_IMPORT, GNC_PREF_AUTO_COMMODITY); /* Initialize libofx */ diff --git a/src/import-export/qif-import/assistant-qif-import.c b/src/import-export/qif-import/assistant-qif-import.c index ff97cf78e9..558a85a355 100644 --- a/src/import-export/qif-import/assistant-qif-import.c +++ b/src/import-export/qif-import/assistant-qif-import.c @@ -52,6 +52,7 @@ #include "gnc-gtk-utils.h" #include "gnc-main-window.h" #include "gnc-plugin-page-account-tree.h" +#include "gnc-prefs.h" #include "gnc-ui.h" #include "guile-mappings.h" @@ -59,8 +60,8 @@ #define ASSISTANT_QIF_IMPORT_CM_CLASS "assistant-qif-import" #define GCONF_SECTION "dialogs/import/qif" -#define GNC_PREFS_GROUP "dialogs.import.qif" -#define GCONF_NAME_SHOW_DOC "show_doc" +#define GNC_PREFS_GROUP "dialogs.import.qif" +#define GNC_PREF_SHOW_DOC "show_doc" #define GCONF_NAME_DEFAULT_TRANSACTION_STATUS "default_status" #define PREV_ROW "prev_row" @@ -1379,18 +1380,7 @@ get_preferences(QIFImportWindow *wind) /* Get the user's preference for showing documentation pages. */ wind->show_doc_pages = - gnc_gconf_get_bool(GCONF_SECTION, GCONF_NAME_SHOW_DOC, &err); - if (err != NULL) - { - g_warning("QIF import: gnc_gconf_get_bool error: %s", err->message); - g_error_free(err); - - /* Show documentation pages by default. */ - g_warning("QIF import: Couldn't get %s setting from gconf.", - GCONF_NAME_SHOW_DOC); - g_warning("QIF import: Documentation pages will be shown by default."); - wind->show_doc_pages = TRUE; - } + gnc_prefs_get_bool (GNC_PREFS_GROUP, GNC_PREF_SHOW_DOC); /* Clear / Reconcile transaction if not specified in QIF file. */ status_pref = gnc_gconf_get_string( diff --git a/src/import-export/qif-import/dialog-account-picker.glade b/src/import-export/qif-import/dialog-account-picker.glade index 5cc9659303..974d85ba4c 100644 --- a/src/import-export/qif-import/dialog-account-picker.glade +++ b/src/import-export/qif-import/dialog-account-picker.glade @@ -26,7 +26,7 @@ - + _Show documentation True True diff --git a/src/register/register-gnome/table-gnome.c b/src/register/register-gnome/table-gnome.c index df27097ec6..778973dac9 100644 --- a/src/register/register-gnome/table-gnome.c +++ b/src/register/register-gnome/table-gnome.c @@ -49,6 +49,7 @@ #include "table-allgui.h" #include "table-gnome.h" #include "gnc-gconf-utils.h" +#include "gnc-prefs.h" #include "gnc-engine.h" #include "gnc-ledger-display.h" @@ -82,7 +83,7 @@ gnc_table_save_state (Table *table, gchar * gconf_key) if (table->ui_data == NULL) return; - if (!gnc_gconf_get_bool(GCONF_GENERAL, KEY_SAVE_GEOMETRY, NULL)) + if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY)) return; sheet = GNUCASH_SHEET (table->ui_data); @@ -193,7 +194,7 @@ gnc_table_init_gui (GtkWidget *widget, gchar * gconf_key) widths = gnc_header_widths_new (); - if (gnc_gconf_get_bool(GCONF_GENERAL, KEY_SAVE_GEOMETRY, NULL)) + if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY)) { node = gnc_table_layout_get_cells (table->layout); for (; node; node = node->next) diff --git a/src/report/report-gnome/gnc-plugin-page-report.c b/src/report/report-gnome/gnc-plugin-page-report.c index 2b39dc9771..c39a6f4154 100644 --- a/src/report/report-gnome/gnc-plugin-page-report.c +++ b/src/report/report-gnome/gnc-plugin-page-report.c @@ -60,6 +60,7 @@ #include "gnc-plugin.h" #include "gnc-plugin-page-report.h" #include "gnc-plugin-file-history.h" +#include "gnc-prefs.h" #include "gnc-report.h" #include "gnc-session.h" #include "gnc-ui-util.h" @@ -1137,7 +1138,7 @@ gnc_plugin_page_report_constr_init(GncPluginPageReport *plugin_page, gint report /* Init parent declared variables */ parent = GNC_PLUGIN_PAGE(plugin_page); - use_new = gnc_gconf_get_bool(GCONF_GENERAL_REPORT, KEY_USE_NEW, NULL); + use_new = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REPORT, GNC_PREF_USE_NEW); name = gnc_report_name( priv->initial_report ); g_object_set(G_OBJECT(plugin_page), "page-name", name,