[gvfs] AFC: remove com.apple.afc dependency from afc volume monitor
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] AFC: remove com.apple.afc dependency from afc volume monitor
- Date: Sat, 29 May 2010 16:28:02 +0000 (UTC)
commit fefbd88952ad9336d93143556b2349a833a1eb2d
Author: Nikias Bassen <nikias gmx li>
Date: Sat May 29 15:51:58 2010 +0200
AFC: remove com.apple.afc dependency from afc volume monitor
We can get the required information via lockdown even if we are
not a trusted host, e.g. when a passcode is set and the device has not
been paired before.
https://bugzilla.gnome.org/show_bug.cgi?id=618019
monitor/afc/afcvolume.c | 44 ++++++++++++++++----------------------------
1 files changed, 16 insertions(+), 28 deletions(-)
---
diff --git a/monitor/afc/afcvolume.c b/monitor/afc/afcvolume.c
index 10598cd..0adce77 100644
--- a/monitor/afc/afcvolume.c
+++ b/monitor/afc/afcvolume.c
@@ -11,12 +11,9 @@
#include <libimobiledevice/libimobiledevice.h>
#include <libimobiledevice/lockdown.h>
-#include <libimobiledevice/afc.h>
#include "afcvolume.h"
-#define DEFAULT_SERVICE "com.apple.afc"
-
struct _GVfsAfcVolume {
GObject parent;
@@ -72,12 +69,11 @@ static int
_g_vfs_afc_volume_update_metadata (GVfsAfcVolume *self)
{
idevice_t dev;
- afc_client_t afc_cli;
lockdownd_client_t lockdown_cli = NULL;
idevice_error_t err;
- guint retries;
+ guint retries
+ plist_t value;
char *model, *display_name;
- guint16 port;
retries = 0;
do {
@@ -90,7 +86,7 @@ _g_vfs_afc_volume_update_metadata (GVfsAfcVolume *self)
if (err != IDEVICE_E_SUCCESS)
return 0;
- if (lockdownd_client_new_with_handshake (dev, &lockdown_cli, "gvfs-afc-volume-monitor") != LOCKDOWN_E_SUCCESS)
+ if (lockdownd_client_new (dev, &lockdown_cli, "gvfs-afc-volume-monitor") != LOCKDOWN_E_SUCCESS)
{
idevice_free (dev);
return 0;
@@ -103,32 +99,24 @@ _g_vfs_afc_volume_update_metadata (GVfsAfcVolume *self)
self->name = display_name;
}
- if (lockdownd_start_service (lockdown_cli, DEFAULT_SERVICE, &port) != LOCKDOWN_E_SUCCESS)
- {
- lockdownd_client_free (lockdown_cli);
- idevice_free (dev);
- return 0;
- }
-
- if (afc_client_new (dev, port, &afc_cli) == AFC_E_SUCCESS)
+ value = NULL;
+ if (lockdownd_get_value (lockdown_cli, NULL, "DeviceClass", &value) == LOCKDOWN_E_SUCCESS)
{
/* set correct fd icon spec name depending on device model */
model = NULL;
- if (afc_get_device_info_key (afc_cli, "Model", &model) == AFC_E_SUCCESS)
+ plist_get_string_val(value, &model);
+ if (g_str_equal(model, "iPod") != FALSE)
+ {
+ g_free (self->icon);
+ self->icon = g_strdup ("multimedia-player-apple-ipod-touch");
+ }
+ else if (g_str_equal(model, "iPad") != FALSE)
{
- if (g_str_has_prefix(model, "iPod") != FALSE)
- {
- g_free (self->icon);
- self->icon = g_strdup ("multimedia-player-apple-ipod-touch");
- }
- else if (g_str_has_prefix(model, "iPad") != FALSE)
- {
- g_free (self->icon);
- self->icon = g_strdup ("computer-apple-ipad");
- }
- g_free (model);
+ g_free (self->icon);
+ self->icon = g_strdup ("computer-apple-ipad");
}
- afc_client_free(afc_cli);
+ g_free (model);
+ plist_free (value);
}
lockdownd_client_free (lockdown_cli);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]