GnuCash  4.8a-134-g214de30c7+
Files | Macros | Functions

The only function in this file is meant to initialize the preferences system early in the load process. More...

Files

file  gnc-prefs-utils.h
 Preferences initialization function.
 
file  gnc-prefs.h
 Generic api to store and retrieve preferences.
 

Macros

#define GNC_PREFS_GROUP_GENERAL   "general"
 
#define GNC_PREFS_GROUP_GENERAL_REGISTER   "general.register"
 
#define GNC_PREFS_GROUP_GENERAL_REPORT   "general.report"
 
#define GNC_PREFS_GROUP_WARNINGS   "general.warnings"
 
#define GNC_PREFS_GROUP_WARNINGS_TEMP   "warnings.temporary"
 
#define GNC_PREFS_GROUP_WARNINGS_PERM   "warnings.permanent"
 
#define GNC_PREFS_GROUP_ACCT_SUMMARY   "window.pages.account-tree.summary"
 
#define GNC_PREF_VERSION   "prefs-version"
 
#define GNC_PREF_SAVE_GEOMETRY   "save-window-geometry"
 
#define GNC_PREF_LAST_PATH   "last-path"
 
#define GNC_PREF_USE_NEW   "use-new-window"
 
#define GNC_PREF_ACCOUNTING_LABELS   "use-accounting-labels"
 
#define GNC_PREF_ACCOUNT_SEPARATOR   "account-separator"
 
#define GNC_PREF_NEGATIVE_IN_RED   "negative-in-red"
 
#define GNC_PREF_NUM_SOURCE   "num-source"
 
#define GNC_PREF_DATE_FORMAT   "date-format"
 
#define GNC_PREF_DATE_COMPL_THISYEAR   "date-completion-thisyear"
 
#define GNC_PREF_DATE_COMPL_SLIDING   "date-completion-sliding"
 
#define GNC_PREF_DATE_BACKMONTHS   "date-backmonths"
 
#define GNC_PREF_SHOW_LEAF_ACCT_NAMES   "show-leaf-account-names"
 
#define GNC_PREF_ENTER_MOVES_TO_END   "enter-moves-to-end"
 
#define GNC_PREF_DRAW_HOR_LINES   "draw-horizontal-lines"
 
#define GNC_PREF_DRAW_VERT_LINES   "draw-vertical-lines"
 
#define GNC_PREF_ALT_COLOR_BY_TRANS   "alternate-color-by-transaction"
 
#define GNC_PREF_USE_THEME_COLORS   "use-theme-colors"
 
#define GNC_PREF_USE_GNUCASH_COLOR_THEME   "use-gnucash-color-theme"
 
#define GNC_PREF_TAB_TRANS_MEMORISED   "tab-to-transfer-on-memorised"
 
#define GNC_PREF_FUTURE_AFTER_BLANK   "future-after-blank-transaction"
 
#define GNC_PREF_START_CHOICE_ABS   "start-choice-absolute"
 
#define GNC_PREF_START_CHOICE_REL   "start-choice-relative"
 
#define GNC_PREF_START_DATE   "start-date"
 
#define GNC_PREF_START_PERIOD   "start-period"
 
#define GNC_PREF_END_CHOICE_ABS   "end-choice-absolute"
 
#define GNC_PREF_END_CHOICE_REL   "end-choice-relative"
 
#define GNC_PREF_END_DATE   "end-date"
 
#define GNC_PREF_END_PERIOD   "end-period"
 
#define GNC_PREF_CURRENCY_OTHER   "currency-other"
 
#define GNC_PREF_CURRENCY_CHOICE_LOCALE   "currency-choice-locale"
 
#define GNC_PREF_CURRENCY_CHOICE_OTHER   "currency-choice-other"
 

Functions

void gnc_prefs_init (void)
 This function is called early in the load process to preload a number of preferences from the settings backend.
 
void gnc_prefs_remove_registered (void)
 This function is called to remove the registered preference call backs setup in this file.
 
