summaryrefslogtreecommitdiffstats
path: root/tests/test-photos.c
diff options
context:
space:
mode:
authorChristophe Fergeau <teuf@gnome.org>2008-05-30 12:00:21 +0000
committerChristophe Fergeau <teuf@gnome.org>2008-05-30 12:00:21 +0000
commit37e1533b203557602942eea32cc9f2397004023c (patch)
tree15322f7006e27473d2c0c69b2d891f26c66cde67 /tests/test-photos.c
parent747eda0937e4bf51a586183d99a326b75ebf6a78 (diff)
downloadlibgpod-tmz-37e1533b203557602942eea32cc9f2397004023c.tar.gz
libgpod-tmz-37e1533b203557602942eea32cc9f2397004023c.tar.xz
libgpod-tmz-37e1533b203557602942eea32cc9f2397004023c.zip
* src/Makefile.am:
* src/db-artwork-parser.c: * src/db-artwork-writer.c: * src/db-image-parser.c: * src/db-image-parser.h: * src/itdb.h: * src/itdb_artwork.c: * src/itdb_device.h: * src/itdb_photoalbum.c: * src/itdb_track.c: * src/ithumb-writer.c: * tests/test-covers.c: * tests/test-photos.c: rework Itdb_Thumb type. Now it's split into different subtypes depending on what it represents (GdkPixbuf, thumbnail read from the ipod, ...). Itdb_Artwork now contains only a pointer to a single Itdb_Thumb (it used to contain a GList * of Itdb_Thumb) since the only time when the list is useful is for thumbs read from the ipod. Using a list for the other types of thumbnails created some complications when trying to set art on an Itdb_Track that wasn't attached to an Itdb_iTunesDB. git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1991 f01d2545-417e-4e96-918e-98f8d0dbbcb6
Diffstat (limited to 'tests/test-photos.c')
-rw-r--r--tests/test-photos.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/tests/test-photos.c b/tests/test-photos.c
index af98b1c..02ecaa3 100644
--- a/tests/test-photos.c
+++ b/tests/test-photos.c
@@ -31,6 +31,8 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib/gi18n-lib.h>
+#include "itdb_thumb.h"
+
static void usage (int argc, char **argv)
{
/* gchar *name = argv[0];*/
@@ -60,40 +62,33 @@ static Itdb_Artwork *get_photo_by_id (Itdb_PhotoDB *db, guint32 id)
}
static void
-save_itdb_thumb (Itdb_PhotoDB *itdb, Itdb_Thumb *thumb,
- const gchar *filename)
-{
- GdkPixbuf *pixbuf;
-
- pixbuf = itdb_thumb_get_gdk_pixbuf (itdb->device, thumb);
-
- if (pixbuf != NULL) {
- gdk_pixbuf_save (pixbuf, filename, "png", NULL, NULL);
- gdk_pixbuf_unref (pixbuf);
- }
-}
-
-static void
dump_thumbs (Itdb_PhotoDB *db, Itdb_Artwork *artwork,
const gchar *album_name, const gchar *dir)
{
GList *it;
gint i = 0;
+ GList *thumbnails;
+ Itdb_Thumb_Ipod *thumb;
- for (it = artwork->thumbnails; it != NULL; it = it->next, i++) {
- Itdb_Thumb *thumb;
+ thumb = (Itdb_Thumb_Ipod *)artwork->thumbnail;
+ thumbnails = itdb_thumb_ipod_to_pixbufs (db->device, thumb);
+ for (it = thumbnails; it != NULL; it = it->next, i++) {
gchar *filename, *path;
+ GdkPixbuf *pixbuf;
- thumb = (Itdb_Thumb *)it->data;
- g_return_if_fail (thumb);
+ pixbuf = GDK_PIXBUF (it->data);
+
+ g_return_if_fail (pixbuf);
filename = g_strdup_printf ("%s-%d-%d.png",
album_name, artwork->id, i );
path = g_build_filename (dir, filename, NULL);
g_free (filename);
- save_itdb_thumb (db, thumb, path);
+ gdk_pixbuf_save (pixbuf, path, "png", NULL, NULL);
+ gdk_pixbuf_unref (pixbuf);
g_free (path);
}
+ g_list_free (thumbnails);
}
static void