commit 6b676bdf72725b4a86c76298d729bb28ff01ebb0
Author: Christophe Fergeau <[email protected]>
Date:   Wed Oct 21 09:05:04 2009 +0200

    add itdb_device_is_iphone_family function

 src/itdb_device.c                  |   45 ++++++++++++++++++++++++++++++++++++
 src/itdb_device.h                  |    1 +
 src/itdb_sysinfo_extended_parser.c |    6 ++++
 src/itdb_sysinfo_extended_parser.h |    2 +
 4 files changed, 54 insertions(+), 0 deletions(-)
---
diff --git a/src/itdb_device.c b/src/itdb_device.c
index 4a13672..fd924a1 100644
--- a/src/itdb_device.c
+++ b/src/itdb_device.c
@@ -2031,3 +2031,48 @@ gchar *itdb_device_get_uuid(const Itdb_Device *device)
 {
     return g_hash_table_lookup (device->sysinfo, "FirewireGuid");
 }
+
+gboolean itdb_device_is_iphone_family (const Itdb_Device *device)
+{
+    if (device->sysinfo_extended != NULL) {
+       return (itdb_sysinfo_properties_get_family_id 
(device->sysinfo_extended) >= 10000);
+    } else {
+       const Itdb_IpodInfo *info;
+
+       info = itdb_device_get_ipod_info (device);
+       switch (info->ipod_generation) {
+           case ITDB_IPOD_GENERATION_UNKNOWN:
+           case ITDB_IPOD_GENERATION_FIRST:
+           case ITDB_IPOD_GENERATION_SECOND:
+           case ITDB_IPOD_GENERATION_THIRD:
+           case ITDB_IPOD_GENERATION_MOBILE:
+           case ITDB_IPOD_GENERATION_FOURTH:
+           case ITDB_IPOD_GENERATION_PHOTO:
+           case ITDB_IPOD_GENERATION_MINI_1:
+           case ITDB_IPOD_GENERATION_MINI_2:
+           case ITDB_IPOD_GENERATION_NANO_1:
+           case ITDB_IPOD_GENERATION_NANO_2:
+           case ITDB_IPOD_GENERATION_NANO_3:
+           case ITDB_IPOD_GENERATION_NANO_4:
+           case ITDB_IPOD_GENERATION_NANO_5:
+           case ITDB_IPOD_GENERATION_SHUFFLE_1:
+           case ITDB_IPOD_GENERATION_SHUFFLE_2:
+           case ITDB_IPOD_GENERATION_SHUFFLE_3:
+           case ITDB_IPOD_GENERATION_SHUFFLE_4:
+           case ITDB_IPOD_GENERATION_VIDEO_1:
+           case ITDB_IPOD_GENERATION_VIDEO_2:
+           case ITDB_IPOD_GENERATION_CLASSIC_1:
+           case ITDB_IPOD_GENERATION_CLASSIC_2:
+           case ITDB_IPOD_GENERATION_CLASSIC_3:
+               return FALSE;
+           case ITDB_IPOD_GENERATION_TOUCH_1:
+           case ITDB_IPOD_GENERATION_TOUCH_2:
+           case ITDB_IPOD_GENERATION_TOUCH_3:
+           case ITDB_IPOD_GENERATION_IPHONE_1:
+           case ITDB_IPOD_GENERATION_IPHONE_2:
+           case ITDB_IPOD_GENERATION_IPHONE_3:
+               return TRUE;
+       }
+       g_return_val_if_reached (FALSE);
+    }
+}
diff --git a/src/itdb_device.h b/src/itdb_device.h
index ecb4742..518ca93 100644
--- a/src/itdb_device.h
+++ b/src/itdb_device.h
@@ -174,6 +174,7 @@ G_GNUC_INTERNAL gboolean itdb_device_write_checksum 
(Itdb_Device *device,
                                                     gsize itdb_len,
                                                     GError **error);
 G_GNUC_INTERNAL void itdb_device_set_timezone_info (Itdb_Device *device);
+G_GNUC_INTERNAL gboolean itdb_device_is_iphone_family (const Itdb_Device 
*device);
 
 const Itdb_IpodInfo *
 itdb_ipod_info_from_serial (const char *serial);
diff --git a/src/itdb_sysinfo_extended_parser.c 
b/src/itdb_sysinfo_extended_parser.c
index fa29d33..ba48c19 100644
--- a/src/itdb_sysinfo_extended_parser.c
+++ b/src/itdb_sysinfo_extended_parser.c
@@ -691,3 +691,9 @@ itdb_sysinfo_properties_supports_sqlite (const 
SysInfoIpodProperties *props)
     return props->sqlite_db;
 }
 
+gint
+itdb_sysinfo_properties_get_family_id (const SysInfoIpodProperties *props)
+{
+    g_return_val_if_fail (props != NULL, FALSE);
+    return props->family_id;
+}
diff --git a/src/itdb_sysinfo_extended_parser.h 
b/src/itdb_sysinfo_extended_parser.h
index 0fc33c5..ad150fe 100644
--- a/src/itdb_sysinfo_extended_parser.h
+++ b/src/itdb_sysinfo_extended_parser.h
@@ -68,6 +68,8 @@ G_GNUC_INTERNAL const char *
 itdb_sysinfo_properties_get_firmware_version (const SysInfoIpodProperties *);
 G_GNUC_INTERNAL gboolean
 itdb_sysinfo_properties_supports_sqlite (const SysInfoIpodProperties *props);
+G_GNUC_INTERNAL gint
+itdb_sysinfo_properties_get_family_id (const SysInfoIpodProperties *props);
 
 G_END_DECLS
 

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to