31 #define QOF_CONFIG_DESC "desc"
32 #define QOF_CONFIG_TIP "tip"
39 be->session_begin = NULL;
40 be->session_end = NULL;
41 be->destroy_backend = NULL;
46 be->compile_query = NULL;
47 be->free_query = NULL;
50 be->load_config = NULL;
51 be->events_pending = NULL;
52 be->process_events = NULL;
53 be->percentage = NULL;
64 (be->begin) (be, inst);
83 (be->commit) (be, inst);
91 g_return_if_fail (be);
108 g_return_if_fail (be || option);
109 count = be->config_count;
112 switch (option->
type)
116 value = kvp_value_new_gint64 (*(gint64 *) option->
value);
121 value = kvp_value_new_double (*(gdouble *) option->
value);
131 value = kvp_value_new_string ((
const gchar *) option->
value);
162 temp = g_strdup_printf (
"/%s", option->
option_name);
166 g_strdup_printf (
"/%s/%s", QOF_CONFIG_DESC,
172 g_strdup_printf (
"/%s/%s", QOF_CONFIG_TIP,
178 be->config_count = count;
185 g_return_val_if_fail (be, NULL);
186 be->config_count = 0;
187 return be->backend_configuration;
190 struct config_iterate
203 config_foreach_cb (
const gchar * key,
KvpValue * value, gpointer data)
210 struct config_iterate *helper;
212 g_return_if_fail (key || value || data);
213 helper = (
struct config_iterate *) data;
214 if (!helper->recursive)
216 PERR (
" no parent frame");
228 ENTER (
" key=%s", key);
230 option.
type = kvp_value_get_type (value);
238 option.
value = (gpointer) & int64;
243 db = kvp_value_get_double (value);
244 option.
value = (gpointer) & db;
249 num = kvp_value_get_numeric (value);
250 option.
value = (gpointer) & num;
260 option.
value = (gpointer) kvp_value_get_time (value);
283 parent = g_strdup_printf (
"/%s/%s", QOF_CONFIG_DESC, key);
284 option.
description = kvp_frame_get_string (helper->recursive, parent);
286 parent = g_strdup_printf (
"/%s/%s", QOF_CONFIG_TIP, key);
287 option.
tooltip = kvp_frame_get_string (helper->recursive, parent);
291 helper->fcn (&option, helper->data);
297 (*(gint64 *) option.
value));
303 (*(gdouble *) option.
value));
315 (gchar *) option.
value);
352 struct config_iterate helper;
360 helper.recursive = config;
370 if (!be->load_config)
372 (be->load_config) (be, config);
382 return (be->get_config) (be);
398 const gchar * filename,
const gchar * init_fcn)
401 typedef void (*backend_init) (void);
403 backend_init gmod_init;
406 g_return_val_if_fail (g_module_supported (), FALSE);
407 fullpath = g_module_build_path (directory, filename);
408 backend = g_module_open (fullpath, G_MODULE_BIND_LAZY);
411 PERR (
" No backend found. %s", g_module_error ());
415 if (!g_module_symbol (backend, init_fcn, g))
417 PERR (
" Backend did not initialise. %s", g_module_error ());
420 g_module_make_resident (backend);