[gvfs] Adaption to latest libiphone API
- From: Bastien Nocera <hadess src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gvfs] Adaption to latest libiphone API
- Date: Thu, 29 Oct 2009 14:20:14 +0000 (UTC)
commit 690150b6d2beb3364690b4303143a049598c1a9d
Author: Nikias Bassen <nikias gmx li>
Date: Thu Oct 29 14:19:21 2009 +0000
Adaption to latest libiphone API
Remove libusbmuxd dependency, and use afc_get_device_info_key
to get the model name.
configure.ac | 4 ++--
daemon/gvfsbackendafc.c | 18 +++++++++---------
monitor/afc/afcvolume.c | 8 ++++----
monitor/afc/afcvolumemonitor.c | 16 ++++++++--------
4 files changed, 23 insertions(+), 23 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 5069d73..d15db88 100644
--- a/configure.ac
+++ b/configure.ac
@@ -330,10 +330,10 @@ AFC_LIBS=
AFC_CFLAGS=
if test "x$enable_afc" != "xno" -a "x$msg_gudev" = "xyes" ; then
- PKG_CHECK_EXISTS(libiphone-1.0 >= 0.9.2 libusbmuxd >= 1.0, msg_afc=yes)
+ PKG_CHECK_EXISTS(libiphone-1.0 >= 0.9.4, msg_afc=yes)
if test "x$msg_afc" = "xyes"; then
- PKG_CHECK_MODULES(AFC, libiphone-1.0 libusbmuxd >= 1.0)
+ PKG_CHECK_MODULES(AFC, libiphone-1.0)
AC_DEFINE(HAVE_AFC, 1, [Define to 1 if AFC is going to be built])
fi
fi
diff --git a/daemon/gvfsbackendafc.c b/daemon/gvfsbackendafc.c
index 8bdd2ec..131d683 100644
--- a/daemon/gvfsbackendafc.c
+++ b/daemon/gvfsbackendafc.c
@@ -218,21 +218,21 @@ g_vfs_backend_iphone_check (iphone_error_t cond, GVfsJob *job)
}
static void
-_usbmuxd_event_cb (const usbmuxd_event_t *event, void *user_data)
+_iphone_event_cb (const iphone_event_t *event, void *user_data)
{
GVfsBackendAfc *afc_backend = G_VFS_BACKEND_AFC (user_data);
g_return_if_fail (afc_backend->uuid != NULL);
- if (event->event != UE_DEVICE_REMOVE)
+ if (event->event != IPHONE_DEVICE_REMOVE)
return;
- if (g_str_equal (event->device.uuid, afc_backend->uuid) == FALSE)
+ if (g_str_equal (event->uuid, afc_backend->uuid) == FALSE)
return;
g_print ("Shutting down AFC backend for device uuid %s\n", afc_backend->uuid);
g_vfs_backend_afc_close_connection (afc_backend);
- usbmuxd_unsubscribe();
+ iphone_event_unsubscribe ();
/* TODO: need a cleaner way to force unmount ourselves */
exit (1);
@@ -258,7 +258,8 @@ g_vfs_backend_afc_mount (GVfsBackend *backend,
self = G_VFS_BACKEND_AFC(backend);
self->connected = FALSE;
- usbmuxd_subscribe (_usbmuxd_event_cb, self);
+
+ iphone_event_subscribe (_iphone_event_cb, self);
/* setup afc */
@@ -318,7 +319,7 @@ g_vfs_backend_afc_mount (GVfsBackend *backend,
retries = 0;
do {
- err = iphone_get_device_by_uuid(&self->dev, self->uuid);
+ err = iphone_device_new(&self->dev, self->uuid);
if (err == IPHONE_E_SUCCESS)
break;
g_usleep (G_USEC_PER_SEC);
@@ -368,11 +369,10 @@ g_vfs_backend_afc_mount (GVfsBackend *backend,
}
/* set correct fd icon spec name depending on device model */
- self->model = afc_get_device_info_field (self->afc_cli, "Model");
- if (G_UNLIKELY(self->model == NULL))
+ if (G_UNLIKELY(g_vfs_backend_afc_check (afc_get_device_info_key (self->afc_cli, "Model", &self->model), G_VFS_JOB(job))))
goto out_destroy_afc;
- if (strstr(self->model, "iPod") != NULL)
+ if ((self->model != NULL) && (strstr(self->model, "iPod") != NULL))
{
g_vfs_backend_set_icon_name (G_VFS_BACKEND(self), "multimedia-player-apple-ipod-touch");
}
diff --git a/monitor/afc/afcvolume.c b/monitor/afc/afcvolume.c
index 0e3c65e..73f2e55 100644
--- a/monitor/afc/afcvolume.c
+++ b/monitor/afc/afcvolume.c
@@ -37,7 +37,7 @@ G_DEFINE_TYPE_EXTENDED(GVfsAfcVolume, g_vfs_afc_volume, G_TYPE_OBJECT, 0,
static void
g_vfs_afc_volume_finalize (GObject *object)
{
- GVfsAfcVolume *self;
+ GVfsAfcVolume *self = NULL;
self = G_VFS_AFC_VOLUME(object);
@@ -81,7 +81,7 @@ _g_vfs_afc_volume_update_metadata (GVfsAfcVolume *self)
retries = 0;
do {
- err = iphone_get_device_by_uuid (&dev, self->uuid);
+ err = iphone_device_new (&dev, self->uuid);
if (err == IPHONE_E_SUCCESS)
break;
g_usleep (G_USEC_PER_SEC);
@@ -113,8 +113,8 @@ _g_vfs_afc_volume_update_metadata (GVfsAfcVolume *self)
if (afc_client_new (dev, port, &afc_cli) == AFC_E_SUCCESS)
{
/* set correct fd icon spec name depending on device model */
- model = afc_get_device_info_field (afc_cli, "Model");
- if (model != NULL)
+ model = NULL;
+ if (afc_get_device_info_key (afc_cli, "Model", &model) == AFC_E_SUCCESS)
{
if(g_str_has_prefix(model, "iPod") != FALSE)
{
diff --git a/monitor/afc/afcvolumemonitor.c b/monitor/afc/afcvolumemonitor.c
index e0de6ef..76f4303 100644
--- a/monitor/afc/afcvolumemonitor.c
+++ b/monitor/afc/afcvolumemonitor.c
@@ -10,7 +10,7 @@
#include <gvfsproxyvolumemonitordaemon.h>
#include <stdio.h>
#include <gio/gio.h>
-#include <usbmuxd.h>
+#include <libiphone/libiphone.h>
#include "afcvolume.h"
#include "afcvolumemonitor.h"
@@ -69,7 +69,7 @@ g_vfs_afc_monitor_remove_volume (GVfsAfcVolumeMonitor *self,
}
static void
-g_vfs_afc_monitor_usbmuxd_event (const usbmuxd_event_t *event, void *user_data)
+g_vfs_afc_monitor_iphone_event (const iphone_event_t *event, void *user_data)
{
GVfsAfcVolumeMonitor *self;
@@ -77,10 +77,10 @@ g_vfs_afc_monitor_usbmuxd_event (const usbmuxd_event_t *event, void *user_data)
self = G_VFS_AFC_VOLUME_MONITOR(user_data);
- if (event->event == UE_DEVICE_ADD)
- g_vfs_afc_monitor_create_volume (self, event->device.uuid);
+ if (event->event == IPHONE_DEVICE_ADD)
+ g_vfs_afc_monitor_create_volume (self, event->uuid);
else
- g_vfs_afc_monitor_remove_volume (self, event->device.uuid);
+ g_vfs_afc_monitor_remove_volume (self, event->uuid);
}
static GObject *
@@ -94,7 +94,7 @@ g_vfs_afc_volume_monitor_constructor (GType type, guint ncps,
self->volumes = NULL;
- usbmuxd_subscribe(g_vfs_afc_monitor_usbmuxd_event, self);
+ iphone_event_subscribe(g_vfs_afc_monitor_iphone_event, self);
g_print ("Volume monitor alive\n");
@@ -115,11 +115,11 @@ g_vfs_afc_volume_monitor_finalize (GObject *_self)
self = G_VFS_AFC_VOLUME_MONITOR(_self);
- usbmuxd_unsubscribe();
-
if (self->volumes)
list_free (self->volumes);
+ iphone_event_unsubscribe();
+
if (G_OBJECT_CLASS(g_vfs_afc_volume_monitor_parent_class)->finalize)
(*G_OBJECT_CLASS(g_vfs_afc_volume_monitor_parent_class)->finalize)( G_OBJECT(self));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]