gboolean gnc_prefs_is_set_up (void)
 Test if preferences backend is set up.
 
void gnc_prefs_block_all (void)
 Block all preference callbacks.
 
void gnc_prefs_unblock_all (void)
 Unblock all preferences callbacks.
 

Early bird functions, needed before any backend has been set up

const gchar * gnc_prefs_get_namespace_regexp (void)
 
void gnc_prefs_set_namespace_regexp (const gchar *str)
 
gboolean gnc_prefs_is_debugging_enabled (void)
 
void gnc_prefs_set_debugging (gboolean d)
 
gboolean gnc_prefs_is_extra_enabled (void)
 
void gnc_prefs_set_extra (gboolean enabled)
 
gboolean gnc_prefs_get_file_save_compressed (void)
 
void gnc_prefs_set_file_save_compressed (gboolean compressed)
 
gint gnc_prefs_get_file_retention_policy (void)
 
void gnc_prefs_set_file_retention_policy (gint policy)
 
gint gnc_prefs_get_file_retention_days (void)
 
void gnc_prefs_set_file_retention_days (gint days)
 
guint gnc_prefs_get_long_version (void)
 

Listening for changes

gulong gnc_prefs_register_cb (const char *group, const gchar *pref_name, gpointer func, gpointer user_data)
 Register a callback that gets triggered when the given preference changes. More...
 
void gnc_prefs_remove_cb_by_func (const gchar *group, const gchar *pref_name, gpointer func, gpointer user_data)
 Remove a function that was registered for a callback when the given preference changed. More...
 
void gnc_prefs_remove_cb_by_id (const gchar *group, guint id)
 Remove a function that was registered for a callback when a specific preference in the settings group changed. More...
 
guint gnc_prefs_register_group_cb (const gchar *group, gpointer func, gpointer user_data)
 Register a callback for when any preference in the settings group is changed. More...
 
void gnc_prefs_remove_group_cb_by_func (const gchar *group, gpointer func, gpointer user_data)
 Remove a function that was registered for a callback when any preference in the given settings group changed. More...
 
void gnc_prefs_bind (const gchar *group, const gchar *pref_name, gpointer object, const gchar *property)
 Bind a setting to a g_object property. More...
 

Preference Getters

gboolean gnc_prefs_get_bool (const gchar *group, const gchar *pref_name)
 Get a boolean value from the preferences backend. More...
 
gint gnc_prefs_get_int (const gchar *group, const gchar *pref_name)
 Get an integer value from the preferences backend. More...
 
gint64 gnc_prefs_get_int64 (const gchar *group, const gchar *pref_name)
 Get an 64 bit integer value from the preferences backend. More...
 
gdouble gnc_prefs_get_float (const gchar *group, const gchar *pref_name)
 Get an float value from the preferences backend. More...
 
gchar * gnc_prefs_get_string (const gchar *group, const gchar *pref_name)
 Get a string value from the preferences backend. More...
 
gint gnc_prefs_get_enum (const gchar *group, const gchar *pref_name)
 Get an enum value from the preferences backend. More...
 
void gnc_prefs_get_coords (const gchar *group, const gchar *pref_name, gdouble *x, gdouble *y)
 Get a pair of coordinates from the preferences backend. More...
 
GVariant * gnc_prefs_get_value (const gchar *group, const gchar *pref_name)
 Get an arbitrary combination of values from the preferences backend. More...
 

Preference Setters and Unset Functions

gboolean gnc_prefs_set_bool (const gchar *group, const gchar *pref_name, gboolean value)
 Store a boolean value into the preferences backend. More...
 
gboolean gnc_prefs_set_int (const gchar *group, const gchar *pref_name, gint value)
 Store an integer value into the preferences backend. More...
 
gboolean gnc_prefs_set_int64 (const gchar *group, const gchar *pref_name, gint64 value)
 Store a 64 bit integer value into the preferences backend. More...
 
