summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/itdb.h2
-rw-r--r--src/itdb_device.c55
-rw-r--r--src/itdb_itunesdb.c5
3 files changed, 59 insertions, 3 deletions
diff --git a/src/itdb.h b/src/itdb.h
index ed9a89e..6ef8a7f 100644
--- a/src/itdb.h
+++ b/src/itdb.h
@@ -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);