GnuCash
2.6.99
|
Files | |
file | gnc-prefs-utils.h |
Preferences initialization function. | |
file | gnc-prefs.h |
Generic api to store and retrieve preferences. | |
Functions | |
void | gnc_prefs_init (void) |
gboolean | gnc_prefs_is_set_up (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) |
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.
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.
group | This string contains the group name of the preference to bind to. |
preference | This string is the name of the particular preference to bind to. |
object | The object to be bound. |
property | The property of the object to bind to. |
Definition at line 186 of file gnc-prefs.c.
gboolean gnc_prefs_get_bool | ( | const gchar * | group, |
const gchar * | pref_name | ||
) |
Get a boolean value from the preferences backend.
group | This string specifies the group to which the preference belongs |
preference | This string is the name of the particular preference within the named group of the preferences backend. |
Definition at line 196 of file gnc-prefs.c.
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.
group | This string specifies the group to which the preference belongs |
preference | This string is the name of the particular preference within the named group of the preferences backend. |
x | The x coordinate to retrieve. |
y | The 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.
gint gnc_prefs_get_enum | ( | const gchar * | group, |
const gchar * | pref_name | ||
) |
Get an enum value from the preferences backend.
group | This string specifies the group to which the preference belongs |
preference | This string is the name of the particular preference within the named group of the preferences backend. |
Definition at line 247 of file gnc-prefs.c.
gdouble gnc_prefs_get_float | ( | const gchar * | group, |
const gchar * | pref_name | ||
) |
Get an float value from the preferences backend.
group | This string specifies the group to which the preference belongs |
preference | This string is the name of the particular preference within the named group of the preferences backend. |
Definition at line 227 of file gnc-prefs.c.
gint gnc_prefs_get_int | ( | const gchar * | group, |
const gchar * | pref_name | ||
) |
Get an integer value from the preferences backend.
group | This string specifies the group to which the preference belongs |
preference | This string is the name of the particular preference within the named group of the preferences backend. |
Definition at line 206 of file gnc-prefs.c.
gint64 gnc_prefs_get_int64 | ( | const gchar * | group, |
const gchar * | pref_name | ||
) |
Get an 64 bit integer value from the preferences backend.
group | This string specifies the group to which the preference belongs |
preference | This string is the name of the particular preference within the named group of the preferences backend. |
Definition at line 216 of file gnc-prefs.c.
gchar* gnc_prefs_get_string | ( | const gchar * | group, |
const gchar * | pref_name | ||
) |
Get a string value from the preferences backend.
group | This string specifies the group to which the preference belongs |
preference | This string is the name of the particular preference within the named group of the preferences backend. |
Definition at line 237 of file gnc-prefs.c.
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.
group | This string specifies the group to which the preference belongs |
preference | This string is the name of the particular preference within the named group of the preferences backend. |
Definition at line 272 of file gnc-prefs.c.
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.
gboolean gnc_prefs_is_set_up | ( | void | ) |
Test if preferences backend is set up
Definition at line 379 of file gnc-prefs.c.
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.
group | This string contains the group name of the preference to watch. |
preference | This string contains the name of the preference to watch. |
func | This is a pointer to the function to call when the preference changes. |
user_data | This pointer will be passed to the callback function. |
Definition at line 128 of file gnc-prefs.c.
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.
group | This string contains the name of the group that is being watched. |
func | This is a pointer to the function to call when a preference changes. |
user_data | This pointer will be passed to the callback function. |
Definition at line 166 of file gnc-prefs.c.
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.
group | This string contains the group name of the preference that is being watched. |
preference | This string contains the name of the preference being watched. |
func | This is a pointer to the function that was registered earlier. |
user_data | This pointer was passed to the callback function when it was registered. |
Definition at line 148 of file gnc-prefs.c.
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.
group | This string contains the group name of the preference that is being watched. |
id | The handler id of the callback to be removed. |
Definition at line 158 of file gnc-prefs.c.
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.
group | This string contains the name of the group that is being watched. |
func | This is a pointer to the function that was registered earlier. |
user_data | This pointer was passed to the callback function when it was registered. |
Definition at line 177 of file gnc-prefs.c.
void gnc_prefs_reset | ( | const gchar * | group, |
const gchar * | pref_name | ||
) |
Reset a preference to its default value in the preferences backend.
group | This string specifies the group to which the preference belongs |
preference | This 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.
void gnc_prefs_reset_group | ( | const gchar * | group | ) |
Reset all preferences in a group to their default values in the preferences backend.
group | This string specifies the group to which the preference belongs |
Definition at line 373 of file gnc-prefs.c.
gboolean gnc_prefs_set_bool | ( | const gchar * | group, |
const gchar * | pref_name, | ||
gboolean | value | ||
) |
Store a boolean value into the preferences backend.
group | This string specifies the group to which the preference belongs |
preference | This string is the name of the particular preference within the named group of the preferences backend. |
value | The boolean value to be stored. |
Definition at line 282 of file gnc-prefs.c.
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).
group | This string specifies the group to which the preference belongs |
preference | This string is the name of the particular preference within the named group of the preferences backend. |
x | The x coordinate to be stored. |
y | The y coordinate to be stored. |
Definition at line 346 of file gnc-prefs.c.
gboolean gnc_prefs_set_enum | ( | const gchar * | group, |
const gchar * | pref_name, | ||
gint | value | ||
) |
Store an enum value into the preferences backend.
group | This string specifies the group to which the preference belongs |
preference | This string is the name of the particular preference within the named group of the preferences backend. |
value | The enum number to be stored. |
Definition at line 335 of file gnc-prefs.c.
gboolean gnc_prefs_set_float | ( | const gchar * | group, |
const gchar * | pref_name, | ||
gdouble | value | ||
) |
Store a float value into the preferences backend.
group | This string specifies the group to which the preference belongs |
preference | This string is the name of the particular preference within the named group of the preferences backend. |
value | The floating point number to be stored. |
Definition at line 313 of file gnc-prefs.c.
gboolean gnc_prefs_set_int | ( | const gchar * | group, |
const gchar * | pref_name, | ||
gint | value | ||
) |
Store an integer value into the preferences backend.
group | This string specifies the group to which the preference belongs |
preference | This string is the name of the particular preference within the named group of the preferences backend. |
value | The integer number to be stored. |
Definition at line 293 of file gnc-prefs.c.
gboolean gnc_prefs_set_int64 | ( | const gchar * | group, |
const gchar * | pref_name, | ||
gint64 | value | ||
) |
Store a 64 bit integer value into the preferences backend.
group | This string specifies the group to which the preference belongs |
preference | This string is the name of the particular preference within the named group of the preferences backend. |
value | The 64 bit integer number to be stored. |
Definition at line 304 of file gnc-prefs.c.
gboolean gnc_prefs_set_string | ( | const gchar * | group, |
const gchar * | pref_name, | ||
const gchar * | value | ||
) |
Store a string into the preferences backend.
group | This string specifies the group to which the preference belongs |
preference | This string is the name of the particular preference within the named group of the preferences backend. |
value | The 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). |
Definition at line 324 of file gnc-prefs.c.
gboolean gnc_prefs_set_value | ( | const gchar * | group, |
const gchar * | pref_name, | ||
GVariant * | value | ||
) |
Store an arbitrary combination of values into the preferences backend.
group | This string specifies the group to which the preference belongs |
preference | This string is the name of the particular preference within the named group of the preferences backend. |
value | The combination of values encapsulated in a GVariant to be stored. |
Definition at line 355 of file gnc-prefs.c.