[gnome-control-center] background: Add function to copy a background item



commit 85b2cad706dcc5145622dff5e44cef348ce1c39d
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Feb 11 12:48:28 2011 +0000

    background: Add function to copy a background item

 panels/background/cc-background-item.c |   21 +++++++++++++++++++++
 panels/background/cc-background-item.h |    1 +
 2 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/panels/background/cc-background-item.c b/panels/background/cc-background-item.c
index 14d5a4b..fbf857c 100644
--- a/panels/background/cc-background-item.c
+++ b/panels/background/cc-background-item.c
@@ -754,6 +754,27 @@ cc_background_item_new (const char *filename)
         return CC_BACKGROUND_ITEM (object);
 }
 
+CcBackgroundItem *
+cc_background_item_copy (CcBackgroundItem *item)
+{
+	CcBackgroundItem *ret;
+
+	ret = cc_background_item_new (item->priv->filename);
+	ret->priv->name = g_strdup (item->priv->name);
+	ret->priv->filename = g_strdup (item->priv->filename);
+	ret->priv->size = g_strdup (item->priv->size);
+	ret->priv->placement = item->priv->placement;
+	ret->priv->shading = item->priv->shading;
+	ret->priv->primary_color = g_strdup (item->priv->primary_color);
+	ret->priv->secondary_color = g_strdup (item->priv->secondary_color);
+	ret->priv->source_url = g_strdup (item->priv->source_url);
+	ret->priv->source_xml = g_strdup (item->priv->source_xml);
+	ret->priv->is_deleted = item->priv->is_deleted;
+	ret->priv->flags = item->priv->flags;
+
+	return ret;
+}
+
 static const char *
 flags_to_str (CcBackgroundItemFlags flag)
 {
diff --git a/panels/background/cc-background-item.h b/panels/background/cc-background-item.h
index 31515e6..55b1c29 100644
--- a/panels/background/cc-background-item.h
+++ b/panels/background/cc-background-item.h
@@ -67,6 +67,7 @@ typedef struct
 GType              cc_background_item_get_type (void);
 
 CcBackgroundItem * cc_background_item_new                 (const char                   *filename);
+CcBackgroundItem * cc_background_item_copy                (CcBackgroundItem             *item);
 gboolean           cc_background_item_load                (CcBackgroundItem             *item,
 							   GFileInfo                    *info);
 gboolean           cc_background_item_changes_with_time   (CcBackgroundItem             *item);



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