gboolean gnc_prefs_set_float (const gchar *group, const gchar *pref_name, gdouble value)
 Store a float value into the preferences backend. More...
 
gboolean gnc_prefs_set_string (const gchar *group, const gchar *pref_name, const gchar *value)
 Store a string into the preferences backend. More...
 
gboolean gnc_prefs_set_enum (const gchar *group, const gchar *pref_name, gint value)
 Store an enum value into the preferences backend. More...
 
gboolean gnc_prefs_set_coords (const gchar *group, const gchar *pref_name, gdouble x, gdouble y)
 Store coordinates into the preferences backend. More...
 
gboolean gnc_prefs_set_value (const gchar *group, const gchar *pref_name, GVariant *value)
 Store an arbitrary combination of values into the preferences backend. More...
 
void gnc_prefs_reset (const gchar *group, const gchar *pref_name)
 Reset a preference to its default value in the preferences backend. More...
 
void gnc_prefs_reset_group (const gchar *group)
 Reset all preferences in a group to their default values in the preferences backend. More...
 
gulong gnc_prefs_get_reg_auto_raise_lists_id (void)
 Get and Set registered preference id for register auto_raise_lists.
 
void gnc_prefs_set_reg_auto_raise_lists_id (gulong id)
 
gulong gnc_prefs_get_reg_negative_color_pref_id (void)
 Get and Set registered preference id for register negative_color_pref.
 
void gnc_prefs_set_reg_negative_color_pref_id (gulong id)
 

Detailed Description

The only function in this file is meant to initialize the preferences system early in the load process.

The API in this file is used to read and store preferences used by gnucash.

This is done in a way to hide the actual preferences backend from the rest of the engine.

This api is a generic one. To actually store and load preferences, a preferences backend should be configured. Currently only one backend is defined: the preferences backend.

Note that preferences are organized in groups. Most functions will require both a group and a preference name to find the exact preference to work with.

Function Documentation

◆ gnc_prefs_bind()

void gnc_prefs_bind ( const gchar *  group,
const gchar *  pref_name,
gpointer  object,
const gchar *  property 
)

Bind a setting to a g_object property.

When this succeeds a change of the setting will automatically update the bound object property and vice versa.

Parameters
groupThis string contains the group name of the preference to bind to.
preferenceThis string is the name of the particular preference to bind to.
objectThe object to be bound.
propertyThe property of the object to bind to.

Definition at line 181 of file gnc-prefs.c.

185 {
186  if (prefsbackend && prefsbackend->bind)
187  (prefsbackend->bind) (group, pref_name, object, property);
188 }

◆ gnc_prefs_get_bool()

gboolean gnc_prefs_get_bool ( const gchar *  group,
const gchar *  pref_name 
)

Get a boolean value from the preferences backend.

Parameters
groupThis string specifies the group to which the preference belongs
preferenceThis string is the name of the particular preference within the named group of the preferences backend.
Returns
This function returns the TRUE or FALSE value stored at the requested preference in the preferences backend. If the preference has never been set, this function passes on the default value returned by the preferences backend.

Definition at line 16 of file gmock-gnc-prefs.cpp.

17 {
18  EXPECT_NE(prefsbackend, nullptr);
19  return prefsbackend ? prefsbackend->get_bool(group, pref_name) : FALSE;
20 }

◆ gnc_prefs_get_coords()

void gnc_prefs_get_coords ( const gchar *  group,
const gchar *  pref_name,
gdouble *  x,
gdouble *  y 
)

Get a pair of coordinates from the preferences backend.

Parameters
groupThis string specifies the group to which the preference belongs
preferenceThis string is the name of the particular preference within the named group of the preferences backend.
xThe x coordinate to retrieve.
yThe y coordinate to retrieve.

If there is an error in processing, both coordinates will be set to zero.

Definition at line 58 of file gmock-gnc-prefs.cpp.

