summaryrefslogtreecommitdiffstats
path: root/src/itdb_device.c
diff options
context:
space:
mode:
authorChristophe Fergeau <teuf@gnome.org>2008-05-25 10:38:09 +0000
committerChristophe Fergeau <teuf@gnome.org>2008-05-25 10:38:09 +0000
commit38ea0e03d9414b955cd51f09a8e668c63f8899f9 (patch)
treed24c80f92bfb89240b81a2dcdc97a6520f7016fc /src/itdb_device.c
parentc3e9ad30bd3e6beb2e3edc5a1a732e66ac17d0f5 (diff)
downloadlibgpod-38ea0e03d9414b955cd51f09a8e668c63f8899f9.tar.gz
libgpod-38ea0e03d9414b955cd51f09a8e668c63f8899f9.tar.xz
libgpod-38ea0e03d9414b955cd51f09a8e668c63f8899f9.zip
* configure.ac: check libxml presence
* src/Makefile.am: add new files, remove obsolete ones * src/itdb_plist.h: * src/itdb_plist.c: plist parser, this parses a plist XML file to a GHashTable of GValue *. This parser should be generic, ie it doesn't know it's parsing SysInfoExtended, it only cares about it being a plist file * src/itdb_sysinfo_extended_parser.h: * src/itdb_sysinfo_extended_parser.c: convert the parsed plist data to data structures usable by libgpod * src/itdb_device.h: * src/itdb_device.c: parses SysInfoExtended in addition to SysInfo * src/itdb_sysinfo.c: this hacky parser is obsoleted by the new (much more complete) SysInfoExtended parser, so it's removed * tests/Makefile.am: * tests/test-sysinfo-extended-parsing.c: small test program for the new parser git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1980 f01d2545-417e-4e96-918e-98f8d0dbbcb6
Diffstat (limited to 'src/itdb_device.c')
-rw-r--r--src/itdb_device.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/itdb_device.c b/src/itdb_device.c
index 3b5e7e3..4f3fe50 100644
--- a/src/itdb_device.c
+++ b/src/itdb_device.c
@@ -387,6 +387,8 @@ void itdb_device_free (Itdb_Device *device)
g_free (device->mountpoint);
if (device->sysinfo)
g_hash_table_destroy (device->sysinfo);
+ if (device->sysinfo_extended)
+ itdb_sysinfo_properties_free (device->sysinfo_extended);
g_free (device);
}
}
@@ -428,6 +430,32 @@ G_GNUC_INTERNAL guint64 device_time_time_t_to_mac (Itdb_Device *device, time_t t
else return 0;
}
+static void itdb_device_read_sysinfo_extended (Itdb_Device *device)
+{
+ const gchar *p_sysinfo_ex[] = {"SysInfoExtended", NULL};
+ gchar *dev_path, *sysinfo_ex_path;
+
+ if (device->sysinfo_extended != NULL) {
+ itdb_sysinfo_properties_free (device->sysinfo_extended);
+ device->sysinfo_extended = NULL;
+ }
+
+ dev_path = itdb_get_device_dir (device->mountpoint);
+ if (!dev_path) return;
+
+ sysinfo_ex_path = itdb_resolve_path (dev_path, p_sysinfo_ex);
+ g_free (dev_path);
+ if (!sysinfo_ex_path) return;
+ device->sysinfo_extended = itdb_sysinfo_extended_parse (sysinfo_ex_path);
+ g_free (sysinfo_ex_path);
+
+ if ((device->sysinfo != NULL) && (device->sysinfo_extended != NULL)) {
+ const char *fwid;
+ fwid = itdb_sysinfo_properties_get_firewire_id (device->sysinfo_extended);
+ g_hash_table_insert (device->sysinfo, g_strdup ("FirewireGuid"),
+ g_strdup (fwid));
+ }
+}
/**
* itdb_device_read_sysinfo:
@@ -490,7 +518,7 @@ gboolean itdb_device_read_sysinfo (Itdb_Device *device)
}
g_free (dev_path);
- itdb_device_read_sysinfo_xml (device, NULL);
+ itdb_device_read_sysinfo_extended (device);
/* indicate that sysinfo is identical to what is on the iPod */
device->sysinfo_changed = FALSE;