commit 2e0dad081b1b6c25b1b6a121b05380fe6fe13191
Author: Nathaniel McCallum <[email protected]>
Date: Thu Mar 25 12:43:26 2010 -0400
add itdb_photodb_photoalbum_unlink() method
src/itdb.h | 1 +
src/itdb_photoalbum.c | 24 +++++++++++++++++++++---
2 files changed, 22 insertions(+), 3 deletions(-)
---
diff --git a/src/itdb.h b/src/itdb.h
index 006860d..f21486d 100644
--- a/src/itdb.h
+++ b/src/itdb.h
@@ -1928,6 +1928,7 @@ void itdb_photodb_remove_photo (Itdb_PhotoDB *db,
void itdb_photodb_photoalbum_remove (Itdb_PhotoDB *db,
Itdb_PhotoAlbum *album,
gboolean remove_pics);
+void itdb_photodb_photoalbum_unlink (Itdb_PhotoAlbum *album);
Itdb_PhotoAlbum *itdb_photodb_photoalbum_by_name(Itdb_PhotoDB *db,
const gchar *albumname );
diff --git a/src/itdb_photoalbum.c b/src/itdb_photoalbum.c
index 6495939..a2c8c29 100644
--- a/src/itdb_photoalbum.c
+++ b/src/itdb_photoalbum.c
@@ -685,8 +685,9 @@ void itdb_photodb_photoalbum_remove (Itdb_PhotoDB *db,
Itdb_PhotoAlbum *album,
gboolean remove_pics)
{
- g_return_if_fail (db);
g_return_if_fail (album);
+ g_return_if_fail (album->photodb);
+ g_return_if_fail (db == NULL || album->photodb == db);
/* if remove_pics, iterate over the photos within that album
* and remove them from the database */
@@ -700,14 +701,31 @@ void itdb_photodb_photoalbum_remove (Itdb_PhotoDB *db,
while (album->members)
{
Itdb_Artwork *photo = album->members->data;
- itdb_photodb_remove_photo (db, NULL, photo);
+ itdb_photodb_remove_photo (album->photodb, NULL, photo);
}
}
- db->photoalbums = g_list_remove (db->photoalbums, album);
+ itdb_photodb_photoalbum_unlink (album);
itdb_photodb_photoalbum_free (album);
}
/**
+ * itdb_photodb_photoalbum_unlink:
+ * @album: an #Itdb_PhotoAlbum
+ *
+ * Removes @album from the #Itdb_PhotoDB it's associated with, but do not free
+ * memory.
+ * @album->photodb is set to NULL.
+ */
+void itdb_photodb_photoalbum_unlink (Itdb_PhotoAlbum *album)
+{
+ g_return_if_fail (album);
+ g_return_if_fail (album->photodb);
+
+ album->photodb->photoalbums = g_list_remove
(album->photodb->photoalbums, album);
+ album->photodb = NULL;
+}
+
+/**
* itdb_photodb_photoalbum_add_photo:
* @db: the #Itdb_PhotoDB to act on
* @album: the #Itdb_PhotoAlbum to add the photo to
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2