From 8d6d1ca3d39386953b047b75b1f10452b30c9578 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Sat, 18 Dec 2010 18:36:16 +0100 Subject: Read home screen and icon folder configuration from device --- src/device.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++---- src/device.h | 11 +++++++++++ 2 files changed, 57 insertions(+), 4 deletions(-) diff --git a/src/device.c b/src/device.c index e92fbc2..ddd6d53 100644 --- a/src/device.c +++ b/src/device.c @@ -386,12 +386,54 @@ gboolean device_get_info(const char *uuid, device_info_t *device_info, GError ** plist_free(node); } - /* get battery poll interval */ + /* get layout information */ node = NULL; - lockdownd_get_value(client, "com.apple.mobile.iTunes", "BatteryPollInterval", &node); - plist_get_uint_val(node, &interval); - (*device_info)->battery_poll_interval = (guint)interval; + plist_t value = NULL; + lockdownd_get_value(client, "com.apple.mobile.iTunes", NULL, &node); + + value = plist_dict_get_item(node, "HomeScreenIconColumns"); + plist_get_uint_val(value, &integer); + (*device_info)->home_screen_icon_columns = (guint)integer; + + value = plist_dict_get_item(node, "HomeScreenIconDockMaxCount"); + plist_get_uint_val(value, &integer); + (*device_info)->home_screen_icon_dock_max_count = (guint)integer; + + value = plist_dict_get_item(node, "HomeScreenIconHeight"); + plist_get_uint_val(value, &integer); + (*device_info)->home_screen_icon_height = (guint)integer; + + value = plist_dict_get_item(node, "HomeScreenIconRows"); + plist_get_uint_val(value, &integer); + (*device_info)->home_screen_icon_rows = (guint)integer; + + value = plist_dict_get_item(node, "HomeScreenIconWidth"); + plist_get_uint_val(value, &integer); + (*device_info)->home_screen_icon_width = (guint)integer; + + value = plist_dict_get_item(node, "IconFolderColumns"); + plist_get_uint_val(value, &integer); + (*device_info)->icon_folder_columns = (guint)integer; + + value = plist_dict_get_item(node, "IconFolderMaxPages"); + plist_get_uint_val(value, &integer); + (*device_info)->icon_folder_max_pages = (guint)integer; + + value = plist_dict_get_item(node, "IconFolderRows"); + plist_get_uint_val(value, &integer); + (*device_info)->icon_folder_rows = (guint)integer; + + value = plist_dict_get_item(node, "IconStateSaves"); + plist_get_bool_val(value, &boolean); + (*device_info)->icon_state_saves = (gboolean)boolean; + + /* get battery poll interval */ + value = plist_dict_get_item(node, "BatteryPollInterval"); + plist_get_uint_val(value, &integer); + (*device_info)->battery_poll_interval = (guint)integer; + plist_free(node); + value = NULL; /* get current battery capacity */ node = NULL; diff --git a/src/device.h b/src/device.h index c8829b2..b572c89 100644 --- a/src/device.h +++ b/src/device.h @@ -33,6 +33,17 @@ struct device_info_int { char *device_type; guint battery_capacity; guint battery_poll_interval; + /* layout on iOS 3.2+ */ + guint home_screen_icon_columns; + guint home_screen_icon_dock_max_count; + guint home_screen_icon_height; + guint home_screen_icon_rows; + guint home_screen_icon_width; + /* folders on iOS 4+ */ + guint icon_folder_columns; + guint icon_folder_max_pages; + guint icon_folder_rows; + gboolean icon_state_saves; }; typedef struct device_info_int *device_info_t; -- cgit v1.1-32-gdbae