59 {
60  EXPECT_NE(prefsbackend, nullptr);
61 
62  *x = 0.0;
63  *y = 0.0;
64 
65  if (prefsbackend != nullptr)
66  prefsbackend->get_coords(group, pref_name, x, y);
67 }

◆ gnc_prefs_get_enum()

gint gnc_prefs_get_enum ( const gchar *  group,
const gchar *  pref_name 
)

Get an enum value from the preferences backend.

Parameters
groupThis string specifies the group to which the preference belongs
preferenceThis string is the name of the particular preference within the named group of the preferences backend.
Returns
This function returns the enum value stored at the requested preference in the preferences backend. If the preference has never been set, this function passes on the default value returned by the preferences backend. If there is an error in processing, zero will be returned.

Definition at line 51 of file gmock-gnc-prefs.cpp.

52 {
53  EXPECT_NE(prefsbackend, nullptr);
54  return prefsbackend ? prefsbackend->get_enum(group, pref_name) : 0;
55 }

◆ gnc_prefs_get_float()

gdouble gnc_prefs_get_float ( const gchar *  group,
const gchar *  pref_name 
)

Get an float value from the preferences backend.

Parameters
groupThis string specifies the group to which the preference belongs
preferenceThis string is the name of the particular preference within the named group of the preferences backend.
Returns
This function returns the float value stored at the requested preference in the preferences backend. If the preference has never been set, this function passes on the default value returned by the preferences backend. If there is an error in processing, zero will be returned.

Definition at line 37 of file gmock-gnc-prefs.cpp.

38 {
39  EXPECT_NE(prefsbackend, nullptr);
40  return prefsbackend ? prefsbackend->get_float(group, pref_name) : 0.0;
41 }

◆ gnc_prefs_get_int()

gint gnc_prefs_get_int ( const gchar *  group,
const gchar *  pref_name 
)

Get an integer value from the preferences backend.

Parameters
groupThis string specifies the group to which the preference belongs
preferenceThis string is the name of the particular preference within the named group of the preferences backend.
Returns
This function returns the integer value stored at the requested preference in the preferences backend. If the preference has never been set, this function passes on the default value returned by the preferences backend. If there is an error in processing, zero will be returned.

Definition at line 23 of file gmock-gnc-prefs.cpp.

24 {
25  EXPECT_NE(prefsbackend, nullptr);
26  return prefsbackend ? prefsbackend->get_int(group, pref_name) : 0;
27 }

◆ gnc_prefs_get_int64()

gint64 gnc_prefs_get_int64 ( const gchar *  group,
const gchar *  pref_name 
)

Get an 64 bit integer value from the preferences backend.

Parameters
groupThis string specifies the group to which the preference belongs
preferenceThis string is the name of the particular preference within the named group of the preferences backend.
Returns
This function returns the 64 bit integer value stored at the requested preference in the preferences backend. If the preference has never been set, this function passes on the default value returned by the preferences backend. If there is an error in processing, zero will be returned.

Definition at line 30 of file gmock-gnc-prefs.cpp.

31 {
32  EXPECT_NE(prefsbackend, nullptr);
33  return prefsbackend ? prefsbackend->get_int64(group, pref_name) : 0;
34 }

◆ gnc_prefs_get_string()

gchar* gnc_prefs_get_string ( const gchar *  group,
const gchar *  pref_name 
)

Get a string value from the preferences backend.

Parameters
groupThis string specifies the group to which the preference belongs
preferenceThis string is the name of the particular preference within the named group of the preferences backend.
Returns
This function returns the string value stored at the requested preference in the preferences backend. If the preference has never been set, this function passes on the default value returned by the preferences backend If there is an error in processing, NULL will be returned.

Definition at line 44 of file gmock-gnc-prefs.cpp.

45 {
46  EXPECT_NE(prefsbackend, nullptr);
47  return prefsbackend ? prefsbackend->get_string(group, pref_name) : NULL;
48 }

◆ gnc_prefs_get_value()

