GnuCash
5.6-150-g038405b370+
|
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. | |
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. | |
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) |
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.
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 181 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 16 of file gmock-gnc-prefs.cpp.
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 58 of file gmock-gnc-prefs.cpp.
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 51 of file gmock-gnc-prefs.cpp.
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 37 of file gmock-gnc-prefs.cpp.
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 23 of file gmock-gnc-prefs.cpp.
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 30 of file gmock-gnc-prefs.cpp.
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 44 of file gmock-gnc-prefs.cpp.
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 267 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 161 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 143 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 153 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 172 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 361 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 368 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 277 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 341 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 330 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 308 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 288 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 299 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 319 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 350 of file gnc-prefs.c.