/* HomeBank -- Free, easy, personal accounting for everyone.
- * Copyright (C) 1995-2017 Maxime DOYEN
+ * Copyright (C) 1995-2018 Maxime DOYEN
*
* This file is part of HomeBank.
*
g_free(PREFS->minor_cur.decimal_char);
g_free(PREFS->minor_cur.grouping_char);
+ g_strfreev(PREFS->ext_path);
+ g_list_free_full(PREFS->ext_whitelist, g_free);
+
memset(PREFS, 0, sizeof(struct Preferences));
}
PREFS->lst_ope_columns[i++] = LST_DSPOPE_DATE;
PREFS->lst_ope_columns[i++] = LST_DSPOPE_INFO;
PREFS->lst_ope_columns[i++] = LST_DSPOPE_PAYEE;
- PREFS->lst_ope_columns[i++] = LST_DSPOPE_WORDING;
+ PREFS->lst_ope_columns[i++] = LST_DSPOPE_MEMO;
PREFS->lst_ope_columns[i++] = -LST_DSPOPE_AMOUNT;
PREFS->lst_ope_columns[i++] = LST_DSPOPE_EXPENSE;
PREFS->lst_ope_columns[i++] = LST_DSPOPE_INCOME;
PREFS->lst_ope_columns[i++] = LST_DSPOPE_EXPENSE;
PREFS->lst_ope_columns[i++] = LST_DSPOPE_INCOME;
PREFS->lst_ope_columns[i++] = LST_DSPOPE_BALANCE;
- PREFS->lst_ope_columns[i++] = LST_DSPOPE_WORDING;
+ PREFS->lst_ope_columns[i++] = LST_DSPOPE_MEMO;
PREFS->lst_ope_sort_id = LST_DSPOPE_DATE;
PREFS->lst_ope_sort_order = GTK_SORT_ASCENDING;
PREFS->vehicle_unit_ismile = FALSE;
PREFS->vehicle_unit_isgal = FALSE;
+ gchar** plugin_path = g_new0(gchar*, 4);
+ i = 0;
+ const gchar* env = g_getenv("HOMEBANK_PLUGINS");
+ if (env) {
+ if (g_path_is_absolute(env)) {
+ plugin_path[i++] = g_strdup(env);
+ } else {
+ gchar* cur = g_get_current_dir();
+ plugin_path[i++] = g_build_filename(cur, env, NULL);
+ g_free(cur);
+ }
+ }
+ plugin_path[i++] = g_build_filename(homebank_app_get_config_dir(), "plugins", NULL);
+ plugin_path[i++] = g_build_filename(homebank_app_get_pkglib_dir(), "plugins", NULL);
+ PREFS->ext_path = plugin_path;
+ PREFS->ext_whitelist = NULL;
+
_homebank_pref_init_measurement_units();
}
string = g_key_file_get_string(key_file, group_name, key, NULL);
if( string != NULL )
{
- *storage = g_strdup(string);
+ //*storage = g_strdup(string);
+ //leak
+ *storage = string; //already a new allocated string
//DB( g_print(" store '%s' for %s at %x\n", string, key, *storage) );
}
DB( g_print(" - copying column width from pref file\n") );
memcpy(PREFS->lst_ope_col_size, src, length*sizeof(gint));
}
+
+ //leak
+ g_free(src);
+
}
homebank_pref_get_integer(keyfile, group, "OpeSortId", &PREFS->lst_ope_sort_id);
DB( g_print(" -> ** Exchange\n") );
//homebank_pref_get_boolean(keyfile, group, "DoIntro", &PREFS->dtex_nointro);
+
homebank_pref_get_integer(keyfile, group, "DateFmt", &PREFS->dtex_datefmt);
homebank_pref_get_integer(keyfile, group, "OfxName", &PREFS->dtex_ofxname);
homebank_pref_get_integer(keyfile, group, "OfxMemo", &PREFS->dtex_ofxmemo);
//PREFS->chart_legend = g_key_file_get_boolean (keyfile, group, "Legend", NULL);
+ group = "Plugins";
+ {
+ DB( g_print(" -> ** Plugins\n") );
+
+ gchar** strv = g_key_file_get_string_list(keyfile, group, "Path", NULL, NULL);
+ if (strv) {
+ g_strfreev(PREFS->ext_path);
+ PREFS->ext_path = strv;
+ }
+
+ strv = g_key_file_get_string_list(keyfile, group, "Whitelist", NULL, NULL);
+ if (strv) {
+ gchar** it;
+ for (it = strv; it && *it; ++it) {
+ PREFS->ext_whitelist = g_list_append(PREFS->ext_whitelist, g_strdup(*it));
+ }
+ g_strfreev(strv);
+ }
+ }
+
+
/*
#if MYDEBUG == 1
gsize length;
g_key_file_set_integer (keyfile, group, "BarStyle", PREFS->toolbar_style);
//g_key_file_set_integer (keyfile, group, "BarImageSize", PREFS->image_size);
+
+
g_key_file_set_boolean (keyfile, group, "CustomColors", PREFS->custom_colors);
g_key_file_set_string (keyfile, group, "ColorExp" , PREFS->color_exp);
g_key_file_set_string (keyfile, group, "ColorInc" , PREFS->color_inc);
homebank_pref_set_string (keyfile, group, "ExportPath" , PREFS->path_export);
//g_key_file_set_string (keyfile, group, "NavigatorPath", PREFS->path_navigator);
+
+
+
g_key_file_set_boolean (keyfile, group, "ShowSplash", PREFS->showsplash);
g_key_file_set_boolean (keyfile, group, "LoadLast", PREFS->loadlast);
g_key_file_set_boolean (keyfile, group, "AppendScheduled", PREFS->appendscheduled);
group = "Filter";
g_key_file_set_integer (keyfile, group, "DateRangeWal", PREFS->date_range_wal);
g_key_file_set_integer (keyfile, group, "DateRangeTxn", PREFS->date_range_txn);
- g_key_file_set_integer (keyfile, group, "DateFutureNbdays", PREFS->date_future_nbdays);
+ g_key_file_set_integer (keyfile, group, "DateFutureNbDays", PREFS->date_future_nbdays);
g_key_file_set_integer (keyfile, group, "DateRangeRep", PREFS->date_range_rep);
DB( g_print(" -> ** euro\n") );
group = "Exchange";
//g_key_file_set_boolean (keyfile, group, "DoIntro", PREFS->dtex_nointro);
+
g_key_file_set_integer (keyfile, group, "DateFmt", PREFS->dtex_datefmt);
g_key_file_set_integer (keyfile, group, "OfxName", PREFS->dtex_ofxname);
g_key_file_set_integer (keyfile, group, "OfxMemo", PREFS->dtex_ofxmemo);
//group = "Chart";
//g_key_file_set_boolean (keyfile, group, "Legend", PREFS->chart_legend);
+ group = "Plugins";
+ {
+ g_key_file_set_string_list(keyfile, group, "Path", (const gchar* const*)PREFS->ext_path, g_strv_length(PREFS->ext_path));
+
+ gsize len = g_list_length(PREFS->ext_whitelist);
+ gchar** strv = g_new0(gchar*, len + 1);
+ guint i;
+
+ for (i = 0; i < len; ++i) {
+ strv[i] = g_list_nth_data(PREFS->ext_whitelist, i);
+ }
+ g_key_file_set_string_list(keyfile, group, "Whitelist", (const gchar* const*)strv, len);
+ g_free(strv);
+ }
+
//g_key_file_set_string (keyfile, group, "", PREFS->);
//g_key_file_set_boolean (keyfile, group, "", PREFS->);
//g_key_file_set_integer (keyfile, group, "", PREFS->);