GVariant* gnc_prefs_get_value ( const gchar *  group,
const gchar *  pref_name 
)

Get an arbitrary combination of values from the preferences backend.

This combination of values can be anything that can be encapsulated in a GVariant structure.

Parameters
groupThis string specifies the group to which the preference belongs
preferenceThis string is the name of the particular preference within the named group of the preferences backend.
Returns
This function returns the a GVariant encapsulating the combination of values stored at the requested preference in the preferences backend. If the preference has never been set, this function passes on the default value returned by the preferences backend. If there is an error in processing, NULL will be returned. It is the callers responsibility to free any GVariant data returned by this function.

Definition at line 267 of file gnc-prefs.c.

269 {
270  if (prefsbackend && prefsbackend->get_value)
271  return (prefsbackend->get_value) (group,pref_name);
272  else
273  return NULL;
274 }

◆ gnc_prefs_register_cb()

gulong gnc_prefs_register_cb ( const char *  group,
const gchar *  pref_name,
gpointer  func,
gpointer  user_data 
)

Register a callback that gets triggered when the given preference changes.

Any time the preference's value changes, the routine will be invoked and will be passed both the changed preference and the user data passed to this function.

Parameters
groupThis string contains the group name of the preference to watch.
preferenceThis string contains the name of the preference to watch.
funcThis is a pointer to the function to call when the preference changes.
user_dataThis pointer will be passed to the callback function.
Returns
This function returns the handler id for the registered callback.

Definition at line 128 of file gnc-prefs.c.

132 {
133  if (prefsbackend && prefsbackend->register_cb)
134  return (prefsbackend->register_cb) (group, pref_name, func, user_data);
135  else
136  {
137  g_warning ("no preferences backend loaded, or the backend doesn't define register_cb, returning 0");
138  return 0;
139  }
140 }

◆ gnc_prefs_register_group_cb()

guint gnc_prefs_register_group_cb ( const gchar *  group,
gpointer  func,
gpointer  user_data 
)

Register a callback for when any preference in the settings group is changed.

Any time the value of a preference in this group changes, the routine will be invoked and will be passed the specified user data.

Parameters
groupThis string contains the name of the group that is being watched.
funcThis is a pointer to the function to call when a preference changes.
user_dataThis pointer will be passed to the callback function.

Definition at line 161 of file gnc-prefs.c.

164 {
165  if (prefsbackend && prefsbackend->register_group_cb)
166  return (prefsbackend->register_group_cb) (group, func, user_data);
167  else
168  return 0;
169 }

◆ gnc_prefs_remove_cb_by_func()

void gnc_prefs_remove_cb_by_func ( const gchar *  group,
const gchar *  pref_name,
gpointer  func,
gpointer  user_data 
)

Remove a function that was registered for a callback when the given preference changed.

Both the func and user_data arguments are used to match up the callback to remove. If no matching func and user_data are found to be registered for the given preference, nothing will happen.

Parameters
groupThis string contains the group name of the preference that is being watched.
preferenceThis string contains the name of the preference being watched.
funcThis is a pointer to the function that was registered earlier.
user_dataThis pointer was passed to the callback function when it was registered.

Definition at line 143 of file gnc-prefs.c.

147 {
148  if (prefsbackend && prefsbackend->remove_cb_by_func)
149  (prefsbackend->remove_cb_by_func) (group, pref_name, func, user_data);
150 }

◆ gnc_prefs_remove_cb_by_id()

void gnc_prefs_remove_cb_by_id ( const gchar *  group,
guint  id 
)

Remove a function that was registered for a callback when a specific preference in the settings group changed.

The handler id that was generated when the callback was registered is use to find the callback to remove. If no handler id is found nothing will happen.

Parameters
groupThis string contains the group name of the preference that is being watched.
idThe handler id of the callback to be removed.

Definition at line 153 of file gnc-prefs.c.

155 {
156  if (prefsbackend && prefsbackend->remove_cb_by_id)
157  (prefsbackend->remove_cb_by_id) (group, id);
158 }

