GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Files | Macros | Functions

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_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_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)
 
gboolean gnc_prefs_is_set_up (void)
 

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)
 
void gnc_prefs_remove_cb_by_func (const gchar *group, const gchar *pref_name, gpointer func, gpointer user_data)
 
void gnc_prefs_remove_cb_by_id (const gchar *group, guint id)
 
guint gnc_prefs_register_group_cb (const gchar *group, gpointer func, gpointer user_data)
 
void gnc_prefs_remove_group_cb_by_func (const gchar *group, gpointer func, gpointer user_data)
 
void gnc_prefs_bind (const gchar *group, const gchar *pref_name, gpointer object, const gchar *property)
 

Preference Getters

gboolean gnc_prefs_get_bool (const gchar *group, const gchar *pref_name)
 
gint gnc_prefs_get_int (const gchar *group, const gchar *pref_name)
 
gint64 gnc_prefs_get_int64 (const gchar *group, const gchar *pref_name)
 
gdouble gnc_prefs_get_float (const gchar *group, const gchar *pref_name)
 
gchar * gnc_prefs_get_string (const gchar *group, const gchar *pref_name)
 
gint gnc_prefs_get_enum (const gchar *group, const gchar *pref_name)
 
void gnc_prefs_get_coords (const gchar *group, const gchar *pref_name, gdouble *x, gdouble *y)
 
GVariant * gnc_prefs_get_value (const gchar *group, const gchar *pref_name)
 

Preference Setters and Unset Functions

gboolean gnc_prefs_set_bool (const gchar *group, const gchar *pref_name, gboolean value)
 
gboolean gnc_prefs_set_int (const gchar *group, const gchar *pref_name, gint value)
 
gboolean gnc_prefs_set_int64 (const gchar *group, const gchar *pref_name, gint64 value)
 
gboolean gnc_prefs_set_float (const gchar *group, const gchar *pref_name, gdouble value)
 
gboolean gnc_prefs_set_string (const gchar *group, const gchar *pref_name, const gchar *value)
 
gboolean gnc_prefs_set_enum (const gchar *group, const gchar *pref_name, gint value)
 
gboolean gnc_prefs_set_coords (const gchar *group, const gchar *pref_name, gdouble x, gdouble y)
 
gboolean gnc_prefs_set_value (const gchar *group, const gchar *pref_name, GVariant *value)
 
void gnc_prefs_reset (const gchar *group, const gchar *pref_name)
 
void gnc_prefs_reset_group (const gchar *group)
 

Detailed Description

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

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

The API in this file is used to read and store preferences used by gnucash. 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

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 186 of file gnc-prefs.c.

190 {
191  if (prefsbackend && prefsbackend->bind)
192  (prefsbackend->bind) (group, pref_name, object, property);
193 }
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 196 of file gnc-prefs.c.

198 {
199  if (prefsbackend && prefsbackend->get_bool)
200  return (prefsbackend->get_bool) (group, pref_name);
201  else
202  return FALSE;
203 }
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 257 of file gnc-prefs.c.

260 {
261  GVariant *coords = gnc_prefs_get_value (group, pref_name);
262 
263  *x = 0;
264  *y = 0;
265 
266  if (g_variant_is_of_type (coords, (const GVariantType *) "(dd)") )
267  g_variant_get (coords, "(dd)", x, y);
268  g_variant_unref (coords);
269 }
GVariant * gnc_prefs_get_value(const gchar *group, const gchar *pref_name)
Definition: gnc-prefs.c:272
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 247 of file gnc-prefs.c.

249 {
250  if (prefsbackend && prefsbackend->get_enum)
251  return (prefsbackend->get_enum) (group, pref_name);
252  else
253  return 0;
254 }
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 227 of file gnc-prefs.c.

229 {
230  if (prefsbackend && prefsbackend->get_float)
231  return (prefsbackend->get_float) (group, pref_name);
232  else
233  return 0.0;
234 }
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 206 of file gnc-prefs.c.

