[gnome-panel] panel: Fix check for unique id with dconf subdirs



commit 7454717e2f45e6b0ecd2d7db4f47c99dcf3e43b2
Author: Vincent Untz <vuntz gnome org>
Date:   Thu Mar 24 22:07:07 2011 +0100

    panel: Fix check for unique id with dconf subdirs
    
    We were keeping a trailing slash in the subdirs, so the checks were
    not working.

 gnome-panel/libpanel-util/panel-dconf.c |    9 ++++++++-
 gnome-panel/libpanel-util/panel-dconf.h |    3 ++-
 gnome-panel/panel-layout.c              |    2 +-
 3 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/gnome-panel/libpanel-util/panel-dconf.c b/gnome-panel/libpanel-util/panel-dconf.c
index a49b755..63a1c48 100644
--- a/gnome-panel/libpanel-util/panel-dconf.c
+++ b/gnome-panel/libpanel-util/panel-dconf.c
@@ -22,6 +22,8 @@
  *	Vincent Untz <vuntz gnome org>
  */
 
+#include <string.h>
+
 #include <dconf-client.h>
 #include <dconf-paths.h>
 
@@ -49,7 +51,8 @@ panel_dconf_recursive_reset (const gchar  *dir,
 }
 
 gchar **
-panel_dconf_list_subdirs (const gchar *dir)
+panel_dconf_list_subdirs (const gchar *dir,
+                          gboolean     remove_trailing_slash)
 {
         GArray       *array;
         gchar       **children;
@@ -66,6 +69,10 @@ panel_dconf_list_subdirs (const gchar *dir)
         for (i = 0; children[i] != NULL; i++) {
                 if (dconf_is_rel_dir (children[i], NULL)) {
                         char *val = g_strdup (children[i]);
+
+                        if (remove_trailing_slash)
+                                val[strlen (val) - 1] = '\0';
+
                         array = g_array_append_val (array, val);
                 }
         }
diff --git a/gnome-panel/libpanel-util/panel-dconf.h b/gnome-panel/libpanel-util/panel-dconf.h
index a826c52..0cf8b35 100644
--- a/gnome-panel/libpanel-util/panel-dconf.h
+++ b/gnome-panel/libpanel-util/panel-dconf.h
@@ -32,7 +32,8 @@ G_BEGIN_DECLS
 gboolean panel_dconf_recursive_reset (const gchar  *dir,
                                       GError     **error);
 
-gchar **panel_dconf_list_subdirs (const gchar *dir);
+gchar **panel_dconf_list_subdirs (const gchar *dir,
+                                  gboolean     remove_trailing_slash);
 
 G_END_DECLS
 
diff --git a/gnome-panel/panel-layout.c b/gnome-panel/panel-layout.c
index 93f83bc..0ecb0bb 100644
--- a/gnome-panel/panel-layout.c
+++ b/gnome-panel/panel-layout.c
@@ -186,7 +186,7 @@ panel_layout_find_free_id (const char *id_list_key,
 
         existing_ids = g_settings_get_strv (layout_settings,
                                             id_list_key);
-        existing_dirs = panel_dconf_list_subdirs (path_prefix);
+        existing_dirs = panel_dconf_list_subdirs (path_prefix, TRUE);
 
         index = 0;
         existing = TRUE;



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