9d19e6ae2a83fef47ace3ace3c66714cf3bf17c4
[apps/home/ug-setting-manage-applications-efl.git] / view / src / mgr-app-view-app-info.c
1 /*
2  *      Copyright 2012  Samsung Electronics Co., Ltd
3  *
4  *      Licensed under the Flora License, Version 1.0 (the "License");
5  *      you may not use this file except in compliance with the License.
6  *      You may obtain a copy of the License at
7  *
8  *              http://www.tizenopensource.org/license
9  *
10  *      Unless required by applicable law or agreed to in writing, software
11  *      distributed under the License is distributed on an "AS IS" BASIS,
12  *      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *      See the License for the specific language governing permissions and
14  *      limitations under the License.
15  */
16
17
18 #include "mgr-app-common-debug.h"
19 #include "mgr-app-common-error.h"
20 #include "mgr-app-view-manager.h"
21 #include "mgr-app-widget.h"
22 #include "mgr-app-view-factory.h"
23 #include "mgr-app-common-util.h"
24 #include "mgr-app-uigadget.h"
25 #include <package-manager.h>
26 #include <appsvc.h>
27 #include <app_manager.h>
28
29
30 #define WRT_PREFIX                                      "wgt"
31 #define RPM_PREFIX                                      "rpm"
32 #define TPK_PREFIX                                      "tpk"
33
34 #define UG_NAME_MIDLET_INFO_EFL         "midlet-info-efl"
35 #define UG_NAME_WEBAPP_INFO_EFL         "webapp-detail-efl"
36 #define UG_PARAM_KEY_PKG_NAME           "pkg_name"
37
38 #define STR_ICON                                        "icon"
39 #define STR_UGD                                         "ugd"
40 #define STR_INSTALLED_SIZE                      "installed_size"
41 #define STR_DATA_SIZE                           "data_size"
42
43 #define STR_TITLE_APPLICATION_INFO      "APPLICATION INFO"
44 #define STR_FORCE_STOP                          "Force stop"
45 #define STR_UNINSTALL                           "Uninstall"
46 #define STR_CLEAR_DATA                          "Clear data"
47
48 #define STR_BTN_UNINSTALL                       "btn_uninstall"
49 #define STR_POPUP                                       "popup"
50
51 #define MAX_NAME_LEN                            128
52 #define NUM_KILO                                        1000
53 #define NUM_MEGA                                        1000000
54 #define NUM_GIGA                                        1000000000
55
56 #define ELM_TEXT_1                                      "elm.text.1"
57 #define ELM_TEXT_2                                      "elm.text.2"
58 #define ELM_TEXT                                        "elm.text"
59 #define ELM_ICON_1                                      "elm.icon.1"
60 #define ELM_ICON_2                                      "elm.icon.2"
61 #define ELM_BUTTON_STYLE                        "popup_button/default"
62
63 #define ITC_ITEM_STYLE                          "dialogue/2text.1icon.2"
64 #define ITC_LIFE_ITEM_STYLE                     "dialogue/bg/2icon"
65 #define ITC_STO_TITLE_ITEM_STYLE        "dialogue/title"
66 #define ITC_STO_TOTAL_ITEM_STYLE        "dialogue/2text.2"
67 #define ITC_STO_APP_ITEM_STYLE          "dialogue/2text.2"
68 #define ITC_STO_DATA_ITEM_STYLE         "dialogue/2text.2"
69 #define ITC_DATA_ITEM_STYLE             "dialogue/bg/2icon"
70 #define ITC_LAUNCH_TITLE_ITEM_STYLE     "dialogue/title"
71 #define ITC_LAUNCH_ITEM_STYLE           "dialogue/1text"
72 #define ITC_LAUNCH_TEXT_ITEM_STYLE      "multiline/1text"
73 #define ITC_DETAIL_ITEM_STYLE           "dialogue/1text"
74 #define ITC_SEP_10_ITEM_STYLE           "dialogue/separator/10"
75 #define ITC_SEP_21_ITEM_STYLE           "dialogue/separator/21/with_line"
76
77 typedef struct _app_info_view_data_t app_info_view_data_t;
78
79 struct _app_info_view_data_t {
80         Evas_Object                     *genlist;
81         Elm_Object_Item *cbar_item;
82         mgr_app_app_info_t      *app_info;
83 };
84
85 static Evas_Object *mgr_app_view_app_info_create(void *data);
86 static Evas_Object *mgr_app_view_app_info_set_cbar(void *data);
87 static mgr_app_result_e mgr_app_view_app_info_set_navibar(void *data);
88 static mgr_app_result_e mgr_app_view_app_info_destory(void *data);
89 static mgr_app_result_e mgr_app_view_app_info_update(void *data);
90 static mgr_app_result_e mgr_app_view_app_info_cleanup(void *data);
91
92 static Evas_Object *__create_genlist_app_info(Evas_Object *parent, void *data);
93
94
95 mgr_app_view_t mgr_app_view_app_info = {
96         .create         = mgr_app_view_app_info_create,
97         .setcbar        = mgr_app_view_app_info_set_cbar,
98         .setnavibar     = mgr_app_view_app_info_set_navibar,
99         .destroy        = mgr_app_view_app_info_destory,
100         .update         = mgr_app_view_app_info_update,
101 };
102
103 static Elm_Genlist_Item_Class *itc                      = NULL;
104 static Elm_Genlist_Item_Class *itc_life         = NULL;
105 static Elm_Genlist_Item_Class *itc_sto_title= NULL;
106 static Elm_Genlist_Item_Class *itc_sto_total= NULL;
107 static Elm_Genlist_Item_Class *itc_sto_app      = NULL;
108 static Elm_Genlist_Item_Class *itc_sto_data     = NULL;
109 static Elm_Genlist_Item_Class *itc_data         = NULL;
110 static Elm_Genlist_Item_Class *itc_launch_title = NULL;
111 static Elm_Genlist_Item_Class *itc_launch       = NULL;
112 static Elm_Genlist_Item_Class *itc_launch_text = NULL;
113 static Elm_Genlist_Item_Class *itc_detail       = NULL;
114 static Elm_Genlist_Item_Class *itc_sep_10       = NULL;
115 static Elm_Genlist_Item_Class *itc_sep_21       = NULL;
116
117
118 static void _app_info_next_cb(void *data, Evas_Object *obj, void *event_info)
119 {
120         MGR_APP_BEGIN();
121         mgr_app_view_create(&mgr_app_view_app_info, data);
122         MGR_APP_END();
123 }
124
125 void _app_info_back_cb(void *data, Evas_Object *obj, void *event_info)
126 {
127         MGR_APP_BEGIN();
128
129         ret_if(data == NULL);
130         struct ug_data *ugd = (struct ug_data*)data;
131         int ret = 0;
132
133         if (ugd->pc) {
134                 MGR_APP_DEBUG("pc is freed");
135                 pkgmgr_client_free(ugd->pc);
136                 ugd->pc = NULL;
137         }
138
139         /* ug destroy */
140         ret = ug_destroy(ugd->sub_ug);
141         if (-1 == ret) {
142                 MGR_APP_DEBUG_ERR("ug_destroy ugd->sub_ug is failed");
143         }
144
145         mgr_app_view_common_back_cb(ugd, EINA_FALSE);
146
147         elm_genlist_item_class_free(itc_sep_21);
148         elm_genlist_item_class_free(itc);
149         elm_genlist_item_class_free(itc_sep_10);
150         elm_genlist_item_class_free(itc_life);
151         elm_genlist_item_class_free(itc_sto_title);
152         elm_genlist_item_class_free(itc_sto_total);
153         elm_genlist_item_class_free(itc_sto_app);
154         elm_genlist_item_class_free(itc_sto_data);
155         elm_genlist_item_class_free(itc_data);
156         elm_genlist_item_class_free(itc_launch_title);
157         elm_genlist_item_class_free(itc_launch);
158         elm_genlist_item_class_free(itc_launch_text);
159         elm_genlist_item_class_free(itc_detail);
160
161         MGR_APP_END();
162 }
163
164 static void _force_stop_clicked_cb(void *data, Evas_Object *obj, void *event_info)
165 {
166         MGR_APP_BEGIN();
167
168         ret_if(data == NULL);
169         mgr_app_app_info_t *app_info = (mgr_app_app_info_t*)data;
170         ret_if(app_info->pkg_name == NULL);
171         bool is_running = false;
172         int ret = APP_MANAGER_ERROR_NONE;
173
174
175         ret = app_manager_is_running(app_info->pkg_name, &is_running);
176         switch (ret) {
177         case APP_MANAGER_ERROR_NONE:
178                 MGR_APP_DEBUG("is_running APP_MANAGER_ERROR_NONE");
179                 break;
180         case APP_MANAGER_ERROR_INVALID_PARAMETER:
181                 MGR_APP_DEBUG("is_running APP_MANAGER_ERROR_INVALID_PARAMETER");
182                 return;
183         default:
184                 MGR_APP_DEBUG("default");
185                 return;
186         }
187
188         if (is_running) {
189                 MGR_APP_DEBUG("%s app_is_running", app_info->pkg_name);
190                 app_context_h app_context = {0, };
191
192                 ret = app_manager_get_app_context(app_info->pkg_name, &app_context);
193                 switch (ret) {
194                 case APP_MANAGER_ERROR_NONE:
195                         MGR_APP_DEBUG("get_app_context APP_MANAGER_ERROR_NONE");
196                         break;
197                 case APP_MANAGER_ERROR_INVALID_PARAMETER:
198                         MGR_APP_DEBUG("get_app_context APP_MANAGER_ERROR_INVALID_PARAMETER");
199                         return;
200                 case APP_MANAGER_ERROR_DB_FAILED:
201                         MGR_APP_DEBUG("get_app_context APP_MANAGER_ERROR_DB_FAILED");
202                         return;
203                 case APP_MANAGER_ERROR_OUT_OF_MEMORY:
204                         MGR_APP_DEBUG("get_app_context APP_MANAGER_ERROR_OUT_OF_MEMORY");
205                         return;
206                 case APP_MANAGER_ERROR_NO_SUCH_APP:
207                         MGR_APP_DEBUG("get_app_context APP_MANAGER_ERROR_NO_SUCH_APP");
208                         return;
209                 default:
210                         MGR_APP_DEBUG("default");
211                         return;
212                 }
213
214                 ret = app_manager_terminate_app(app_context);
215                 switch (ret) {
216                 case APP_MANAGER_ERROR_NONE:
217                         MGR_APP_DEBUG("terminate_app APP_MANAGER_ERROR_NONE");
218                         break;
219                 case APP_MANAGER_ERROR_INVALID_PARAMETER:
220                         MGR_APP_DEBUG("terminate_app APP_MANAGER_ERROR_INVALID_PARAMETER");
221                         return;
222                 default:
223                         MGR_APP_DEBUG("default");
224                         return;
225                 }
226
227                 ret = app_context_destroy(app_context);
228                 switch (ret) {
229                 case APP_MANAGER_ERROR_NONE:
230                         MGR_APP_DEBUG("context_destroy APP_MANAGER_ERROR_NONE");
231                         break;
232                 case APP_MANAGER_ERROR_INVALID_PARAMETER:
233                         MGR_APP_DEBUG("context_destroy APP_MANAGER_ERROR_INVALID_PARAMETER");
234                         break;
235                 default:
236                         MGR_APP_DEBUG("default");
237                         break;
238                 }
239
240         } else {
241                 MGR_APP_DEBUG("%s app is not running", app_info->pkg_name);
242         }
243
244
245         if (obj) {
246                 elm_object_disabled_set(obj, EINA_TRUE);
247         }
248
249         MGR_APP_END();
250 }
251
252 static void _no_response_cb(void *data, Evas_Object *obj, void *event_info)
253 {
254         MGR_APP_BEGIN();
255
256         ret_if(data == NULL);
257         evas_object_del(data);
258
259         MGR_APP_END();
260 }
261
262 static void _uninstall_by_pkgmgr_cb(void *data, Evas_Object *obj, void *event_info)
263 {
264         MGR_APP_BEGIN();
265
266         ret_if(obj == NULL);
267         ret_if(data == NULL);
268         mgr_app_app_info_t *app_info = (mgr_app_app_info_t*)data;
269
270         ret_if(mgr_app_view_app_info.view_common_data == NULL);
271         mgr_app_view_common_data_t *view_common_data = mgr_app_view_app_info.view_common_data;
272
273         ret_if(view_common_data->user_view_data == NULL);
274         app_info_view_data_t *app_info_view_data = view_common_data->user_view_data;
275
276         struct ug_data *ugd = NULL;
277         ugd             = evas_object_data_get(app_info_view_data->genlist, STR_UGD);
278         ret_if(ugd == NULL);
279
280         Evas_Object *btn_uninstall = NULL;
281         btn_uninstall = (Evas_Object*)evas_object_data_get(obj, STR_BTN_UNINSTALL);
282         ret_if(btn_uninstall == NULL);
283
284         Evas_Object *popup = NULL;
285         popup = (Evas_Object*)evas_object_data_get(obj, STR_POPUP);
286         ret_if(popup == NULL);
287
288         evas_object_data_del(obj, STR_BTN_UNINSTALL);
289         evas_object_data_del(obj, STR_POPUP);
290         evas_object_del(popup);
291
292         _force_stop_clicked_cb(data, btn_uninstall, event_info);
293
294         MGR_APP_DEBUG("pkg type: %s, pkg_name: %s", app_info->pkg_type, app_info->pkg_name);
295         int req_id = 0;
296         if (ugd->pc) {
297                 pkgmgr_client_free(ugd->pc);
298                 ugd->pc = NULL;
299         }
300         ugd->pc = pkgmgr_client_new(PC_REQUEST);
301         if (!ugd->pc) {
302                 MGR_APP_DEBUG_ERR("create new pkgmgr client is failed");
303                 MGR_APP_END();
304                 return;
305         }
306
307         req_id = pkgmgr_client_uninstall(ugd->pc, app_info->pkg_type, app_info->pkg_name, PM_QUIET, /*mgr_app_view_listen_cb*/NULL, /*(void*)ugd*/NULL);
308
309         if (req_id > 0) {
310                 MGR_APP_DEBUG("uninstall success, req_id=%d", req_id);
311         } else {
312                 switch (req_id) {
313                 case PKGMGR_R_EINVAL:   /* -3: Invalid argument */
314                         MGR_APP_DEBUG("PKGMGR_R_EINVAL");
315                         break;
316                 case PKGMGR_R_ECOMM:    /* -2: Comunication Error */
317                         MGR_APP_DEBUG("PKGMGR_R_ECOMM");
318                         break;
319                 case PKGMGR_R_OK:               /* 0: General success */
320                         MGR_APP_DEBUG("PKGMGR_R_OK");
321                         break;
322                 default:
323                         MGR_APP_DEBUG("default req_id=%d", req_id);
324                         break;
325                 }
326         }
327
328         /* the select 'No' noti be available from pkg-mgr then add the condition */
329         elm_object_disabled_set(obj, EINA_FALSE);
330
331         MGR_APP_END();
332 }
333
334 static void _uninstall_clicked_cb(void *data, Evas_Object *obj, void *event_info)
335 {
336         MGR_APP_BEGIN();
337
338         ret_if(obj == NULL);
339         Evas_Object *btn_uninstall = obj;
340
341         ret_if(data == NULL);
342         mgr_app_app_info_t *app_info = (mgr_app_app_info_t*)data;
343
344         ret_if(mgr_app_view_app_info.view_common_data == NULL);
345         mgr_app_view_common_data_t *view_common_data = mgr_app_view_app_info.view_common_data;
346
347         Evas_Object *popup = NULL;
348         Evas_Object *btn_yes = NULL;
349         Evas_Object *btn_no = NULL;
350
351         popup = elm_popup_add(view_common_data->common_navibar);
352         ret_if(popup == NULL);
353         evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
354         elm_object_text_set(popup, "Uninstall?");
355         elm_object_part_text_set(popup, "title,text", app_info->app_name);
356
357         btn_yes = elm_button_add(popup);
358         ret_if(btn_yes == NULL);
359         elm_object_text_set(btn_yes, "Yes");
360         elm_object_part_content_set(popup, "button1", btn_yes);
361         elm_object_style_set(btn_yes, ELM_BUTTON_STYLE);
362         evas_object_smart_callback_add(btn_yes, "clicked", _uninstall_by_pkgmgr_cb, data);
363         evas_object_data_set(btn_yes, STR_BTN_UNINSTALL, btn_uninstall);
364         evas_object_data_set(btn_yes, STR_POPUP, popup);
365
366         btn_no = elm_button_add(popup);
367         ret_if(btn_no == NULL);
368         elm_object_text_set(btn_no, "No");
369         elm_object_part_content_set(popup, "button2", btn_no);
370         elm_object_style_set(btn_no, ELM_BUTTON_STYLE);
371         evas_object_smart_callback_add(btn_no, "clicked", _no_response_cb, (void*)popup);
372
373         evas_object_show(popup);
374
375         MGR_APP_END();
376 }
377
378 static void _clear_data_clicked_cb(void *data, Evas_Object *obj, void *event_info)
379 {
380         MGR_APP_BEGIN();
381         /* TODO */
382         if (obj) {
383                 elm_object_disabled_set(obj, EINA_TRUE);
384         }
385         MGR_APP_END();
386 }
387
388 static void _gl_sel(void *data, Evas_Object *obj, void *event_info)
389 {
390         MGR_APP_BEGIN();
391
392         Elm_Object_Item *item = (Elm_Object_Item *)event_info;
393
394         if (item) {
395                 elm_genlist_item_selected_set(item, EINA_FALSE);
396         }
397
398         MGR_APP_END();
399 }
400
401 static void _gl_sel_launch(void *data, Evas_Object *obj, void *event_info)
402 {
403         MGR_APP_BEGIN();
404
405         Elm_Object_Item *item = (Elm_Object_Item *)event_info;
406         ret_if(data == NULL);
407         struct ug_data *ugd = (struct ug_data*)data;
408
409         ret_if(ugd->data == NULL);
410         mgr_app_app_info_t *app_info = (mgr_app_app_info_t*)ugd->data;
411
412         ret_if(app_info->pkg_name == NULL);
413         char *package_name = NULL;
414         package_name = app_info->pkg_name;
415
416         if (item) {
417                 elm_genlist_item_selected_set(item, EINA_FALSE);
418                 elm_object_item_disabled_set(item, EINA_TRUE);
419         }
420
421         if (appsvc_is_defapp(package_name)) {
422                 MGR_APP_DEBUG("%s is the default app", package_name);
423                 if (appsvc_unset_defapp(package_name) != APPSVC_RET_OK) {
424                         MGR_APP_DEBUG_ERR("unset the %s to default app is failed", package_name);
425                 }
426         } else {
427                 MGR_APP_DEBUG("%s is not the default app", package_name);
428         }
429
430         MGR_APP_END();
431 }
432
433 static void _layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
434 {
435         MGR_APP_BEGIN();
436
437         Evas_Object *base       = NULL;
438         Evas_Object *win        = NULL;
439
440         if (!priv) {
441                 MGR_APP_END();
442                 return;
443         }
444
445         base = ug_get_layout(ug);
446         if (!base) {
447                 MGR_APP_END();
448                 return;
449         }
450
451         win = ug_get_window();
452
453         switch (mode) {
454         case UG_MODE_FULLVIEW:
455                 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
456                 elm_win_resize_object_add(win, base);
457                 ug_disable_effect(ug);
458                 evas_object_show(base);
459                 break;
460         default:
461                 break;
462         }
463
464         MGR_APP_END();
465 }
466
467 static void _result_cb(ui_gadget_h ug, service_h service, void *priv)
468 {
469         MGR_APP_BEGIN();
470
471         struct ug_data *mydata = NULL;
472         char *val = NULL;
473
474         if (!priv) {
475                 MGR_APP_END();
476                 return;
477         }
478
479         mydata = priv;
480         if (service) {
481                 int ret = SERVICE_ERROR_NONE;
482
483                 ret = service_get_extra_data(service, "name", &val);
484                 switch (ret) {
485                 case SERVICE_ERROR_NONE:
486                         MGR_APP_DEBUG_ERR("SERVICE_ERROR_NONE");
487                         break;
488                 case SERVICE_ERROR_INVALID_PARAMETER:
489                         MGR_APP_DEBUG_ERR("SERVICE_ERROR_INVALID_PARAMETER");
490                         break;
491                 case SERVICE_ERROR_KEY_NOT_FOUND:
492                         MGR_APP_DEBUG_ERR("SERVICE_ERROR_KEY_NOT_FOUND");
493                         break;
494                 case SERVICE_ERROR_OUT_OF_MEMORY:
495                         MGR_APP_DEBUG_ERR("SERVICE_ERROR_OUT_OF_MEMORY");
496                         break;
497                 case SERVICE_ERROR_INVALID_DATA_TYPE:
498                         MGR_APP_DEBUG_ERR("SERVICE_ERROR_INVALID_DATA_TYPE");
499                         break;
500                 default:
501                         MGR_APP_DEBUG_ERR("ret value has an error. %d.", ret);
502                         break;
503                 }
504
505                 if (val) {
506                         MGR_APP_DEBUG("The name of UI gadget that sends result is [%s]", val);
507                 }
508         }
509
510         ug_destroy(ug);
511
512         MGR_APP_DEBUG("mydata->sub_ug:%d", mydata->sub_ug);
513
514         mydata->sub_ug = NULL;
515
516         MGR_APP_END();
517 }
518
519 static void _destroy_cb(ui_gadget_h ug, void *priv)
520 {
521         MGR_APP_BEGIN();
522
523         if (!ug || !priv) {
524                 MGR_APP_END();
525                 return;
526         }
527
528         struct ug_data *mydata = (struct ug_data*)priv;
529
530         ug_destroy(ug);
531         mydata->sub_ug = NULL;
532
533         MGR_APP_END();
534 }
535
536 static void __create_ug(void *data)
537 {
538         MGR_APP_BEGIN();
539
540         ret_if(data == NULL);
541         struct ug_data *ugd = (struct ug_data*)data;
542         mgr_app_app_info_t *app_info = NULL;
543
544         ret_if(ugd->data == NULL);
545         app_info = (mgr_app_app_info_t*)ugd->data;
546
547         ui_gadget_h ug = {0, };
548         struct ug_cbs cbs = {0,};
549         service_h service = {0, };
550         int ret = MGR_APP_OK;
551
552         cbs.layout_cb   = _layout_cb;
553         cbs.result_cb   = _result_cb;
554         cbs.destroy_cb  = _destroy_cb;
555         cbs.priv                = (void*)ugd;
556
557         ret = service_create(&service);
558         switch (ret) {
559         case SERVICE_ERROR_NONE:
560                 MGR_APP_DEBUG("service_create SERVICE_ERROR_NONE");
561                 break;
562         case SERVICE_ERROR_INVALID_PARAMETER:
563                 MGR_APP_DEBUG_ERR("service_create SERVICE_ERROR_INVALID_PARAMETER");
564                 return;
565         case SERVICE_ERROR_OUT_OF_MEMORY:
566                 MGR_APP_DEBUG_ERR("service_create SERVICE_ERROR_OUT_OF_MEMORY");
567                 return;
568         default:
569                 MGR_APP_DEBUG_ERR("service_create ret value has an error, %d.", ret);
570                 return;
571         }
572
573         if (app_info->pkg_type && !strncmp(app_info->pkg_type, WRT_PREFIX, strlen(WRT_PREFIX))) {
574                 MGR_APP_DEBUG("app_info->pkg_type: %s", app_info->pkg_type);
575                 MGR_APP_DEBUG("app_info->pkg_name : %s", app_info->pkg_name);
576
577                 ret = service_add_extra_data(service, UG_PARAM_KEY_PKG_NAME, app_info->pkg_name);
578                 switch (ret) {
579                 case SERVICE_ERROR_NONE:
580                         MGR_APP_DEBUG("service_add_extra_data SERVICE_ERROR_NONE");
581                         break;
582                 case SERVICE_ERROR_INVALID_PARAMETER:
583                         MGR_APP_DEBUG_ERR("service_add_extra_data SERVICE_ERROR_INVALID_PARAMETER");
584                         goto end;
585                 case SERVICE_ERROR_KEY_REJECTED:
586                         MGR_APP_DEBUG_ERR("service_add_extra_data SERVICE_ERROR_KEY_REJECTED");
587                         goto end;
588                 default:
589                         MGR_APP_DEBUG_ERR("service_add_extra_data ret value has an error, %d.", ret);
590                         goto end;
591                 }
592
593                 /* wrt ug more detail info */
594                 ug = ug_create(ugd->ug, UG_NAME_WEBAPP_INFO_EFL, UG_MODE_FULLVIEW, service, &cbs);
595                 ugd->sub_ug = ug;
596         } else {
597                 MGR_APP_DEBUG(">>> NOT SUPPORTED TYPE");
598         }
599
600 end:
601         ret = service_destroy(service);
602         switch (ret) {
603         case SERVICE_ERROR_NONE:
604                 MGR_APP_DEBUG("service_destroy SERVICE_ERROR_NONE");
605                 break;
606         case SERVICE_ERROR_INVALID_PARAMETER:
607                 MGR_APP_DEBUG_ERR("service_destroy SERVICE_ERROR_INVALID_PARAMETER");
608                 break;
609         case SERVICE_ERROR_OUT_OF_MEMORY:
610                 MGR_APP_DEBUG_ERR("service_destroy SERVICE_ERROR_OUT_OF_MEMORY");
611                 break;
612         default:
613                 MGR_APP_DEBUG_ERR("service_destroy ret value has an error, %d.", ret);
614                 break;
615         }
616
617         MGR_APP_END();
618 }
619
620 static void _gl_sel_detail(void *data, Evas_Object *obj, void *event_info)
621 {
622         MGR_APP_BEGIN();
623
624         Elm_Object_Item *item = (Elm_Object_Item *)event_info;
625         struct ug_data *ugd = (struct ug_data*)data;
626
627         if (item) {
628                 elm_genlist_item_selected_set(item, 0);
629         }
630
631         __create_ug((void*)ugd);
632
633         MGR_APP_END();
634 }
635
636 static char *__get_formated_size(float size)
637 {
638         MGR_APP_BEGIN();
639
640         char *buf = (char*)malloc(sizeof(char)*MAX_NAME_LEN);
641         retv_if(buf == NULL, NULL);
642         memset(buf, 0, MAX_NAME_LEN);
643
644         if (size < NUM_KILO) {
645                 snprintf(buf, MAX_NAME_LEN, "%d %s", (int)size, dgettext(PACKAGE, "IDS_ST_BODY_BYTES"));
646         } else if (size >= NUM_KILO && size < NUM_MEGA) {
647                 snprintf(buf, MAX_NAME_LEN, "%'.2f %s", size / NUM_KILO, dgettext(PACKAGE, "IDS_ST_BODY_KB"));
648         } else if (size >= NUM_MEGA && size < NUM_GIGA) {
649                 snprintf(buf, MAX_NAME_LEN, "%'.2f %s", size / NUM_MEGA, dgettext(PACKAGE, "IDS_ST_BODY_MB"));
650         } else {
651                 snprintf(buf, MAX_NAME_LEN, "%'.2f %s", size / NUM_GIGA, dgettext(PACKAGE, "IDS_ST_BODY_GB"));
652         }
653
654         MGR_APP_END();
655         return buf;
656 }
657
658 static char *_gl_label_get(void *data, Evas_Object *obj, const char *part)
659 {
660         MGR_APP_BEGIN();
661
662         retv_if(data == NULL, NULL);
663         mgr_app_app_info_t *app_info = (mgr_app_app_info_t*)data;
664
665         char *label = NULL;
666
667         char *package_name      = app_info->pkg_name;
668         char *app_name  = app_info->app_name;
669         char *icon_path         = app_info->icon_path;
670         char *pkg_type          = app_info->pkg_type;
671
672         MGR_APP_DEBUG("package_name:[%s], x_slp_packagetype:[%s], icon_path:[%s]\n", app_name, pkg_type, icon_path);
673         MGR_APP_DEBUG("part:%s\n", part);
674         retv_if(app_name == NULL, NULL);
675
676         /* label for 'elm.text' part */
677         if (!strncmp(part, ELM_TEXT_1, strlen(ELM_TEXT_1))) {
678                 if (package_name) {
679                         MGR_APP_MEM_STRDUP(label, app_name);
680                 }
681         } else if (!strncmp(part, ELM_TEXT_2, strlen(ELM_TEXT_2))) {
682                 label = __get_formated_size((float)app_info->total_size);
683         } else {
684                 MGR_APP_MEM_STRDUP(label, dgettext("sys_string", "IDS_COM_POP_ERROR"));
685         }
686
687         MGR_APP_END();
688         return label;
689 }
690
691 static char *_gl_label_get_sto_total(void *data, Evas_Object *obj, const char *part)
692 {
693         MGR_APP_BEGIN();
694
695         retv_if(data == NULL, NULL);
696         mgr_app_app_info_t *app_info = (mgr_app_app_info_t*)data;
697
698         char *label = NULL;
699
700         MGR_APP_DEBUG("part:%s\n", part);
701
702         /* label for 'elm.text' part */
703         if (!strncmp(part, ELM_TEXT_2, strlen(ELM_TEXT_2))) {
704                 MGR_APP_MEM_STRDUP(label, dgettext(PACKAGE, "IDS_ST_BODY_TOTAL"));
705         } else if (!strncmp(part, ELM_TEXT_1, strlen(ELM_TEXT_1))) {
706                 label = __get_formated_size((float)app_info->total_size);
707         } else {
708                 MGR_APP_MEM_STRDUP(label, dgettext("sys_string", "IDS_COM_POP_ERROR"));
709         }
710
711         MGR_APP_END();
712         return label;
713 }
714
715 static char *_gl_label_get_sto_app(void *data, Evas_Object *obj, const char *part)
716 {
717         MGR_APP_BEGIN();
718
719         retv_if(data == NULL, NULL);
720         mgr_app_app_info_t *app_info = (mgr_app_app_info_t*)data;
721
722         char *label = NULL;
723
724         MGR_APP_DEBUG("part:%s\n", part);
725
726         /* label for 'elm.text' part */
727         if (!strncmp(part, ELM_TEXT_2, strlen(ELM_TEXT_2))) {
728                 MGR_APP_MEM_STRDUP(label, dgettext(PACKAGE, "IDS_ST_BODY_APPLICATION"));
729         } else if (!strncmp(part, ELM_TEXT_1, strlen(ELM_TEXT_1))) {
730                 label = __get_formated_size((float)app_info->total_size - (float)app_info->data_size);
731         } else {
732                 MGR_APP_MEM_STRDUP(label, dgettext("sys_string", "IDS_COM_POP_ERROR"));
733         }
734
735         MGR_APP_END();
736         return label;
737 }
738
739 static char *_gl_label_get_sto_data(void *data, Evas_Object *obj, const char *part)
740 {
741         MGR_APP_BEGIN();
742
743         retv_if(data == NULL, NULL);
744         mgr_app_app_info_t *app_info = (mgr_app_app_info_t*)data;
745
746         char *label = NULL;
747
748         MGR_APP_DEBUG("part:%s\n", part);
749
750         /* label for 'elm.text' part */
751         if (!strncmp(part, ELM_TEXT_2, strlen(ELM_TEXT_2))) {
752                 MGR_APP_MEM_STRDUP(label, dgettext(PACKAGE, "IDS_ST_BODY_DATA"));
753         } else if (!strncmp(part, ELM_TEXT_1, strlen(ELM_TEXT_1))) {
754                 label = __get_formated_size((float)app_info->data_size);
755         } else {
756                 MGR_APP_MEM_STRDUP(label, dgettext("sys_string", "IDS_COM_POP_ERROR"));
757         }
758
759         MGR_APP_END();
760         return label;
761 }
762
763 static char *_gl_label_get_launch(void *data, Evas_Object *obj, const char *part)
764 {
765         MGR_APP_BEGIN();
766
767         char *label = NULL;
768
769         MGR_APP_DEBUG("part:%s\n", part);
770
771         /* label for 'elm.text' part */
772         if (!strncmp(part, ELM_TEXT, strlen(ELM_TEXT))) {
773                 MGR_APP_MEM_STRDUP(label, dgettext(PACKAGE, "IDS_ST_BODY_CLEAR_DEFAULTS"));
774         }
775
776         MGR_APP_END();
777         return label;
778 }
779
780 static char *_gl_label_get_detail(void *data, Evas_Object *obj, const char *part)
781 {
782         MGR_APP_BEGIN();
783
784         char *label = NULL;
785
786         MGR_APP_DEBUG("part:%s\n", part);
787
788         /* label for 'elm.text' part */
789         if (!strncmp(part, ELM_TEXT, strlen(ELM_TEXT))) {
790                 MGR_APP_MEM_STRDUP(label, dgettext(PACKAGE, "IDS_ST_BODY_MORE_DETAILS"));
791         }
792
793         MGR_APP_END();
794         return label;
795 }
796
797 static char *_gl_label_get_launch_text(void *data, Evas_Object *obj, const char *part)
798 {
799         MGR_APP_BEGIN();
800
801         char *label = NULL;
802
803         MGR_APP_DEBUG("part:%s\n", part);
804
805         /* label for 'elm.text' part */
806         if (!strncmp(part, ELM_TEXT, strlen(ELM_TEXT))) {
807                 MGR_APP_MEM_STRDUP(label, dgettext(PACKAGE, "IDS_ST_BODY_YOU_HAVE_SELECTED_TO_LAUNCH_THIS_APPLICATION_BY_DEFAULT_FOR_SOME_ACTIONS"));
808         }
809
810         MGR_APP_END();
811         return label;
812 }
813
814 static Evas_Object *_gl_icon_get(void *data, Evas_Object *obj, const char *part)
815 {
816         MGR_APP_BEGIN();
817
818         retv_if(data == NULL, NULL);
819         mgr_app_app_info_t *app_info = (mgr_app_app_info_t*)data;
820
821         Evas_Object *icon = NULL;
822         char *icon_path = NULL;
823
824         retv_if(app_info->icon_path == NULL, NULL);
825         icon_path = app_info->icon_path;
826
827         MGR_APP_DEBUG("icon_path:[%s]\n", icon_path);
828         MGR_APP_DEBUG("part:%s\n", part);
829
830         /* icon for 'elm.icon' part */
831         icon = elm_icon_add(obj);
832         retv_if(icon == NULL, NULL);
833         elm_icon_file_set(icon, icon_path, STR_ICON);
834
835         evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
836
837         MGR_APP_END();
838
839         return icon;
840 }
841
842 static Evas_Object *_gl_icon_get_life(void *data, Evas_Object *obj, const char *part)
843 {
844         MGR_APP_BEGIN();
845
846         MGR_APP_DEBUG("part:%s\n", part);
847         retv_if(data == NULL, NULL);
848         mgr_app_app_info_t *app_info = (mgr_app_app_info_t*)data;
849
850         Evas_Object *button = NULL;
851         if (!strncmp(part, ELM_ICON_1, strlen(ELM_ICON_1))) {
852                 button = elm_button_add(obj);
853                 if (button) {
854                         elm_object_disabled_set(button, EINA_TRUE);
855                         elm_object_text_set(button, STR_FORCE_STOP);
856                         elm_object_style_set(button, ELM_BUTTON_STYLE);
857                         evas_object_smart_callback_add(button, "clicked", _force_stop_clicked_cb, (void*)data);
858
859                         if (app_info->taskmanage) {
860                                 bool is_running = false;
861                                 int ret = app_manager_is_running(app_info->pkg_name, &is_running);
862
863                                 switch (ret) {
864                                 case APP_MANAGER_ERROR_NONE:
865                                         MGR_APP_DEBUG("is_running APP_MANAGER_ERROR_NONE");
866                                         if (is_running) {
867                                                 elm_object_disabled_set(button, EINA_FALSE);
868                                         }
869                                         break;
870                                 case APP_MANAGER_ERROR_INVALID_PARAMETER:
871                                         MGR_APP_DEBUG("is_running APP_MANAGER_ERROR_INVALID_PARAMETER");
872                                         break;
873                                 default:
874                                         MGR_APP_DEBUG("default");
875                                         break;
876                                 }
877                         }
878                 }
879         } else if (!strncmp(part, ELM_ICON_2, strlen(ELM_ICON_2))) {
880                 button = elm_button_add(obj);
881                 if (button) {
882                         elm_object_disabled_set(button, EINA_TRUE);
883                         elm_object_text_set(button, STR_UNINSTALL);
884                         elm_object_style_set(button, ELM_BUTTON_STYLE);
885                         evas_object_smart_callback_add(button, "clicked", _uninstall_clicked_cb, (void*)data);
886
887                         if (app_info->removable) {
888                                 elm_object_disabled_set(button, EINA_FALSE);
889                         }
890                 }
891         } else {
892                 MGR_APP_DEBUG_ERR("elm icon part is wrong");
893                 button = NULL;
894         }
895
896         MGR_APP_END();
897         return button;
898 }
899
900 static Evas_Object *_gl_icon_get_data(void *data, Evas_Object *obj, const char *part)
901 {
902         MGR_APP_BEGIN();
903
904         MGR_APP_DEBUG("part:%s\n", part);
905         retv_if(data == NULL, NULL);
906         mgr_app_app_info_t *app_info = (mgr_app_app_info_t*)data;
907
908         Evas_Object *button = NULL;
909         if (!strncmp(part, ELM_ICON_2, strlen(ELM_ICON_2))) {
910                 button = elm_button_add(obj);
911                 if (button) {
912                         elm_object_text_set(button, STR_CLEAR_DATA);
913                         elm_object_style_set(button, ELM_BUTTON_STYLE);
914                         evas_object_smart_callback_add(button, "clicked", _clear_data_clicked_cb, (void*)data);
915                         if (app_info->data_size <= 0) {
916                                 elm_object_disabled_set(button, EINA_TRUE);
917                         }
918                 }
919         } else {
920                 MGR_APP_DEBUG_ERR("empty button area");
921                 button = NULL;
922         }
923
924         MGR_APP_END();
925         return button;
926 }
927
928 static char *_gl_label_get_title(void *data, Evas_Object *obj, const char *part)
929 {
930         MGR_APP_BEGIN();
931
932         char *group_title = (char *)data;
933         char *title = NULL;
934
935         MGR_APP_MEM_STRDUP(title, group_title);
936         MGR_APP_END();
937
938         return title;
939 }
940
941 static Evas_Object *__create_genlist_app_info(Evas_Object *parent, void *data)
942 {
943         MGR_APP_BEGIN();
944
945         retv_if(data == NULL, NULL);
946         struct ug_data *ugd = (struct ug_data*)data;
947
948         Elm_Object_Item *item_app                       = NULL;
949         Elm_Object_Item *item_life                      = NULL;
950         Elm_Object_Item *item_sto_title         = NULL;
951         Elm_Object_Item *item_sto_total = NULL;
952         Elm_Object_Item *item_sto_app           = NULL;
953         Elm_Object_Item *item_sto_data          = NULL;
954         Elm_Object_Item *item_data                      = NULL;
955         Elm_Object_Item *item_launch_text       = NULL;
956         Elm_Object_Item *item_launch_title      = NULL;
957         Elm_Object_Item *item_launch            = NULL;
958         Elm_Object_Item *item_sep_10            = NULL;
959         Elm_Object_Item *item_sep_21            = NULL;
960         Elm_Object_Item *item_detail            = NULL;
961
962         Evas_Object     *genlist        = NULL;
963         char *sto_title                 = NULL;
964         char *launch_title              = NULL;
965
966
967         /* set the genlist item style */
968         itc_sep_21 = elm_genlist_item_class_new();
969         retv_if(itc_sep_21 == NULL, NULL);
970         itc = elm_genlist_item_class_new();
971         retv_if(itc == NULL, NULL);
972         itc_sep_10 = elm_genlist_item_class_new();
973         retv_if(itc_sep_10 == NULL, NULL);
974         itc_life = elm_genlist_item_class_new();
975         retv_if(itc_life == NULL, NULL);
976         itc_sto_title = elm_genlist_item_class_new();
977         retv_if(itc_sto_title == NULL, NULL);
978         itc_sto_total = elm_genlist_item_class_new();
979         retv_if(itc_sto_total == NULL, NULL);
980         itc_sto_app = elm_genlist_item_class_new();
981         retv_if(itc_sto_app == NULL, NULL);
982         itc_sto_data = elm_genlist_item_class_new();
983         retv_if(itc_sto_data == NULL, NULL);
984         itc_data = elm_genlist_item_class_new();
985         retv_if(itc_data == NULL, NULL);
986         itc_launch_title = elm_genlist_item_class_new();
987         retv_if(itc_launch_title == NULL, NULL);
988         itc_launch = elm_genlist_item_class_new();
989         retv_if(itc_launch == NULL, NULL);
990         itc_launch_text = elm_genlist_item_class_new();
991         retv_if(itc_launch_text == NULL, NULL);
992         itc_detail = elm_genlist_item_class_new();
993         retv_if(itc_detail == NULL, NULL);
994
995         itc_sep_21->item_style                  = ITC_SEP_21_ITEM_STYLE;
996         itc_sep_21->func.text_get               = NULL;
997         itc_sep_21->func.content_get    = NULL;
998         itc_sep_21->func.state_get              = NULL;
999         itc_sep_21->func.del                    = NULL;
1000
1001         itc->item_style                                 = ITC_ITEM_STYLE;
1002         itc->func.text_get                              = _gl_label_get;
1003         itc->func.content_get                   = _gl_icon_get;
1004         itc->func.state_get                             = NULL;
1005         itc->func.del                                   = NULL;
1006
1007         itc_sep_10->item_style                  = ITC_SEP_10_ITEM_STYLE;
1008         itc_sep_10->func.text_get               = NULL;
1009         itc_sep_10->func.content_get    = NULL;
1010         itc_sep_10->func.state_get              = NULL;
1011         itc_sep_10->func.del                    = NULL;
1012
1013         itc_life->item_style                    = ITC_LIFE_ITEM_STYLE;
1014         itc_life->func.text_get                 = NULL;
1015         itc_life->func.content_get              = _gl_icon_get_life;
1016         itc_life->func.state_get                = NULL;
1017         itc_life->func.del                              = NULL;
1018
1019         itc_sto_title->item_style               = ITC_STO_TITLE_ITEM_STYLE;
1020         itc_sto_title->func.text_get    = _gl_label_get_title;
1021         itc_sto_title->func.content_get = NULL;
1022         itc_sto_title->func.state_get   = NULL;
1023         itc_sto_title->func.del                 = NULL;
1024
1025         itc_sto_total->item_style               = ITC_STO_TOTAL_ITEM_STYLE;
1026         itc_sto_total->func.text_get    = _gl_label_get_sto_total;
1027         itc_sto_total->func.content_get = NULL;
1028         itc_sto_total->func.state_get   = NULL;
1029         itc_sto_total->func.del                 = NULL;
1030
1031         itc_sto_app->item_style                 = ITC_STO_APP_ITEM_STYLE;
1032         itc_sto_app->func.text_get              = _gl_label_get_sto_app;
1033         itc_sto_app->func.content_get   = NULL;
1034         itc_sto_app->func.state_get     = NULL;
1035         itc_sto_app->func.del                   = NULL;
1036
1037         itc_sto_data->item_style                = ITC_STO_DATA_ITEM_STYLE;
1038         itc_sto_data->func.text_get             = _gl_label_get_sto_data;
1039         itc_sto_data->func.content_get  = NULL;
1040         itc_sto_data->func.state_get    = NULL;
1041         itc_sto_data->func.del                  = NULL;
1042
1043         itc_data->item_style                    = ITC_DATA_ITEM_STYLE;
1044         itc_data->func.text_get                 = NULL;
1045         itc_data->func.content_get              = _gl_icon_get_data;
1046         itc_data->func.state_get                = NULL;
1047         itc_data->func.del                              = NULL;
1048
1049         itc_launch_title->item_style    = ITC_LAUNCH_TITLE_ITEM_STYLE;
1050         itc_launch_title->func.text_get = _gl_label_get_title;
1051         itc_launch_title->func.content_get      = NULL;
1052         itc_launch_title->func.state_get        = NULL;
1053         itc_launch_title->func.del              = NULL;
1054
1055         itc_launch->item_style                  = ITC_LAUNCH_ITEM_STYLE;
1056         itc_launch->func.text_get               = _gl_label_get_launch;
1057         itc_launch->func.content_get    = NULL;
1058         itc_launch->func.state_get              = NULL;
1059         itc_launch->func.del                    = NULL;
1060
1061         itc_launch_text->item_style     = ITC_LAUNCH_TEXT_ITEM_STYLE;
1062         itc_launch_text->func.text_get  = _gl_label_get_launch_text;
1063         itc_launch_text->func.content_get       = NULL;
1064         itc_launch_text->func.state_get = NULL;
1065         itc_launch_text->func.del               = NULL;
1066
1067         itc_detail->item_style                  = ITC_DETAIL_ITEM_STYLE;
1068         itc_detail->func.text_get               = _gl_label_get_detail;
1069         itc_detail->func.content_get    = NULL;
1070         itc_detail->func.state_get              = NULL;
1071         itc_detail->func.del                    = NULL;
1072
1073
1074         retv_if(ugd->data == NULL, NULL);
1075         mgr_app_app_info_t *app_info = (mgr_app_app_info_t*)ugd->data;
1076
1077         /* get app size from pkgmgr */
1078         pkgmgr_info *pkg_info = pkgmgr_info_new(app_info->pkg_type, app_info->pkg_name);
1079         if (!pkg_info) {
1080                 MGR_APP_DEBUG_ERR("pkg_info is null, couldn't get the sizes");
1081                 app_info->data_size = 0;
1082                 app_info->total_size = 0;
1083         } else {
1084                 char *buf = NULL;
1085
1086                 buf = pkgmgr_info_get_string(pkg_info, STR_DATA_SIZE);
1087                 if (buf) {
1088                         app_info->data_size = atoi(buf);
1089                         MGR_APP_MEM_FREE(buf);
1090                 } else {
1091                         app_info->data_size = 0;
1092                 }
1093
1094                 buf = NULL;
1095                 buf = pkgmgr_info_get_string(pkg_info, STR_INSTALLED_SIZE);
1096                 if (buf) {
1097                         app_info->total_size = atoi(buf);
1098                         MGR_APP_MEM_FREE(buf);
1099                 } else {
1100                         app_info->total_size = 0;
1101                 }
1102                 pkgmgr_info_free(pkg_info);
1103         }
1104
1105         /* add a genlist */
1106         genlist = elm_genlist_add(parent);
1107         retv_if(genlist == NULL, NULL);
1108         evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1109         evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
1110         elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
1111         elm_genlist_scroller_policy_set(genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
1112         evas_object_data_set(genlist, STR_UGD, (void*)ugd);
1113         elm_object_style_set(genlist, "dialogue");
1114         evas_object_show(genlist);
1115
1116         MGR_APP_MEM_STRDUP(sto_title, dgettext(PACKAGE, "IDS_ST_BODY_STORAGE"));
1117         MGR_APP_MEM_STRDUP(launch_title, dgettext(PACKAGE, "IDS_ST_BODY_LAUNCH_BY_DEFAULT"));
1118
1119
1120         /* app info */
1121         item_app = elm_genlist_item_append(genlist, itc, (void *)app_info, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
1122         if (item_app)
1123                 elm_genlist_item_select_mode_set(item_app, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1124
1125
1126         /* separator with no bottom line */
1127         item_sep_10 = elm_genlist_item_append(genlist, itc_sep_10, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
1128         if (item_sep_10)
1129                 elm_genlist_item_select_mode_set(item_sep_10, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1130
1131
1132         /* Force stop & Uninstall */
1133         item_life = elm_genlist_item_append(genlist, itc_life, (void *)app_info, NULL, ELM_GENLIST_ITEM_NONE, _gl_sel, NULL);
1134
1135
1136         /* Storage */
1137         item_sto_title = elm_genlist_item_append(genlist, itc_sto_title, sto_title, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
1138         item_sto_total = elm_genlist_item_append(genlist, itc_sto_total, (void *)app_info, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
1139         if (item_sto_total)
1140                 elm_genlist_item_select_mode_set(item_sto_total, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1141         item_sto_app = elm_genlist_item_append(genlist, itc_sto_app, (void *)app_info, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
1142         if (item_sto_app)
1143                 elm_genlist_item_select_mode_set(item_sto_app, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1144         item_sto_data = elm_genlist_item_append(genlist, itc_sto_data, (void *)app_info, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
1145         if (item_sto_data)
1146                 elm_genlist_item_select_mode_set(item_sto_data, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1147
1148
1149         /* separator with no bottom line */
1150         //item_sep_10 = elm_genlist_item_append(genlist, itc_sep_10, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
1151         //if (item_sep_10)
1152         //      elm_genlist_item_select_mode_set(item_sep_10, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1153
1154
1155         /* Clear Data */
1156         /* remove the button until the feature is supported */
1157         //item_data = elm_genlist_item_append(genlist, &itc_data, (void *)app_info, NULL, ELM_GENLIST_ITEM_NONE, _gl_sel, NULL);
1158
1159
1160         /* separator with bottom line */
1161         /* the separator is located bottom of Clear Data button */
1162         //item_sep_10 = elm_genlist_item_append(genlist, &itc_sep_10, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
1163         //if (item_sep_10)
1164         //      elm_genlist_item_select_mode_set(item_sep_10, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1165
1166
1167         /* Launch */
1168         item_launch_title = elm_genlist_item_append(genlist, itc_launch_title, launch_title, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
1169         item_launch = elm_genlist_item_append(genlist, itc_launch, (void *)app_info, NULL, ELM_GENLIST_ITEM_NONE, _gl_sel_launch, (void*)ugd);
1170         if (item_launch && !appsvc_is_defapp(app_info->pkg_name)) {
1171                 elm_genlist_item_selected_set(item_launch, EINA_FALSE);
1172                 elm_object_item_disabled_set(item_launch, EINA_TRUE);
1173         }
1174         item_launch_text = elm_genlist_item_append(genlist, itc_launch_text, (void *)app_info, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
1175         if (item_launch_text)
1176                 elm_genlist_item_select_mode_set(item_launch_text, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1177         item_sep_21 = elm_genlist_item_append(genlist, itc_sep_21, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
1178         if (item_sep_21)
1179                 elm_genlist_item_select_mode_set(item_sep_21, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1180
1181
1182         /* More Detail */
1183         item_detail = elm_genlist_item_append(genlist, itc_detail, (void *)app_info, NULL, ELM_GENLIST_ITEM_NONE, _gl_sel_detail, (void*)ugd);
1184         if (app_info->pkg_type) {
1185                 if (item_detail != NULL && (!strncmp(app_info->pkg_type, TPK_PREFIX, strlen(TPK_PREFIX)) || !strncmp(app_info->pkg_type, RPM_PREFIX, strlen(RPM_PREFIX)))) {
1186                         elm_genlist_item_selected_set(item_detail, EINA_FALSE);
1187                         elm_object_item_disabled_set(item_detail, EINA_TRUE);
1188                 }
1189         } else {
1190                 MGR_APP_DEBUG_ERR("app_info->pkg_type is NULL");
1191         }
1192
1193         if (elm_genlist_first_item_get(genlist)) {
1194                 item_sep_21 = elm_genlist_item_prepend(genlist, itc_sep_21, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
1195                 if (item_sep_21)
1196                         elm_genlist_item_select_mode_set(item_sep_21, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1197         }
1198
1199         MGR_APP_END();
1200         return genlist;
1201 }
1202
1203 static Evas_Object *mgr_app_view_app_info_create(void *data)
1204 {
1205         MGR_APP_BEGIN();
1206
1207         retv_if(data == NULL, NULL);
1208         struct ug_data *ugd = (struct ug_data*)data;
1209
1210         retv_if(mgr_app_view_app_info.view_common_data == NULL, NULL);
1211         mgr_app_view_common_data_t *view_common_data = mgr_app_view_app_info.view_common_data;
1212
1213         MGR_APP_MEM_MALLOC(view_common_data->user_view_data, 1, app_info_view_data_t);
1214         retv_if(view_common_data->user_view_data == NULL, NULL);
1215         app_info_view_data_t *app_info_view_data = view_common_data->user_view_data;
1216
1217         app_info_view_data->genlist = __create_genlist_app_info(view_common_data->common_navibar, (void*)ugd);
1218
1219         MGR_APP_END();
1220         return app_info_view_data->genlist;
1221 }
1222
1223 static Evas_Object *mgr_app_view_app_info_set_cbar(void *data)
1224 {
1225         MGR_APP_BEGIN();
1226         MGR_APP_END();
1227
1228         return NULL;
1229 }
1230
1231 static mgr_app_result_e mgr_app_view_app_info_set_navibar(void *data)
1232 {
1233         MGR_APP_BEGIN();
1234         mgr_app_view_manager_set_navibar(mgr_app_view_app_info.view_common_data, /*dgettext(PACKAGE, "IDS_ST_HEADER_APPLICATION_INFO")*/STR_TITLE_APPLICATION_INFO, NULL, _app_info_back_cb, NULL, NULL);
1235         MGR_APP_END();
1236         return MGR_APP_OK;
1237 }
1238
1239 static mgr_app_result_e mgr_app_view_app_info_destory(void *data)
1240 {
1241         MGR_APP_BEGIN();
1242
1243         retv_if(mgr_app_view_app_info.view_common_data == NULL, MGR_APP_ERROR);
1244         mgr_app_view_app_info.view_common_data->view_layout = NULL;
1245
1246         MGR_APP_END();
1247         return MGR_APP_OK;
1248 }
1249
1250 static mgr_app_result_e mgr_app_view_app_info_update(void *data)
1251 {
1252         MGR_APP_BEGIN();
1253
1254         retv_if(mgr_app_view_app_info.view_common_data == NULL, MGR_APP_ERROR);
1255         mgr_app_view_common_data_t *view_common_data = mgr_app_view_app_info.view_common_data;
1256
1257         retv_if(view_common_data->user_view_data == NULL, MGR_APP_ERROR);
1258         app_info_view_data_t *app_info_view_data = (app_info_view_data_t*)view_common_data->user_view_data;
1259
1260         elm_genlist_realized_items_update(app_info_view_data->genlist);
1261
1262         /* button disable */
1263         if (!app_info_view_data->genlist) {
1264                 MGR_APP_DEBUG("genlist is null\n");
1265                 elm_object_item_disabled_set(app_info_view_data->cbar_item, EINA_TRUE);
1266         }
1267
1268         MGR_APP_END();
1269         return MGR_APP_OK;
1270 }
1271 static mgr_app_result_e mgr_app_view_app_info_cleanup(void *data)
1272 {
1273         MGR_APP_BEGIN();
1274         MGR_APP_END();
1275         return MGR_APP_OK;
1276 }
1277