208 {
209  if (prefsbackend && prefsbackend->get_int)
210  return (prefsbackend->get_int) (group, pref_name);
211  else
212  return 0;
213 }
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 216 of file gnc-prefs.c.

218 {
219  gint64 result = 0;
220  GVariant *var = gnc_prefs_get_value(group, pref_name);
221  result = g_variant_get_int64 (var);
222  g_variant_unref (var);
223  return result;
224 }
GVariant * gnc_prefs_get_value(const gchar *group, const gchar *pref_name)
Definition: gnc-prefs.c:272
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 237 of file gnc-prefs.c.

239 {
240  if (prefsbackend && prefsbackend->get_string)
241  return (prefsbackend->get_string) (group, pref_name);
242  else
243  return NULL;
244 }
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 272 of file gnc-prefs.c.

274 {
275  if (prefsbackend && prefsbackend->get_value)
276  return (prefsbackend->get_value) (group,pref_name);
277  else
278  return NULL;
279 }
void gnc_prefs_init ( void  )

This function is called early in the load process to preload a number of preferences from the settings backend

Definition at line 82 of file gnc-prefs-utils.c.

83 {
85 
86  /* Initialize the core preferences by reading their values from the loaded backend.
87  * Note: of no backend was loaded, these functions will return sane default values.
88  */
89  file_retain_changed_cb (NULL, NULL, NULL);
90  file_retain_type_changed_cb (NULL, NULL, NULL);
91  file_compression_changed_cb (NULL, NULL, NULL);
92 
93  /* Check for invalid retain_type (days)/retain_days (0) combo.
94  * This can happen either because a user changed the preferences
95  * manually outside of GnuCash, or because the user upgraded from
96  * gnucash version 2.3.15 or older. Back then, 0 retain_days meant
97  * "keep forever". From 2.3.15 on this is controlled via a multiple
98  * choice ("retain_type").
99  * So if we find a 0 retain_days value with a "days" retain_type,
100  * we will silently and conservatively interpret is as meaning
101  * retain forever ("forever" retain_type).
102  */
103  if ( (gnc_prefs_get_file_retention_policy () == XML_RETAIN_DAYS) &&
104  (gnc_prefs_get_file_retention_days () == 0 ) )
105  {
106  gnc_prefs_set_file_retention_policy (XML_RETAIN_ALL);
107  gnc_prefs_set_file_retention_days (30);
108  gnc_prefs_set_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_RETAIN_TYPE_FOREVER, TRUE);
109  gnc_prefs_set_float (GNC_PREFS_GROUP_GENERAL, GNC_PREF_RETAIN_DAYS, 30);
110  PWARN("retain 0 days policy was set, but this is probably not what the user wanted,\n"
111  "assuming conservative policy 'forever'");
112  }
113 
114  /* Add hooks to update core preferences whenever the associated preference changes */
115  gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_RETAIN_DAYS,
116  file_retain_changed_cb, NULL);
117  gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_RETAIN_TYPE_NEVER,
118  file_retain_type_changed_cb, NULL);
119  gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_RETAIN_TYPE_DAYS,
120  file_retain_type_changed_cb, NULL);
121  gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_RETAIN_TYPE_FOREVER,
122  file_retain_type_changed_cb, NULL);
123  gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_FILE_COMPRESSION,
124  file_compression_changed_cb, NULL);
125 
126 }
gulong gnc_prefs_register_cb(const char *group, const gchar *pref_name, gpointer func, gpointer user_data)
Definition: gnc-prefs.c:128
#define PWARN(format, args...)
Definition: qoflog.h:243
gboolean gnc_prefs_set_bool(const gchar *group, const gchar *pref_name, gboolean value)
Definition: gnc-prefs.c:282
gboolean gnc_prefs_set_float(const gchar *group, const gchar *pref_name, gdouble value)
Definition: gnc-prefs.c:313
void gnc_gsettings_load_backend(void)
gboolean gnc_prefs_is_set_up ( void  )