◆ gnc_prefs_remove_group_cb_by_func()

void gnc_prefs_remove_group_cb_by_func ( const gchar *  group,
gpointer  func,
gpointer  user_data 
)

Remove a function that was registered for a callback when any preference in the given settings group changed.

Both the func and user_data arguments are used to match up the callback to remove. If no matching func and user_data are found to be registered for the given preference, nothing will happen.

Parameters
groupThis string contains the name of the group that is being watched.
funcThis is a pointer to the function that was registered earlier.
user_dataThis pointer was passed to the callback function when it was registered.
Note
there is no gnc_settings_remove_any_cb_by_id. Use gnc_settings_remove_cb_by_id instead if you want to remove a callback set with gnc_settings_register_any_cb by its handler id.

Definition at line 172 of file gnc-prefs.c.

175 {
176  if (prefsbackend && prefsbackend->remove_group_cb_by_func)
177  (prefsbackend->remove_group_cb_by_func) (group, func, user_data);
178 }

◆ gnc_prefs_reset()

void gnc_prefs_reset ( const gchar *  group,
const gchar *  pref_name 
)

Reset a preference to its default value in the preferences backend.

Parameters
groupThis string specifies the group to which the preference belongs
preferenceThis string is the name of the particular preference within the named group of the preferences backend.

Definition at line 361 of file gnc-prefs.c.

363 {
364  if (prefsbackend && prefsbackend->reset)
365  (prefsbackend->reset) (group, pref_name);
366 }

◆ gnc_prefs_reset_group()

void gnc_prefs_reset_group ( const gchar *  group)

Reset all preferences in a group to their default values in the preferences backend.

Parameters
groupThis string specifies the group to which the preference belongs

Definition at line 368 of file gnc-prefs.c.

369 {
370  if (prefsbackend && prefsbackend->reset_group)
371  (prefsbackend->reset_group) (group);
372 }

◆ gnc_prefs_set_bool()

gboolean gnc_prefs_set_bool ( const gchar *  group,
const gchar *  pref_name,
gboolean  value 
)

Store a boolean value into the preferences backend.

Parameters
groupThis string specifies the group to which the preference belongs
preferenceThis string is the name of the particular preference within the named group of the preferences backend.
valueThe boolean value to be stored.
Returns
This function returns true if the value was set successfully on the preference or false if not.

Definition at line 277 of file gnc-prefs.c.

280 {
281  if (prefsbackend && prefsbackend->set_bool)
282  return (prefsbackend->set_bool) (group, pref_name, value);
283  else
284  return FALSE;
285 }

◆ gnc_prefs_set_coords()

gboolean gnc_prefs_set_coords ( const gchar *  group,
const gchar *  pref_name,
gdouble  x,
gdouble  y 
)

Store coordinates into the preferences backend.

Coordinates consist of a pair of floating point values (x and y).

Parameters
groupThis string specifies the group to which the preference belongs
preferenceThis string is the name of the particular preference within the named group of the preferences backend.
xThe x coordinate to be stored.
yThe y coordinate to be stored.
Returns
This function returns true if the value was set successfully on the preference or false if not.

Definition at line 341 of file gnc-prefs.c.

344 {
345  GVariant *var = g_variant_new ("(dd)",x, y);
346  return gnc_prefs_set_value (group, pref_name, var);
347 }
gboolean gnc_prefs_set_value(const gchar *group, const gchar *pref_name, GVariant *value)
Store an arbitrary combination of values into the preferences backend.
Definition: gnc-prefs.c:350

◆ gnc_prefs_set_enum()

gboolean gnc_prefs_set_enum ( const gchar *  group,
const gchar *  pref_name,
gint  value 
)

Store an enum value into the preferences backend.

Parameters
groupThis string specifies the group to which the preference belongs
preferenceThis string is the name of the particular preference within the named group of the preferences backend.
valueThe enum number to be stored.
Returns
This function returns true if the value was set successfully on the preference or false if not.

