[gnome-settings-daemon] keyboard: Stop using deprecated GSettings API



commit 4ef177bc80ba530c97a9cccebc9fb665a3f5d139
Author: Rui Matos <tiagomatos gmail com>
Date:   Mon May 26 17:33:12 2014 +0200

    keyboard: Stop using deprecated GSettings API

 plugins/keyboard/gsd-keyboard-manager.c |   30 +++++++++++++++++++++++-------
 1 files changed, 23 insertions(+), 7 deletions(-)
---
diff --git a/plugins/keyboard/gsd-keyboard-manager.c b/plugins/keyboard/gsd-keyboard-manager.c
index 0e566d7..d52412d 100644
--- a/plugins/keyboard/gsd-keyboard-manager.c
+++ b/plugins/keyboard/gsd-keyboard-manager.c
@@ -168,19 +168,35 @@ init_builder_with_sources (GVariantBuilder *builder,
 }
 
 static gboolean
-schema_is_installed (const gchar *name)
+contained (char       **items,
+           const char  *item)
 {
-        const gchar * const *schemas;
-        const gchar * const *s;
-
-        schemas = g_settings_list_schemas ();
-        for (s = schemas; *s; ++s)
-                if (g_str_equal (*s, name))
+        while (*items) {
+                if (g_strcmp0 (*items++, item) == 0) {
                         return TRUE;
+                }
+        }
 
         return FALSE;
 }
 
+static gboolean
+schema_is_installed (const char *schema)
+{
+        GSettingsSchemaSource *source = NULL;
+        gchar **non_relocatable = NULL;
+        gchar **relocatable = NULL;
+
+        source = g_settings_schema_source_get_default ();
+        if (!source)
+                return FALSE;
+
+        g_settings_schema_source_list_schemas (source, TRUE, &non_relocatable, &relocatable);
+
+        return (contained (non_relocatable, schema) ||
+                contained (relocatable, schema));
+}
+
 #ifdef HAVE_IBUS
 static void
 clear_ibus (GsdKeyboardManager *manager)


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