GnuCash  5.6-150-g038405b370+
gnc-prefs.h
Go to the documentation of this file.
1 /********************************************************************\
2  * gnc-prefs.h -- Api to load and store preferences to a *
3  * configurable backend *
4  * *
5  * Copyright (C) 2013 Geert Janssens <geert@kobaltwit.be> *
6  * *
7  * This program is free software; you can redistribute it and/or *
8  * modify it under the terms of the GNU General Public License as *
9  * published by the Free Software Foundation; either version 2 of *
10  * the License, or (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License*
18  * along with this program; if not, contact: *
19  * *
20  * Free Software Foundation Voice: +1-617-542-5942 *
21  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
22  * Boston, MA 02110-1301, USA gnu@gnu.org *
23  * *
24  ********************************************************************/
25 
45 #ifndef GNC_PREFS_H
46 #define GNC_PREFS_H
47 
48 #include <glib.h>
49 
50 /* Preference groups used across multiple modules */
51 #define GNC_PREFS_GROUP_GENERAL "general"
52 #define GNC_PREFS_GROUP_GENERAL_REGISTER "general.register"
53 #define GNC_PREFS_GROUP_GENERAL_REPORT "general.report"
54 #define GNC_PREFS_GROUP_WARNINGS "general.warnings"
55 #define GNC_PREFS_GROUP_WARNINGS_TEMP "warnings.temporary"
56 #define GNC_PREFS_GROUP_WARNINGS_PERM "warnings.permanent"
57 #define GNC_PREFS_GROUP_ACCT_SUMMARY "window.pages.account-tree.summary"
58 
59 /* Preference names used across multiple modules */
60 #define GNC_PREF_VERSION "prefs-version"
61 #define GNC_PREF_SAVE_GEOMETRY "save-window-geometry"
62 #define GNC_PREF_LAST_PATH "last-path"
63 #define GNC_PREF_USE_NEW "use-new-window"
64 #define GNC_PREF_ACCOUNTING_LABELS "use-accounting-labels"
65 #define GNC_PREF_ACCOUNT_SEPARATOR "account-separator"
66 #define GNC_PREF_NEGATIVE_IN_RED "negative-in-red"
67 #define GNC_PREF_NUM_SOURCE "num-source"
68 #define GNC_PREF_DATE_FORMAT "date-format"
69 #define GNC_PREF_DATE_COMPL_THISYEAR "date-completion-thisyear"
70 #define GNC_PREF_DATE_COMPL_SLIDING "date-completion-sliding"
71 #define GNC_PREF_DATE_BACKMONTHS "date-backmonths"
72 #define GNC_PREF_SHOW_LEAF_ACCT_NAMES "show-leaf-account-names"
73 #define GNC_PREF_ENTER_MOVES_TO_END "enter-moves-to-end"
74 /* Register preferences */
75 #define GNC_PREF_DRAW_HOR_LINES "draw-horizontal-lines"
76 #define GNC_PREF_DRAW_VERT_LINES "draw-vertical-lines"
77 #define GNC_PREF_ALT_COLOR_BY_TRANS "alternate-color-by-transaction"
78 #define GNC_PREF_USE_THEME_COLORS "use-theme-colors" // Obsolete, to remove in a future major version (> 2.8)
79 #define GNC_PREF_USE_GNUCASH_COLOR_THEME "use-gnucash-color-theme"
80 #define GNC_PREF_TAB_TRANS_MEMORISED "tab-to-transfer-on-memorised"
81 #define GNC_PREF_FUTURE_AFTER_BLANK "future-after-blank-transaction"
82 #define GNC_PREF_JUMP_MULT_SPLITS "jump-multiple-splits"
83 /* Date preferences */
84 #define GNC_PREF_START_CHOICE_ABS "start-choice-absolute"
85 #define GNC_PREF_START_CHOICE_REL "start-choice-relative"
86 #define GNC_PREF_START_DATE "start-date"
87 #define GNC_PREF_START_PERIOD "start-period"
88 #define GNC_PREF_END_CHOICE_ABS "end-choice-absolute"
89 #define GNC_PREF_END_CHOICE_REL "end-choice-relative"
90 #define GNC_PREF_END_DATE "end-date"
91 #define GNC_PREF_END_PERIOD "end-period"
92 /* Currency preferences */
93 #define GNC_PREF_CURRENCY_OTHER "currency-other"
94 #define GNC_PREF_CURRENCY_CHOICE_LOCALE "currency-choice-locale"
95 #define GNC_PREF_CURRENCY_CHOICE_OTHER "currency-choice-other"
96 /* Chart preferences */
97 #define GNC_CHART_POINT_STYLE "chart-point-style"
98 #define GNC_CHART_POINT_SIZE "chart-point-size"
99 #define GNC_CHART_POINT_SIZE_HOVER "chart-point-size-hover"
100 #define GNC_CHART_TOOLTIP_CARET "chart-tooltip-caret-size"
101 #define GNC_CHART_TOOLTIP_POSITION "chart-tooltip-position"
102 #define GNC_CHART_TOOLTIP_ENGAGE_RADIUS "chart-tooltip-engage-radius"
103 
104 #ifdef __cplusplus
105 extern "C" {
106 #endif
107 
112 const gchar *gnc_prefs_get_namespace_regexp(void);
113 void gnc_prefs_set_namespace_regexp(const gchar *str);
114 
115 gboolean gnc_prefs_is_debugging_enabled(void);
116 void gnc_prefs_set_debugging(gboolean d);
117 
118 gboolean gnc_prefs_is_extra_enabled(void);
119 void gnc_prefs_set_extra(gboolean enabled);
120 
121 gboolean gnc_prefs_get_file_save_compressed(void);
122 void gnc_prefs_set_file_save_compressed(gboolean compressed);
123 
124 gint gnc_prefs_get_file_retention_policy(void);
125 void gnc_prefs_set_file_retention_policy(gint policy);
126 
127 gint gnc_prefs_get_file_retention_days(void);
128 void gnc_prefs_set_file_retention_days(gint days);
129 
130 guint gnc_prefs_get_long_version( void );
131 
137 gboolean gnc_prefs_is_set_up (void);
138 
141 void gnc_prefs_block_all (void);
142 
145 void gnc_prefs_unblock_all (void);
146 
171 gulong gnc_prefs_register_cb (const char *group,
172  const gchar *pref_name,
173  gpointer func,
174  gpointer user_data);
175 
176 
194 void gnc_prefs_remove_cb_by_func (const gchar *group,
195  const gchar *pref_name,
196  gpointer func,
197  gpointer user_data);
198 
199 
211 void gnc_prefs_remove_cb_by_id (const gchar *group,
212  guint id);
213 
214 
229 guint gnc_prefs_register_group_cb (const gchar *group,
230  gpointer func,
231  gpointer user_data);
232 
233 
254 void gnc_prefs_remove_group_cb_by_func (const gchar *group,
255  gpointer func,
256  gpointer user_data);
257 
258 
274 void gnc_prefs_bind (const gchar *group,
275  /*@ null @*/ const gchar *pref_name,
276  /*@ null @*/ const gchar *pref_value,
277  gpointer object,
278  const gchar *property);
279 
298 gboolean gnc_prefs_get_bool (const gchar *group,
299  /*@ null @*/ const gchar *pref_name);
300 
313 gint gnc_prefs_get_int (const gchar *group,
314  const gchar *pref_name);
315 
328 gint64 gnc_prefs_get_int64 (const gchar *group,
329  const gchar *pref_name);
330 
343 gdouble gnc_prefs_get_float (const gchar *group,
344  const gchar *pref_name);
345 
358 gchar *gnc_prefs_get_string (const gchar *group,
359  const gchar *pref_name);
360 
373 gint gnc_prefs_get_enum (const gchar *group,
374  const gchar *pref_name);
375 
389 void gnc_prefs_get_coords (const gchar *group,
390  const gchar *pref_name,
391  gdouble *x, gdouble *y);
392 
410 GVariant *gnc_prefs_get_value (const gchar *group,
411  const gchar *pref_name);
412 
432 gboolean gnc_prefs_set_bool (const gchar *group,
433  const gchar *pref_name,
434  gboolean value);
435 
448 gboolean gnc_prefs_set_int (const gchar *group,
449  const gchar *pref_name,
450  gint value);
451 
464 gboolean gnc_prefs_set_int64 (const gchar *group,
465  const gchar *pref_name,
466  gint64 value);
467 
480 gboolean gnc_prefs_set_float (const gchar *group,
481  const gchar *pref_name,
482  gdouble value);
483 
484 
499 gboolean gnc_prefs_set_string (const gchar *group,
500  const gchar *pref_name,
501  const gchar *value);
502 
515 gboolean gnc_prefs_set_enum (const gchar *group,
516  const gchar *pref_name,
517  gint value);
518 
534 gboolean gnc_prefs_set_coords (const gchar *group,
535  const gchar *pref_name,
536  gdouble x, gdouble y);
537 
551 gboolean gnc_prefs_set_value (const gchar *group,
552  const gchar *pref_name,
553  GVariant *value);
554 
562 void gnc_prefs_reset (const gchar *group,
563  const gchar *pref_name);
564 
569 void gnc_prefs_reset_group (const gchar *group);
570 
574 void gnc_prefs_set_reg_auto_raise_lists_id (gulong id);
575 
579 void gnc_prefs_set_reg_negative_color_pref_id (gulong id);
580 
583 #ifdef __cplusplus
584 }
585 #endif
586 
587 
588 #endif /* GNC_PREFS_H */
589 
void gnc_prefs_reset_group(const gchar *group)
Reset all preferences in a group to their default values in the preferences backend.
Definition: gnc-prefs.cpp:368
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.cpp:350
gchar * gnc_prefs_get_string(const gchar *group, const gchar *pref_name)
Get a string value from the preferences backend.
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.
Definition: gnc-prefs.cpp:127
gulong gnc_prefs_get_reg_negative_color_pref_id(void)
Get and Set registered preference id for register negative_color_pref.
Definition: gnc-prefs.cpp:401
gboolean gnc_prefs_set_int(const gchar *group, const gchar *pref_name, gint value)
Store an integer value into the preferences backend.
Definition: gnc-prefs.cpp:288
void gnc_prefs_reset(const gchar *group, const gchar *pref_name)
Reset a preference to its default value in the preferences backend.
Definition: gnc-prefs.cpp:361
gboolean gnc_prefs_set_string(const gchar *group, const gchar *pref_name, const gchar *value)
Store a string into the preferences backend.
Definition: gnc-prefs.cpp:319
gint64 gnc_prefs_get_int64(const gchar *group, const gchar *pref_name)
Get an 64 bit integer value from the preferences backend.
gint gnc_prefs_get_int(const gchar *group, const gchar *pref_name)
Get an integer value from the preferences backend.
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...
Definition: gnc-prefs.cpp:152
gboolean gnc_prefs_set_bool(const gchar *group, const gchar *pref_name, gboolean value)
Store a boolean value into the preferences backend.
Definition: gnc-prefs.cpp:277
gboolean gnc_prefs_set_enum(const gchar *group, const gchar *pref_name, gint value)
Store an enum value into the preferences backend.
Definition: gnc-prefs.cpp:330
gint gnc_prefs_get_enum(const gchar *group, const gchar *pref_name)
Get an enum value from the preferences backend.
gboolean gnc_prefs_set_float(const gchar *group, const gchar *pref_name, gdouble value)
Store a float value into the preferences backend.
Definition: gnc-prefs.cpp:308
gboolean gnc_prefs_set_coords(const gchar *group, const gchar *pref_name, gdouble x, gdouble y)
Store coordinates into the preferences backend.
Definition: gnc-prefs.cpp:341
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.
void gnc_prefs_bind(const gchar *group, const gchar *pref_name, const gchar *pref_value, gpointer object, const gchar *property)
Bind a setting to a g_object property.
Definition: gnc-prefs.cpp:180
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 ...
Definition: gnc-prefs.cpp:171
GVariant * gnc_prefs_get_value(const gchar *group, const gchar *pref_name)
Get an arbitrary combination of values from the preferences backend.
Definition: gnc-prefs.cpp:267
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.
Definition: gnc-prefs.cpp:160
gboolean gnc_prefs_get_bool(const gchar *group, const gchar *pref_name)
Get a boolean value from the preferences backend.
gulong gnc_prefs_get_reg_auto_raise_lists_id(void)
Get and Set registered preference id for register auto_raise_lists.
Definition: gnc-prefs.cpp:391
void gnc_prefs_block_all(void)
Block all preference callbacks.
Definition: gnc-prefs.cpp:379
void gnc_prefs_unblock_all(void)
Unblock all preferences callbacks.
Definition: gnc-prefs.cpp:385
gboolean gnc_prefs_is_set_up(void)
Test if preferences backend is set up.
Definition: gnc-prefs.cpp:374
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.
Definition: gnc-prefs.cpp:142
gdouble gnc_prefs_get_float(const gchar *group, const gchar *pref_name)
Get an float value from the preferences backend.
gboolean gnc_prefs_set_int64(const gchar *group, const gchar *pref_name, gint64 value)
Store a 64 bit integer value into the preferences backend.
Definition: gnc-prefs.cpp:299