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