diff options
author | Nikias Bassen | 2010-02-01 01:35:09 +0100 |
---|---|---|
committer | Martin Szulecki | 2010-02-01 01:48:16 +0100 |
commit | a45244afa72841c8e0b0ee6f711e37883f888899 (patch) | |
tree | a8df3c6157f576d40eeef3e56309bb8d001e7954 | |
parent | 815bb69a028db59962e4bf12b359331a7ae7c580 (diff) | |
download | sbmanager-a45244afa72841c8e0b0ee6f711e37883f888899.tar.gz sbmanager-a45244afa72841c8e0b0ee6f711e37883f888899.tar.bz2 |
Updated to make use of new libimobiledevice
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/device.c | 34 | ||||
-rw-r--r-- | src/device.h | 2 | ||||
-rw-r--r-- | src/gui.c | 2 | ||||
-rw-r--r-- | src/main.c | 16 |
6 files changed, 30 insertions, 32 deletions
diff --git a/configure.ac b/configure.ac index e51c454..538582f 100644 --- a/configure.ac +++ b/configure.ac @@ -15,10 +15,10 @@ AM_PROG_CC_C_O AC_PROG_LIBTOOL # Checks for libraries. -PKG_CHECK_MODULES(libiphone, libiphone-1.0) +PKG_CHECK_MODULES(libimobiledevice, libimobiledevice-1.0) PKG_CHECK_MODULES(libglib2, glib-2.0 >= 2.14.1) PKG_CHECK_MODULES(libgthread2, gthread-2.0 >= 2.14.1) -PKG_CHECK_MODULES(libplist, libplist >= 0.15) +PKG_CHECK_MODULES(libplist, libplist >= 1.0) PKG_CHECK_MODULES(libclutter, clutter-1.0 >= 1.0.6) PKG_CHECK_MODULES(libcluttergtk, clutter-gtk-0.10 >= 0.10) PKG_CHECK_MODULES(libgtk, gtk+-2.0 >= 2.16) 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 <glib.h> #include <glib/gi18n-lib.h> -#include <libiphone/libiphone.h> -#include <libiphone/lockdown.h> -#include <libiphone/sbservices.h> +#include <libimobiledevice/libimobiledevice.h> +#include <libimobiledevice/lockdown.h> +#include <libimobiledevice/sbservices.h> #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 <glib.h> -#include <libiphone/sbservices.h> +#include <libimobiledevice/sbservices.h> struct device_info_int { char *uuid; @@ -29,8 +29,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <libiphone/libiphone.h> -#include <libiphone/sbservices.h> #include <plist/plist.h> #include <time.h> #include <sys/time.h> @@ -28,8 +28,8 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <libiphone/libiphone.h> -#include <libiphone/sbservices.h> +#include <libimobiledevice/libimobiledevice.h> +#include <libimobiledevice/sbservices.h> #include <plist/plist.h> #include <time.h> #include <sys/time.h> @@ -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); |