From 3f2830dc026ba5211504261513a74855ccbb098f Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Mon, 9 Jun 2008 19:53:36 +0000 Subject: * src/db-artwork-parser.c: remove duplicated artwork/photo support testing functions * src/db-artwork-parser.h: ditto * src/itdb_itunesdb.c: s/ipod_supports_XXX/itdb_device_supports_XXX * src/itdb_photoalbum.c: ditto * src/itdb.h: use a const Itdb_Device argument for itdb_device_supports_*, add ITDB_IPOD_GENERATION_IPHONE_1 to Itdb_IpodGeneration, get rid of ITDB_IPOD_GENERATION_FIFTH and ITDB_IPOD_GENERATION_SIXTH * src/itdb_device.c: split functions to get artwork format from the ipod in 2 separate functions: instead of itdb_device_get_artwork_formats we now have itdb_device_get_photo_formats and itdb_device_get_cover_art_formats * src/itdb_device.h: * src/db-image-parser.c: use the separate get_cover_art_formats/get_photos_formats functions * src/db-artwork-writer.c: ditto * src/ithumb-writer.c: ditto git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@2009 f01d2545-417e-4e96-918e-98f8d0dbbcb6 --- src/ithumb-writer.c | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'src/ithumb-writer.c') diff --git a/src/ithumb-writer.c b/src/ithumb-writer.c index a5629c3..83c9bff 100644 --- a/src/ithumb-writer.c +++ b/src/ithumb-writer.c @@ -1395,9 +1395,9 @@ itdb_write_ithumb_files (Itdb_DB *db) { #ifdef HAVE_GDKPIXBUF GList *writers; - GList *it; Itdb_Device *device; - const Itdb_ArtworkFormat *format; + GList *formats; + GList *it; const gchar *mount_point; g_return_val_if_fail (db, -1); @@ -1410,26 +1410,27 @@ itdb_write_ithumb_files (Itdb_DB *db) if (mount_point == NULL) return -1; - format = itdb_device_get_artwork_formats (device); - if (format == NULL) { - return -1; - } + formats = NULL; + switch (db->db_type) { + case DB_TYPE_ITUNES: + formats = itdb_device_get_cover_art_formats(db_get_device(db)); + break; + case DB_TYPE_PHOTO: + formats = itdb_device_get_photo_formats(db_get_device(db)); + break; + } writers = NULL; - while (format->type != -1) { + for (it = formats; it != NULL; it = it->next) { iThumbWriter *writer; - - if (itdb_thumb_type_is_valid_for_db (format, db->db_type)) - { - ithmb_rearrange_existing_thumbnails (db, format ); - writer = ithumb_writer_new (mount_point, - format, - db->db_type, - device->byte_order); - if (writer != NULL) { - writers = g_list_prepend (writers, writer); - } + const Itdb_ArtworkFormat *format; + + format = (const Itdb_ArtworkFormat *)it->data; + ithmb_rearrange_existing_thumbnails (db, format); + writer = ithumb_writer_new (mount_point, format, + db->db_type, device->byte_order); + if (writer != NULL) { + writers = g_list_prepend (writers, writer); } - format++; } if (writers == NULL) { return -1; -- cgit