From a45244afa72841c8e0b0ee6f711e37883f888899 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Mon, 1 Feb 2010 01:35:09 +0100 Subject: Updated to make use of new libimobiledevice --- src/Makefile.am | 4 ++-- src/device.c | 34 +++++++++++++++++----------------- src/device.h | 2 +- src/gui.c | 2 -- src/main.c | 16 ++++++++-------- 5 files changed, 28 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index fe69ce7..a7e0778 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,6 @@ AM_CFLAGS = \ $(GLOBAL_CFLAGS) \ - $(libiphone_CFLAGS) \ + $(libimobiledevice_CFLAGS) \ $(libglib2_CFLAGS) \ $(libgthread2_CFLAGS) \ $(libplist_CFLAGS) \ @@ -11,7 +11,7 @@ AM_CFLAGS = \ -DSBMGR_DATA=\"$(pkgdatadir)\" AM_LDFLAGS = \ - $(libiphone_LIBS) \ + $(libimobiledevice_LIBS) \ $(libglib2_LIBS) \ $(libgthread2_LIBS) \ $(libplist_LIBS) \ diff --git a/src/device.c b/src/device.c index bf2f2a2..b24757b 100644 --- a/src/device.c +++ b/src/device.c @@ -32,35 +32,35 @@ #include #include -#include -#include -#include +#include +#include +#include #include "device.h" -static GMutex *libiphone_mutex = NULL; +static GMutex *idevice_mutex = NULL; static GQuark device_domain = 0; void device_init() { - libiphone_mutex = g_mutex_new(); - device_domain = g_quark_from_string("libiphone"); + idevice_mutex = g_mutex_new(); + device_domain = g_quark_from_string("libimobiledevice"); } sbservices_client_t device_sbs_new(const char *uuid, GError **error) { sbservices_client_t sbc = NULL; - iphone_device_t phone = NULL; + idevice_t phone = NULL; lockdownd_client_t client = NULL; uint16_t port = 0; printf("%s: %s\n", __func__, uuid); - g_mutex_lock(libiphone_mutex); - if (IPHONE_E_SUCCESS != iphone_device_new(&phone, uuid)) { + g_mutex_lock(idevice_mutex); + if (IDEVICE_E_SUCCESS != idevice_new(&phone, uuid)) { if (error) *error = g_error_new(device_domain, ENODEV, _("No device found, is it plugged in?")); - g_mutex_unlock(libiphone_mutex); + g_mutex_unlock(idevice_mutex); return sbc; } @@ -85,8 +85,8 @@ sbservices_client_t device_sbs_new(const char *uuid, GError **error) if (client) { lockdownd_client_free(client); } - iphone_device_free(phone); - g_mutex_unlock(libiphone_mutex); + idevice_free(phone); + g_mutex_unlock(idevice_mutex); return sbc; } @@ -206,7 +206,7 @@ gboolean device_get_info(const char *uuid, device_info_t *device_info, GError ** { uint64_t interval = 60; plist_t node = NULL; - iphone_device_t phone = NULL; + idevice_t phone = NULL; lockdownd_client_t client = NULL; gboolean res = FALSE; @@ -218,8 +218,8 @@ gboolean device_get_info(const char *uuid, device_info_t *device_info, GError ** printf("%s\n", __func__); - g_mutex_lock(libiphone_mutex); - if (IPHONE_E_SUCCESS != iphone_device_new(&phone, uuid)) { + g_mutex_lock(idevice_mutex); + if (IDEVICE_E_SUCCESS != idevice_new(&phone, uuid)) { *error = g_error_new(device_domain, ENODEV, _("No device found, is it plugged in?")); goto leave_cleanup; } @@ -290,8 +290,8 @@ gboolean device_get_info(const char *uuid, device_info_t *device_info, GError ** if (client) { lockdownd_client_free(client); } - iphone_device_free(phone); - g_mutex_unlock(libiphone_mutex); + idevice_free(phone); + g_mutex_unlock(idevice_mutex); return res; } diff --git a/src/device.h b/src/device.h index 1fa7c4b..cfe4d54 100644 --- a/src/device.h +++ b/src/device.h @@ -25,7 +25,7 @@ #ifndef DEVICE_H #define DEVICE_H #include -#include +#include struct device_info_int { char *uuid; diff --git a/src/gui.c b/src/gui.c index e7466d0..6538e79 100644 --- a/src/gui.c +++ b/src/gui.c @@ -29,8 +29,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/src/main.c b/src/main.c index 2246c29..c83cc84 100644 --- a/src/main.c +++ b/src/main.c @@ -28,8 +28,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include @@ -130,7 +130,7 @@ static void quit_program_cb(GtkWidget *widget, gpointer user_data) { /* cleanup */ sbmgr_finalize(); - iphone_event_unsubscribe(); + idevice_event_unsubscribe(); gtk_main_quit(); } @@ -156,9 +156,9 @@ static gpointer device_add_cb(gpointer user_data) return NULL; } -static void device_event_cb(const iphone_event_t *event, void *user_data) +static void device_event_cb(const idevice_event_t *event, void *user_data) { - if (event->event == IPHONE_DEVICE_ADD) { + if (event->event == IDEVICE_DEVICE_ADD) { if (!current_uuid && (!match_uuid || !strcasecmp(match_uuid, event->uuid))) { debug_printf("Device add event: adding device %s\n", event->uuid); current_uuid = g_strdup(event->uuid); @@ -166,7 +166,7 @@ static void device_event_cb(const iphone_event_t *event, void *user_data) } else { debug_printf("Device add event: ignoring device %s\n", event->uuid); } - } else if (event->event == IPHONE_DEVICE_REMOVE) { + } else if (event->event == IDEVICE_DEVICE_REMOVE) { if (current_uuid && !strcasecmp(current_uuid, event->uuid)) { debug_printf("Device remove event: removing device %s\n", event->uuid); free(current_uuid); @@ -252,7 +252,7 @@ static void wnd_init() g_signal_connect(main_window, "hide", G_CALLBACK(quit_program_cb), NULL); /* get notified when plug in/out events occur */ - iphone_event_subscribe(device_event_cb, NULL); + idevice_event_subscribe(device_event_cb, NULL); } /* main */ @@ -277,7 +277,7 @@ int main(int argc, char **argv) /* parse cmdline args */ for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) { - iphone_set_debug_level(1); + idevice_set_debug_level(1); continue; } else if (!strcmp(argv[i], "-D") || !strcmp(argv[i], "--debug-app")) { set_debug(TRUE); -- cgit v1.1-32-gdbae