[Bug] Fix P120828-5568 : use proper API to get model info .
authorJing Yigang <yigang.jing@samsung.com>
Wed, 29 Aug 2012 03:34:07 +0000 (11:34 +0800)
committerJing Yigang <yigang.jing@samsung.com>
Wed, 29 Aug 2012 03:34:07 +0000 (11:34 +0800)
Change-Id: I745467620a7100a391b4524f2b08c37e7f2bf82a

setting-about/CMakeLists.txt
setting-about/src/setting-about-main.c
setting-about/src/setting-about.c

index 4fcf877..b9291d0 100755 (executable)
@@ -9,7 +9,7 @@ pkg_check_modules(pkgs_about REQUIRED
 #      drm-service iniparser ui-gadget-1
        iniparser ui-gadget-1
        capi-appfw-application capi-appfw-app-manager evas ecore
-       tapi bluetooth-api json-glib-1.0)
+       tapi bluetooth-api json-glib-1.0 capi-system-info)
 
 FOREACH(flag ${pkgs_about_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
index 352c3e5..2176f05 100755 (executable)
@@ -29,6 +29,7 @@
 
 
 #include <app_manager.h>
+#include <system_info.h>
 
 #define DEVNAME_BLOCK_SPACE    0
 // #define SUPPORT_DIAG_USAGE
@@ -201,44 +202,23 @@ void setting_about_main_get_phone_model_name(char* szStr, int nSize)
 {
        retm_if(szStr == NULL, "szStr parameter is NULL");
 
-       char szBin[50];
-       char szEmul[50];
-
-       const char* szBinVer = NULL;
-
-       dictionary* dic = iniparser_load(SETTING_ABOUT_INFO_PATH);
-       if (dic) {
-               szBinVer = (char*)iniparser_getstr(dic, "Version:Build");
-               if (szBinVer) {
-                       char* str = g_strdup(szBinVer);
-                       if (str) {
-                               char* pPos = str;
-                               while (*pPos++) {
-                                       if ('_' == *pPos)
-                                               *pPos = ' ';
-                               }
-                               sscanf(str, "%s %s", szBin, szEmul);
-                       }
-                       G_FREE(str);
-               }
+       char *value = NULL;
+       int ret = system_info_get_value_string(SYSTEM_INFO_KEY_MODEL, &value);
+       SETTING_TRACE("value : %s", value);
+       if (ret != SYSTEM_INFO_ERROR_NONE) {
+               SETTING_TRACE_ERROR("fail to call system_info_get_value_string");
+               FREE(value);
+               snprintf(szStr, nSize, "%s", _("IDS_ST_HEADER_UNAVAILABLE"));
+               return;
        }
 
-       if (!strncmp(szEmul, "emul", 4)) {
-               snprintf(szStr, nSize, "%s", "SDK");
+       if (value) {
+               snprintf(szStr, nSize, "%s", value);
        } else {
-               if (!strncmp(szBin, "I9500", 5)) {
-                       snprintf(szStr, nSize, "GT-%s", szBin);
-               } else if (!strncmp(szBin, "SLP", 3)) {
-                       snprintf(szStr, nSize, "GT-%s", szBin);
-               } else {
-                       snprintf(szStr, nSize, "%s", _("IDS_ST_HEADER_UNAVAILABLE"));
-               }
+               snprintf(szStr, nSize, "%s", _("IDS_ST_HEADER_UNAVAILABLE"));
        }
 
-       if (dic) {
-               iniparser_freedict(dic);
-               dic = NULL;
-       }
+       FREE(value);
 }
 
 void setting_about_main_get_sw_version(char* szStr, int nSize)
index d9fd17b..5e060d0 100755 (executable)
@@ -267,7 +267,7 @@ Eina_Bool __insert_item_idler(void *data)
                Setting_GenGroupItem_Data *item_data = NULL;
                if (ad->my_numbers.count == 1) {
                        item_data = calloc(1, sizeof(Setting_GenGroupItem_Data));
-                       setting_retm_if(!item_data, "calloc item_data failed");
+                       setting_retvm_if(!item_data, FALSE, "calloc item_data failed");
                        item_data->keyStr = (char *)g_strdup("IDS_ST_BODY_MY_NUMBER");
                        item_data->sub_desc = (char *)g_strdup(sel_num);
                        item_data->swallow_type = SWALLOW_Type_INVALID;
@@ -283,7 +283,7 @@ Eina_Bool __insert_item_idler(void *data)
                        setting_enable_expandable_genlist(ad->genlsit, ad,
                                                  setting_about_main_exp_cb, NULL);
                        item_data = calloc(1, sizeof(Setting_GenGroupItem_Data));
-                       setting_retm_if(!item_data, "calloc item_data failed");
+                       setting_retvm_if(!item_data, FALSE, "calloc item_data failed");
                        item_data->keyStr = (char *)g_strdup("IDS_ST_BODY_MY_NUMBER");
                        item_data->sub_desc = (char *)g_strdup(sel_num);
                        item_data->swallow_type = SWALLOW_Type_INVALID;