Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
gsettings.h
Go to the documentation of this file.
1/*
2 * Copyright © 2009, 2010 Codethink Limited
3 *
4 * SPDX-License-Identifier: LGPL-2.1-or-later
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18 *
19 * Author: Ryan Lortie <desrt@desrt.ca>
20 */
21
22#ifndef __G_SETTINGS_H__
23#define __G_SETTINGS_H__
24
25#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
26#error "Only <gio/gio.h> can be included directly."
27#endif
28
29#include <gio/gsettingsschema.h>
30#include <gio/giotypes.h>
31
33
34#define G_TYPE_SETTINGS (g_settings_get_type ())
35#define G_SETTINGS(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
36 G_TYPE_SETTINGS, GSettings))
37#define G_SETTINGS_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
38 G_TYPE_SETTINGS, GSettingsClass))
39#define G_IS_SETTINGS(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_SETTINGS))
40#define G_IS_SETTINGS_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_SETTINGS))
41#define G_SETTINGS_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
42 G_TYPE_SETTINGS, GSettingsClass))
43
44typedef struct _GSettingsPrivate GSettingsPrivate;
46
48{
50
51 /* Signals */
52 void (*writable_changed) (GSettings *settings,
53 const gchar *key);
54 void (*changed) (GSettings *settings,
55 const gchar *key);
57 GQuark key);
59 const GQuark *keys,
60 gint n_keys);
61
63};
64
70
71
74
76const gchar * const * g_settings_list_schemas (void);
80GSettings * g_settings_new (const gchar *schema_id);
83 const gchar *path);
86 GSettingsBackend *backend);
89 GSettingsBackend *backend,
90 const gchar *path);
93 GSettingsBackend *backend,
94 const gchar *path);
101 const gchar *key);
104 const gchar *key,
105 GVariant *value);
106
109 const gchar *key,
110 GVariant *value);
113 const gchar *key);
114
117 const gchar *key);
120 const gchar *key);
121
124 const gchar *key,
125 const gchar *format,
126 ...);
128void g_settings_get (GSettings *settings,
129 const gchar *key,
130 const gchar *format,
131 ...);
134 const gchar *key);
135
138 const gchar *key);
141 const gchar *key,
142 gint value);
145 const gchar *key);
148 const gchar *key,
149 gint64 value);
152 const gchar *key);
155 const gchar *key,
156 guint value);
159 const gchar *key);
162 const gchar *key,
163 guint64 value);
166 const gchar *key);
169 const gchar *key,
170 const gchar *value);
173 const gchar *key);
176 const gchar *key,
180 const gchar *key);
183 const gchar *key,
184 gdouble value);
187 const gchar *key);
190 const gchar *key,
191 const gchar *const *value);
194 const gchar *key);
197 const gchar *key,
198 gint value);
201 const gchar *key);
204 const gchar *key,
205 guint value);
208 const gchar *name);
209
212 const gchar *name);
213
223void g_settings_sync (void);
224
225/**
226 * GSettingsBindSetMapping:
227 * @value: a #GValue containing the property value to map
228 * @expected_type: the #GVariantType to create
229 * @user_data: user data that was specified when the binding was created
230 *
231 * The type for the function that is used to convert an object property
232 * value to a #GVariant for storing it in #GSettings.
233 *
234 * Returns: a new #GVariant holding the data from @value,
235 * or %NULL in case of an error
236 */
238 const GVariantType *expected_type,
239 gpointer user_data);
240
241/**
242 * GSettingsBindGetMapping:
243 * @value: return location for the property value
244 * @variant: the #GVariant
245 * @user_data: user data that was specified when the binding was created
246 *
247 * The type for the function that is used to convert from #GSettings to
248 * an object property. The @value is already initialized to hold values
249 * of the appropriate type.
250 *
251 * Returns: %TRUE if the conversion succeeded, %FALSE in case of an error
252 */
254 GVariant *variant,
255 gpointer user_data);
256
257/**
258 * GSettingsGetMapping:
259 * @value: the #GVariant to map, or %NULL
260 * @result: (out): the result of the mapping
261 * @user_data: (closure): the user data that was passed to
262 * g_settings_get_mapped()
263 *
264 * The type of the function that is used to convert from a value stored
265 * in a #GSettings to a value that is useful to the application.
266 *
267 * If the value is successfully mapped, the result should be stored at
268 * @result and %TRUE returned. If mapping fails (for example, if @value
269 * is not in the right format) then %FALSE should be returned.
270 *
271 * If @value is %NULL then it means that the mapping function is being
272 * given a "last chance" to successfully return a valid value. %TRUE
273 * must be returned in this case.
274 *
275 * Returns: %TRUE if the conversion succeeded, %FALSE in case of an error
276 **/
278 gpointer *result,
279 gpointer user_data);
280
281/**
282 * GSettingsBindFlags:
283 * @G_SETTINGS_BIND_DEFAULT: Equivalent to `G_SETTINGS_BIND_GET|G_SETTINGS_BIND_SET`
284 * @G_SETTINGS_BIND_GET: Update the #GObject property when the setting changes.
285 * It is an error to use this flag if the property is not writable.
286 * @G_SETTINGS_BIND_SET: Update the setting when the #GObject property changes.
287 * It is an error to use this flag if the property is not readable.
288 * @G_SETTINGS_BIND_NO_SENSITIVITY: Do not try to bind a "sensitivity" property to the writability of the setting
289 * @G_SETTINGS_BIND_GET_NO_CHANGES: When set in addition to %G_SETTINGS_BIND_GET, set the #GObject property
290 * value initially from the setting, but do not listen for changes of the setting
291 * @G_SETTINGS_BIND_INVERT_BOOLEAN: When passed to g_settings_bind(), uses a pair of mapping functions that invert
292 * the boolean value when mapping between the setting and the property. The setting and property must both
293 * be booleans. You cannot pass this flag to g_settings_bind_with_mapping().
294 *
295 * Flags used when creating a binding. These flags determine in which
296 * direction the binding works. The default is to synchronize in both
297 * directions.
298 */
308
311 const gchar *key,
312 gpointer object,
313 const gchar *property,
314 GSettingsBindFlags flags);
317 const gchar *key,
318 gpointer object,
319 const gchar *property,
320 GSettingsBindFlags flags,
321 GSettingsBindGetMapping get_mapping,
322 GSettingsBindSetMapping set_mapping,
323 gpointer user_data,
324 GDestroyNotify destroy);
327 const char *key,
328 GObject *object,
329 const char *property,
330 GSettingsBindFlags flags,
331 GClosure *get_mapping,
332 GClosure *set_mapping);
335 const gchar *key,
336 gpointer object,
337 const gchar *property,
338 gboolean inverted);
341 const gchar *property);
342
345 const gchar *key);
346
349 const gchar *key,
350 GSettingsGetMapping mapping,
351 gpointer user_data);
352
354
355#endif /* __G_SETTINGS_H__ */
#define GIO_AVAILABLE_IN_ALL
#define GIO_DEPRECATED_IN_2_46_FOR(f)
#define GIO_AVAILABLE_IN_2_32
#define GIO_AVAILABLE_IN_2_40
#define GIO_DEPRECATED_IN_2_40_FOR(f)
#define GIO_AVAILABLE_IN_2_82
#define GIO_AVAILABLE_IN_2_50
struct _GAction GAction
Definition giotypes.h:58
unsigned long guint64
Definition glibconfig.h:67
signed long gint64
Definition glibconfig.h:66
#define G_END_DECLS
Definition gmacros.h:910
#define G_BEGIN_DECLS
Definition gmacros.h:909
G_BEGIN_DECLS typedef guint32 GQuark
Definition gquark.h:38
GIO_AVAILABLE_IN_ALL void g_settings_get(GSettings *settings, const gchar *key, const gchar *format,...)
GIO_AVAILABLE_IN_ALL GSettings * g_settings_new_with_backend(const gchar *schema_id, GSettingsBackend *backend)
GIO_AVAILABLE_IN_2_50 guint64 g_settings_get_uint64(GSettings *settings, const gchar *key)
GIO_AVAILABLE_IN_2_82 void g_settings_bind_with_mapping_closures(GSettings *settings, const char *key, GObject *object, const char *property, GSettingsBindFlags flags, GClosure *get_mapping, GClosure *set_mapping)
GIO_AVAILABLE_IN_ALL void g_settings_bind_with_mapping(GSettings *settings, const gchar *key, gpointer object, const gchar *property, GSettingsBindFlags flags, GSettingsBindGetMapping get_mapping, GSettingsBindSetMapping set_mapping, gpointer user_data, GDestroyNotify destroy)
GIO_AVAILABLE_IN_ALL void g_settings_bind_writable(GSettings *settings, const gchar *key, gpointer object, const gchar *property, gboolean inverted)
GIO_AVAILABLE_IN_ALL gboolean g_settings_set_enum(GSettings *settings, const gchar *key, gint value)
GVariant *(* GSettingsBindSetMapping)(const GValue *value, const GVariantType *expected_type, gpointer user_data)
Definition gsettings.h:237
GIO_AVAILABLE_IN_ALL gboolean g_settings_get_has_unapplied(GSettings *settings)
GIO_AVAILABLE_IN_ALL gboolean g_settings_set_boolean(GSettings *settings, const gchar *key, gboolean value)
const gchar *const * g_settings_list_schemas(void)
GIO_AVAILABLE_IN_2_32 guint g_settings_get_uint(GSettings *settings, const gchar *key)
GIO_AVAILABLE_IN_ALL gpointer g_settings_get_mapped(GSettings *settings, const gchar *key, GSettingsGetMapping mapping, gpointer user_data)
GIO_AVAILABLE_IN_ALL gboolean g_settings_set_flags(GSettings *settings, const gchar *key, guint value)
GIO_AVAILABLE_IN_2_50 gboolean g_settings_set_int64(GSettings *settings, const gchar *key, gint64 value)
gchar ** g_settings_list_keys(GSettings *settings)
GIO_AVAILABLE_IN_ALL void g_settings_reset(GSettings *settings, const gchar *key)
GIO_AVAILABLE_IN_ALL gint g_settings_get_enum(GSettings *settings, const gchar *key)
GIO_AVAILABLE_IN_2_32 gboolean g_settings_set_uint(GSettings *settings, const gchar *key, guint value)
GIO_AVAILABLE_IN_ALL GSettings * g_settings_new(const gchar *schema_id)
GIO_AVAILABLE_IN_2_32 GAction * g_settings_create_action(GSettings *settings, const gchar *key)
struct _GSettingsPrivate GSettingsPrivate
Definition gsettings.h:44
GIO_AVAILABLE_IN_ALL gboolean g_settings_is_writable(GSettings *settings, const gchar *name)
const gchar *const * g_settings_list_relocatable_schemas(void)
GIO_AVAILABLE_IN_ALL gchar * g_settings_get_string(GSettings *settings, const gchar *key)
GIO_AVAILABLE_IN_2_32 GSettings * g_settings_new_full(GSettingsSchema *schema, GSettingsBackend *backend, const gchar *path)
GIO_AVAILABLE_IN_ALL gchar ** g_settings_list_children(GSettings *settings)
GIO_AVAILABLE_IN_ALL gboolean g_settings_set_value(GSettings *settings, const gchar *key, GVariant *value)
GIO_AVAILABLE_IN_ALL void g_settings_unbind(gpointer object, const gchar *property)
GIO_AVAILABLE_IN_ALL GSettings * g_settings_get_child(GSettings *settings, const gchar *name)
GIO_AVAILABLE_IN_ALL GVariant * g_settings_get_value(GSettings *settings, const gchar *key)
GVariant * g_settings_get_range(GSettings *settings, const gchar *key)
gboolean g_settings_range_check(GSettings *settings, const gchar *key, GVariant *value)
GIO_AVAILABLE_IN_ALL void g_settings_delay(GSettings *settings)
gboolean(* GSettingsGetMapping)(GVariant *value, gpointer *result, gpointer user_data)
Definition gsettings.h:277
GIO_AVAILABLE_IN_ALL gboolean g_settings_set_string(GSettings *settings, const gchar *key, const gchar *value)
GIO_AVAILABLE_IN_ALL GSettings * g_settings_new_with_path(const gchar *schema_id, const gchar *path)
GIO_AVAILABLE_IN_ALL void g_settings_revert(GSettings *settings)
GIO_AVAILABLE_IN_2_50 gboolean g_settings_set_uint64(GSettings *settings, const gchar *key, guint64 value)
GIO_AVAILABLE_IN_ALL guint g_settings_get_flags(GSettings *settings, const gchar *key)
GIO_AVAILABLE_IN_ALL gboolean g_settings_get_boolean(GSettings *settings, const gchar *key)
GIO_AVAILABLE_IN_2_40 GVariant * g_settings_get_user_value(GSettings *settings, const gchar *key)
GIO_AVAILABLE_IN_ALL gboolean g_settings_set(GSettings *settings, const gchar *key, const gchar *format,...)
GSettingsBindFlags
Definition gsettings.h:300
@ G_SETTINGS_BIND_INVERT_BOOLEAN
Definition gsettings.h:306
@ G_SETTINGS_BIND_SET
Definition gsettings.h:303
@ G_SETTINGS_BIND_GET_NO_CHANGES
Definition gsettings.h:305
@ G_SETTINGS_BIND_NO_SENSITIVITY
Definition gsettings.h:304
@ G_SETTINGS_BIND_DEFAULT
Definition gsettings.h:301
@ G_SETTINGS_BIND_GET
Definition gsettings.h:302
GIO_AVAILABLE_IN_ALL gboolean g_settings_set_int(GSettings *settings, const gchar *key, gint value)
GIO_AVAILABLE_IN_2_50 gint64 g_settings_get_int64(GSettings *settings, const gchar *key)
GIO_AVAILABLE_IN_ALL void g_settings_bind(GSettings *settings, const gchar *key, gpointer object, const gchar *property, GSettingsBindFlags flags)
GIO_AVAILABLE_IN_ALL gint g_settings_get_int(GSettings *settings, const gchar *key)
GIO_AVAILABLE_IN_2_40 GVariant * g_settings_get_default_value(GSettings *settings, const gchar *key)
GIO_AVAILABLE_IN_ALL GType g_settings_get_type(void)
GIO_AVAILABLE_IN_ALL void g_settings_sync(void)
GIO_AVAILABLE_IN_ALL gboolean g_settings_set_strv(GSettings *settings, const gchar *key, const gchar *const *value)
GIO_AVAILABLE_IN_ALL GSettings * g_settings_new_with_backend_and_path(const gchar *schema_id, GSettingsBackend *backend, const gchar *path)
GIO_AVAILABLE_IN_ALL gboolean g_settings_set_double(GSettings *settings, const gchar *key, gdouble value)
GIO_AVAILABLE_IN_ALL void g_settings_apply(GSettings *settings)
GIO_AVAILABLE_IN_ALL gchar ** g_settings_get_strv(GSettings *settings, const gchar *key)
GIO_AVAILABLE_IN_ALL gdouble g_settings_get_double(GSettings *settings, const gchar *key)
gboolean(* GSettingsBindGetMapping)(GValue *value, GVariant *variant, gpointer user_data)
Definition gsettings.h:253
GIO_AVAILABLE_IN_2_40 gboolean g_settings_schema_key_range_check(GSettingsSchemaKey *key, GVariant *value)
struct _GSettingsSchema GSettingsSchema
GIO_AVAILABLE_IN_2_46 gchar ** g_settings_schema_list_keys(GSettingsSchema *schema)
GIO_AVAILABLE_IN_2_40 GVariant * g_settings_schema_key_get_range(GSettingsSchemaKey *key)
GIO_AVAILABLE_IN_2_40 void g_settings_schema_source_list_schemas(GSettingsSchemaSource *source, gboolean recursive, gchar ***non_relocatable, gchar ***relocatable)
gsize GType
Definition gtype.h:427
gint gboolean
Definition gtypes.h:56
G_BEGIN_DECLS typedef char gchar
Definition gtypes.h:52
void * gpointer
Definition gtypes.h:109
int gint
Definition gtypes.h:55
double gdouble
Definition gtypes.h:64
void(* GDestroyNotify)(gpointer data)
Definition gtypes.h:140
unsigned int guint
Definition gtypes.h:61
typedefG_BEGIN_DECLS struct _GVariant GVariant
Definition gvariant.h:36
typedefG_BEGIN_DECLS struct _GVariantType GVariantType
json_t format(printf, 1, 2)))
const char * name
Definition lsqlite3.c:2154
int value
Definition lsqlite3.c:2155
void(* writable_changed)(GSettings *settings, const gchar *key)
Definition gsettings.h:52
void(* changed)(GSettings *settings, const gchar *key)
Definition gsettings.h:54
gboolean(* writable_change_event)(GSettings *settings, GQuark key)
Definition gsettings.h:56
gpointer padding[20]
Definition gsettings.h:62
gboolean(* change_event)(GSettings *settings, const GQuark *keys, gint n_keys)
Definition gsettings.h:58
GObjectClass parent_class
Definition gsettings.h:49
GObject parent_instance
Definition gsettings.h:67
GSettingsPrivate * priv
Definition gsettings.h:68