[glib] Add g_settings_schema_exists
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Add g_settings_schema_exists
- Date: Thu, 24 Jun 2010 06:17:20 +0000 (UTC)
commit 6218d8047a9f073dc9e6eab009d70dc7933c5fd7
Author: Ryan Lortie <desrt desrt ca>
Date: Thu Jun 24 01:49:27 2010 -0400
Add g_settings_schema_exists
Solves half of #622554.
gio/gio.symbols | 4 ++++
gio/gsettings.h | 1 +
gio/gsettingsschema.c | 25 +++++++++++++++++++++++++
3 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/gio/gio.symbols b/gio/gio.symbols
index f93b779..46af246 100644
--- a/gio/gio.symbols
+++ b/gio/gio.symbols
@@ -1441,6 +1441,10 @@ g_keyfile_settings_backend_new
#endif
#if IN_HEADER(__G_SETTINGS_H__)
+#if IN_FILE(__G_SETTINGS_SCHEMA_C__)
+g_settings_schema_exists
+#endif
+
#if IN_FILE(__G_SETTINGS_C__)
g_settings_apply
g_settings_bind
diff --git a/gio/gsettings.h b/gio/gsettings.h
index f98ecc6..9815364 100644
--- a/gio/gsettings.h
+++ b/gio/gsettings.h
@@ -70,6 +70,7 @@ struct _GSettings
GType g_settings_get_type (void);
+gboolean g_settings_schema_exists (const gchar *schema_name);
GSettings * g_settings_new (const gchar *schema);
GSettings * g_settings_new_with_path (const gchar *schema,
const gchar *path);
diff --git a/gio/gsettingsschema.c b/gio/gsettingsschema.c
index 275e427..67d1164 100644
--- a/gio/gsettingsschema.c
+++ b/gio/gsettingsschema.c
@@ -237,3 +237,28 @@ g_settings_schema_list (GSettingsSchema *schema,
*n_items = schema->priv->n_items;
return schema->priv->items;
}
+
+/**
+ * g_settings_schema_exists:
+ * @schema_name: the schema name to query for
+ * Returns: %TRUE if @schema_name exists
+ *
+ * Checks if the named schema is installed.
+ **/
+gboolean
+g_settings_schema_exists (const gchar *schema_name)
+{
+ GSList *source;
+
+ initialise_schema_sources ();
+
+ for (source = schema_sources; source; source = source->next)
+ {
+ GvdbTable *file = source->data;
+
+ if (gvdb_table_get_table (file, schema_name))
+ return TRUE;
+ }
+
+ return FALSE;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]