GnuCash  5.6-150-g038405b370+
gnc-prefs-p.h
1 /********************************************************************\
2  * gnc-prefs.h Api to load and store preferences to a configurable *
3  * 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 
26 #ifndef GNC_PREFS_P_H_
27 #define GNC_PREFS_P_H_
28 
29 #include "gnc-prefs.h"
30 
31 
32 typedef struct
33 {
34  gulong (*register_cb) (const char *group,
35  const gchar *pref_name,
36  gpointer func,
37  gpointer user_data);
38 
39  void (*remove_cb_by_func) (const gchar *group,
40  const gchar *pref_name,
41  gpointer func,
42  gpointer user_data);
43 
44  void (*remove_cb_by_id) (const gchar *group,
45  guint id);
46 
47  guint (*register_group_cb) (const gchar *group,
48  gpointer func,
49  gpointer user_data);
50 
51  void (*remove_group_cb_by_func) (const gchar *group,
52  gpointer func,
53  gpointer user_data);
54 
55  void (*bind) (const gchar *group,
56  /*@ null @*/ const gchar *pref_name,
57  gpointer object,
58  const gchar *property);
59 
60  gboolean (*get_bool) (const gchar *group,
61  /*@ null @*/ const gchar *pref_name);
62 
63  gint (*get_int) (const gchar *group,
64  const gchar *pref_name);
65 
66  gdouble (*get_float) (const gchar *group,
67  const gchar *pref_name);
68 
69  gchar *(*get_string) (const gchar *group,
70  const gchar *pref_name);
71 
72  gint (*get_enum) (const gchar *group,
73  const gchar *pref_name);
74 
75  GVariant *(*get_value) (const gchar *group,
76  const gchar *pref_name);
77 
78  gboolean (*set_bool) (const gchar *group,
79  const gchar *pref_name,
80  gboolean value);
81 
82  gboolean (*set_int) (const gchar *group,
83  const gchar *pref_name,
84  gint value);
85 
86  gboolean (*set_float) (const gchar *group,
87  const gchar *pref_name,
88  gdouble value);
89 
90  gboolean (*set_string) (const gchar *group,
91  const gchar *pref_name,
92  const gchar *value);
93 
94  gboolean (*set_enum) (const gchar *group,
95  const gchar *pref_name,
96  gint value);
97 
98  gboolean (*set_value) (const gchar *group,
99  const gchar *pref_name,
100  GVariant *value);
101 
102  void (*reset) (const gchar *group,
103  const gchar *pref_name);
104 
105  void (*reset_group) (const gchar *group);
106 
107  void (*block_all) (void);
108 
109  void (*unblock_all) (void);
110 
111 } PrefsBackend;
112 
113 extern PrefsBackend *prefsbackend;
114 
115 #endif /* GNC_PREFS_P_H_ */
Generic api to store and retrieve preferences.