Add g_settings_schema_source_new_from_directory()

It is now possible for plugin loading systems to do the right thing.
This commit is contained in:
Ryan Lortie 2011-11-16 10:37:30 +00:00
parent 446eda8c2b
commit fee2c87ba1
3 changed files with 40 additions and 9 deletions

View File

@ -1103,6 +1103,7 @@ g_settings_schema_source_get_default
g_settings_schema_source_lookup g_settings_schema_source_lookup
g_settings_schema_source_ref g_settings_schema_source_ref
g_settings_schema_source_unref g_settings_schema_source_unref
g_settings_schema_source_new_from_directory
g_settings_schema_get_type g_settings_schema_get_type
g_settings_schema_ref g_settings_schema_ref
g_settings_schema_unref g_settings_schema_unref

View File

@ -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 static void
initialise_schema_sources (void) initialise_schema_sources (void)
{ {

View File

@ -30,20 +30,25 @@ typedef struct _GSettingsSchema GSettingsSchema;
GType g_settings_schema_source_get_type (void) G_GNUC_CONST; GType g_settings_schema_source_get_type (void) G_GNUC_CONST;
GSettingsSchemaSource * g_settings_schema_source_get_default (void); GSettingsSchemaSource * g_settings_schema_source_get_default (void);
GSettingsSchemaSource * g_settings_schema_source_ref (GSettingsSchemaSource *source); GSettingsSchemaSource * g_settings_schema_source_ref (GSettingsSchemaSource *source);
void g_settings_schema_source_unref (GSettingsSchemaSource *source); void g_settings_schema_source_unref (GSettingsSchemaSource *source);
GSettingsSchema * g_settings_schema_source_lookup (GSettingsSchemaSource *source, GSettingsSchemaSource * g_settings_schema_source_new_from_directory (GSettingsSchemaSource *parent,
const gchar *schema_id, const gchar *directory,
gboolean recursive); 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 ()) #define G_TYPE_SETTINGS_SCHEMA (g_settings_schema_get_type ())
GType g_settings_schema_get_type (void) G_GNUC_CONST; GType g_settings_schema_get_type (void) G_GNUC_CONST;
GSettingsSchema * g_settings_schema_ref (GSettingsSchema *schema); GSettingsSchema * g_settings_schema_ref (GSettingsSchema *schema);
void g_settings_schema_unref (GSettingsSchema *schema); void g_settings_schema_unref (GSettingsSchema *schema);
const gchar * g_settings_schema_get_id (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_path (GSettingsSchema *schema);
#endif /* __G_SETTINGS_SCHEMA_H__ */ #endif /* __G_SETTINGS_SCHEMA_H__ */