2
* panel-dconf.c: helper API for dconf
4
* Copyright (C) 2011 Novell, Inc.
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License as
8
* published by the Free Software Foundation; either version 2 of the
9
* License, or (at your option) any later version.
11
* This program is distributed in the hope that it will be useful, but
12
* WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22
* Vincent Untz <vuntz@gnome.org>
27
#include <dconf-client.h>
28
#include <dconf-paths.h>
30
#include "panel-dconf.h"
33
panel_dconf_client_get (void)
35
return dconf_client_new (NULL, NULL, NULL, NULL);
39
panel_dconf_recursive_reset (const gchar *dir,
43
DConfClient *client = panel_dconf_client_get ();
45
ret = dconf_client_write (client, dir, NULL,
48
g_object_unref (client);
54
panel_dconf_list_subdirs (const gchar *dir,
55
gboolean remove_trailing_slash)
61
DConfClient *client = panel_dconf_client_get ();
63
array = g_array_new (TRUE, TRUE, sizeof (gchar *));
65
children = dconf_client_list (client, dir, &len);
67
g_object_unref (client);
69
for (i = 0; children[i] != NULL; i++) {
70
if (dconf_is_rel_dir (children[i], NULL)) {
71
char *val = g_strdup (children[i]);
73
if (remove_trailing_slash)
74
val[strlen (val) - 1] = '\0';
76
array = g_array_append_val (array, val);
80
g_strfreev (children);
82
return (gchar **) g_array_free (array, FALSE);