background: Add function to copy a background item

This commit is contained in:
Bastien Nocera 2011-02-11 12:48:28 +00:00
parent 9b55bb20e3
commit 85b2cad706
2 changed files with 22 additions and 0 deletions

View file

@ -754,6 +754,27 @@ cc_background_item_new (const char *filename)
return CC_BACKGROUND_ITEM (object); 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 * static const char *
flags_to_str (CcBackgroundItemFlags flag) flags_to_str (CcBackgroundItemFlags flag)
{ {

View file

@ -67,6 +67,7 @@ typedef struct
GType cc_background_item_get_type (void); GType cc_background_item_get_type (void);
CcBackgroundItem * cc_background_item_new (const char *filename); CcBackgroundItem * cc_background_item_new (const char *filename);
CcBackgroundItem * cc_background_item_copy (CcBackgroundItem *item);
gboolean cc_background_item_load (CcBackgroundItem *item, gboolean cc_background_item_load (CcBackgroundItem *item,
GFileInfo *info); GFileInfo *info);
gboolean cc_background_item_changes_with_time (CcBackgroundItem *item); gboolean cc_background_item_changes_with_time (CcBackgroundItem *item);