mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-24 14:36:13 +01:00
merge GSettings
This commit is contained in:
parent
43a72ce1be
commit
a187634b29
@ -79,21 +79,25 @@ gio-marshal.c: gio-marshal.h gio-marshal.list
|
||||
$(glib_genmarshal) --prefix=_gio_marshal $(srcdir)/gio-marshal.list --body --internal) > $@.tmp && \
|
||||
mv $@.tmp $@
|
||||
|
||||
settings_headers = \
|
||||
gsettingsbackend.h \
|
||||
gsettings.h
|
||||
|
||||
settings_sources = \
|
||||
gsettingsbackendinternal.h \
|
||||
gdelayedsettingsbackend.h \
|
||||
gdelayedsettingsbackend. \
|
||||
gnullsettingsbackend.h \
|
||||
gnullsettingsbackend.c \
|
||||
gsettingsbackend.c \
|
||||
gvdb/gvdb-format.h \
|
||||
gvdb/gvdb-reader.h \
|
||||
gvdb/gvdb-reader.c \
|
||||
gdelayedsettingsbackend.h \
|
||||
gdelayedsettingsbackend.c \
|
||||
gnullsettingsbackend.h \
|
||||
gnullsettingsbackend.c \
|
||||
gsettingsbackendinternal.h \
|
||||
gsettingsbackend.c \
|
||||
gsettingsschema.h \
|
||||
gsettingsschema.c
|
||||
|
||||
settings_headers = \
|
||||
gsettingsbackend.h
|
||||
gsettingsschema.c \
|
||||
gsettings-mapping.h \
|
||||
gsettings-mapping.c \
|
||||
gsettings.c
|
||||
|
||||
local_sources = \
|
||||
glocaldirectorymonitor.c \
|
||||
@ -428,7 +432,7 @@ gio_headers = \
|
||||
gvolumemonitor.h \
|
||||
gzlibcompressor.h \
|
||||
gzlibdecompressor.h \
|
||||
$(settings_headers) \
|
||||
$(settings_headers) \
|
||||
$(NULL)
|
||||
|
||||
gioincludedir=$(includedir)/glib-2.0/gio/
|
||||
@ -489,9 +493,9 @@ gio_querymodules_LDADD = \
|
||||
|
||||
gschema_compile_LDADD = $(top_builddir)/glib/libglib-2.0.la
|
||||
gschema_compile_SOURCES = \
|
||||
gvdb/gvdb-format.h \
|
||||
gvdb/gvdb-builder.h \
|
||||
gvdb/gvdb-builder.c \
|
||||
gvdb/gvdb-format.h \
|
||||
gvdb/gvdb-builder.h \
|
||||
gvdb/gvdb-builder.c \
|
||||
gschema-compile.c
|
||||
|
||||
dist-hook: $(BUILT_EXTRA_DIST) ../build/win32/vs9/gio.vcproj
|
||||
|
@ -4,3 +4,5 @@ VOID:BOOLEAN,POINTER
|
||||
VOID:OBJECT,OBJECT,ENUM
|
||||
BOOLEAN:OBJECT,OBJECT
|
||||
VOID:STRING,BOXED,BOXED
|
||||
BOOL:POINTER,INT
|
||||
BOOL:UINT
|
||||
|
@ -76,6 +76,7 @@
|
||||
#include <gio/goutputstream.h>
|
||||
#include <gio/gresolver.h>
|
||||
#include <gio/gseekable.h>
|
||||
#include <gio/gsettings.h>
|
||||
#include <gio/gsimpleasyncresult.h>
|
||||
#include <gio/gsocket.h>
|
||||
#include <gio/gsocketaddress.h>
|
||||
|
@ -957,6 +957,7 @@ g_socket_protocol_get_type G_GNUC_CONST
|
||||
g_socket_msg_flags_get_type G_GNUC_CONST
|
||||
g_resolver_error_get_type G_GNUC_CONST
|
||||
g_zlib_compressor_format_get_type
|
||||
g_settings_bind_flags_get_type
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -1352,3 +1353,36 @@ g_settings_backend_writable_changed
|
||||
g_settings_backend_changed_tree
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__G_SETTINGS_H__)
|
||||
#if IN_FILE(__G_SETTINGS_C__)
|
||||
g_settings_apply
|
||||
g_settings_bind
|
||||
g_settings_bind_with_mapping
|
||||
g_settings_delay
|
||||
g_settings_get
|
||||
g_settings_get_child
|
||||
g_settings_get_has_unapplied
|
||||
g_settings_get_type
|
||||
g_settings_get_value
|
||||
g_settings_is_writable
|
||||
g_settings_new
|
||||
g_settings_new_with_context
|
||||
g_settings_new_with_context_and_path
|
||||
g_settings_new_with_path
|
||||
g_settings_revert
|
||||
g_settings_set
|
||||
g_settings_set_value
|
||||
g_settings_unbind
|
||||
g_settings_get_int
|
||||
g_settings_set_int
|
||||
g_settings_get_string
|
||||
g_settings_set_string
|
||||
g_settings_get_strv
|
||||
g_settings_set_strv
|
||||
g_settings_get_double
|
||||
g_settings_set_double
|
||||
g_settings_get_boolean
|
||||
g_settings_set_boolean
|
||||
#endif
|
||||
#endif
|
||||
|
367
gio/gsettings-mapping.c
Normal file
367
gio/gsettings-mapping.c
Normal file
@ -0,0 +1,367 @@
|
||||
/*
|
||||
* Copyright © 2010 Novell, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the licence, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Author: Vincent Untz <vuntz@gnome.org>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gsettings-mapping.h"
|
||||
|
||||
static GVariant *
|
||||
g_settings_set_mapping_numeric (const GValue *value,
|
||||
const GVariantType *expected_type)
|
||||
{
|
||||
GVariant *variant = NULL;
|
||||
glong l;
|
||||
|
||||
if (G_VALUE_HOLDS_INT (value))
|
||||
l = g_value_get_int (value);
|
||||
else if (G_VALUE_HOLDS_INT64 (value))
|
||||
l = g_value_get_int64 (value);
|
||||
else if (G_VALUE_HOLDS_DOUBLE (value))
|
||||
l = g_value_get_double (value);
|
||||
else
|
||||
return NULL;
|
||||
|
||||
if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_INT16))
|
||||
{
|
||||
if (G_MININT16 <= l && l <= G_MAXINT16)
|
||||
variant = g_variant_new_int16 ((gint16) l);
|
||||
}
|
||||
else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_UINT16))
|
||||
{
|
||||
if (0 <= l && l <= G_MAXUINT16)
|
||||
variant = g_variant_new_uint16 ((guint16) l);
|
||||
}
|
||||
else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_INT32))
|
||||
{
|
||||
if (G_MININT32 <= l && l <= G_MAXINT32)
|
||||
variant = g_variant_new_int32 ((gint) l);
|
||||
}
|
||||
else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_UINT32))
|
||||
{
|
||||
if (0 <= l && l <= G_MAXUINT32)
|
||||
variant = g_variant_new_uint32 ((guint) l);
|
||||
}
|
||||
else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_INT64))
|
||||
{
|
||||
if (G_MININT64 <= l && l <= G_MAXINT64)
|
||||
variant = g_variant_new_int64 ((gint64) l);
|
||||
}
|
||||
else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_UINT64))
|
||||
{
|
||||
if (0 <= l && l <= G_MAXUINT64)
|
||||
variant = g_variant_new_uint64 ((guint64) l);
|
||||
}
|
||||
else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_HANDLE))
|
||||
{
|
||||
if (0 <= l && l <= G_MAXUINT32)
|
||||
variant = g_variant_new_handle ((guint) l);
|
||||
}
|
||||
else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_DOUBLE))
|
||||
variant = g_variant_new_double ((double) l);
|
||||
|
||||
return variant;
|
||||
}
|
||||
|
||||
static GVariant *
|
||||
g_settings_set_mapping_unsigned_numeric (const GValue *value,
|
||||
const GVariantType *expected_type)
|
||||
{
|
||||
GVariant *variant = NULL;
|
||||
gulong u;
|
||||
|
||||
if (G_VALUE_HOLDS_UINT (value))
|
||||
u = g_value_get_uint (value);
|
||||
else if (G_VALUE_HOLDS_UINT64 (value))
|
||||
u = g_value_get_uint64 (value);
|
||||
else
|
||||
return NULL;
|
||||
|
||||
if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_INT16))
|
||||
{
|
||||
if (u <= G_MAXINT16)
|
||||
variant = g_variant_new_int16 ((gint16) u);
|
||||
}
|
||||
else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_UINT16))
|
||||
{
|
||||
if (u <= G_MAXUINT16)
|
||||
variant = g_variant_new_uint16 ((guint16) u);
|
||||
}
|
||||
else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_INT32))
|
||||
{
|
||||
if (u <= G_MAXINT32)
|
||||
variant = g_variant_new_int32 ((gint) u);
|
||||
}
|
||||
else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_UINT32))
|
||||
{
|
||||
if (u <= G_MAXUINT32)
|
||||
variant = g_variant_new_uint32 ((guint) u);
|
||||
}
|
||||
else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_INT64))
|
||||
{
|
||||
if (u <= G_MAXINT64)
|
||||
variant = g_variant_new_int64 ((gint64) u);
|
||||
}
|
||||
else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_UINT64))
|
||||
{
|
||||
if (u <= G_MAXUINT64)
|
||||
variant = g_variant_new_uint64 ((guint64) u);
|
||||
}
|
||||
else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_HANDLE))
|
||||
{
|
||||
if (u <= G_MAXUINT32)
|
||||
variant = g_variant_new_handle ((guint) u);
|
||||
}
|
||||
else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_DOUBLE))
|
||||
variant = g_variant_new_double ((double) u);
|
||||
|
||||
return variant;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
g_settings_get_mapping_numeric (GValue *value,
|
||||
GVariant *variant)
|
||||
{
|
||||
const GVariantType *type;
|
||||
glong l;
|
||||
|
||||
type = g_variant_get_type (variant);
|
||||
|
||||
if (g_variant_type_equal (type, G_VARIANT_TYPE_INT16))
|
||||
l = g_variant_get_int16 (variant);
|
||||
else if (g_variant_type_equal (type, G_VARIANT_TYPE_INT32))
|
||||
l = g_variant_get_int32 (variant);
|
||||
else if (g_variant_type_equal (type, G_VARIANT_TYPE_INT64))
|
||||
l = g_variant_get_int64 (variant);
|
||||
else if (g_variant_type_equal (type, G_VARIANT_TYPE_DOUBLE))
|
||||
l = g_variant_get_double (variant);
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
if (G_VALUE_HOLDS_INT (value))
|
||||
{
|
||||
g_value_set_int (value, l);
|
||||
return (G_MININT32 <= l && l <= G_MAXINT32);
|
||||
}
|
||||
else if (G_VALUE_HOLDS_UINT (value))
|
||||
{
|
||||
g_value_set_uint (value, l);
|
||||
return (0 <= l && l <= G_MAXUINT32);
|
||||
}
|
||||
else if (G_VALUE_HOLDS_INT64 (value))
|
||||
{
|
||||
g_value_set_int64 (value, l);
|
||||
return (G_MININT64 <= l && l <= G_MAXINT64);
|
||||
}
|
||||
else if (G_VALUE_HOLDS_UINT64 (value))
|
||||
{
|
||||
g_value_set_uint64 (value, l);
|
||||
return (0 <= l && l <= G_MAXUINT64);
|
||||
}
|
||||
else if (G_VALUE_HOLDS_DOUBLE (value))
|
||||
{
|
||||
g_value_set_double (value, l);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
g_settings_get_mapping_unsigned_numeric (GValue *value,
|
||||
GVariant *variant)
|
||||
{
|
||||
const GVariantType *type;
|
||||
gulong u;
|
||||
|
||||
type = g_variant_get_type (variant);
|
||||
|
||||
if (g_variant_type_equal (type, G_VARIANT_TYPE_UINT16))
|
||||
u = g_variant_get_uint16 (variant);
|
||||
else if (g_variant_type_equal (type, G_VARIANT_TYPE_UINT32))
|
||||
u = g_variant_get_uint32 (variant);
|
||||
else if (g_variant_type_equal (type, G_VARIANT_TYPE_UINT64))
|
||||
u = g_variant_get_uint64 (variant);
|
||||
else if (g_variant_type_equal (type, G_VARIANT_TYPE_HANDLE))
|
||||
u = g_variant_get_handle (variant);
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
if (G_VALUE_HOLDS_INT (value))
|
||||
{
|
||||
g_value_set_int (value, u);
|
||||
return (u <= G_MAXINT32);
|
||||
}
|
||||
else if (G_VALUE_HOLDS_UINT (value))
|
||||
{
|
||||
g_value_set_uint (value, u);
|
||||
return (u <= G_MAXUINT32);
|
||||
}
|
||||
else if (G_VALUE_HOLDS_INT64 (value))
|
||||
{
|
||||
g_value_set_int64 (value, u);
|
||||
return (u <= G_MAXINT64);
|
||||
}
|
||||
else if (G_VALUE_HOLDS_UINT64 (value))
|
||||
{
|
||||
g_value_set_uint64 (value, u);
|
||||
return (u <= G_MAXUINT64);
|
||||
}
|
||||
else if (G_VALUE_HOLDS_DOUBLE (value))
|
||||
{
|
||||
g_value_set_double (value, u);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GVariant *
|
||||
g_settings_set_mapping (const GValue *value,
|
||||
const GVariantType *expected_type,
|
||||
gpointer user_data)
|
||||
{
|
||||
gchar *type_string;
|
||||
|
||||
if (G_VALUE_HOLDS_BOOLEAN (value))
|
||||
{
|
||||
if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_BOOLEAN))
|
||||
return g_variant_new_boolean (g_value_get_boolean (value));
|
||||
}
|
||||
|
||||
else if (G_VALUE_HOLDS_CHAR (value) ||
|
||||
G_VALUE_HOLDS_UCHAR (value))
|
||||
{
|
||||
if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_BYTE))
|
||||
{
|
||||
if (G_VALUE_HOLDS_CHAR (value))
|
||||
return g_variant_new_byte (g_value_get_char (value));
|
||||
else
|
||||
return g_variant_new_byte (g_value_get_uchar (value));
|
||||
}
|
||||
}
|
||||
|
||||
else if (G_VALUE_HOLDS_INT (value) ||
|
||||
G_VALUE_HOLDS_INT64 (value) ||
|
||||
G_VALUE_HOLDS_DOUBLE (value))
|
||||
return g_settings_set_mapping_numeric (value, expected_type);
|
||||
|
||||
else if (G_VALUE_HOLDS_UINT (value) ||
|
||||
G_VALUE_HOLDS_UINT64 (value))
|
||||
return g_settings_set_mapping_unsigned_numeric (value, expected_type);
|
||||
|
||||
else if (G_VALUE_HOLDS_STRING (value))
|
||||
{
|
||||
if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_STRING))
|
||||
return g_variant_new_string (g_value_get_string (value));
|
||||
else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_OBJECT_PATH))
|
||||
return g_variant_new_object_path (g_value_get_string (value));
|
||||
else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_SIGNATURE))
|
||||
return g_variant_new_signature (g_value_get_string (value));
|
||||
}
|
||||
|
||||
type_string = g_variant_type_dup_string (expected_type);
|
||||
g_critical ("No GSettings bind handler for type \"%s\".", type_string);
|
||||
g_free (type_string);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_settings_get_mapping (GValue *value,
|
||||
GVariant *variant,
|
||||
gpointer user_data)
|
||||
{
|
||||
if (g_variant_is_of_type (variant, G_VARIANT_TYPE_BOOLEAN))
|
||||
{
|
||||
if (!G_VALUE_HOLDS_BOOLEAN (value))
|
||||
return FALSE;
|
||||
g_value_set_boolean (value, g_variant_get_boolean (variant));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
else if (g_variant_is_of_type (variant, G_VARIANT_TYPE_BYTE))
|
||||
{
|
||||
if (G_VALUE_HOLDS_UCHAR (value))
|
||||
g_value_set_uchar (value, g_variant_get_byte (variant));
|
||||
else if (G_VALUE_HOLDS_CHAR (value))
|
||||
g_value_set_char (value, (gchar) g_variant_get_byte (variant));
|
||||
else
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
else if (g_variant_is_of_type (variant, G_VARIANT_TYPE_INT16) ||
|
||||
g_variant_is_of_type (variant, G_VARIANT_TYPE_INT32) ||
|
||||
g_variant_is_of_type (variant, G_VARIANT_TYPE_INT64) ||
|
||||
g_variant_is_of_type (variant, G_VARIANT_TYPE_DOUBLE))
|
||||
return g_settings_get_mapping_numeric (value, variant);
|
||||
|
||||
else if (g_variant_is_of_type (variant, G_VARIANT_TYPE_UINT16) ||
|
||||
g_variant_is_of_type (variant, G_VARIANT_TYPE_UINT32) ||
|
||||
g_variant_is_of_type (variant, G_VARIANT_TYPE_UINT64) ||
|
||||
g_variant_is_of_type (variant, G_VARIANT_TYPE_HANDLE))
|
||||
return g_settings_get_mapping_unsigned_numeric (value, variant);
|
||||
|
||||
else if (g_variant_is_of_type (variant, G_VARIANT_TYPE_STRING) ||
|
||||
g_variant_is_of_type (variant, G_VARIANT_TYPE_OBJECT_PATH) ||
|
||||
g_variant_is_of_type (variant, G_VARIANT_TYPE_SIGNATURE))
|
||||
{
|
||||
g_value_set_string (value, g_variant_get_string (variant, NULL));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
g_critical ("No GSettings bind handler for type \"%s\".",
|
||||
g_variant_get_type_string (variant));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_settings_mapping_is_compatible (GType gvalue_type,
|
||||
const GVariantType *variant_type)
|
||||
{
|
||||
gboolean ok = FALSE;
|
||||
|
||||
if (gvalue_type == G_TYPE_BOOLEAN)
|
||||
ok = g_variant_type_equal (variant_type, G_VARIANT_TYPE_BOOLEAN);
|
||||
else if (gvalue_type == G_TYPE_CHAR ||
|
||||
gvalue_type == G_TYPE_UCHAR)
|
||||
ok = g_variant_type_equal (variant_type, G_VARIANT_TYPE_BYTE);
|
||||
else if (gvalue_type == G_TYPE_INT ||
|
||||
gvalue_type == G_TYPE_UINT ||
|
||||
gvalue_type == G_TYPE_INT64 ||
|
||||
gvalue_type == G_TYPE_UINT64 ||
|
||||
gvalue_type == G_TYPE_DOUBLE)
|
||||
ok = (g_variant_type_equal (variant_type, G_VARIANT_TYPE_INT16) ||
|
||||
g_variant_type_equal (variant_type, G_VARIANT_TYPE_UINT16) ||
|
||||
g_variant_type_equal (variant_type, G_VARIANT_TYPE_INT32) ||
|
||||
g_variant_type_equal (variant_type, G_VARIANT_TYPE_UINT32) ||
|
||||
g_variant_type_equal (variant_type, G_VARIANT_TYPE_INT64) ||
|
||||
g_variant_type_equal (variant_type, G_VARIANT_TYPE_UINT64) ||
|
||||
g_variant_type_equal (variant_type, G_VARIANT_TYPE_HANDLE) ||
|
||||
g_variant_type_equal (variant_type, G_VARIANT_TYPE_DOUBLE));
|
||||
else if (gvalue_type == G_TYPE_STRING)
|
||||
ok = (g_variant_type_equal (variant_type, G_VARIANT_TYPE_STRING) ||
|
||||
g_variant_type_equal (variant_type, G_VARIANT_TYPE_OBJECT_PATH) ||
|
||||
g_variant_type_equal (variant_type, G_VARIANT_TYPE_SIGNATURE));
|
||||
|
||||
return ok;
|
||||
}
|
39
gio/gsettings-mapping.h
Normal file
39
gio/gsettings-mapping.h
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright © 2010 Novell, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the licence, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Author: Vincent Untz <vuntz@gnome.org>
|
||||
*/
|
||||
|
||||
#ifndef __G_SETTINGS_MAPPING_H__
|
||||
#define __G_SETTINGS_MAPPING_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
GVariant * g_settings_set_mapping (const GValue *value,
|
||||
const GVariantType *expected_type,
|
||||
gpointer user_data);
|
||||
G_GNUC_INTERNAL
|
||||
gboolean g_settings_get_mapping (GValue *value,
|
||||
GVariant *variant,
|
||||
gpointer user_data);
|
||||
G_GNUC_INTERNAL
|
||||
gboolean g_settings_mapping_is_compatible (GType gvalue_type,
|
||||
const GVariantType *variant_type);
|
||||
|
||||
#endif /* __G_SETTINGS_MAPPING_H__ */
|
1715
gio/gsettings.c
Normal file
1715
gio/gsettings.c
Normal file
File diff suppressed because it is too large
Load Diff
203
gio/gsettings.h
Normal file
203
gio/gsettings.h
Normal file
@ -0,0 +1,203 @@
|
||||
/*
|
||||
* Copyright © 2009, 2010 Codethink Limited
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the licence, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Author: Ryan Lortie <desrt@desrt.ca>
|
||||
*/
|
||||
|
||||
#ifndef __G_SETTINGS_H__
|
||||
#define __G_SETTINGS_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define G_TYPE_SETTINGS (g_settings_get_type ())
|
||||
#define G_SETTINGS(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
|
||||
G_TYPE_SETTINGS, GSettings))
|
||||
#define G_SETTINGS_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
|
||||
G_TYPE_SETTINGS, GSettingsClass))
|
||||
#define G_IS_SETTINGS(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_SETTINGS))
|
||||
#define G_IS_SETTINGS_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_SETTINGS))
|
||||
#define G_SETTINGS_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
|
||||
G_TYPE_SETTINGS, GSettingsClass))
|
||||
|
||||
typedef struct _GSettingsPrivate GSettingsPrivate;
|
||||
typedef struct _GSettingsClass GSettingsClass;
|
||||
typedef struct _GSettings GSettings;
|
||||
|
||||
struct _GSettingsClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
/* Signals */
|
||||
void (*writable_changed) (GSettings *settings,
|
||||
const gchar *key);
|
||||
void (*changed) (GSettings *settings,
|
||||
const gchar *key);
|
||||
gboolean (*writable_change_event) (GSettings *settings,
|
||||
GQuark key);
|
||||
gboolean (*change_event) (GSettings *settings,
|
||||
const GQuark *keys,
|
||||
gint n_keys);
|
||||
|
||||
gpointer padding[20];
|
||||
};
|
||||
|
||||
struct _GSettings
|
||||
{
|
||||
GObject parent_instance;
|
||||
GSettingsPrivate *priv;
|
||||
};
|
||||
|
||||
|
||||
GType g_settings_get_type (void);
|
||||
|
||||
GSettings * g_settings_new (const gchar *schema);
|
||||
GSettings * g_settings_new_with_path (const gchar *schema,
|
||||
const gchar *path);
|
||||
gboolean g_settings_supports_context (const gchar *context);
|
||||
GSettings * g_settings_new_with_context (const gchar *schema,
|
||||
const gchar *context);
|
||||
GSettings * g_settings_new_with_context_and_path (const gchar *schema,
|
||||
const gchar *context,
|
||||
const gchar *path);
|
||||
|
||||
gboolean g_settings_set_value (GSettings *settings,
|
||||
const gchar *key,
|
||||
GVariant *value);
|
||||
GVariant * g_settings_get_value (GSettings *settings,
|
||||
const gchar *key);
|
||||
|
||||
gboolean g_settings_set (GSettings *settings,
|
||||
const gchar *key,
|
||||
const gchar *format,
|
||||
...);
|
||||
void g_settings_get (GSettings *settings,
|
||||
const gchar *key,
|
||||
const gchar *format,
|
||||
...);
|
||||
|
||||
gint g_settings_get_int (GSettings *settings,
|
||||
const gchar *key);
|
||||
gboolean g_settings_set_int (GSettings *settings,
|
||||
const gchar *key,
|
||||
gint value);
|
||||
gchar * g_settings_get_string (GSettings *settings,
|
||||
const gchar *key);
|
||||
gboolean g_settings_set_string (GSettings *settings,
|
||||
const gchar *key,
|
||||
const gchar *value);
|
||||
gboolean g_settings_get_boolean (GSettings *settings,
|
||||
const gchar *key);
|
||||
gboolean g_settings_set_boolean (GSettings *settings,
|
||||
const gchar *key,
|
||||
gboolean value);
|
||||
gdouble g_settings_get_double (GSettings *settings,
|
||||
const gchar *key);
|
||||
gboolean g_settings_set_double (GSettings *settings,
|
||||
const gchar *key,
|
||||
gdouble value);
|
||||
gchar ** g_settings_get_strv (GSettings *settings,
|
||||
const gchar *key,
|
||||
gsize *length);
|
||||
gboolean g_settings_set_strv (GSettings *settings,
|
||||
const gchar *key,
|
||||
const gchar *const *value,
|
||||
gssize length);
|
||||
|
||||
GSettings * g_settings_get_child (GSettings *settings,
|
||||
const gchar *name);
|
||||
|
||||
gboolean g_settings_is_writable (GSettings *settings,
|
||||
const gchar *name);
|
||||
|
||||
void g_settings_delay (GSettings *settings);
|
||||
void g_settings_apply (GSettings *settings);
|
||||
void g_settings_revert (GSettings *settings);
|
||||
gboolean g_settings_get_has_unapplied (GSettings *settings);
|
||||
|
||||
/**
|
||||
* GSettingsBindSetMapping:
|
||||
* @value: a #GValue containing the property value to map
|
||||
* @expected_type: the #GVariantType to create
|
||||
* @user_data: user data that was specified when the binding was created
|
||||
* @returns: a new #GVariant holding the data from @value,
|
||||
* or %NULL in case of an error
|
||||
*
|
||||
* The type for the function that is used to convert an object property
|
||||
* value to a #GVariant for storing it in #GSettings.
|
||||
*/
|
||||
typedef GVariant * (*GSettingsBindSetMapping) (const GValue *value,
|
||||
const GVariantType *expected_type,
|
||||
gpointer user_data);
|
||||
|
||||
/**
|
||||
* GSettingsBindGetMapping:
|
||||
* @value: return location for the property value
|
||||
* @variant: the #GVariant
|
||||
* @user_data: user data that was specified when the binding was created
|
||||
* @returns: %TRUE if the conversion succeeded, %FALSE in case of an error
|
||||
*
|
||||
* The type for the function that is used to convert from #GSettings to
|
||||
* an object property. The @value is already initialized to hold values
|
||||
* of the appropriate type.
|
||||
*/
|
||||
typedef gboolean (*GSettingsBindGetMapping) (GValue *value,
|
||||
GVariant *variant,
|
||||
gpointer user_data);
|
||||
|
||||
/**
|
||||
* GSettingsBindFlags:
|
||||
* @G_SETTINGS_BIND_DEFAULT: Equivalent to <literal>G_SETTINGS_BIND_GET|G_SETTINGS_BIND_SET</literal>
|
||||
* @G_SETTINGS_BIND_GET: Update the #GObject property when the #GSettings key changes
|
||||
* @G_SETTINGS_BIND_SET: Update the #GSettings key when the #GObject property changes
|
||||
* @G_SETTINGS_BIND_NO_SENSITIVITY: Do not try to bind a "sensitivity" property to #GSettings writability
|
||||
*
|
||||
* Flags used when creating a binding. These flags determine in which
|
||||
* direction the binding works. The default is to synchronize in both
|
||||
* directions.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
G_SETTINGS_BIND_DEFAULT,
|
||||
G_SETTINGS_BIND_GET = (1<<0),
|
||||
G_SETTINGS_BIND_SET = (1<<1),
|
||||
G_SETTINGS_BIND_NO_SENSITIVITY = (1<<2),
|
||||
G_SETTINGS_BIND_GET_NO_CHANGES = (1<<3)
|
||||
} GSettingsBindFlags;
|
||||
|
||||
void g_settings_bind (GSettings *settings,
|
||||
const gchar *key,
|
||||
gpointer object,
|
||||
const gchar *property,
|
||||
GSettingsBindFlags flags);
|
||||
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);
|
||||
void g_settings_unbind (gpointer object,
|
||||
const gchar *property);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __G_SETTINGS_H__ */
|
@ -9,7 +9,7 @@ if ! which readelf 2>/dev/null >/dev/null; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
SKIP='\<g_access\|\<g_array_\|\<g_ascii\|\<g_list_\|\<g_assertion_message\|\<g_warn_message\|\<g_atomic\|\<g_bit_\|\<g_boxed\|\<g_build_filename\|\<g_byte_array\|\<g_checksum\|\<g_child_watch\|\<g_clear_error\|\<g_convert\|\<g_dir_\|\<g_enum_\|\<g_error_\|\<g_prefix_error\|\<g_file_error_quark\|\<g_file_get_contents\|\<g_file_set_contents\|\<g_file_test\|\<g_file_read_link\|\<g_filename_\|\<g_find_program_in_path\|\<g_flags_\|\<g_free\|\<g_get_\|\<g_getenv\|\<g_setenv\|\<g_hash_table_\|\<g_hostname_\|\<g_iconv\|\<g_idle_\|\<g_intern_static_string\|\<g_io_add_watch\|\<g_io_channel_\|\<g_io_create_watch\|\<g_key_file_\|\<g_listenv\|\<g_locale_to_utf8\|\<g_log\|\<g_main_context_\|\<g_main_current_source\|\<g_main_loop_\|\<g_malloc\|\<g_markup_\|\<g_mkdir_\|\<g_mkstemp\|\<g_module_\|\<g_object_\|\<g_once_\|\<g_param_spec_\|\<g_path_\|\<g_poll\|\<g_printerr\|\<g_propagate_error\|\<g_ptr_array_\|\<g_qsort_\|\<g_quark_\|\<g_queue_\|\<g_random_int_range\|\<g_realloc\|\<g_return_if_fail\|\<g_set_error\|\<g_shell_\|\<g_signal_\|\<g_slice_\|\<g_slist_\|\<g_snprintf\|\<g_source_\|\<g_spawn_\|\<g_static_\|\<g_str\|\<g_thread_pool_\|\<g_time_val_add\|\<g_timeout_\|\<g_type_\|\<g_unlink\|\<g_uri_\|\<g_utf8_\|\<g_value_\|\<g_tree_\|\<g_variant_\|\<g_mapped_file_'
|
||||
SKIP='\<g_access\|\<g_array_\|\<g_ascii\|\<g_list_\|\<g_assertion_message\|\<g_warn_message\|\<g_atomic\|\<g_bit_\|\<g_boxed\|\<g_build_filename\|\<g_byte_array\|\<g_checksum\|\<g_child_watch\|\<g_clear_error\|\<g_convert\|\<g_dir_\|\<g_enum_\|\<g_error_\|\<g_prefix_error\|\<g_file_error_quark\|\<g_file_get_contents\|\<g_file_set_contents\|\<g_file_test\|\<g_file_read_link\|\<g_filename_\|\<g_find_program_in_path\|\<g_flags_\|\<g_free\|\<g_get_\|\<g_getenv\|\<g_setenv\|\<g_hash_table_\|\<g_hostname_\|\<g_iconv\|\<g_idle_\|\<g_intern_static_string\|\<g_io_add_watch\|\<g_io_channel_\|\<g_io_create_watch\|\<g_key_file_\|\<g_listenv\|\<g_locale_to_utf8\|\<g_log\|\<g_main_context_\|\<g_main_current_source\|\<g_main_loop_\|\<g_malloc\|\<g_markup_\|\<g_mkdir_\|\<g_mkstemp\|\<g_module_\|\<g_object_\|\<g_once_\|\<g_param_spec_\|\<g_path_\|\<g_poll\|\<g_printerr\|\<g_propagate_error\|\<g_ptr_array_\|\<g_qsort_\|\<g_quark_\|\<g_queue_\|\<g_random_int_range\|\<g_realloc\|\<g_return_if_fail\|\<g_set_error\|\<g_shell_\|\<g_signal_\|\<g_slice_\|\<g_slist_\|\<g_snprintf\|\<g_source_\|\<g_spawn_\|\<g_static_\|\<g_str\|\<g_thread_pool_\|\<g_time_val_add\|\<g_timeout_\|\<g_type_\|\<g_unlink\|\<g_uri_\|\<g_utf8_\|\<g_value_\|\<g_tree_\|\<g_variant_\|\<g_mapped_file_\|\<g_intern_string\>'
|
||||
|
||||
for so in .libs/lib*.so; do
|
||||
echo Checking $so for local PLT entries
|
||||
|
Loading…
Reference in New Issue
Block a user