[gnome-panel] libpanel-applet: Add panel_applet_settings_new() API
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] libpanel-applet: Add panel_applet_settings_new() API
- Date: Mon, 28 Mar 2011 21:16:06 +0000 (UTC)
commit 9d89bbc8a3cb37ded868dd642043535b68de9dd1
Author: Vincent Untz <vuntz gnome org>
Date: Sat Mar 26 07:11:14 2011 +0100
libpanel-applet: Add panel_applet_settings_new() API
This makes it convenient for applets to use per-instance configuration
in GSettings.
Note that for compatibility reasons, we keep all the gconf API too.
libpanel-applet/panel-applet.c | 23 +++++++++++++++++++++++
libpanel-applet/panel-applet.h | 3 +++
2 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/libpanel-applet/panel-applet.c b/libpanel-applet/panel-applet.c
index f656752..81052de 100644
--- a/libpanel-applet/panel-applet.c
+++ b/libpanel-applet/panel-applet.c
@@ -370,6 +370,29 @@ panel_applet_set_preferences_key (PanelApplet *applet,
g_object_notify (G_OBJECT (applet), "prefs-key");
}
+/**
+ * panel_applet_settings_new:
+ * @applet: a #PanelApplet.
+ * @schema: the name of the schema.
+ *
+ * Creates a new #GSettings object for the per-instance settings of @applet,
+ * with a given schema.
+ *
+ * Returns: a new #GSettings object for the per-instance settings of @applet.
+ **/
+GSettings *
+panel_applet_settings_new (PanelApplet *applet,
+ const char *schema)
+{
+ g_return_val_if_fail (PANEL_IS_APPLET (applet), NULL);
+ g_return_val_if_fail (schema != NULL, NULL);
+
+ if (!applet->priv->settings_path)
+ return NULL;
+
+ return g_settings_new_with_path (schema, applet->priv->settings_path);
+}
+
static void
panel_applet_set_settings_path (PanelApplet *applet,
const char *settings_path)
diff --git a/libpanel-applet/panel-applet.h b/libpanel-applet/panel-applet.h
index 715efec..a23e38b 100644
--- a/libpanel-applet/panel-applet.h
+++ b/libpanel-applet/panel-applet.h
@@ -139,6 +139,9 @@ cairo_pattern_t *panel_applet_get_background (PanelApplet *applet);
void panel_applet_set_background_widget (PanelApplet *applet,
GtkWidget *widget);
+GSettings *panel_applet_settings_new (PanelApplet *applet,
+ const char *schema);
+
gchar *panel_applet_get_preferences_key (PanelApplet *applet);
void panel_applet_add_preferences (PanelApplet *applet,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]