Definition at line 330 of file gnc-prefs.c.

333 {
334  if (prefsbackend && prefsbackend->set_enum)
335  return (prefsbackend->set_enum) (group, pref_name, value);
336  else
337  return FALSE;
338 }

◆ gnc_prefs_set_float()

gboolean gnc_prefs_set_float ( const gchar *  group,
const gchar *  pref_name,
gdouble  value 
)

Store a float value into the preferences backend.

Parameters
groupThis string specifies the group to which the preference belongs
preferenceThis string is the name of the particular preference within the named group of the preferences backend.
valueThe floating point number to be stored.
Returns
This function returns true if the value was set successfully on the preference or false if not.

Definition at line 308 of file gnc-prefs.c.

311 {
312  if (prefsbackend && prefsbackend->set_float)
313  return (prefsbackend->set_float) (group, pref_name, value);
314  else
315  return FALSE;
316 }

◆ gnc_prefs_set_int()

gboolean gnc_prefs_set_int ( const gchar *  group,
const gchar *  pref_name,
gint  value 
)

Store an integer value into the preferences backend.

Parameters
groupThis string specifies the group to which the preference belongs
preferenceThis string is the name of the particular preference within the named group of the preferences backend.
valueThe integer number to be stored.
Returns
This function returns true if the value was set successfully on the preference or false if not.

Definition at line 288 of file gnc-prefs.c.

291 {
292  if (prefsbackend && prefsbackend->set_int)
293  return (prefsbackend->set_int) (group, pref_name, value);
294  else
295  return FALSE;
296 }

◆ gnc_prefs_set_int64()

gboolean gnc_prefs_set_int64 ( const gchar *  group,
const gchar *  pref_name,
gint64  value 
)

Store a 64 bit integer value into the preferences backend.

Parameters
groupThis string specifies the group to which the preference belongs
preferenceThis string is the name of the particular preference within the named group of the preferences backend.
valueThe 64 bit integer number to be stored.
Returns
This function returns true if the value was set successfully on the preference or false if not.

Definition at line 299 of file gnc-prefs.c.

302 {
303  GVariant *var = g_variant_new ("x",value);
304  return gnc_prefs_set_value (group, pref_name, var);
305 }
gboolean gnc_prefs_set_value(const gchar *group, const gchar *pref_name, GVariant *value)
Store an arbitrary combination of values into the preferences backend.
Definition: gnc-prefs.c:350

◆ gnc_prefs_set_string()

gboolean gnc_prefs_set_string ( const gchar *  group,
const gchar *  pref_name,
const gchar *  value 
)

Store a string into the preferences backend.

Parameters
groupThis string specifies the group to which the preference belongs
preferenceThis string is the name of the particular preference within the named group of the preferences backend.
valueThe string to be stored. the preferences backend will make a copy of this string, so it is the callers responsibility to free the space used by this string (if necessary).
Returns
This function returns true if the value was set successfully on the preference or false if not.

Definition at line 319 of file gnc-prefs.c.

322 {
323  if (prefsbackend && prefsbackend->set_string)
324  return (prefsbackend->set_string) (group, pref_name, value);
325  else
326  return FALSE;
327 }

◆ gnc_prefs_set_value()

gboolean gnc_prefs_set_value ( const gchar *  group,
const gchar *  pref_name,
GVariant *  value 
)

Store an arbitrary combination of values into the preferences backend.

Parameters
groupThis string specifies the group to which the preference belongs
preferenceThis string is the name of the particular preference within the named group of the preferences backend.
valueThe combination of values encapsulated in a GVariant to be stored.
Returns
This function returns true if the value was set successfully on the preference or false if not.

Definition at line 350 of file gnc-prefs.c.

353 {
354  if (prefsbackend && prefsbackend->set_value)
355  return (prefsbackend->set_value) (group, pref_name, value);
356  else
357  return FALSE;
358 }