[gnome-session] shell-extensions: stop using g_settings_list_schemas()



commit b6563e7886709dc972b60552038502fb197eab7c
Author: Ray Strode <rstrode redhat com>
Date:   Wed Dec 11 01:29:23 2013 -0500

    shell-extensions: stop using g_settings_list_schemas()
    
    This commit drops another use of g_settings_list_schemas
    
    https://bugzilla.gnome.org/show_bug.cgi?id=720232

 gnome-session/gsm-shell-extensions.c |   20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)
---
diff --git a/gnome-session/gsm-shell-extensions.c b/gnome-session/gsm-shell-extensions.c
index acc0eae..e42cdb2 100644
--- a/gnome-session/gsm-shell-extensions.c
+++ b/gnome-session/gsm-shell-extensions.c
@@ -165,22 +165,18 @@ gsm_shell_extensions_scan (GsmShellExtensions *self)
 static void
 gsm_shell_extensions_init (GsmShellExtensions *self)
 {
-  const gchar * const * schemas;
+  GSettingsSchemaSource *source;
+  GSettingsSchema *schema;
 
   self->priv = SHELL_EXTENSIONS_PRIVATE (self);
 
-  /* Unfortunately, gsettings does not have a way to test
-   * for the existance of a schema, so hack around it. */
-  schemas = g_settings_list_schemas ();
-  while (schemas != NULL)
-    {
-      if (g_str_equal (*schemas, SHELL_SCHEMA))
-        {
-          self->priv->settings = g_settings_new (SHELL_SCHEMA);
-          break;
-        }
+  source = g_settings_schema_source_get_default ();
+  schema = g_settings_schema_source_lookup (source, SHELL_SCHEMA, TRUE);
 
-      schemas ++;
+  if (schema != NULL)
+    {
+      self->priv->settings = g_settings_new_full (schema, NULL, NULL);
+      g_settings_schema_unref (schema);
     }
 
   if (self->priv->settings != NULL)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]