state->choices = NULL;
}
- gvdb_item_set_value (state->key, state->value);
- gvdb_item_set_options (state->key,
- g_variant_builder_end (&state->key_options));
-
+ gvdb_item_set_value (state->key,
+ g_variant_new ("(*a{sv})", state->value,
+ &state->key_options));
state->value = NULL;
}
g_settings_get_child (GSettings *settings,
const gchar *name)
{
- GVariant *child_schema;
+ const gchar *child_schema;
gchar *child_path;
gchar *child_name;
GSettings *child;
g_return_val_if_fail (G_IS_SETTINGS (settings), NULL);
child_name = g_strconcat (name, "/", NULL);
- child_schema = g_settings_schema_get_value (settings->priv->schema,
- child_name, NULL);
- if (child_schema == NULL ||
- !g_variant_is_of_type (child_schema, G_VARIANT_TYPE_STRING))
+ child_schema = g_settings_schema_get_string (settings->priv->schema,
+ child_name);
+ if (child_schema == NULL)
g_error ("Schema '%s' has no child '%s'",
settings->priv->schema_name, name);
child_path = g_strconcat (settings->priv->path, child_name, NULL);
child = g_object_new (G_TYPE_SETTINGS,
- "schema", g_variant_get_string (child_schema, NULL),
+ "schema", child_schema,
"path", child_path,
NULL);
- g_variant_unref (child_schema);
g_free (child_path);
g_free (child_name);
g_type_class_add_private (class, sizeof (GSettingsSchemaPrivate));
}
-static const gchar *
+const gchar *
g_settings_schema_get_string (GSettingsSchema *schema,
const gchar *key)
{
const gchar *result = NULL;
GVariant *value;
- if ((value = gvdb_table_get_value (schema->priv->table, key, NULL)))
+ if ((value = gvdb_table_get_value (schema->priv->table, key)))
{
result = g_variant_get_string (value, NULL);
g_variant_unref (value);
const gchar *key,
GVariant **options)
{
+ GVariant *variant, *value;
#if G_BYTE_ORDER == G_BIG_ENDIAN
- GVariant *variant, *tmp;
+ GVariant *tmp;
- tmp = gvdb_table_get_value (schema->priv->table, key, options);
+ tmp = gvdb_table_get_value (schema->priv->table, key);
if (tmp)
{
}
else
variant = NULL;
-
- /* NOTE: no options have byteswapped data in them at the moment */
-
- return variant;
#else
- return gvdb_table_get_value (schema->priv->table, key, options);
+ variant = gvdb_table_get_value (schema->priv->table, key);
#endif
+
+ if (variant == NULL)
+ return NULL;
+
+ value = g_variant_get_child_value (variant, 0);
+ if (options != NULL)
+ *options = g_variant_get_child_value (variant, 1);
+ g_variant_unref (variant);
+
+ return value;
}
const gchar *
G_GNUC_INTERNAL
const GQuark * g_settings_schema_list (GSettingsSchema *schema,
gint *n_items);
+G_GNUC_INTERNAL
+const gchar * g_settings_schema_get_string (GSettingsSchema *schema,
+ const gchar *key);
G_END_DECLS