mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Gnc-Prefs: migrate most preferences found in app-utils
This required changes in dependent modules as well. And obviously the gnc-gconf-utils.[ch] files are not removed yet. Too many other files still require those. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@23228 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -46,18 +46,18 @@
|
||||
#include "gnc-accounting-period.h"
|
||||
#include "gnc-gdate-utils.h"
|
||||
#include "gnc-date.h"
|
||||
#include "gnc-gconf-utils.h"
|
||||
#include "gnc-prefs.h"
|
||||
#include "qof.h"
|
||||
#include "gnc-ui-util.h"
|
||||
|
||||
/* TODO: This should probably be changed eventually. */
|
||||
#define GCONF_SECTION "window/pages/account_tree/summary"
|
||||
#define KEY_START_CHOICE "start_choice"
|
||||
#define KEY_START_DATE "start_date"
|
||||
#define KEY_START_PERIOD "start_period"
|
||||
#define KEY_END_CHOICE "end_choice"
|
||||
#define KEY_END_DATE "end_date"
|
||||
#define KEY_END_PERIOD "end_period"
|
||||
#define GNC_PREFS_GROUP "window.pages.account_tree.summary"
|
||||
#define GNC_PREF_START_CHOICE "start_choice"
|
||||
#define GNC_PREF_START_DATE "start_date"
|
||||
#define GNC_PREF_START_PERIOD "start_period"
|
||||
#define GNC_PREF_END_CHOICE "end_choice"
|
||||
#define GNC_PREF_END_DATE "end_date"
|
||||
#define GNC_PREF_END_PERIOD "end_period"
|
||||
|
||||
static time64 gnc_accounting_period_start_time64 (GncAccountingPeriod which,
|
||||
const GDate *fy_end,
|
||||
@@ -77,14 +77,14 @@ lookup_start_date_option(const gchar *section,
|
||||
time64 time;
|
||||
int which;
|
||||
|
||||
choice = gnc_gconf_get_string(section, key_choice, NULL);
|
||||
choice = gnc_prefs_get_string(section, key_choice);
|
||||
if (choice && strcmp(choice, "absolute") == 0)
|
||||
{
|
||||
time = gnc_gconf_get_int(section, key_absolute, NULL);
|
||||
time = gnc_prefs_get_int(section, key_absolute);
|
||||
}
|
||||
else
|
||||
{
|
||||
which = gnc_gconf_get_int(section, key_relative, NULL);
|
||||
which = gnc_prefs_get_int(section, key_relative);
|
||||
time = gnc_accounting_period_start_time64(which, fy_end, NULL);
|
||||
}
|
||||
g_free(choice);
|
||||
@@ -106,15 +106,15 @@ lookup_end_date_option(const gchar *section,
|
||||
time64 time;
|
||||
int which;
|
||||
|
||||
choice = gnc_gconf_get_string(section, key_choice, NULL);
|
||||
choice = gnc_prefs_get_string(section, key_choice);
|
||||
if (choice && strcmp(choice, "absolute") == 0)
|
||||
{
|
||||
time = gnc_gconf_get_int(section, key_absolute, NULL);
|
||||
time = gnc_prefs_get_int(section, key_absolute);
|
||||
time = gnc_time64_get_day_end(time);
|
||||
}
|
||||
else
|
||||
{
|
||||
which = gnc_gconf_get_int(section, key_relative, NULL);
|
||||
which = gnc_prefs_get_int(section, key_relative);
|
||||
time = gnc_accounting_period_end_time64(which, fy_end, NULL);
|
||||
}
|
||||
g_free(choice);
|
||||
@@ -144,8 +144,9 @@ gnc_accounting_period_fiscal_start(void)
|
||||
{
|
||||
time64 t;
|
||||
GDate *fy_end = get_fy_end();
|
||||
t = lookup_start_date_option(GCONF_SECTION, KEY_START_CHOICE,
|
||||
KEY_START_DATE, KEY_START_PERIOD, fy_end);
|
||||
t = lookup_start_date_option(GNC_PREFS_GROUP, GNC_PREF_START_CHOICE,
|
||||
GNC_PREF_START_DATE, GNC_PREF_START_PERIOD,
|
||||
fy_end);
|
||||
if (fy_end)
|
||||
g_date_free(fy_end);
|
||||
return t;
|
||||
@@ -157,8 +158,9 @@ gnc_accounting_period_fiscal_end(void)
|
||||
time64 t;
|
||||
GDate *fy_end = get_fy_end();
|
||||
|
||||
t = lookup_end_date_option(GCONF_SECTION, KEY_END_CHOICE,
|
||||
KEY_END_DATE, KEY_END_PERIOD, fy_end);
|
||||
t = lookup_end_date_option(GNC_PREFS_GROUP, GNC_PREF_END_CHOICE,
|
||||
GNC_PREF_END_DATE, GNC_PREF_END_PERIOD,
|
||||
fy_end);
|
||||
if (fy_end)
|
||||
g_date_free(fy_end);
|
||||
return t;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <gio/gio.h>
|
||||
#include <libguile.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
@@ -43,7 +44,7 @@
|
||||
|
||||
#include "qof.h"
|
||||
#include "guile-mappings.h"
|
||||
#include "gnc-gconf-utils.h"
|
||||
#include "gnc-prefs.h"
|
||||
#include "gnc-module/gnc-module.h"
|
||||
#include "engine/Account.h"
|
||||
#include "engine/Transaction.h"
|
||||
@@ -57,9 +58,9 @@
|
||||
#include "gnc-features.h"
|
||||
#include "gnc-guile-utils.h"
|
||||
|
||||
#define KEY_CURRENCY_CHOICE "currency_choice"
|
||||
#define KEY_CURRENCY_OTHER "currency_other"
|
||||
#define KEY_REVERSED_ACCOUNTS "reversed_accounts"
|
||||
#define GNC_PREF_CURRENCY_CHOICE "currency_choice"
|
||||
#define GNC_PREF_CURRENCY_OTHER "currency_other"
|
||||
#define GNC_PREF_REVERSED_ACCOUNTS "reversed_accounts"
|
||||
|
||||
static QofLogModule log_module = GNC_MOD_GUI;
|
||||
|
||||
@@ -69,7 +70,7 @@ static int auto_decimal_places = 2; /* default, can be changed */
|
||||
static gboolean reverse_balance_inited = FALSE;
|
||||
static gboolean reverse_type[NUM_ACCOUNT_TYPES];
|
||||
|
||||
/* Cache currency ISO codes and only look them up in gconf when
|
||||
/* Cache currency ISO codes and only look them up in the settings when
|
||||
* absolutely necessary. Can't cache a pointer to the data structure
|
||||
* as that will change any time the book changes. */
|
||||
static gchar *user_default_currency = NULL;
|
||||
@@ -87,7 +88,7 @@ gnc_configure_account_separator (void)
|
||||
const gchar *separator;
|
||||
char *string;
|
||||
|
||||
string = gnc_gconf_get_string(GCONF_GENERAL, KEY_ACCOUNT_SEPARATOR, NULL);
|
||||
string = gnc_prefs_get_string(GNC_PREFS_GROUP_GENERAL, GNC_PREF_ACCOUNT_SEPARATOR);
|
||||
|
||||
if (!string || !*string || g_strcmp0(string, "colon") == 0)
|
||||
separator = ":";
|
||||
@@ -118,7 +119,7 @@ gnc_configure_reverse_balance (void)
|
||||
for (i = 0; i < NUM_ACCOUNT_TYPES; i++)
|
||||
reverse_type[i] = FALSE;
|
||||
|
||||
choice = gnc_gconf_get_string(GCONF_GENERAL, KEY_REVERSED_ACCOUNTS, NULL);
|
||||
choice = gnc_prefs_get_string(GNC_PREFS_GROUP_GENERAL, GNC_PREF_REVERSED_ACCOUNTS);
|
||||
|
||||
if (g_strcmp0 (choice, "none") == 0)
|
||||
{
|
||||
@@ -170,11 +171,11 @@ gnc_reverse_balance (const Account *account)
|
||||
|
||||
|
||||
gchar *
|
||||
gnc_get_default_directory (const gchar *gconf_section)
|
||||
gnc_get_default_directory (const gchar *section)
|
||||
{
|
||||
gchar *dir;
|
||||
|
||||
dir = gnc_gconf_get_string (gconf_section, KEY_LAST_PATH, NULL);
|
||||
dir = gnc_prefs_get_string (section, GNC_PREF_LAST_PATH);
|
||||
if (!dir)
|
||||
#ifdef G_OS_WIN32
|
||||
dir = g_strdup (g_get_user_data_dir ()); /* equivalent of "My Documents" */
|
||||
@@ -186,9 +187,9 @@ gnc_get_default_directory (const gchar *gconf_section)
|
||||
}
|
||||
|
||||
void
|
||||
gnc_set_default_directory (const gchar *gconf_section, const gchar *directory)
|
||||
gnc_set_default_directory (const gchar *section, const gchar *directory)
|
||||
{
|
||||
gnc_gconf_set_string(gconf_section, KEY_LAST_PATH, directory, NULL);
|
||||
gnc_prefs_set_string(section, GNC_PREF_LAST_PATH, directory);
|
||||
}
|
||||
|
||||
QofBook *
|
||||
@@ -279,8 +280,8 @@ gchar *
|
||||
gnc_get_account_name_for_register(const Account *account)
|
||||
{
|
||||
gboolean show_leaf_accounts;
|
||||
show_leaf_accounts = gnc_gconf_get_bool(GCONF_GENERAL_REGISTER,
|
||||
KEY_SHOW_LEAF_ACCOUNT_NAMES, NULL);
|
||||
show_leaf_accounts = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL_REGISTER,
|
||||
GNC_PREF_SHOW_LEAF_ACCT_NAMES);
|
||||
|
||||
if (show_leaf_accounts)
|
||||
return g_strdup (xaccAccountGetName (account));
|
||||
@@ -292,8 +293,8 @@ Account *
|
||||
gnc_account_lookup_for_register(const Account *base_account, const char *name)
|
||||
{
|
||||
gboolean show_leaf_accounts;
|
||||
show_leaf_accounts = gnc_gconf_get_bool(GCONF_GENERAL_REGISTER,
|
||||
KEY_SHOW_LEAF_ACCOUNT_NAMES, NULL);
|
||||
show_leaf_accounts = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL_REGISTER,
|
||||
GNC_PREF_SHOW_LEAF_ACCT_NAMES);
|
||||
|
||||
if (show_leaf_accounts)
|
||||
return gnc_account_lookup_by_name (base_account, name);
|
||||
@@ -881,7 +882,7 @@ gnc_locale_default_currency_nodefault (void)
|
||||
/* Some very old locales (notably on win32) still announce a euro
|
||||
currency as default, although it has been replaced by EUR in
|
||||
2001. We use EUR as default in that case, but the user can always
|
||||
override from gconf. */
|
||||
override from gsettings. */
|
||||
if (gnc_is_euro_currency (currency))
|
||||
currency = gnc_get_euro();
|
||||
|
||||
@@ -901,7 +902,7 @@ gnc_locale_default_currency (void)
|
||||
|
||||
static gnc_commodity *
|
||||
gnc_default_currency_common (gchar *requested_currency,
|
||||
const gchar *gconf_section)
|
||||
const gchar *section)
|
||||
{
|
||||
gnc_commodity *currency = NULL;
|
||||
gchar *choice, *mnemonic;
|
||||
@@ -911,10 +912,10 @@ gnc_default_currency_common (gchar *requested_currency,
|
||||
GNC_COMMODITY_NS_CURRENCY,
|
||||
requested_currency);
|
||||
|
||||
choice = gnc_gconf_get_string(gconf_section, KEY_CURRENCY_CHOICE, NULL);
|
||||
choice = gnc_prefs_get_string(section, GNC_PREF_CURRENCY_CHOICE);
|
||||
if (g_strcmp0(choice, "other") == 0)
|
||||
{
|
||||
mnemonic = gnc_gconf_get_string(gconf_section, KEY_CURRENCY_OTHER, NULL);
|
||||
mnemonic = gnc_prefs_get_string(section, GNC_PREF_CURRENCY_OTHER);
|
||||
currency = gnc_commodity_table_lookup(gnc_get_current_commodities(),
|
||||
GNC_COMMODITY_NS_CURRENCY, mnemonic);
|
||||
DEBUG("mnemonic %s, result %p", mnemonic ? mnemonic : "(null)", currency);
|
||||
@@ -937,7 +938,7 @@ gnc_default_currency_common (gchar *requested_currency,
|
||||
gnc_commodity *
|
||||
gnc_default_currency (void)
|
||||
{
|
||||
return gnc_default_currency_common (user_default_currency, GCONF_GENERAL);
|
||||
return gnc_default_currency_common (user_default_currency, GNC_PREFS_GROUP_GENERAL);
|
||||
}
|
||||
|
||||
gnc_commodity * gnc_account_or_default_currency(const Account* account, gboolean * currency_from_account_found)
|
||||
@@ -970,11 +971,11 @@ gnc_commodity * gnc_account_or_default_currency(const Account* account, gboolean
|
||||
gnc_commodity *
|
||||
gnc_default_report_currency (void)
|
||||
{
|
||||
return gnc_default_currency_common (user_report_currency, GCONF_GENERAL_REPORT);
|
||||
return gnc_default_currency_common (user_report_currency, GNC_PREFS_GROUP_GENERAL_REPORT);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_currency_changed_cb (GConfEntry *entry, gpointer user_data)
|
||||
gnc_currency_changed_cb (GSettings *settings, gchar *key, gpointer user_data)
|
||||
{
|
||||
user_default_currency = NULL;
|
||||
user_report_currency = NULL;
|
||||
@@ -2278,31 +2279,25 @@ xaccParseAmountExtended (const char * in_str, gboolean monetary,
|
||||
|
||||
/* enable/disable the auto_decimal_enabled option */
|
||||
static void
|
||||
gnc_set_auto_decimal_enabled (GConfEntry *entry, gpointer user_data)
|
||||
gnc_set_auto_decimal_enabled (GSettings *settings, gchar *key, gpointer user_data)
|
||||
{
|
||||
GConfValue *value;
|
||||
|
||||
value = gconf_entry_get_value(entry);
|
||||
auto_decimal_enabled = gconf_value_get_bool(value);
|
||||
auto_decimal_enabled = g_settings_get_boolean (settings, key);
|
||||
}
|
||||
|
||||
/* set the number of auto decimal places to use */
|
||||
static void
|
||||
gnc_set_auto_decimal_places (GConfEntry *entry, gpointer user_data)
|
||||
gnc_set_auto_decimal_places (GSettings *settings, gchar *key, gpointer user_data)
|
||||
{
|
||||
GConfValue *value;
|
||||
|
||||
value = gconf_entry_get_value(entry);
|
||||
auto_decimal_places = gconf_value_get_float(value);
|
||||
auto_decimal_places = g_settings_get_int (settings, key);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_auto_decimal_init (void)
|
||||
{
|
||||
auto_decimal_enabled =
|
||||
gnc_gconf_get_bool(GCONF_GENERAL, "auto_decimal_point", NULL);
|
||||
gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_AUTO_DECIMAL_POINT);
|
||||
auto_decimal_places =
|
||||
(int)gnc_gconf_get_float(GCONF_GENERAL, "auto_decimal_places", NULL);
|
||||
gnc_prefs_get_float (GNC_PREFS_GROUP_GENERAL, GNC_PREF_AUTO_DECIMAL_PLACES);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2311,21 +2306,17 @@ gnc_ui_util_init (void)
|
||||
gnc_configure_account_separator ();
|
||||
gnc_auto_decimal_init();
|
||||
|
||||
gnc_gconf_general_register_cb(KEY_ACCOUNT_SEPARATOR,
|
||||
(GncGconfGeneralCb)gnc_configure_account_separator,
|
||||
NULL);
|
||||
gnc_gconf_general_register_cb(KEY_REVERSED_ACCOUNTS,
|
||||
(GncGconfGeneralCb)gnc_configure_reverse_balance,
|
||||
NULL);
|
||||
gnc_gconf_general_register_cb(KEY_CURRENCY_CHOICE,
|
||||
gnc_currency_changed_cb, NULL);
|
||||
gnc_gconf_general_register_cb(KEY_CURRENCY_OTHER,
|
||||
gnc_currency_changed_cb, NULL);
|
||||
gnc_gconf_general_register_cb("auto_decimal_point",
|
||||
gnc_set_auto_decimal_enabled,
|
||||
NULL);
|
||||
gnc_gconf_general_register_cb("auto_decimal_places",
|
||||
gnc_set_auto_decimal_places,
|
||||
NULL);
|
||||
gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL, GNC_PREF_ACCOUNT_SEPARATOR,
|
||||
gnc_configure_account_separator, NULL);
|
||||
gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL, GNC_PREF_REVERSED_ACCOUNTS,
|
||||
gnc_configure_reverse_balance, NULL);
|
||||
gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL, GNC_PREF_CURRENCY_CHOICE,
|
||||
gnc_currency_changed_cb, NULL);
|
||||
gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL, GNC_PREF_CURRENCY_OTHER,
|
||||
gnc_currency_changed_cb, NULL);
|
||||
gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL, GNC_PREF_AUTO_DECIMAL_POINT,
|
||||
gnc_set_auto_decimal_enabled, NULL);
|
||||
gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL, GNC_PREF_AUTO_DECIMAL_PLACES,
|
||||
gnc_set_auto_decimal_places, NULL);
|
||||
|
||||
}
|
||||
|
||||
@@ -46,14 +46,16 @@ typedef QofSession * (*QofSessionCB) (void);
|
||||
gboolean gnc_reverse_balance(const Account *account);
|
||||
|
||||
/* Default directory sections ***************************************/
|
||||
#define GCONF_DIR_OPEN_SAVE "dialogs/open_save"
|
||||
#define GCONF_DIR_EXPORT "dialogs/export_accounts"
|
||||
#define GCONF_DIR_REPORT "dialogs/report"
|
||||
#define GNC_PREFS_GROUP_OPEN_SAVE "dialogs.open_save"
|
||||
#define GNC_PREFS_GROUP_EXPORT "dialogs.export_accounts"
|
||||
#define GNC_PREFS_GROUP_REPORT "dialogs.report"
|
||||
#define GNC_PREF_AUTO_DECIMAL_POINT "auto_decimal_point"
|
||||
#define GNC_PREF_AUTO_DECIMAL_PLACES "auto_decimal_places"
|
||||
|
||||
/* Default directories **********************************************/
|
||||
|
||||
gchar *gnc_get_default_directory (const gchar *gconf_section);
|
||||
void gnc_set_default_directory (const gchar *gconf_section,
|
||||
gchar *gnc_get_default_directory (const gchar *section);
|
||||
void gnc_set_default_directory (const gchar *section,
|
||||
const gchar *directory);
|
||||
|
||||
/* Engine enhancements & i18n ***************************************/
|
||||
|
||||
@@ -39,9 +39,9 @@
|
||||
#include "qof.h"
|
||||
#include "engine-helpers-guile.h"
|
||||
#include "glib-helpers.h"
|
||||
#include "gnc-gconf-utils.h"
|
||||
#include "gnc-glib-utils.h"
|
||||
#include "gnc-guile-utils.h"
|
||||
#include "gnc-prefs.h"
|
||||
#include "guile-util.h"
|
||||
#include "guile-mappings.h"
|
||||
|
||||
@@ -902,7 +902,7 @@ gnc_get_debit_string(GNCAccountType account_type)
|
||||
|
||||
initialize_scm_functions();
|
||||
|
||||
if (gnc_gconf_get_bool(GCONF_GENERAL, KEY_ACCOUNTING_LABELS, NULL))
|
||||
if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_ACCOUNTING_LABELS))
|
||||
return g_strdup(_("Debit"));
|
||||
|
||||
if ((account_type < ACCT_TYPE_NONE) || (account_type >= NUM_ACCOUNT_TYPES))
|
||||
@@ -933,7 +933,7 @@ gnc_get_credit_string(GNCAccountType account_type)
|
||||
|
||||
initialize_scm_functions();
|
||||
|
||||
if (gnc_gconf_get_bool(GCONF_GENERAL, KEY_ACCOUNTING_LABELS, NULL))
|
||||
if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_ACCOUNTING_LABELS))
|
||||
return g_strdup(_("Credit"));
|
||||
|
||||
if ((account_type < ACCT_TYPE_NONE) || (account_type >= NUM_ACCOUNT_TYPES))
|
||||
|
||||
@@ -40,8 +40,7 @@ LDADD = \
|
||||
${top_builddir}/src/app-utils/libgncmod-app-utils.la \
|
||||
${top_builddir}/src/test-core/libtest-core.la \
|
||||
${top_builddir}/src/engine/test-core/libgncmod-test-engine.la \
|
||||
${GUILE_LIBS} \
|
||||
${GCONF_LIBS}
|
||||
${GUILE_LIBS}
|
||||
|
||||
check_PROGRAMS = \
|
||||
test-link-module \
|
||||
@@ -64,5 +63,4 @@ AM_CPPFLAGS = \
|
||||
-I${top_srcdir}/src/core-utils \
|
||||
-I${top_srcdir}/src/libqof/qof \
|
||||
${GUILE_INCS} \
|
||||
${GLIB_CFLAGS} \
|
||||
${GCONF_CFLAGS}
|
||||
${GLIB_CFLAGS}
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include <libguile.h>
|
||||
#include "gnc-gconf-utils.h"
|
||||
#include "gnc-exp-parser.h"
|
||||
#include "gnc-numeric.h"
|
||||
#include "test-stuff.h"
|
||||
|
||||
@@ -260,7 +260,7 @@ gnc_ui_file_access( int type )
|
||||
gint active_access_method_index = -1;
|
||||
const gchar* default_db;
|
||||
const gchar *button_label = NULL;
|
||||
const gchar *gconf_section = NULL;
|
||||
const gchar *settings_section = NULL;
|
||||
gchar *last;
|
||||
|
||||
g_return_if_fail( type == FILE_ACCESS_OPEN || type == FILE_ACCESS_SAVE_AS || type == FILE_ACCESS_EXPORT );
|
||||
@@ -295,14 +295,14 @@ gnc_ui_file_access( int type )
|
||||
gtk_window_set_title(GTK_WINDOW(faw->dialog), _("Open..."));
|
||||
button_label = "gtk-open";
|
||||
fileChooserAction = GTK_FILE_CHOOSER_ACTION_OPEN;
|
||||
gconf_section = GCONF_DIR_OPEN_SAVE;
|
||||
settings_section = GNC_PREFS_GROUP_OPEN_SAVE;
|
||||
break;
|
||||
|
||||
case FILE_ACCESS_SAVE_AS:
|
||||
gtk_window_set_title(GTK_WINDOW(faw->dialog), _("Save As..."));
|
||||
button_label = "gtk-save-as";
|
||||
fileChooserAction = GTK_FILE_CHOOSER_ACTION_SAVE;
|
||||
gconf_section = GCONF_DIR_OPEN_SAVE;
|
||||
settings_section = GNC_PREFS_GROUP_OPEN_SAVE;
|
||||
gtk_widget_destroy(faw->readonly_checkbutton);
|
||||
faw->readonly_checkbutton = NULL;
|
||||
break;
|
||||
@@ -311,7 +311,7 @@ gnc_ui_file_access( int type )
|
||||
gtk_window_set_title(GTK_WINDOW(faw->dialog), _("Export"));
|
||||
button_label = "gtk-save-as";
|
||||
fileChooserAction = GTK_FILE_CHOOSER_ACTION_SAVE;
|
||||
gconf_section = GCONF_DIR_EXPORT;
|
||||
settings_section = GNC_PREFS_GROUP_EXPORT;
|
||||
gtk_widget_destroy(faw->readonly_checkbutton);
|
||||
faw->readonly_checkbutton = NULL;
|
||||
break;
|
||||
@@ -341,7 +341,7 @@ gnc_ui_file_access( int type )
|
||||
}
|
||||
}
|
||||
if (!faw->starting_dir)
|
||||
faw->starting_dir = gnc_get_default_directory(gconf_section);
|
||||
faw->starting_dir = gnc_get_default_directory(settings_section);
|
||||
gtk_file_chooser_set_current_folder(faw->fileChooser, faw->starting_dir);
|
||||
|
||||
g_object_connect( G_OBJECT(faw->fileChooser), "signal::file-activated",
|
||||
|
||||
@@ -113,7 +113,7 @@ GSList *add_ins = NULL;
|
||||
|
||||
|
||||
/** This function is called whenever the account separator is changed
|
||||
* in gconf. It updates the label in the "Account" page of the
|
||||
* in gconf. It updates the example label in the "Account" page of the
|
||||
* preferences dialog.
|
||||
*
|
||||
* @internal
|
||||
|
||||
@@ -687,7 +687,7 @@ RESTART:
|
||||
if (gnc_uri_is_file_protocol(protocol))
|
||||
{
|
||||
gchar *default_dir = g_path_get_dirname(path);
|
||||
gnc_set_default_directory (GCONF_DIR_OPEN_SAVE, default_dir);
|
||||
gnc_set_default_directory (GNC_PREFS_GROUP_OPEN_SAVE, default_dir);
|
||||
g_free(default_dir);
|
||||
}
|
||||
|
||||
@@ -723,7 +723,7 @@ RESTART:
|
||||
if (g_file_test (filename, G_FILE_TEST_IS_DIR))
|
||||
directory = g_strdup (filename);
|
||||
else
|
||||
directory = gnc_get_default_directory (GCONF_DIR_OPEN_SAVE);
|
||||
directory = gnc_get_default_directory (GNC_PREFS_GROUP_OPEN_SAVE);
|
||||
|
||||
filename = gnc_file_dialog (NULL, NULL, directory,
|
||||
GNC_FILE_DIALOG_OPEN);
|
||||
@@ -1023,7 +1023,7 @@ gnc_file_open (void)
|
||||
g_free ( filepath );
|
||||
}
|
||||
else
|
||||
default_dir = gnc_get_default_directory(GCONF_DIR_OPEN_SAVE);
|
||||
default_dir = gnc_get_default_directory(GNC_PREFS_GROUP_OPEN_SAVE);
|
||||
|
||||
newfile = gnc_file_dialog (_("Open"), NULL, default_dir, GNC_FILE_DIALOG_OPEN);
|
||||
g_free ( last );
|
||||
@@ -1072,7 +1072,7 @@ gnc_file_export (void)
|
||||
g_free ( filepath );
|
||||
}
|
||||
else
|
||||
default_dir = gnc_get_default_directory(GCONF_DIR_EXPORT);
|
||||
default_dir = gnc_get_default_directory(GNC_PREFS_GROUP_EXPORT);
|
||||
|
||||
filename = gnc_file_dialog (_("Save"), NULL, default_dir,
|
||||
GNC_FILE_DIALOG_SAVE);
|
||||
@@ -1137,7 +1137,7 @@ gnc_file_do_export(const char * filename)
|
||||
{
|
||||
/* Remember the directory as the default. */
|
||||
gchar *default_dir = g_path_get_dirname(path);
|
||||
gnc_set_default_directory (GCONF_DIR_OPEN_SAVE, default_dir);
|
||||
gnc_set_default_directory (GNC_PREFS_GROUP_OPEN_SAVE, default_dir);
|
||||
g_free(default_dir);
|
||||
|
||||
/* Prevent user to store file in GnuCash' private configuration
|
||||
@@ -1308,7 +1308,7 @@ gnc_file_save_as (void)
|
||||
g_free ( filepath );
|
||||
}
|
||||
else
|
||||
default_dir = gnc_get_default_directory(GCONF_DIR_OPEN_SAVE);
|
||||
default_dir = gnc_get_default_directory(GNC_PREFS_GROUP_OPEN_SAVE);
|
||||
|
||||
filename = gnc_file_dialog (_("Save"), NULL, default_dir,
|
||||
GNC_FILE_DIALOG_SAVE);
|
||||
@@ -1375,7 +1375,7 @@ gnc_file_do_save_as (const char* filename)
|
||||
{
|
||||
/* Remember the directory as the default. */
|
||||
gchar *default_dir = g_path_get_dirname(path);
|
||||
gnc_set_default_directory (GCONF_DIR_OPEN_SAVE, default_dir);
|
||||
gnc_set_default_directory (GNC_PREFS_GROUP_OPEN_SAVE, default_dir);
|
||||
g_free(default_dir);
|
||||
|
||||
/* Prevent user to store file in GnuCash' private configuration
|
||||
|
||||
@@ -71,6 +71,7 @@ G_BEGIN_DECLS
|
||||
#endif
|
||||
|
||||
#define GCONF_SECTION_AQBANKING "dialogs/import/hbci"
|
||||
#define GNC_PREFS_GROUP_AQBANKING "dialogs.import.hbci"
|
||||
#define KEY_FORMAT_SWIFT940 "format_swift_mt940"
|
||||
#define KEY_FORMAT_SWIFT942 "format_swift_mt942"
|
||||
#define KEY_FORMAT_DTAUS "format_dtaus"
|
||||
|
||||
@@ -90,7 +90,7 @@ gnc_file_aqbanking_import(const gchar *aqbanking_importername,
|
||||
GString *errstr = NULL;
|
||||
|
||||
/* Select a file */
|
||||
default_dir = gnc_get_default_directory(GCONF_SECTION_AQBANKING);
|
||||
default_dir = gnc_get_default_directory(GNC_PREFS_GROUP_AQBANKING);
|
||||
selected_filename = gnc_file_dialog(_("Select a file to import"),
|
||||
NULL, default_dir,
|
||||
GNC_FILE_DIALOG_IMPORT);
|
||||
@@ -102,7 +102,7 @@ gnc_file_aqbanking_import(const gchar *aqbanking_importername,
|
||||
|
||||
/* Remember the directory as the default */
|
||||
default_dir = g_path_get_dirname(selected_filename);
|
||||
gnc_set_default_directory(GCONF_SECTION_AQBANKING, default_dir);
|
||||
gnc_set_default_directory(GNC_PREFS_GROUP_AQBANKING, default_dir);
|
||||
g_free(default_dir);
|
||||
|
||||
dtaus_fd = g_open(selected_filename, O_RDONLY, 0);
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "csv-transactions-export.h"
|
||||
|
||||
#define GCONF_SECTION "dialogs/export/csv"
|
||||
#define GNC_PREFS_GROUP "dialogs.export.csv"
|
||||
#define PANED_POSITION "paned_position"
|
||||
#define ASSISTANT_CSV_EXPORT_CM_CLASS "assistant-csv-export"
|
||||
|
||||
@@ -250,7 +251,7 @@ void load_settings (CsvExportInfo *info)
|
||||
info->starting_dir = NULL;
|
||||
|
||||
/* The default directory for the user to select files. */
|
||||
info->starting_dir = gnc_get_default_directory(GCONF_SECTION);
|
||||
info->starting_dir = gnc_get_default_directory(GNC_PREFS_GROUP);
|
||||
}
|
||||
|
||||
/* =============================================================== */
|
||||
@@ -748,7 +749,7 @@ csv_export_assistant_summary_page_prepare (GtkAssistant *assistant,
|
||||
/* 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);
|
||||
gnc_set_default_directory(GCONF_SECTION, info->starting_dir);
|
||||
gnc_set_default_directory(GNC_PREFS_GROUP, info->starting_dir);
|
||||
|
||||
if (info->failed)
|
||||
text = _("There was a problem with the export, this could be due to lack of space, "
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "csv-account-import.h"
|
||||
|
||||
#define GCONF_SECTION "dialogs/import/csv"
|
||||
#define GNC_PREFS_GROUP "dialogs.import.csv"
|
||||
#define ASSISTANT_CSV_IMPORT_CM_CLASS "assistant-csv-account-import"
|
||||
|
||||
/* This static indicates the debugging module that this .o belongs to. */
|
||||
@@ -275,7 +276,7 @@ void load_settings (CsvImportInfo *info)
|
||||
info->error = "";
|
||||
|
||||
/* The default directory for the user to select files. */
|
||||
info->starting_dir = gnc_get_default_directory(GCONF_SECTION);
|
||||
info->starting_dir = gnc_get_default_directory(GNC_PREFS_GROUP);
|
||||
}
|
||||
|
||||
|
||||
@@ -420,7 +421,7 @@ csv_import_assistant_finish_page_prepare (GtkAssistant *assistant,
|
||||
g_free(text);
|
||||
|
||||
/* Save the Window size and directory */
|
||||
gnc_set_default_directory(GCONF_SECTION, info->starting_dir);
|
||||
gnc_set_default_directory(GNC_PREFS_GROUP, info->starting_dir);
|
||||
|
||||
/* Enable the Assistant Buttons */
|
||||
gtk_assistant_set_page_complete (assistant, page, TRUE);
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
|
||||
#define MIN_COL_WIDTH 70
|
||||
#define GCONF_SECTION "dialogs/import/csv"
|
||||
#define GNC_PREFS_GROUP "dialogs.import.csv"
|
||||
#define ASSISTANT_CSV_IMPORT_TRANS_CM_CLASS "assistant-csv-trans-import"
|
||||
|
||||
/* This static indicates the debugging module that this .o belongs to. */
|
||||
@@ -1270,7 +1271,7 @@ void load_settings (CsvImportTrans *info)
|
||||
info->starting_dir = NULL;
|
||||
|
||||
/* The default directory for the user to select files. */
|
||||
info->starting_dir = gnc_get_default_directory(GCONF_SECTION);
|
||||
info->starting_dir = gnc_get_default_directory(GNC_PREFS_GROUP);
|
||||
}
|
||||
|
||||
/*======================================================================*/
|
||||
@@ -1510,7 +1511,7 @@ csv_import_trans_assistant_summary_page_prepare (GtkAssistant *assistant,
|
||||
gchar *text, *mtext;
|
||||
|
||||
/* Save the Window size and directory */
|
||||
gnc_set_default_directory(GCONF_SECTION, info->starting_dir);
|
||||
gnc_set_default_directory(GNC_PREFS_GROUP, info->starting_dir);
|
||||
|
||||
/* Remove the added button */
|
||||
gtk_assistant_remove_action_widget (assistant, info->help_button);
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#include "gnc-ui-util.h"
|
||||
#include "gnc-gui-query.h"
|
||||
|
||||
#define GCONF_SECTION "dialogs/log_replay"
|
||||
#define GNC_PREFS_GROUP "dialogs.log_replay"
|
||||
|
||||
/* NW: If you want a new log_module, just define
|
||||
a unique string either in gnc-engine.h or
|
||||
@@ -562,7 +562,7 @@ void gnc_file_log_replay (void)
|
||||
/* Don't log the log replay. This would only result in redundant logs */
|
||||
xaccLogDisable();
|
||||
|
||||
default_dir = gnc_get_default_directory(GCONF_SECTION);
|
||||
default_dir = gnc_get_default_directory(GNC_PREFS_GROUP);
|
||||
|
||||
filter = gtk_file_filter_new();
|
||||
gtk_file_filter_set_name(filter, "*.log");
|
||||
@@ -577,7 +577,7 @@ void gnc_file_log_replay (void)
|
||||
{
|
||||
/* Remember the directory as the default. */
|
||||
default_dir = g_path_get_dirname(selected_filename);
|
||||
gnc_set_default_directory(GCONF_SECTION, default_dir);
|
||||
gnc_set_default_directory(GNC_PREFS_GROUP, default_dir);
|
||||
g_free(default_dir);
|
||||
|
||||
/*strncpy(file,selected_filename, 255);*/
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
#include "gnc-ofx-kvp.h"
|
||||
|
||||
#define GCONF_SECTION "dialogs/import/ofx"
|
||||
#define GNC_PREFS_GROUP "dialogs.import.ofx"
|
||||
|
||||
static QofLogModule log_module = GNC_MOD_IMPORT;
|
||||
|
||||
@@ -929,7 +929,7 @@ void gnc_file_ofx_import (void)
|
||||
|
||||
DEBUG("gnc_file_ofx_import(): Begin...\n");
|
||||
|
||||
default_dir = gnc_get_default_directory(GCONF_SECTION);
|
||||
default_dir = gnc_get_default_directory(GNC_PREFS_GROUP);
|
||||
selected_filename = gnc_file_dialog(_("Select an OFX/QFX file to process"),
|
||||
NULL,
|
||||
default_dir,
|
||||
@@ -944,7 +944,7 @@ void gnc_file_ofx_import (void)
|
||||
|
||||
/* Remember the directory as the default. */
|
||||
default_dir = g_path_get_dirname(selected_filename);
|
||||
gnc_set_default_directory(GCONF_SECTION, default_dir);
|
||||
gnc_set_default_directory(GNC_PREFS_GROUP, default_dir);
|
||||
g_free(default_dir);
|
||||
|
||||
/*strncpy(file,selected_filename, 255);*/
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
|
||||
#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 GCONF_NAME_DEFAULT_TRANSACTION_STATUS "default_status"
|
||||
|
||||
@@ -1601,7 +1602,7 @@ gnc_ui_qif_import_select_file_cb(GtkButton * button,
|
||||
char *file_name, *default_dir;
|
||||
|
||||
/* Default to whatever's already present */
|
||||
default_dir = gnc_get_default_directory(GCONF_SECTION);
|
||||
default_dir = gnc_get_default_directory(GNC_PREFS_GROUP);
|
||||
|
||||
filter = gtk_file_filter_new();
|
||||
gtk_file_filter_set_name(filter, "*.qif");
|
||||
@@ -1627,7 +1628,7 @@ gnc_ui_qif_import_select_file_cb(GtkButton * button,
|
||||
/* Update the working directory */
|
||||
g_free(default_dir);
|
||||
default_dir = g_path_get_dirname(file_name);
|
||||
gnc_set_default_directory(GCONF_SECTION, default_dir);
|
||||
gnc_set_default_directory(GNC_PREFS_GROUP, default_dir);
|
||||
}
|
||||
g_free(default_dir);
|
||||
|
||||
|
||||
@@ -1402,7 +1402,7 @@ gnc_get_export_filename (SCM choice)
|
||||
|
||||
/* %s is the type of what is about to be saved, e.g. "HTML". */
|
||||
title = g_strdup_printf (_("Save %s To File"), type);
|
||||
default_dir = gnc_get_default_directory(GCONF_DIR_REPORT);
|
||||
default_dir = gnc_get_default_directory(GNC_PREFS_GROUP_REPORT);
|
||||
|
||||
filepath = gnc_file_dialog (title, NULL, default_dir, GNC_FILE_DIALOG_EXPORT);
|
||||
|
||||
@@ -1418,7 +1418,7 @@ gnc_get_export_filename (SCM choice)
|
||||
return NULL;
|
||||
|
||||
default_dir = g_path_get_dirname(filepath);
|
||||
gnc_set_default_directory (GCONF_DIR_REPORT, default_dir);
|
||||
gnc_set_default_directory (GNC_PREFS_GROUP_REPORT, default_dir);
|
||||
g_free(default_dir);
|
||||
|
||||
rc = g_stat (filepath, &statbuf);
|
||||
|
||||
Reference in New Issue
Block a user