[glib] Filter out child schema entries when listing keys



commit d20969e07b8cc0233536cf929db0107b2c21c53e
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jun 27 16:31:53 2010 -0400

    Filter out child schema entries when listing keys

 gio/gsettings-tool.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/gio/gsettings-tool.c b/gio/gsettings-tool.c
index 0e7b2ab..8e38c84 100644
--- a/gio/gsettings-tool.c
+++ b/gio/gsettings-tool.c
@@ -164,7 +164,8 @@ key_exists (GSettings   *settings,
 
   keys = g_settings_list_keys (settings);
   for (i = 0; keys[i]; i++)
-    if (g_strcmp0 (keys[i], name) == 0)
+    if (!g_str_has_suffix (keys[i], "/") &&
+        g_strcmp0 (keys[i], name) == 0)
       {
         ret = TRUE;
         break;
@@ -183,8 +184,11 @@ list_keys (GSettings   *settings,
 
   keys = g_settings_list_keys (settings);
   for (i = 0; keys[i]; i++)
-    if (prefix == NULL || g_str_has_prefix (keys[i], prefix))
-      g_print ("%s \n", keys[i]);
+    {
+      if (!g_str_has_suffix (keys[i], "/") &&
+          (prefix == NULL || g_str_has_prefix (keys[i], prefix)))
+        g_print ("%s \n", keys[i]);
+    }
   g_free (keys);
 }
 



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