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  /*@ null @*/ const gchar *pref_value,
58  gpointer object,
59  const gchar *property);
60 
61  gboolean (*get_bool) (const gchar *group,
62  /*@ null @*/ const gchar *pref_name);
63 
64  gint (*get_int) (const gchar *group,
65  const gchar *pref_name);
66 
67  gdouble (*get_float) (const gchar *group,
68  const gchar *pref_name);
69 
70  gchar *(*get_string) (const gchar *group,
71  const gchar *pref_name);
72 
73  gint (*get_enum) (const gchar *group,
74  const gchar *pref_name);
75 
76  GVariant *(*get_value) (const gchar *group,
77  const gchar *pref_name);
78 
79  gboolean (*set_bool) (const gchar *group,
80  const gchar *pref_name,
81  gboolean value);
82 
83  gboolean (*set_int) (const gchar *group,
84  const gchar *pref_name,
85  gint value);
86 
87  gboolean (*set_float) (const gchar *group,
88  const gchar *pref_name,
89  gdouble value);
90 
91  gboolean (*set_string) (const gchar *group,
92  const gchar *pref_name,
93  const gchar *value);
94 
95  gboolean (*set_enum) (const gchar *group,
96  const gchar *pref_name,
97  gint value);
98 
99  gboolean (*set_value) (const gchar *group,
100  const gchar *pref_name,
101  GVariant *value);
102 
103  void (*reset) (const gchar *group,
104  const gchar *pref_name);
105 
106  void (*reset_group) (const gchar *group);
107 
108  void (*block_all) (void);
109 
110  void (*unblock_all) (void);
111 
112 } PrefsBackend;
113 
114 extern PrefsBackend *prefsbackend;
115 
116 #endif /* GNC_PREFS_P_H_ */
Generic api to store and retrieve preferences.