[nautilus-ideviceinfo/gtk3: 1/5] Retrieve device name from device directly instead of maintaining a list
- From: Martin Szulecki <mszulecki src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-ideviceinfo/gtk3: 1/5] Retrieve device name from device directly instead of maintaining a list
- Date: Mon, 1 Dec 2014 16:42:04 +0000 (UTC)
commit f69887a974133e078516f212f9279d9c0bda7a0c
Author: Martin Szulecki <m szulecki libimobiledevice org>
Date: Sun Nov 30 17:11:02 2014 +0100
Retrieve device name from device directly instead of maintaining a list
src/ideviceinfo-property-page.c | 32 ++++++++++++--------------------
1 files changed, 12 insertions(+), 20 deletions(-)
---
diff --git a/src/ideviceinfo-property-page.c b/src/ideviceinfo-property-page.c
index 6196486..d50d195 100644
--- a/src/ideviceinfo-property-page.c
+++ b/src/ideviceinfo-property-page.c
@@ -266,33 +266,25 @@ update_ui (CompletedMessage *msg)
node = plist_dict_get_item(dict, "ProductType");
if (node) {
char *devtype = NULL;
- const char *devtypes[][2] = {
- {"iPhone1,1", "iPhone"},
- {"iPhone1,2", "iPhone 3G"},
- {"iPhone2,1", "iPhone 3GS"},
- {"iPhone3,1", "iPhone 4"},
- {"iPod1,1", "iPod Touch"},
- {"iPod2,1", "iPod Touch (2G)"},
- {"iPod3,1", "iPod Touch (3G)"},
- {"iPad1,1", "iPad"}
- };
char *str = NULL;
char *val2 = NULL;
plist_get_string_val(node, &devtype);
- val = devtype;
- if (devtype) {
- guint i;
- for (i = 0; i < G_N_ELEMENTS(devtypes); i++) {
- if (g_str_equal(devtypes[i][0], devtype)) {
- val = g_strdup(devtypes[i][1]);
- break;
- }
- }
- }
if (g_str_has_prefix(devtype, "iPod"))
is_ipod_touch = TRUE;
else if (!g_str_has_prefix(devtype, "iPad"))
is_phone = TRUE;
+
+ plist_dict_get_item(dict, "MarketingName");
+ if (node) {
+ plist_get_string_val(node, &val);
+ } else {
+ val = g_strdup(devtype);
+ }
+
+ if (devtype) {
+ free(devtype);
+ }
+
node = plist_dict_get_item(dict, "ModelNumber");
if (node) {
plist_get_string_val(node, &val2);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]