diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | docs/reference/tmpl/device.sgml | 18 | ||||
-rw-r--r-- | src/itdb.h | 2 | ||||
-rw-r--r-- | src/itdb_device.c | 55 | ||||
-rw-r--r-- | src/itdb_itunesdb.c | 5 |
5 files changed, 85 insertions, 3 deletions
@@ -1,3 +1,11 @@ +2007-04-14 Christophe Fergeau <teuf@gnome.org> + + * src/itdb_device.c: add itdb_device_supports_artwork and + idb_device_supports_photo functions + * docs/reference/tmpl/device.sgml: update api doc + * src/itdb_itunesdb.c: don't try to write artwork database if the iPod + model doesn't support artwork. + 2007-04-08 Jorg Schuler <jcsjcs at users.sourceforge.net> * src/itdb.h: changed 'gchar *chapterdata' to 'gpointer diff --git a/docs/reference/tmpl/device.sgml b/docs/reference/tmpl/device.sgml index d90303e..6ca9191 100644 --- a/docs/reference/tmpl/device.sgml +++ b/docs/reference/tmpl/device.sgml @@ -101,6 +101,24 @@ These functions are for reading and setting information about the iPod. @Returns: +<!-- ##### FUNCTION itdb_device_supports_artwork ##### --> +<para> + +</para> + +@device: +@Returns: + + +<!-- ##### FUNCTION itdb_device_supports_photo ##### --> +<para> + +</para> + +@device: +@Returns: + + <!-- ##### FUNCTION itdb_info_get_ipod_info_table ##### --> <para> @@ -964,6 +964,8 @@ void itdb_device_set_sysinfo (Itdb_Device *device, const gchar *field, const gchar *value); const Itdb_IpodInfo *itdb_device_get_ipod_info (Itdb_Device *device); const Itdb_IpodInfo *itdb_info_get_ipod_info_table (void); +gboolean itdb_device_supports_artwork (Itdb_Device *device); +gboolean itdb_device_supports_photo (Itdb_Device *device); const gchar *itdb_info_get_ipod_model_name_string (Itdb_IpodModel model); const gchar *itdb_info_get_ipod_generation_string (Itdb_IpodGeneration generation); diff --git a/src/itdb_device.c b/src/itdb_device.c index a66a2bc..35836fb 100644 --- a/src/itdb_device.c +++ b/src/itdb_device.c @@ -1,4 +1,4 @@ -/* Time-stamp: <2006-11-12 23:07:06 jcs> +/* Time-stamp: <27-mar-2007 10:09:48 teuf> | | Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net> | Part of the gtkpod project. @@ -781,3 +781,56 @@ const gchar *itdb_info_get_ipod_generation_string (Itdb_IpodGeneration generatio } return NULL; } + + +/** + * itdb_device_supports_artwork: + * @device: an #Itdb_Device + * + * Indicates whether @device can display artwork or not. When dealing + * with a non-art capable ipod, no artwork data will be written to the + * iPod so you can spare calls to the artwork handling methods. + * + * Return value: true if @device can display artwork. + */ + +gboolean itdb_device_supports_artwork (Itdb_Device *device) +{ + if (device == NULL) { + return FALSE; + } + + return (itdb_device_get_artwork_formats (device) != NULL); +} + + +/** + * itdb_device_supports_photo: + * @device: an #Itdb_Device + * + * Indicates whether @device can display photos or not. + * + * Return value: true if @device can display photos. + */ + +gboolean itdb_device_supports_photo (Itdb_Device *device) +{ + const Itdb_ArtworkFormat *formats; + const Itdb_ArtworkFormat *it; + + if (device == NULL) { + return FALSE; + } + + formats = itdb_device_get_artwork_formats (device); + if (formats == NULL) { + return FALSE; + } + + it = formats; + while ((it->type != -1) && (it->type != ITDB_THUMB_PHOTO_FULL_SCREEN)) { + it++; + } + + return (it->type != -1); +} diff --git a/src/itdb_itunesdb.c b/src/itdb_itunesdb.c index 61a3e56..c2f9bcd 100644 --- a/src/itdb_itunesdb.c +++ b/src/itdb_itunesdb.c @@ -1,4 +1,4 @@ -/* Time-stamp: <2007-03-25 15:35:00 jcs> +/* Time-stamp: <27-mar-2007 10:06:21 teuf> | | Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net> | Part of the gtkpod project. @@ -4615,8 +4615,9 @@ gboolean itdb_write_file (Itdb_iTunesDB *itdb, const gchar *filename, FIXME: figure out a way to store the artwork data when storing to local directories. At the moment it's the application's task to handle this. */ - if (itdb->device && itdb_device_get_artwork_formats(itdb->device)) + if (itdb_device_supports_artwork (itdb->device)) { ipod_write_artwork_db (itdb); + } #endif fexp = g_new0 (FExport, 1); |