[gvfs] afc: Fix building against libimobiledevice-1.1.2
- From: Tomas Bzatek <tbzatek src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] afc: Fix building against libimobiledevice-1.1.2
- Date: Mon, 2 Apr 2012 13:01:49 +0000 (UTC)
commit c9f840192312c23f7eea666f964e7eab4c2e680e
Author: Alexandre Rostovtsev <tetromino gentoo org>
Date: Mon Apr 2 14:58:58 2012 +0200
afc: Fix building against libimobiledevice-1.1.2
In 1.1.2, the struct idevice_event_t uuid field was renamed to udid.
Since libimobiledevice lacks a library version macro, we are forced
to check for the pkgconfig version in configure.
https://bugzilla.gnome.org/show_bug.cgi?id=672693
Signed-off-by: Tomas Bzatek <tbzatek redhat com>
configure.ac | 3 +++
daemon/gvfsbackendafc.c | 10 +++++++++-
monitor/afc/afcvolumemonitor.c | 11 +++++++++--
3 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index e31fb50..081cc09 100644
--- a/configure.ac
+++ b/configure.ac
@@ -327,6 +327,9 @@ if test "x$enable_afc" != "xno" ; then
if test "x$msg_afc" = "xyes"; then
PKG_CHECK_MODULES(AFC, libimobiledevice-1.0 libplist)
AC_DEFINE(HAVE_AFC, 1, [Define to 1 if AFC is going to be built])
+ PKG_CHECK_EXISTS(libimobiledevice-1.0 >= 1.1.2,
+ [AC_DEFINE(HAVE_LIBIMOBILEDEVICE_1_1_2, 1,
+ [Define to 1 if libimobiledevice-1.1.2 found])])
fi
fi
diff --git a/daemon/gvfsbackendafc.c b/daemon/gvfsbackendafc.c
index ab7094f..a62a197 100644
--- a/daemon/gvfsbackendafc.c
+++ b/daemon/gvfsbackendafc.c
@@ -339,11 +339,19 @@ static void
_idevice_event_cb (const idevice_event_t *event, void *user_data)
{
GVfsBackendAfc *afc_backend = G_VFS_BACKEND_AFC (user_data);
+ gchar *event_udid;
g_return_if_fail (afc_backend->uuid != NULL);
if (event->event != IDEVICE_DEVICE_REMOVE)
return;
- if (g_str_equal (event->uuid, afc_backend->uuid) == FALSE)
+
+#ifdef HAVE_LIBIMOBILEDEVICE_1_1_2
+ event_udid = event->udid;
+#else
+ event_udid = event->uuid;
+#endif
+
+ if (g_str_equal (event_udid, afc_backend->uuid) == FALSE)
return;
g_print ("Shutting down AFC backend for device uuid %s\n", afc_backend->uuid);
diff --git a/monitor/afc/afcvolumemonitor.c b/monitor/afc/afcvolumemonitor.c
index dfc3fa5..9f24753 100644
--- a/monitor/afc/afcvolumemonitor.c
+++ b/monitor/afc/afcvolumemonitor.c
@@ -83,15 +83,22 @@ static void
g_vfs_afc_monitor_idevice_event (const idevice_event_t *event, void *user_data)
{
GVfsAfcVolumeMonitor *self;
+ gchar *event_udid;
g_return_if_fail (event != NULL);
self = G_VFS_AFC_VOLUME_MONITOR(user_data);
+#ifdef HAVE_LIBIMOBILEDEVICE_1_1_2
+ event_udid = event->udid;
+#else
+ event_udid = event->uuid;
+#endif
+
if (event->event == IDEVICE_DEVICE_ADD)
- g_vfs_afc_monitor_create_volume (self, event->uuid);
+ g_vfs_afc_monitor_create_volume (self, event_udid);
else
- g_vfs_afc_monitor_remove_volume (self, event->uuid);
+ g_vfs_afc_monitor_remove_volume (self, event_udid);
}
static GObject *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]