[glib] GSettingsSchema: add call to get list of keys
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] GSettingsSchema: add call to get list of keys
- Date: Sat, 17 Apr 2010 03:24:57 +0000 (UTC)
commit 43a72ce1bea72a581faf34a505004cac941690c3
Author: Ryan Lortie <desrt desrt ca>
Date: Fri Apr 16 23:20:48 2010 -0400
GSettingsSchema: add call to get list of keys
gio/gsettingsschema.c | 32 ++++++++++++++++++++++++++++++++
gio/gsettingsschema.h | 3 +++
2 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/gio/gsettingsschema.c b/gio/gsettingsschema.c
index 188201d..af2c7d8 100644
--- a/gio/gsettingsschema.c
+++ b/gio/gsettingsschema.c
@@ -30,6 +30,8 @@ struct _GSettingsSchemaPrivate
{
const gchar *gettext_domain;
const gchar *path;
+ GQuark *items;
+ gint n_items;
GvdbTable *table;
gchar *name;
};
@@ -86,6 +88,7 @@ g_settings_schema_finalize (GObject *object)
GSettingsSchema *schema = G_SETTINGS_SCHEMA (object);
gvdb_table_unref (schema->priv->table);
+ g_free (schema->priv->items);
g_free (schema->priv->name);
G_OBJECT_CLASS (g_settings_schema_parent_class)
@@ -203,3 +206,32 @@ g_settings_schema_has_key (GSettingsSchema *schema,
{
return gvdb_table_has_value (schema->priv->table, key);
}
+
+const GQuark *
+g_settings_schema_list (GSettingsSchema *schema,
+ gint *n_items)
+{
+ gint i, j;
+
+ if (schema->priv->items == NULL)
+ {
+ gchar **list;
+ gint len;
+
+ list = gvdb_table_list (schema->priv->table, "");
+ len = g_strv_length (list);
+
+ schema->priv->items = g_new (GQuark, len);
+ j = 0;
+
+ for (i = 0; i < len; i++)
+ if (list[i][0] != '.')
+ schema->priv->items[j++] = g_quark_from_string (list[i]);
+ schema->priv->n_items = j;
+
+ g_strfreev (list);
+ }
+
+ *n_items = schema->priv->n_items;
+ return schema->priv->items;
+}
diff --git a/gio/gsettingsschema.h b/gio/gsettingsschema.h
index f813a95..f57b015 100644
--- a/gio/gsettingsschema.h
+++ b/gio/gsettingsschema.h
@@ -67,6 +67,9 @@ GVariant * g_settings_schema_get_value (GSettin
G_GNUC_INTERNAL
gboolean g_settings_schema_has_key (GSettingsSchema *schema,
const gchar *key);
+G_GNUC_INTERNAL
+const GQuark * g_settings_schema_list (GSettingsSchema *schema,
+ gint *n_items);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]