From: Ryan Lortie Date: Wed, 16 Nov 2011 10:37:30 +0000 (+0000) Subject: Add g_settings_schema_source_new_from_directory() X-Git-Tag: 2.31.2~55 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fee2c87ba133cf029cb4a285cbb4d057d0d73391;p=platform%2Fupstream%2Fglib.git Add g_settings_schema_source_new_from_directory() It is now possible for plugin loading systems to do the right thing. --- diff --git a/gio/gio.symbols b/gio/gio.symbols index ed9d87c..2a650ce 100644 --- a/gio/gio.symbols +++ b/gio/gio.symbols @@ -1103,6 +1103,7 @@ g_settings_schema_source_get_default g_settings_schema_source_lookup g_settings_schema_source_ref g_settings_schema_source_unref +g_settings_schema_source_new_from_directory g_settings_schema_get_type g_settings_schema_ref g_settings_schema_unref diff --git a/gio/gsettingsschema.c b/gio/gsettingsschema.c index 21f3307..17875e3 100644 --- a/gio/gsettingsschema.c +++ b/gio/gsettingsschema.c @@ -93,6 +93,31 @@ g_settings_schema_source_unref (GSettingsSchemaSource *source) } } +GSettingsSchemaSource * +g_settings_schema_source_new_from_directory (GSettingsSchemaSource *parent, + const gchar *directory, + gboolean trusted, + GError **error) +{ + GSettingsSchemaSource *source; + GvdbTable *table; + gchar *filename; + + filename = g_build_filename (directory, "gschemas.compiled", NULL); + table = gvdb_table_new (filename, TRUE, error); + g_free (filename); + + if (table == NULL) + return NULL; + + source = g_slice_new (GSettingsSchemaSource); + source->parent = parent ? g_settings_schema_source_ref (parent) : NULL; + source->table = table; + source->ref_count = 1; + + return source; +} + static void initialise_schema_sources (void) { diff --git a/gio/gsettingsschema.h b/gio/gsettingsschema.h index a9f3449..b3c2cd5 100644 --- a/gio/gsettingsschema.h +++ b/gio/gsettingsschema.h @@ -30,20 +30,25 @@ typedef struct _GSettingsSchema GSettingsSchema; GType g_settings_schema_source_get_type (void) G_GNUC_CONST; GSettingsSchemaSource * g_settings_schema_source_get_default (void); -GSettingsSchemaSource * g_settings_schema_source_ref (GSettingsSchemaSource *source); -void g_settings_schema_source_unref (GSettingsSchemaSource *source); +GSettingsSchemaSource * g_settings_schema_source_ref (GSettingsSchemaSource *source); +void g_settings_schema_source_unref (GSettingsSchemaSource *source); -GSettingsSchema * g_settings_schema_source_lookup (GSettingsSchemaSource *source, - const gchar *schema_id, - gboolean recursive); +GSettingsSchemaSource * g_settings_schema_source_new_from_directory (GSettingsSchemaSource *parent, + const gchar *directory, + gboolean trusted, + GError **error); + +GSettingsSchema * g_settings_schema_source_lookup (GSettingsSchemaSource *source, + const gchar *schema_id, + gboolean recursive); #define G_TYPE_SETTINGS_SCHEMA (g_settings_schema_get_type ()) GType g_settings_schema_get_type (void) G_GNUC_CONST; -GSettingsSchema * g_settings_schema_ref (GSettingsSchema *schema); -void g_settings_schema_unref (GSettingsSchema *schema); +GSettingsSchema * g_settings_schema_ref (GSettingsSchema *schema); +void g_settings_schema_unref (GSettingsSchema *schema); -const gchar * g_settings_schema_get_id (GSettingsSchema *schema); -const gchar * g_settings_schema_get_path (GSettingsSchema *schema); +const gchar * g_settings_schema_get_id (GSettingsSchema *schema); +const gchar * g_settings_schema_get_path (GSettingsSchema *schema); #endif /* __G_SETTINGS_SCHEMA_H__ */