[gedit] Use lookup instead of iteration to find schema
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Use lookup instead of iteration to find schema
- Date: Mon, 13 Jan 2014 20:54:34 +0000 (UTC)
commit a9c63941ffaae50b856cfacfbd4d613767622224
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Mon Jan 13 21:52:56 2014 +0100
Use lookup instead of iteration to find schema
plugins/filebrowser/gedit-file-browser-plugin.c | 21 ++++++++-------------
1 files changed, 8 insertions(+), 13 deletions(-)
---
diff --git a/plugins/filebrowser/gedit-file-browser-plugin.c b/plugins/filebrowser/gedit-file-browser-plugin.c
index 28981f5..72e1fa6 100644
--- a/plugins/filebrowser/gedit-file-browser-plugin.c
+++ b/plugins/filebrowser/gedit-file-browser-plugin.c
@@ -129,25 +129,20 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED (GeditFileBrowserPlugin,
)
static GSettings *
-settings_try_new (const gchar *schema)
+settings_try_new (const gchar *schema_id)
{
- const gchar * const * schemas;
GSettings *settings = NULL;
+ GSettingsSchemaSource *source;
+ GSettingsSchema *schema;
- schemas = g_settings_list_schemas ();
+ source = g_settings_schema_source_get_default ();
- if (schemas == NULL)
- {
- return NULL;
- }
+ schema = g_settings_schema_source_lookup (source, schema_id, TRUE);
- for (; *schemas != NULL; schemas++)
+ if (schema != NULL)
{
- if (g_strcmp0 (*schemas, schema) == 0)
- {
- settings = g_settings_new (schema);
- break;
- }
+ settings = g_settings_new_full (schema, NULL, NULL);
+ g_object_unref (schema);
}
return settings;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]