Update of /cvsroot/gtkpod/libgpod/src
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv14192/src

Modified Files:
        itdb.h itdb_device.c itdb_itunesdb.c 
Log Message:
2007-04-14  Christophe Fergeau  <[EMAIL PROTECTED]>

        * 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.

Index: itdb.h
===================================================================
RCS file: /cvsroot/gtkpod/libgpod/src/itdb.h,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- itdb.h      8 Apr 2007 12:58:28 -0000       1.62
+++ itdb.h      14 Apr 2007 11:16:29 -0000      1.63
@@ -964,6 +964,8 @@
                              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);
 

Index: itdb_device.c
===================================================================
RCS file: /cvsroot/gtkpod/libgpod/src/itdb_device.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- itdb_device.c       10 Jan 2007 13:25:10 -0000      1.15
+++ itdb_device.c       14 Apr 2007 11:16:29 -0000      1.16
@@ -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 @@
     }
     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);
+}

Index: itdb_itunesdb.c
===================================================================
RCS file: /cvsroot/gtkpod/libgpod/src/itdb_itunesdb.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -d -r1.84 -r1.85
--- itdb_itunesdb.c     25 Mar 2007 06:44:34 -0000      1.84
+++ itdb_itunesdb.c     14 Apr 2007 11:16:29 -0000      1.85
@@ -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 @@
        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);


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
gtkpod-cvs2 mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to