hook gvariant vectors up to kdbus
[platform/upstream/glib.git] / gio / gsettingsbackend.h
1 /*
2  * Copyright © 2009, 2010 Codethink Limited
3  * Copyright © 2010 Red Hat, Inc.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the licence, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
17  *
18  * Authors: Ryan Lortie <desrt@desrt.ca>
19  *          Matthias Clasen <mclasen@redhat.com>
20  */
21
22 #ifndef __G_SETTINGS_BACKEND_H__
23 #define __G_SETTINGS_BACKEND_H__
24
25 #if !defined (G_SETTINGS_ENABLE_BACKEND) && !defined (GIO_COMPILATION)
26 #error "You must define G_SETTINGS_ENABLE_BACKEND before including <gio/gsettingsbackend.h>."
27 #endif
28
29 #define __GIO_GIO_H_INSIDE__
30 #include <gio/giotypes.h>
31 #undef __GIO_GIO_H_INSIDE__
32
33 G_BEGIN_DECLS
34
35 #define G_TYPE_SETTINGS_BACKEND                             (g_settings_backend_get_type ())
36 #define G_SETTINGS_BACKEND(inst)                            (G_TYPE_CHECK_INSTANCE_CAST ((inst),                     \
37                                                              G_TYPE_SETTINGS_BACKEND, GSettingsBackend))
38 #define G_SETTINGS_BACKEND_CLASS(class)                     (G_TYPE_CHECK_CLASS_CAST ((class),                       \
39                                                              G_TYPE_SETTINGS_BACKEND, GSettingsBackendClass))
40 #define G_IS_SETTINGS_BACKEND(inst)                         (G_TYPE_CHECK_INSTANCE_TYPE ((inst),                     \
41                                                              G_TYPE_SETTINGS_BACKEND))
42 #define G_IS_SETTINGS_BACKEND_CLASS(class)                  (G_TYPE_CHECK_CLASS_TYPE ((class),                       \
43                                                              G_TYPE_SETTINGS_BACKEND))
44 #define G_SETTINGS_BACKEND_GET_CLASS(inst)                  (G_TYPE_INSTANCE_GET_CLASS ((inst),                      \
45                                                              G_TYPE_SETTINGS_BACKEND, GSettingsBackendClass))
46
47 /**
48  * G_SETTINGS_BACKEND_EXTENSION_POINT_NAME:
49  *
50  * Extension point for #GSettingsBackend functionality.
51  **/
52 #define G_SETTINGS_BACKEND_EXTENSION_POINT_NAME "gsettings-backend"
53
54 /**
55  * GSettingsBackend:
56  *
57  * An implementation of a settings storage repository.
58  **/
59 typedef struct _GSettingsBackendPrivate                     GSettingsBackendPrivate;
60 typedef struct _GSettingsBackendClass                       GSettingsBackendClass;
61
62 struct _GSettingsBackendClass
63 {
64   GObjectClass parent_class;
65
66   GVariant *    (*read)             (GSettingsBackend    *backend,
67                                      const gchar         *key,
68                                      const GVariantType  *expected_type,
69                                      gboolean             default_value);
70
71   gboolean      (*get_writable)     (GSettingsBackend    *backend,
72                                      const gchar         *key);
73
74   gboolean      (*write)            (GSettingsBackend    *backend,
75                                      const gchar         *key,
76                                      GVariant            *value,
77                                      gpointer             origin_tag);
78   gboolean      (*write_tree)       (GSettingsBackend    *backend,
79                                      GTree               *tree,
80                                      gpointer             origin_tag);
81   void          (*reset)            (GSettingsBackend    *backend,
82                                      const gchar         *key,
83                                      gpointer             origin_tag);
84
85   void          (*subscribe)        (GSettingsBackend    *backend,
86                                      const gchar         *name);
87   void          (*unsubscribe)      (GSettingsBackend    *backend,
88                                      const gchar         *name);
89   void          (*sync)             (GSettingsBackend    *backend);
90
91   GPermission * (*get_permission)   (GSettingsBackend    *backend,
92                                      const gchar         *path);
93
94   GVariant *    (*read_user_value)  (GSettingsBackend    *backend,
95                                      const gchar         *key,
96                                      const GVariantType  *expected_type);
97
98   gpointer padding[23];
99 };
100
101 struct _GSettingsBackend
102 {
103   GObject parent_instance;
104
105   /*< private >*/
106   GSettingsBackendPrivate *priv;
107 };
108
109 GLIB_AVAILABLE_IN_ALL
110 GType                   g_settings_backend_get_type                     (void);
111
112 GLIB_AVAILABLE_IN_ALL
113 void                    g_settings_backend_changed                      (GSettingsBackend    *backend,
114                                                                          const gchar         *key,
115                                                                          gpointer             origin_tag);
116 GLIB_AVAILABLE_IN_ALL
117 void                    g_settings_backend_path_changed                 (GSettingsBackend    *backend,
118                                                                          const gchar         *path,
119                                                                          gpointer             origin_tag);
120 GLIB_AVAILABLE_IN_ALL
121 void                    g_settings_backend_flatten_tree                 (GTree               *tree,
122                                                                          gchar              **path,
123                                                                          const gchar       ***keys,
124                                                                          GVariant          ***values);
125 GLIB_AVAILABLE_IN_ALL
126 void                    g_settings_backend_keys_changed                 (GSettingsBackend    *backend,
127                                                                          const gchar         *path,
128                                                                          gchar const * const *items,
129                                                                          gpointer             origin_tag);
130
131 GLIB_AVAILABLE_IN_ALL
132 void                    g_settings_backend_path_writable_changed        (GSettingsBackend    *backend,
133                                                                          const gchar         *path);
134 GLIB_AVAILABLE_IN_ALL
135 void                    g_settings_backend_writable_changed             (GSettingsBackend    *backend,
136                                                                          const gchar         *key);
137 GLIB_AVAILABLE_IN_ALL
138 void                    g_settings_backend_changed_tree                 (GSettingsBackend    *backend,
139                                                                          GTree               *tree,
140                                                                          gpointer             origin_tag);
141
142 GLIB_AVAILABLE_IN_ALL
143 GSettingsBackend *      g_settings_backend_get_default                  (void);
144
145 GLIB_AVAILABLE_IN_ALL
146 GSettingsBackend *      g_keyfile_settings_backend_new                  (const gchar         *filename,
147                                                                          const gchar         *root_path,
148                                                                          const gchar         *root_group);
149
150 GLIB_AVAILABLE_IN_ALL
151 GSettingsBackend *      g_null_settings_backend_new                     (void);
152
153 GLIB_AVAILABLE_IN_ALL
154 GSettingsBackend *      g_memory_settings_backend_new                   (void);
155
156 G_END_DECLS
157
158 #endif /* __G_SETTINGS_BACKEND_H__ */