[gnome-panel/wip/3.0-freeze-break] panel: Add some dconf helper API
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel/wip/3.0-freeze-break] panel: Add some dconf helper API
- Date: Fri, 25 Mar 2011 18:36:32 +0000 (UTC)
commit 3138ff798e59f83958a5f51befaa296ca8b9adae
Author: Vincent Untz <vuntz gnome org>
Date: Thu Mar 24 21:11:59 2011 +0100
panel: Add some dconf helper API
We'll need this later on.
configure.ac | 2 +-
gnome-panel/libpanel-util/Makefile.am | 2 +
gnome-panel/libpanel-util/panel-dconf.c | 76 +++++++++++++++++++++++++++++++
gnome-panel/libpanel-util/panel-dconf.h | 39 ++++++++++++++++
4 files changed, 118 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 6817677..4278259 100644
--- a/configure.ac
+++ b/configure.ac
@@ -81,7 +81,7 @@ dnl pkg-config dependency checks
PKG_CHECK_MODULES(EGG_SMCLIENT, ice sm gtk+-3.0)
-PKG_CHECK_MODULES(PANEL, gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED pango >= $PANGO_REQUIRED gtk+-3.0 >= $GTK_REQUIRED cairo-xlib glib-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GLIB_REQUIRED gio-unix-2.0 >= $GLIB_REQUIRED gnome-desktop-3.0 >= $LIBGNOME_DESKTOP_REQUIRED gconf-2.0 >= $GCONF_REQUIRED libgnome-menu >= $LIBGNOME_MENU_REQUIRED)
+PKG_CHECK_MODULES(PANEL, gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED pango >= $PANGO_REQUIRED gtk+-3.0 >= $GTK_REQUIRED cairo-xlib glib-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GLIB_REQUIRED gio-unix-2.0 >= $GLIB_REQUIRED gnome-desktop-3.0 >= $LIBGNOME_DESKTOP_REQUIRED gconf-2.0 >= $GCONF_REQUIRED libgnome-menu >= $LIBGNOME_MENU_REQUIRED dconf)
AC_SUBST(PANEL_CFLAGS)
AC_SUBST(PANEL_LIBS)
diff --git a/gnome-panel/libpanel-util/Makefile.am b/gnome-panel/libpanel-util/Makefile.am
index 8e9ab6e..8af97e0 100644
--- a/gnome-panel/libpanel-util/Makefile.am
+++ b/gnome-panel/libpanel-util/Makefile.am
@@ -13,6 +13,8 @@ AM_CFLAGS = $(WARN_CFLAGS)
libpanel_util_la_SOURCES = \
panel-cleanup.c \
panel-cleanup.h \
+ panel-dconf.c \
+ panel-dconf.h \
panel-error.c \
panel-error.h \
panel-glib.c \
diff --git a/gnome-panel/libpanel-util/panel-dconf.c b/gnome-panel/libpanel-util/panel-dconf.c
new file mode 100644
index 0000000..a49b755
--- /dev/null
+++ b/gnome-panel/libpanel-util/panel-dconf.c
@@ -0,0 +1,76 @@
+/*
+ * panel-dconf.c: helper API for dconf
+ *
+ * Copyright (C) 2011 Novell, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Authors:
+ * Vincent Untz <vuntz gnome org>
+ */
+
+#include <dconf-client.h>
+#include <dconf-paths.h>
+
+#include "panel-dconf.h"
+
+static DConfClient *
+panel_dconf_client_get (void)
+{
+ return dconf_client_new (NULL, NULL, NULL, NULL);
+}
+
+gboolean
+panel_dconf_recursive_reset (const gchar *dir,
+ GError **error)
+{
+ gboolean ret;
+ DConfClient *client = panel_dconf_client_get ();
+
+ ret = dconf_client_write (client, dir, NULL,
+ NULL, NULL, error);
+
+ g_object_unref (client);
+
+ return ret;
+}
+
+gchar **
+panel_dconf_list_subdirs (const gchar *dir)
+{
+ GArray *array;
+ gchar **children;
+ int len;
+ int i;
+ DConfClient *client = panel_dconf_client_get ();
+
+ array = g_array_new (TRUE, TRUE, sizeof (gchar *));
+
+ children = dconf_client_list (client, dir, &len);
+
+ g_object_unref (client);
+
+ for (i = 0; children[i] != NULL; i++) {
+ if (dconf_is_rel_dir (children[i], NULL)) {
+ char *val = g_strdup (children[i]);
+ array = g_array_append_val (array, val);
+ }
+ }
+
+ g_strfreev (children);
+
+ return (gchar **) g_array_free (array, FALSE);
+}
diff --git a/gnome-panel/libpanel-util/panel-dconf.h b/gnome-panel/libpanel-util/panel-dconf.h
new file mode 100644
index 0000000..a826c52
--- /dev/null
+++ b/gnome-panel/libpanel-util/panel-dconf.h
@@ -0,0 +1,39 @@
+/*
+ * panel-dconf.h: helper API for dconf
+ *
+ * Copyright (C) 2011 Novell, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Authors:
+ * Vincent Untz <vuntz gnome org>
+ */
+
+#ifndef __PANEL_DCONF_H__
+#define __PANEL_DCONF_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+gboolean panel_dconf_recursive_reset (const gchar *dir,
+ GError **error);
+
+gchar **panel_dconf_list_subdirs (const gchar *dir);
+
+G_END_DECLS
+
+#endif /* __PANEL_DCONF_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]