void gnc_exp_parser_real_init ( gboolean addPredefined ) { gchar *filename, **keys, **key, *str_value; GKeyFile *key_file; gnc_numeric value; if (parser_inited) gnc_exp_parser_shutdown (); variable_bindings = g_hash_table_new (g_str_hash, g_str_equal); /* This comes after the statics have been initialized. Not at the end! */ parser_inited = TRUE; if ( addPredefined ) { filename = gnc_exp_parser_filname(); key_file = gnc_key_file_load_from_file(filename, TRUE, FALSE, NULL); if (key_file) { keys = g_key_file_get_keys(key_file, GROUP_NAME, NULL, NULL); for (key = keys; key && *key; key++) { str_value = g_key_file_get_string(key_file, GROUP_NAME, *key, NULL); if (str_value && string_to_gnc_numeric(str_value, &value)) { gnc_exp_parser_set_value (*key, gnc_numeric_reduce (value)); } } g_strfreev(keys); g_key_file_free(key_file); } g_free(filename); } }
static void app_utils_shutdown(void) { gnc_exp_parser_shutdown(); gnc_hook_run(HOOK_SAVE_OPTIONS, NULL); }