commit 2e9b093c6547df1efbbdcfe0c730a2d48df9b808 Author: Christophe Fergeau <cferg...@mandriva.com> Date: Thu Mar 25 15:24:51 2010 +0100
rework photo API to make it more binding friendly src/itdb.h | 2 ++ src/itdb_photoalbum.c | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 0 deletions(-) --- diff --git a/src/itdb.h b/src/itdb.h index a284791..2ee3c3e 100644 --- a/src/itdb.h +++ b/src/itdb.h @@ -1917,6 +1917,8 @@ Itdb_PhotoAlbum *itdb_photodb_photoalbum_create (Itdb_PhotoDB *db, const gchar *albumname, gint pos); Itdb_PhotoDB *itdb_photodb_create (const gchar *mountpoint); +Itdb_PhotoAlbum *itdb_photodb_photoalbum_new (const gchar *albumname); +void itdb_photodb_photoalbum_add (Itdb_PhotoDB *db, Itdb_PhotoAlbum *album, gint pos); void itdb_photodb_free (Itdb_PhotoDB *photodb); gboolean itdb_photodb_write (Itdb_PhotoDB *photodb, GError **error); void itdb_photodb_remove_photo (Itdb_PhotoDB *db, diff --git a/src/itdb_photoalbum.c b/src/itdb_photoalbum.c index 84febf7..b2ab641 100644 --- a/src/itdb_photoalbum.c +++ b/src/itdb_photoalbum.c @@ -764,6 +764,44 @@ Itdb_PhotoAlbum *itdb_photodb_photoalbum_create (Itdb_PhotoDB *db, } /** + * itdb_photodb_photoalbum_new: + * @albumname: name of the new album + * + * Creates an empty #Itdb_PhotoAlbum named @albumname + * + * Returns: the new #Itdb_PhotoAlbum, free it with + * itdb_photodb_photoalbum_free () when no longer needed + */ +Itdb_PhotoAlbum *itdb_photodb_photoalbum_new (const gchar *albumname) +{ + Itdb_PhotoAlbum *album; + + g_return_val_if_fail (albumname, NULL); + + album = g_new0 (Itdb_PhotoAlbum, 1); + album->album_type = 2; /* normal album, set to 1 for Photo Library */ + album->name = g_strdup(albumname); + + return album; +} + +/** + * itdb_photodb_photoalbum_add: + * @db: an #Itdb_PhotoDB + * @album: an #Itdb_PhotoAlbum + * @pos: position of the album to add + * + * Adds @album to @db->photoalbums at position @pos (or at the end if pos + * is -1).The @ib gets ownership of the @album and will take care of + * freeing the memory it uses when it's no longer necessary. + */ +void itdb_photodb_photoalbum_add (Itdb_PhotoDB *db, Itdb_PhotoAlbum *album, gint pos) +{ + album->photodb = db; + db->photoalbums = g_list_insert (db->photoalbums, album, pos); +} + +/** * itdb_photodb_write: * @photodb: the #Itdb_PhotoDB to write to disk * @error: return location for a #GError or NULL ------------------------------------------------------------------------------ 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 gtkpod-cvs2@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2