[gnome-panel/wip/3.0-freeze-break] panel: Add panel_layout_get_instance_settings() API



commit 8fdfb1775a5f7139329ed577d31908fa7b0a7f2b
Author: Vincent Untz <vuntz gnome org>
Date:   Fri Mar 25 22:28:00 2011 +0100

    panel: Add panel_layout_get_instance_settings() API
    
    This is needed so that objects can get their per-instance settings
    directory.

 gnome-panel/panel-layout.c |   21 +++++++++++++++++++++
 gnome-panel/panel-layout.h |    3 +++
 2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/gnome-panel/panel-layout.c b/gnome-panel/panel-layout.c
index ab686ee..ea9ce89 100644
--- a/gnome-panel/panel-layout.c
+++ b/gnome-panel/panel-layout.c
@@ -615,6 +615,27 @@ panel_layout_object_create (PanelObjectType   type,
         g_free (id);
 }
 
+GSettings *
+panel_layout_get_instance_settings (GSettings  *settings_object,
+                                    const char *schema)
+{
+        char      *path;
+        char      *path_instance;
+        GSettings *settings_instance;
+
+        g_return_val_if_fail (G_IS_SETTINGS (settings_object), NULL);
+
+        g_object_get (settings_object, "path", &path, NULL);
+        path_instance = g_strdup_printf ("%s%s", path,
+                                         PANEL_LAYOUT_OBJECT_CONFIG_SUFFIX);
+        g_free (path);
+
+        settings_instance = g_settings_new_with_path (schema, path_instance);
+        g_free (path_instance);
+
+        return settings_instance;
+}
+
 char *
 panel_layout_object_create_start (PanelObjectType   type,
                                   const char       *type_detail,
diff --git a/gnome-panel/panel-layout.h b/gnome-panel/panel-layout.h
index 73aaf03..29c3eb8 100644
--- a/gnome-panel/panel-layout.h
+++ b/gnome-panel/panel-layout.h
@@ -43,6 +43,9 @@ void  panel_layout_object_create        (PanelObjectType   type,
 					 int               position,
 					 gboolean          pack_end);
 
+GSettings *panel_layout_get_instance_settings (GSettings  *settings_object,
+                                               const char *schema);
+
 char *panel_layout_object_create_start  (PanelObjectType   type,
 					 const char       *type_detail,
 					 const char       *toplevel_id,



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