2 * Copyright 2012 Samsung Electronics Co., Ltd
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
8 * http://www.tizenopensource.org/license
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.
22 #include <appcore-efl.h>
33 #include "taskmanager.h"
35 #include "_util_log.h"
36 #include "_util_efl.h"
41 #include "_progressbar.h"
46 pthread_mutex_t mutex_for_graph_update = PTHREAD_MUTEX_INITIALIZER;
47 static Elm_Object_Item *g_egi;
49 /* group list:gl, data list:dl, button list:bl, no list: nl */
50 static Elm_Genlist_Item_Class itc_gl;
51 static Elm_Genlist_Item_Class itc_hl;
52 static Elm_Genlist_Item_Class itc_dl;
53 static Elm_Genlist_Item_Class itc_bl;
54 static Elm_Genlist_Item_Class itc_nl;
55 static Elm_Genlist_Item_Class itc_separator4;
56 static Elm_Genlist_Item_Class itc_separator2;
58 static char *button_text[TS_MAX] = {
59 "IDS_TASKMGR_BUTTON_CLOSE_ALL_APPLICATIONS",
60 "IDS_TASKMGR_BUTTON_CLEAR_HISTORY_ABB"
63 static void end_all_inuse_cb(void *data, Evas_Object *obj, void *event_info);
64 static void delete_all_history_cb(void *data, Evas_Object *obj,
66 void (*func_del[TS_MAX]) (void *data, Evas_Object *obj, void *event_info) = {
67 &end_all_inuse_cb, &delete_all_history_cb};
69 static void end_inuse_cb(void *data, Evas_Object *obj, void *event_info);
70 static void delete_history_cb(void *data, Evas_Object *obj, void *event_info);
71 void (*func_end[TS_MAX]) (void *data, Evas_Object *obj, void *event_info) = {
72 &end_inuse_cb, &delete_history_cb};
74 static char *group_name[TS_MAX] = {
75 "IDS_TASKMGR_HEADER_RUNNING",
76 "IDS_TASKMGR_MBODY_RECENTLY_USED"
79 static char *nolist_text[TS_MAX] = {
80 "IDS_TASKMGR_MBODY_NO_APPS_OPEN",
81 "IDS_TASKMGR_MBODY_NO_RECENTLY_USED_APPS"
84 void taskmanager_free_info(struct _task_info *info);
85 Eina_Bool _update_list(void *data);
87 static void clear_genlist(void *data)
91 struct appdata *ad = data;
94 elm_genlist_clear(ad->gl);
98 void clear_task_manager_list(void *data)
100 ret_if(data == NULL);
102 struct appdata *ad = data;
103 _free_einalist_all(ad);
107 static void app_genlist_item_update(void *data)
109 ret_if(data == NULL);
111 struct appdata *ad = (struct appdata *)data;
113 Elm_Object_Item *it_r;
114 Eina_List *realized_item_list, *l_r;
115 unsigned int cnt = 0;
117 realized_item_list = elm_genlist_realized_items_get(ad->gl);
118 cnt = eina_list_count(realized_item_list);
120 EINA_LIST_FOREACH(realized_item_list, l_r, it_r) {
122 elm_genlist_item_update(it_r);
128 Eina_Bool alert_app_info(void *data)
130 retv_if(data == NULL, -1);
132 struct appdata *ad = (struct appdata *)data;
134 app_genlist_item_update(ad);
135 return ECORE_CALLBACK_CANCEL;
138 static void end_all_inuse_cb(void *data, Evas_Object *obj, void *event_info)
140 ret_if(data == NULL);
142 struct appdata *ad = data;
143 char buf[_BUF_MAX] = { 0, };
145 ad->mode = MODE_END_ALL_INUSE;
146 snprintf(buf, sizeof(buf), T_("IDS_TASKMGR_POP_CLOSE_ALL_APPS_Q_THIS_MAY_CAUSE_DATA_TO_BE_LOST"));
148 evas_object_del(ad->popup_ask);
149 ad->popup_ask = NULL;
151 ad->popup_ask = _add_popup_ask(ad->win, buf, ad);
155 delete_all_history_cb(void *data, Evas_Object *obj, void *event_info)
158 ret_if(data == NULL);
160 struct appdata *ad = data;
161 char buf[_BUF_MAX] = { 0, };
163 ad->mode = MODE_DEL_ALL_HISTORY;
164 snprintf(buf, sizeof(buf), T_("IDS_TASKMGR_POP_CLEAR_ALL_APP_HISTORY_Q"));
166 evas_object_del(ad->popup_ask);
167 ad->popup_ask = NULL;
169 ad->popup_ask = _add_popup_ask(ad->win, buf, ad);
172 static void end_inuse_cb(void *data, Evas_Object *obj, void *event_info)
174 ret_if(data == NULL);
176 struct _task_info *info_ev = (struct _task_info *)data;
177 struct appdata *ad = info_ev->ad;
178 char buf[_BUF_MAX] = { 0, };
180 ad->mode = MODE_END_INUSE;
181 snprintf(buf, _BUF_MAX, T_("IDS_TASKMGR_POP_CLOSE_PS_APP_Q_THIS_MAY_CAUSE_DATA_TO_BE_LOST"), info_ev->app_name);
183 evas_object_del(ad->popup_ask);
184 ad->popup_ask = NULL;
186 ad->popup_ask = _add_popup_ask(ad->win, buf, ad);
187 g_egi = (void *)info_ev->it;
190 static void delete_history_cb(void *data, Evas_Object *obj, void *event_info)
192 ret_if(data == NULL);
194 struct _task_info *info_ev = (struct _task_info *)data;
195 struct appdata *ad = info_ev->ad;
196 char buf[_BUF_MAX] = { 0, };
198 ad->mode = MODE_DEL_HISTORY;
200 snprintf(buf, _BUF_MAX, T_("IDS_TASKMGR_POP_CLEAR_PS_HISTORY_Q"), info_ev->app_name);
202 evas_object_del(ad->popup_ask);
203 ad->popup_ask = NULL;
205 ad->popup_ask = _add_popup_ask(ad->win, buf, ad);
206 g_egi = (void *)info_ev->it;
209 static void nl_sel(void *data, Evas_Object *obj, void *event_info)
212 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
213 elm_genlist_item_selected_set(item, EINA_FALSE);
217 static char *nl_text_get(void *data, Evas_Object *obj, const char *part)
219 char buf[_BUF_MAX] = { 0, };
221 if (!strcmp(part, "elm.text")) {
222 snprintf(buf, sizeof(buf), "%s", T_(nolist_text[(int)data]));
229 static void _gl_sel_app(void *data, Evas_Object *obj, void *event_info)
232 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
233 struct appdata *ad = (struct appdata *)data;
234 struct _task_info *info;
235 /* parameter to block double click */
236 static int selected = 0;
237 Elm_Object_Item *it = (Elm_Object_Item *) event_info;
240 elm_genlist_item_selected_set(it, EINA_FALSE);
242 retm_if(ad == NULL, "Invalid argument: appdata is NULL\n");
245 if (ad->update_timer) {
246 ecore_timer_del(ad->update_timer);
247 ad->update_timer = NULL;
255 _E("[Error] Cannot find genlist item\n");
260 info = (struct _task_info *)elm_object_item_data_get(item);
262 _E("[Error] Cannot get item data: info\n");
268 /* when application is alive */
269 ret = aul_resume_pid(info->pid);
272 /* when application is dead */
273 if (info->pkg_name == NULL) {
274 util_show_popup_with_message(info->ad->win,
276 T_("IDS_TASKMGR_POP_UNABLE_TO_OPEN_APPLICATION"));
280 _unset_notification_level(info->ad->win);
282 if (!strcmp(info->pkg_name, "org.tizen.phone")) {
283 /* exception : Because dialer doesn't need bundle
284 * since being unifyed dialer, voice call and video call
286 ret = aul_launch_app(info->pkg_name, NULL);
289 ret = aul_launch_app(info->pkg_name, info->b);
295 _D("exit after 0.3 sec\n");
296 ad->exit_timer = ecore_timer_add(0.3, _exit_cb, ad);
301 static Evas_Object *_gl_content_get_app(void *data, Evas_Object *obj,
304 struct _task_info *info = (struct _task_info *)data;
305 char buf[_BUF_MAX] = { 0, };
307 Evas_Object *icon = NULL;
308 Evas_Object *btn = NULL;
310 Evas_Object *rt, *icon_ly = NULL;
312 retvm_if(data == NULL, NULL, "Invalid argument: task info is NULL\n");
314 if (!strcmp(part, "elm.icon.1")) {
315 snprintf(buf, sizeof(buf), "%s", info->icn_path);
316 retvm_if(buf == NULL, NULL, "%s icon is NULL\n", info->app_name);
317 if (!ecore_file_exists(buf) || strlen(buf) < 4)
318 snprintf((char *)buf, (size_t) sizeof(buf),
319 (const char *)IMAGEDIR "/icon_taskmgr.png");
321 if (!strncmp(&buf[strlen(buf) - 3], "edj", 3)) {
322 icon_ly = _add_layout(obj, buf, "icon");
325 icon_ly = elm_icon_add(obj);
326 elm_icon_file_set(icon_ly, buf, NULL);
329 icon = _add_layout(obj, EDJ_NAME, "icon");
330 retvm_if(icon == NULL, NULL, "Cannot add layout: icon\n");
332 rt = evas_object_rectangle_add(evas_object_evas_get(obj));
333 retvm_if(rt == NULL, NULL, "Failed to add rectangle\n");
335 evas_object_color_set(rt, 0, 0, 0, 0);
336 evas_object_size_hint_min_set(rt,
337 (int)72 * elm_scale_get(),
338 (int)72 * elm_scale_get());
339 elm_object_part_content_set(icon, "icon_ly", rt);
341 elm_object_part_content_set(icon, "icon", icon_ly);
345 } else if (!strcmp(part, "elm.icon.2")) {
346 btn = elm_button_add(obj);
347 elm_object_text_set(btn, S_("IDS_COM_BODY_END"));
348 elm_object_style_set(btn, "default");
350 evas_object_smart_callback_add(btn, "clicked",
351 func_end[info->category], info);
352 elm_object_focus_set(btn, EINA_FALSE);
353 evas_object_propagate_events_set(btn, EINA_FALSE);
361 static char *_gl_text_get_app(void *data, Evas_Object *obj, const char *part)
363 struct _task_info *info = (struct _task_info *)data;
364 char buf[_BUF_MAX] = { 0, };
367 retvm_if(data == NULL, NULL, "Invalid argument: task info is NULL\n");
368 retvm_if(part == NULL, NULL, "Invalid argument: part is NULL\n");
370 if (!strcmp(part, "elm.text.1")) {
371 snprintf(buf, _BUF_MAX, "%s", info->app_name);
374 } else if (!strcmp(part, "elm.text.2")) {
375 if (info->category == TS_INUSE) {
376 snprintf(buf, _BUF_MAX, "CPU: %.1f%%", info->cpu);
381 elm_object_signal_emit(info->it, "prog.hide.mem","taskmanager");
389 static void _bl_sel(void *data, Evas_Object *obj, void *event_info)
392 int mode = (int)data;
394 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
396 elm_genlist_item_selected_set(item, EINA_FALSE);
399 static char *_bl_text_get(void *data, Evas_Object *obj, const char *part)
401 if (!strcmp(part, "elm.text")) {
402 return strdup(T_(button_text[(int)data]));
408 static Evas_Object *_bl_content_get(void *data, Evas_Object *obj,
411 Evas_Object *btn = NULL;
412 struct appdata *ad = evas_object_data_get(obj, "appdata");
414 if (!strcmp(part, "elm.icon")) {
416 btn = elm_button_add(obj);
417 elm_object_style_set(btn, "default");
419 elm_object_text_set(btn, T_(button_text[(int)data]));
420 evas_object_smart_callback_add(btn, "clicked",
421 func_del[(int)data], ad);
422 elm_object_focus_set(btn, EINA_FALSE);
424 evas_object_size_hint_min_set(btn, 0, 50);
425 evas_object_size_hint_max_set(btn, 0, 50);
426 evas_object_propagate_events_set(btn, EINA_FALSE);
434 static char *_gl_text_get_title(void *data, Evas_Object *obj, const char *part)
438 if (!strcmp(part, "elm.text")) {
439 snprintf(buf, sizeof(buf), "%s (%d)",
440 T_(group_name[(int)data]), _get_grp_cnt((int)data));
446 static char *_gl_text_get_his(void *data, Evas_Object *obj, const char *part)
448 struct _task_info *info = (struct _task_info *)data;
449 char buf[_BUF_MAX] = { 0, };
452 if (!strcmp(part, "elm.text")) {
453 snprintf(buf, _BUF_MAX, "%s", info->app_name);
459 static Evas_Object *_gl_content_get_his(void *data, Evas_Object *obj,
462 struct _task_info *info = (struct _task_info *)data;
463 char buf[_BUF_MAX] = { 0, };
465 Evas_Object *icon = NULL;
466 Evas_Object *btn = NULL;
468 Evas_Object *rt, *icon_ly = NULL;
469 retvm_if(data == NULL, NULL, "Invalid argument: task info is NULL\n");
471 if (!strcmp(part, "elm.icon.1")) {
472 snprintf(buf, sizeof(buf), "%s", info->icn_path);
473 retvm_if(buf == NULL, NULL, "%s icon is NULL\n", info->app_name);
474 if (!ecore_file_exists(buf) || strlen(buf) < 4)
475 snprintf((char *)buf, (size_t) sizeof(buf),
476 (const char *)IMAGEDIR "/icon_taskmgr.png");
478 if (!strncmp(&buf[strlen(buf) - 3], "edj", 3)) {
479 icon_ly = _add_layout(obj, buf, "icon");
482 icon_ly = elm_icon_add(obj);
483 elm_icon_file_set(icon_ly, buf, NULL);
486 icon = _add_layout(obj, EDJ_NAME, "icon");
487 retvm_if (icon == NULL, NULL, "Cannot add layout: icon\n");
489 rt = evas_object_rectangle_add(evas_object_evas_get(obj));
490 retvm_if (rt == NULL, NULL, "Failed to add rectangle\n");
492 evas_object_color_set(rt, 0, 0, 0, 0);
493 evas_object_size_hint_min_set(rt,
494 (int)72 * elm_scale_get(),
495 (int)72 * elm_scale_get());
496 elm_object_part_content_set(icon, "icon_ly", rt);
498 elm_object_part_content_set(icon, "icon", icon_ly);
502 } else if (!strcmp(part, "elm.icon.2")) {
503 btn = elm_button_add(obj);
504 elm_object_text_set(btn, S_("IDS_COM_OPT_DELETE"));
505 elm_object_style_set(btn, "default");
507 evas_object_smart_callback_add(btn, "clicked",
508 func_end[info->category], info);
509 elm_object_focus_set(btn, EINA_FALSE);
510 evas_object_propagate_events_set(btn, EINA_FALSE);
521 itc_gl.item_style = "grouptitle";
522 itc_gl.func.text_get = _gl_text_get_title;
524 itc_dl.item_style = "2text.2icon.7";
525 itc_dl.func.text_get = _gl_text_get_app;
526 itc_dl.func.content_get = _gl_content_get_app;
528 itc_hl.item_style = "1text.2icon.4";
529 itc_hl.func.text_get = _gl_text_get_his;
530 itc_hl.func.content_get = _gl_content_get_his;
532 itc_separator4.item_style = "dialogue/seperator.4";
533 itc_separator2.item_style = "dialogue/seperator.2";
535 itc_bl.item_style = "1icon";
536 itc_bl.func.content_get = _bl_content_get;
538 itc_nl.item_style = "1text";
539 itc_nl.func.text_get = nl_text_get;
543 int check_genlist(struct appdata *ad)
545 Elm_Object_Item *egi;
546 struct _task_info *info;
549 egi = elm_genlist_first_item_get(ad->gl);
551 info = (struct _task_info *)elm_object_item_data_get(egi);
553 _D("%s info[0x%x]\n", (int)info < 3 ? "-" : info->app_name, info);
557 egi = elm_genlist_item_next_get(egi);
563 int _set_genlist_from_eina(struct appdata *ad)
567 Elm_Object_Item *git, *item;
568 struct _task_info *info;
571 retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
572 retvm_if(ad->gl == NULL, -1, "Invalid argument:genlist is NULL\n");
574 for (i = 0; i < TS_MAX; i++) {
575 git = elm_genlist_item_append(ad->gl, &itc_gl,
577 ELM_GENLIST_ITEM_NONE,
579 retvm_if(git == NULL, -1, "Failed append item\n");
580 elm_genlist_item_select_mode_set(git, ELM_OBJECT_SELECT_MODE_NONE);
582 if (eina_list_count(ad->applist[i]) > 0) {
584 item = elm_genlist_item_append(ad->gl, &itc_separator4,
586 ELM_GENLIST_ITEM_NONE,
588 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
591 item = elm_genlist_item_append(ad->gl, &itc_bl,
593 ELM_GENLIST_ITEM_NONE,
596 item = elm_genlist_item_append(ad->gl, &itc_separator2,
598 ELM_GENLIST_ITEM_NONE,
600 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
602 ad->applist[i] = eina_list_nth_list(ad->applist[i], 0);
603 EINA_LIST_FOREACH(ad->applist[i], l, info) {
605 info->it = elm_genlist_item_append(ad->gl,
606 (i == TS_INUSE) ? &itc_dl : &itc_hl,
608 ELM_GENLIST_ITEM_NONE,
613 item = elm_genlist_item_append(ad->gl, &itc_nl,
615 ELM_GENLIST_ITEM_NONE,
617 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
623 Eina_Bool _update_list(void *data)
626 struct appdata *ad = data;
627 Eina_List *l, *l_next;
628 struct _task_info *info;
630 pthread_mutex_lock(&mutex_for_graph_update);
632 if(ad->applist[TS_INUSE] == NULL) {
633 _D("inuse is NULL\n");
634 pthread_mutex_unlock(&mutex_for_graph_update);
635 ad->update_timer = NULL;
636 return ECORE_CALLBACK_CANCEL;
638 ad->applist[TS_INUSE] = eina_list_nth_list(ad->applist[TS_INUSE], 0);
639 _D("%d\n", eina_list_count(ad->applist[TS_INUSE]));
641 EINA_LIST_FOREACH_SAFE(ad->applist[TS_INUSE], l, l_next, info) {
642 elm_genlist_item_fields_update(info->it, "elm.text*", ELM_GENLIST_ITEM_FIELD_TEXT);
644 pthread_mutex_unlock(&mutex_for_graph_update);
645 return ECORE_CALLBACK_RENEW;
648 void *_update_pthread_cb(void *data)
651 struct appdata *ad = data;
654 Eina_List *l, *l_next;
655 struct _task_info *info;
659 if (ad->ending == EINA_FALSE) {
660 if(ad->applist[TS_INUSE] == NULL) {
661 _D("in use list is NULL\n");
662 return ECORE_CALLBACK_CANCEL;
665 _get_sysconf(&ncpu, &tick);
667 ad->applist[TS_INUSE] = eina_list_nth_list(ad->applist[TS_INUSE], 0);
668 if (eina_list_count(ad->applist[TS_INUSE]) < 1) {
669 _D("list count is 0\n");
673 EINA_LIST_FOREACH_SAFE(ad->applist[TS_INUSE], l, l_next, info) {
675 info->cpu = _get_cpu_ratio(info, ncpu, tick);
676 _D("%d / %lf\n", info->pid, info->cpu);
688 void _set_genlist(struct appdata *ad)
691 retm_if(ad == NULL, "Invalid argument: appdata is NULL\n");
692 int ret = AUL_R_ERROR;
694 int sleep_value = 1000;
698 while (ret != AUL_R_OK && retry_cnt < 5) {
700 ret = aul_app_get_running_app_info(runapp_info_get, ad);
702 if (ret != AUL_R_OK) {
703 _D("Fail to get running app information from ail");
710 taskmanager_get_history_app_info(ad);
711 _set_genlist_from_eina(ad);
715 void _init_pthread(void)
717 pthread_mutex_init(&pm, NULL);
718 pthread_cond_init(&pc, NULL);
721 void _fini_pthread(void)
729 void refresh_app_info(struct appdata *ad)
732 retm_if(ad == NULL, "Invalid argument: appdata is NULL\n");
734 _free_einalist_all(ad);
743 void _del_popup_timer(struct appdata *ad)
745 if (ad->popup_timer) {
746 ecore_timer_del(ad->popup_timer);
747 ad->popup_timer = NULL;
751 void taskmanager_free_info(struct _task_info *info)
754 if (info->app_name) {
755 free(info->app_name);
756 info->app_name = NULL;
758 if (info->pkg_name) {
759 free(info->pkg_name);
760 info->pkg_name = NULL;
762 if (info->icn_path) {
763 free(info->icn_path);
764 info->icn_path = NULL;
771 void _restart_pthread(struct appdata *ad)
775 if (eina_list_count(ad->applist[TS_INUSE]) > 0) {
777 pthread_create(&pt, NULL, _update_pthread_cb, ad);
779 if (ad->update_timer) {
780 ecore_timer_del(ad->update_timer);
781 ad->update_timer = NULL;
783 ad->update_timer = ecore_timer_add(2.0, _update_list, ad);
786 int response_end_inuse(struct appdata *ad)
789 Eina_List *l, *l_next;
790 struct _task_info *info;
791 Elm_Object_Item *egi;
792 Eina_Bool dead = EINA_FALSE;
794 retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
796 ad->ending = EINA_TRUE;
798 EINA_LIST_FOREACH_SAFE(ad->applist[TS_INUSE], l, l_next, info) {
799 _D("applist pid : %d", info->pid);
800 if (info->it == g_egi) {
801 _D("matched applist pid : %d", info->pid);
803 if (aul_terminate_pid(info->pid) < 0) {
804 kill(info->pid, SIGKILL);
811 ad->ending = EINA_FALSE;
814 _D("matched applist is nothing\n");
815 _del_progressbar(ad);
821 Eina_Bool _refresh_idler_cb(void *data)
824 struct appdata *ad = (struct appdata *)data;
825 retvm_if(data == NULL, ECORE_CALLBACK_CANCEL, "Invalid argument: appdata is NULL\n:");
827 _del_popup_timer(ad);
828 _del_progressbar(ad);
829 refresh_app_info(ad);
830 return ECORE_CALLBACK_CANCEL;
833 int response_end_all_inuse(struct appdata *ad)
836 struct _task_info *info;
838 retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
840 ad->ending = EINA_TRUE;
842 if(ad->update_timer) {
843 ecore_timer_del(ad->update_timer);
844 ad->update_timer = NULL;
847 ad->endcnt = eina_list_count(ad->applist[TS_INUSE]);
848 _D("set end count (%d)\n", ad->endcnt);
850 EINA_LIST_FOREACH(ad->applist[TS_INUSE], l, info) {
852 _D("applist pid : %d", info->pid);
854 if (aul_terminate_pid(info->pid) < 0) {
855 kill(info->pid, SIGKILL);
861 ad->ending = EINA_FALSE;
865 int response_del_history(struct appdata *ad)
867 Eina_List *l, *l_next;
868 struct _task_info *info;
869 Elm_Object_Item *egi;
871 retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
873 _show_progressbar(ad);
874 EINA_LIST_FOREACH_SAFE(ad->applist[TS_HISTORY], l, l_next, info) {
875 _D("history applist pid : %d", info->pid);
876 if (info->it == g_egi) {
878 if (rua_init() == -1) {
881 rua_delete_history_with_pkgname(info->pkg_name);
884 ad->applist[TS_HISTORY] =
885 eina_list_remove_list(ad->applist[TS_HISTORY], l);
888 bundle_free(info->b);
891 elm_object_item_del(info->it);
892 taskmanager_free_info(info);
897 refresh_app_info(ad);
898 _del_popup_timer(ad);
899 _del_progressbar(ad);
901 ad->mode = MODE_NONE;
905 int response_del_all_history(struct appdata *ad)
908 struct _task_info *info;
910 retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
912 if(ad->update_timer) {
913 _D("update timer is deleted\n");
914 ecore_timer_del(ad->update_timer);
915 ad->update_timer = NULL;
919 _show_progressbar(ad);
921 if (rua_init() == -1) {
925 EINA_LIST_FOREACH(ad->applist[TS_HISTORY], l, info) {
927 rua_delete_history_with_pkgname(info->pkg_name);
931 if (eina_list_count(ad->applist[TS_INUSE]) == 0) {
936 refresh_app_info(ad);
937 _del_popup_timer(ad);
938 _del_progressbar(ad);
940 ad->mode = MODE_NONE;
944 int response_kill_inuse(struct appdata *ad)
946 Eina_List *l, *l_next;
947 struct _task_info *info;
948 Elm_Object_Item *egi;
950 retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
952 _show_progressbar(ad);
954 EINA_LIST_FOREACH_SAFE(ad->applist[TS_INUSE], l, l_next, info) {
955 _D("kill applist pid : %d", info->pid);
956 if (info->it == g_egi) {
958 kill(info->pid, SIGKILL);
961 ad->applist[TS_INUSE] =
962 eina_list_remove_list(ad->applist[TS_INUSE], l);
963 taskmanager_free_info(info);
967 refresh_app_info(ad);
968 _del_progressbar(ad);
973 int response_kill_all_inuse(struct appdata *ad)
976 struct _task_info *info;
978 retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
980 _show_progressbar(ad);
982 EINA_LIST_FOREACH(ad->applist[TS_INUSE], l, info) {
983 _D("kill all applist pid : %d", info->pid);
986 kill(info->pid, SIGKILL);
990 refresh_app_info(ad);
991 _del_progressbar(ad);