34 #define GNC_PREF_FILE_COMPRESSION "file-compression" 35 #define GNC_PREF_RETAIN_TYPE_NEVER "retain-type-never" 36 #define GNC_PREF_RETAIN_TYPE_DAYS "retain-type-days" 37 #define GNC_PREF_RETAIN_TYPE_FOREVER "retain-type-forever" 38 #define GNC_PREF_RETAIN_DAYS "retain-days" 44 file_retain_changed_cb(gpointer gsettings, gchar *key, gpointer user_data)
49 gnc_prefs_set_file_retention_days (days);
54 file_retain_type_changed_cb(gpointer gsettings, gchar *key, gpointer user_data)
56 XMLFileRetentionType type = XML_RETAIN_ALL;
61 type = XML_RETAIN_NONE;
63 type = XML_RETAIN_DAYS;
65 PWARN(
"no file retention policy was set, assuming conservative policy 'forever'");
67 gnc_prefs_set_file_retention_policy (type);
72 file_compression_changed_cb(gpointer gsettings, gchar *key, gpointer user_data)
76 gboolean file_compression =
gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_FILE_COMPRESSION);
77 gnc_prefs_set_file_save_compressed (file_compression);
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);
103 if ( (gnc_prefs_get_file_retention_policy () == XML_RETAIN_DAYS) &&
104 (gnc_prefs_get_file_retention_days () == 0 ) )
106 gnc_prefs_set_file_retention_policy (XML_RETAIN_ALL);
107 gnc_prefs_set_file_retention_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'");
116 file_retain_changed_cb, NULL);
118 file_retain_type_changed_cb, NULL);
120 file_retain_type_changed_cb, NULL);
122 file_retain_type_changed_cb, NULL);
124 file_compression_changed_cb, NULL);
133 file_retain_changed_cb, NULL);
135 file_retain_type_changed_cb, NULL);
137 file_retain_type_changed_cb, NULL);
139 file_retain_type_changed_cb, NULL);
141 file_compression_changed_cb, NULL);
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.
#define G_LOG_DOMAIN
Functions providing the SX List as a plugin page.
#define PWARN(format, args...)
Log a warning.
gboolean gnc_prefs_set_bool(const gchar *group, const gchar *pref_name, gboolean value)
Store a boolean value into the preferences backend.
Preferences initialization function.
gboolean gnc_prefs_set_float(const gchar *group, const gchar *pref_name, gdouble value)
Store a float value into the preferences backend.
void gnc_gsettings_shutdown(void)
Free the GSettings resources.
void gnc_prefs_remove_registered(void)
This function is called to remove the registered preference call backs setup in this file...
Generic api to store and retrieve preferences.
void gnc_prefs_init(void)
This function is called early in the load process to preload a number of preferences from the setting...
void gnc_gsettings_load_backend(void)
Configure gsettings as the backend for the gnucash preferences api.
gboolean gnc_prefs_get_bool(const gchar *group, const gchar *pref_name)
Get a boolean value from the preferences backend.
load and save data to files
GSettings helper routines.
gboolean gnc_prefs_is_set_up(void)
Test if preferences backend is set up.
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.
gdouble gnc_prefs_get_float(const gchar *group, const gchar *pref_name)
Get an float value from the preferences backend.