Test if preferences backend is set up

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

380 {
381  return (prefsbackend !=NULL);
382 }
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  ENTER("group %s; pref_name %s, prefsbackend->register_cb %p", group, pref_name,
134  prefsbackend ? prefsbackend->register_cb : NULL);
135  if (prefsbackend && prefsbackend->register_cb)
136  {
137  LEAVE("");
138  return (prefsbackend->register_cb) (group, pref_name, func, user_data);
139  }
140  else
141  {
142  LEAVE("no backend loaded, or the backend doesn't define register_cb, returning 0");
143  return 0;
144  }
145 }
#define ENTER(format, args...)
Definition: qoflog.h:261
#define LEAVE(format, args...)
Definition: qoflog.h:271
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 166 of file gnc-prefs.c.

169 {
170  if (prefsbackend && prefsbackend->register_group_cb)
171  return (prefsbackend->register_group_cb) (group, func, user_data);
172  else
173  return 0;
174 }
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 148 of file gnc-prefs.c.

152 {
153  if (prefsbackend && prefsbackend->remove_cb_by_func)
154  (prefsbackend->remove_cb_by_func) (group, pref_name, func, user_data);
155 }
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 158 of file gnc-prefs.c.

160 {
161  if (prefsbackend && prefsbackend->remove_cb_by_id)
162  (prefsbackend->remove_cb_by_id) (group, id);
163 }
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 177 of file gnc-prefs.c.

180 {
181  if (prefsbackend && prefsbackend->remove_group_cb_by_func)
182  (prefsbackend->remove_group_cb_by_func) (group, func, user_data);
183 }
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 366 of file gnc-prefs.c.

368 {
369  if (prefsbackend && prefsbackend->reset)
370  (prefsbackend->reset) (group, pref_name);
371 }
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 373 of file gnc-prefs.c.

374 {
375  if (prefsbackend && prefsbackend->reset_group)
376  (prefsbackend->reset_group) (group);
377 }
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 282 of file gnc-prefs.c.

285 {
286  if (prefsbackend && prefsbackend->set_bool)
287  return (prefsbackend->set_bool) (group, pref_name, value);
288  else
289  return FALSE;
290 }
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 346 of file gnc-prefs.c.

349 {
350  GVariant *var = g_variant_new ("(dd)",x, y);
351  return gnc_prefs_set_value (group, pref_name, var);
352 }
gboolean gnc_prefs_set_value(const gchar *group, const gchar *pref_name, GVariant *value)
Definition: gnc-prefs.c:355
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 335 of file gnc-prefs.c.

338 {
339  if (prefsbackend && prefsbackend->set_enum)
340  return (prefsbackend->set_enum) (group, pref_name, value);
341  else
342  return FALSE;
343 }
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 313 of file gnc-prefs.c.

316 {
317  if (prefsbackend && prefsbackend->set_float)
318  return (prefsbackend->set_float) (group, pref_name, value);
319  else
320  return FALSE;
321 }
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 293 of file gnc-prefs.c.

296 {
297  if (prefsbackend && prefsbackend->set_int)
298  return (prefsbackend->set_int) (group, pref_name, value);
299  else
300  return FALSE;
301 }
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 304 of file gnc-prefs.c.

307 {
308  GVariant *var = g_variant_new ("x",value);
309  return gnc_prefs_set_value (group, pref_name, var);
310 }
gboolean gnc_prefs_set_value(const gchar *group, const gchar *pref_name, GVariant *value)
Definition: gnc-prefs.c:355
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 324 of file gnc-prefs.c.

327 {
328  if (prefsbackend && prefsbackend->set_string)
329  return (prefsbackend->set_string) (group, pref_name, value);
330  else
331  return FALSE;
332 }
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 355 of file gnc-prefs.c.

358 {
359  if (prefsbackend && prefsbackend->set_value)
360  return (prefsbackend->set_value) (group, pref_name, value);
361  else
362  return FALSE;
363 }