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.
20 #include <appcore-efl.h>
31 #include "taskmanager.h"
33 #include "_util_log.h"
34 #include "_util_efl.h"
39 #include "_progressbar.h"
44 pthread_mutex_t mutex_for_graph_update = PTHREAD_MUTEX_INITIALIZER;
45 static Elm_Object_Item *g_egi;
47 /* group list:gl, data list:dl, button list:bl, no list: nl */
48 static Elm_Genlist_Item_Class itc_gl;
49 static Elm_Genlist_Item_Class itc_hl;
50 static Elm_Genlist_Item_Class itc_dl;
51 static Elm_Genlist_Item_Class itc_bl;
52 static Elm_Genlist_Item_Class itc_nl;
53 static Elm_Genlist_Item_Class itc_separator4;
54 static Elm_Genlist_Item_Class itc_separator2;
56 static char *button_text[TS_MAX] = {
57 "IDS_COM_SK3_END_ALL_APPLICATIONS",
58 "IDS_TASKMGR_DELETE_ALL_HISTORY"
61 static void end_all_inuse_cb(void *data, Evas_Object *obj, void *event_info);
62 static void delete_all_history_cb(void *data, Evas_Object *obj,
64 void (*func_del[TS_MAX]) (void *data, Evas_Object *obj, void *event_info) = {
65 &end_all_inuse_cb, &delete_all_history_cb};
67 static char *icon_text[TS_MAX] = {
72 static void end_inuse_cb(void *data, Evas_Object *obj, void *event_info);
73 static void delete_history_cb(void *data, Evas_Object *obj, void *event_info);
74 void (*func_end[TS_MAX]) (void *data, Evas_Object *obj, void *event_info) = {
75 &end_inuse_cb, &delete_history_cb};
77 static char *group_name[TS_MAX] = {
79 "IDS_MUSIC_OPT_HISTORY"
82 static char *nolist_text[TS_MAX] = {
83 "IDS_TASKMGR_NO_RUNNING_TASK",
84 "IDS_TASKMGR_NO_TASK_HISTORY"
87 void taskmanager_free_info(struct _task_info *info);
88 Eina_Bool _update_list(void *data);
90 static void clear_genlist(void *data)
94 struct appdata *ad = data;
97 elm_genlist_clear(ad->gl);
101 void clear_task_manager_list(void *data)
103 ret_if(data == NULL);
105 struct appdata *ad = data;
106 _free_einalist_all(ad);
110 static void app_genlist_item_update(void *data)
112 ret_if(data == NULL);
114 struct appdata *ad = (struct appdata *)data;
116 Elm_Object_Item *it_r;
117 Eina_List *realized_item_list, *l_r;
118 unsigned int cnt = 0;
120 realized_item_list = elm_genlist_realized_items_get(ad->gl);
121 cnt = eina_list_count(realized_item_list);
123 EINA_LIST_FOREACH(realized_item_list, l_r, it_r) {
125 elm_genlist_item_update(it_r);
131 Eina_Bool alert_app_info(void *data)
133 retv_if(data == NULL, -1);
135 struct appdata *ad = (struct appdata *)data;
137 app_genlist_item_update(ad);
138 return ECORE_CALLBACK_CANCEL;
141 static void end_all_inuse_cb(void *data, Evas_Object *obj, void *event_info)
143 ret_if(data == NULL);
145 struct appdata *ad = data;
146 char buf[_BUF_MAX] = { 0, };
148 ad->mode = MODE_END_ALL_INUSE;
149 snprintf(buf, sizeof(buf), _("IDS_TASKMGR_WARNNING_TERMINATE_ALL_TASKS"));
151 evas_object_del(ad->popup_ask);
152 ad->popup_ask = NULL;
154 ad->popup_ask = _add_popup_ask(ad->win, buf, ad);
158 delete_all_history_cb(void *data, Evas_Object *obj, void *event_info)
161 ret_if(data == NULL);
163 struct appdata *ad = data;
164 char buf[_BUF_MAX] = { 0, };
166 // refresh_app_info(ad);
168 ad->mode = MODE_DEL_ALL_HISTORY;
169 snprintf(buf, sizeof(buf), _("IDS_TASKMGR_ASK_DELETE_ALL_HISTORY"));
171 evas_object_del(ad->popup_ask);
172 ad->popup_ask = NULL;
174 ad->popup_ask = _add_popup_ask(ad->win, buf, ad);
177 static void end_inuse_cb(void *data, Evas_Object *obj, void *event_info)
179 ret_if(data == NULL);
181 struct _task_info *info_ev = (struct _task_info *)data;
182 struct appdata *ad = info_ev->ad;
183 char buf[_BUF_MAX] = { 0, };
185 ad->mode = MODE_END_INUSE;
186 snprintf(buf, _BUF_MAX, _("IDS_TASKMGR_ASK_TERMINATE_TASK"), info_ev->app_name);
188 evas_object_del(ad->popup_ask);
189 ad->popup_ask = NULL;
191 ad->popup_ask = _add_popup_ask(ad->win, buf, ad);
192 g_egi = (void *)info_ev->it;
193 // evas_object_data_set(ad->popup_ask, "selected_egi", (void *)info_ev->it);
196 static void delete_history_cb(void *data, Evas_Object *obj, void *event_info)
198 ret_if(data == NULL);
200 struct _task_info *info_ev = (struct _task_info *)data;
201 struct appdata *ad = info_ev->ad;
202 char buf[_BUF_MAX] = { 0, };
204 ad->mode = MODE_DEL_HISTORY;
206 snprintf(buf, _BUF_MAX, _("IDS_TASKMGR_ASK_CLEAR_HISTORY"), info_ev->app_name);
208 evas_object_del(ad->popup_ask);
209 ad->popup_ask = NULL;
211 ad->popup_ask = _add_popup_ask(ad->win, buf, ad);
212 g_egi = (void *)info_ev->it;
213 // evas_object_data_set(ad->popup_ask, "selected_egi", (void *)info_ev->it);
216 static void nl_sel(void *data, Evas_Object *obj, void *event_info)
219 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
220 elm_genlist_item_selected_set(item, EINA_FALSE);
224 static char *nl_text_get(void *data, Evas_Object *obj, const char *part)
226 char buf[_BUF_MAX] = { 0, };
228 if (!strcmp(part, "elm.text")) {
229 snprintf(buf, sizeof(buf), "%s", _(nolist_text[(int)data]));
236 static void _gl_sel_app(void *data, Evas_Object *obj, void *event_info)
239 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
240 struct appdata *ad = (struct appdata *)data;
241 struct _task_info *info;
242 /* parameter to block double click */
243 static int selected = 0;
245 retm_if(ad == NULL, "Invalid argument: appdata is NULL\n");
248 if (ad->update_timer) {
249 ecore_timer_del(ad->update_timer);
250 ad->update_timer = NULL;
258 _E("[Error] Cannot find genlist item\n");
263 info = (struct _task_info *)elm_object_item_data_get(item);
265 _E("[Error] Cannot get item data: info\n");
271 /* when application is alive */
272 aul_resume_pid(info->pid);
276 /* when application is dead */
277 if (info->pkg_name == NULL) {
278 util_show_popup_with_message(info->ad->win,
280 _("IDS_TASKMGR_CANNOT_LAUNCH_APPLICATION"));
284 _unset_notification_level(info->ad->win);
286 if (!strcmp(info->pkg_name, "org.tizen.phone")) {
287 /* exception : Because dialer doesn't need bundle
288 * since being unifyed dialer, voice call and video call
290 aul_launch_app(info->pkg_name, NULL);
293 aul_launch_app(info->pkg_name, info->b);
300 static Evas_Object *_gl_content_get_app(void *data, Evas_Object *obj,
303 struct _task_info *info = (struct _task_info *)data;
304 char buf[_BUF_MAX] = { 0, };
306 Evas_Object *icon = NULL;
307 Evas_Object *btn = NULL;
309 Evas_Object *rt, *icon_ly = NULL;
311 retvm_if(data == NULL, NULL, "Invalid argument: task info is NULL\n");
313 if (!strcmp(part, "elm.icon.1")) {
314 snprintf(buf, sizeof(buf), "%s", info->icn_path);
315 retvm_if(buf == NULL, NULL, "%s icon is NULL\n", info->app_name);
316 if (!ecore_file_exists(buf) || strlen(buf) < 4)
317 snprintf((char *)buf, (size_t) sizeof(buf),
318 (const char *)IMAGEDIR "/icon_taskmgr.png");
320 if (!strncmp(&buf[strlen(buf) - 3], "edj", 3)) {
321 icon_ly = _add_layout(obj, buf, "icon");
324 icon_ly = elm_icon_add(obj);
325 elm_icon_file_set(icon_ly, buf, NULL);
328 icon = _add_layout(obj, EDJ_NAME, "icon");
329 retvm_if(icon == NULL, NULL, "Cannot add layout: icon\n");
331 rt = evas_object_rectangle_add(evas_object_evas_get(obj));
332 retvm_if(rt == NULL, NULL, "Failed to add rectangle\n");
334 evas_object_color_set(rt, 0, 0, 0, 0);
335 evas_object_size_hint_min_set(rt, 50, 50);
336 // evas_object_size_hint_min_set(rt, (int)(50.0 * scale),
337 // (int)(50.0 * scale));
338 // evas_object_size_hint_max_set(rt, (int)(50.0 * scale),
339 // (int)(50.0 * scale));
340 elm_object_part_content_set(icon, "icon_ly", rt);
342 elm_object_part_content_set(icon, "icon", icon_ly);
346 } else if (!strcmp(part, "elm.icon.2")) {
347 btn = elm_button_add(obj);
348 elm_object_text_set(btn, _("IDS_COM_BODY_END"));
349 elm_object_style_set(btn, "default");
351 evas_object_smart_callback_add(btn, "clicked",
352 func_end[info->category], info);
353 elm_object_focus_set(btn, EINA_FALSE);
355 // evas_object_size_hint_min_set(btn, (int)(90.0 * scale),
356 // (int)(47.0 * scale));
357 // evas_object_size_hint_max_set(btn, (int)(90.0 * scale),
358 // (int)(47.0 * scale));
360 evas_object_propagate_events_set(btn, EINA_FALSE);
368 static char *_gl_text_get_app(void *data, Evas_Object *obj, const char *part)
370 struct _task_info *info = (struct _task_info *)data;
371 char buf[_BUF_MAX] = { 0, };
374 retvm_if(data == NULL, NULL, "Invalid argument: task info is NULL\n");
375 retvm_if(part == NULL, NULL, "Invalid argument: part is NULL\n");
377 if (!strcmp(part, "elm.text.1")) {
378 snprintf(buf, _BUF_MAX, "%s", info->app_name);
381 } else if (!strcmp(part, "elm.text.2")) {
382 if (info->category == TS_INUSE) {
383 snprintf(buf, _BUF_MAX, "CPU: %.1f%%", info->cpu);
388 elm_object_signal_emit(info->it, "prog.hide.mem","taskmanager");
396 static void _bl_sel(void *data, Evas_Object *obj, void *event_info)
399 int mode = (int)data;
401 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
403 elm_genlist_item_selected_set(item, EINA_FALSE);
406 static char *_bl_text_get(void *data, Evas_Object *obj, const char *part)
408 if (!strcmp(part, "elm.text")) {
409 return strdup(_(button_text[(int)data]));
415 static Evas_Object *_bl_content_get(void *data, Evas_Object *obj,
418 Evas_Object *btn = NULL;
419 struct appdata *ad = evas_object_data_get(obj, "appdata");
421 if (!strcmp(part, "elm.icon")) {
423 btn = elm_button_add(obj);
424 elm_object_style_set(btn, "default");
426 elm_object_text_set(btn, _(button_text[(int)data]));
427 evas_object_smart_callback_add(btn, "clicked",
428 func_del[(int)data], ad);
429 elm_object_focus_set(btn, EINA_FALSE);
431 evas_object_size_hint_min_set(btn, 0, 50);
432 evas_object_size_hint_max_set(btn, 0, 50);
433 // evas_object_size_hint_min_set(btn, 0, (int)(47.0 * scale));
434 // evas_object_size_hint_max_set(btn, 0, (int)(47.0 * scale));
436 evas_object_propagate_events_set(btn, EINA_FALSE);
444 static char *_gl_text_get_title(void *data, Evas_Object *obj, const char *part)
448 if (!strcmp(part, "elm.text")) {
449 snprintf(buf, sizeof(buf), "%s (%d)", _(group_name[(int)data]),
450 _get_grp_cnt((int)data));
456 static char *_gl_text_get_his(void *data, Evas_Object *obj, const char *part)
458 struct _task_info *info = (struct _task_info *)data;
459 char buf[_BUF_MAX] = { 0, };
462 if (!strcmp(part, "elm.text")) {
463 snprintf(buf, _BUF_MAX, "%s", info->app_name);
469 static Evas_Object *_gl_content_get_his(void *data, Evas_Object *obj,
472 struct _task_info *info = (struct _task_info *)data;
473 char buf[_BUF_MAX] = { 0, };
475 Evas_Object *icon = NULL;
476 Evas_Object *btn = NULL;
478 Evas_Object *rt, *icon_ly = NULL;
479 retvm_if(data == NULL, NULL, "Invalid argument: task info is NULL\n");
481 if (!strcmp(part, "elm.icon.1")) {
482 snprintf(buf, sizeof(buf), "%s", info->icn_path);
483 retvm_if(buf == NULL, NULL, "%s icon is NULL\n", info->app_name);
484 if (!ecore_file_exists(buf) || strlen(buf) < 4)
485 snprintf((char *)buf, (size_t) sizeof(buf),
486 (const char *)IMAGEDIR "/icon_taskmgr.png");
488 if (!strncmp(&buf[strlen(buf) - 3], "edj", 3)) {
489 icon_ly = _add_layout(obj, buf, "icon");
492 icon_ly = elm_icon_add(obj);
493 elm_icon_file_set(icon_ly, buf, NULL);
496 icon = _add_layout(obj, EDJ_NAME, "icon");
497 retvm_if (icon == NULL, NULL, "Cannot add layout: icon\n");
499 rt = evas_object_rectangle_add(evas_object_evas_get(obj));
500 retvm_if (rt == NULL, NULL, "Failed to add rectangle\n");
502 evas_object_color_set(rt, 0, 0, 0, 0);
503 evas_object_size_hint_min_set(rt, 50, 50);
504 // evas_object_size_hint_min_set(rt, (int)(50.0 * scale),
505 // (int)(50.0 * scale));
506 // evas_object_size_hint_max_set(rt, (int)(50.0 * scale),
507 // (int)(50.0 * scale));
508 elm_object_part_content_set(icon, "icon_ly", rt);
510 elm_object_part_content_set(icon, "icon", icon_ly);
514 } else if (!strcmp(part, "elm.icon.2")) {
515 btn = elm_button_add(obj);
516 elm_object_text_set(btn, _("IDS_COM_OPT_DELETE"));
517 elm_object_style_set(btn, "default");
519 evas_object_smart_callback_add(btn, "clicked",
520 func_end[info->category], info);
521 elm_object_focus_set(btn, EINA_FALSE);
523 // evas_object_size_hint_min_set(btn, (int)(90.0 * scale),
524 // (int)(47.0 * scale));
525 // evas_object_size_hint_max_set(btn, (int)(90.0 * scale),
526 // (int)(47.0 * scale));
528 evas_object_propagate_events_set(btn, EINA_FALSE);
539 itc_gl.item_style = "grouptitle";
540 itc_gl.func.text_get = _gl_text_get_title;
542 itc_dl.item_style = "2text.2icon.4";
543 itc_dl.func.text_get = _gl_text_get_app;
544 itc_dl.func.content_get = _gl_content_get_app;
546 itc_hl.item_style = "1text.2icon.4";
547 itc_hl.func.text_get = _gl_text_get_his;
548 itc_hl.func.content_get = _gl_content_get_his;
550 itc_separator4.item_style = "dialogue/seperator.4";
551 itc_separator2.item_style = "dialogue/seperator.2";
553 itc_bl.item_style = "dialogue/bg/1icon";
554 // itc_bl.item_style = "1icon";
555 itc_bl.func.content_get = _bl_content_get;
557 itc_nl.item_style = "1text";
558 itc_nl.func.text_get = nl_text_get;
562 int check_genlist(struct appdata *ad)
564 Elm_Object_Item *egi;
565 struct _task_info *info;
568 egi = elm_genlist_first_item_get(ad->gl);
570 info = (struct _task_info *)elm_object_item_data_get(egi);
572 _D("%s info[0x%x]\n", (int)info < 3 ? "-" : info->app_name, info);
576 egi = elm_genlist_item_next_get(egi);
582 int _set_genlist_from_eina(struct appdata *ad)
586 Elm_Object_Item *git, *item;
587 struct _task_info *info;
590 retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
591 retvm_if(ad->gl == NULL, -1, "Invalid argument:genlist is NULL\n");
593 for (i = 0; i < TS_MAX; i++) {
594 git = elm_genlist_item_append(ad->gl, &itc_gl,
596 ELM_GENLIST_ITEM_NONE,
598 retvm_if(git == NULL, -1, "Failed append item\n");
599 elm_genlist_item_select_mode_set(git, EINA_TRUE);
601 if (eina_list_count(ad->applist[i]) > 0) {
603 item = elm_genlist_item_append(ad->gl, &itc_separator4,
605 ELM_GENLIST_ITEM_NONE,
607 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
610 item = elm_genlist_item_append(ad->gl, &itc_bl,
612 ELM_GENLIST_ITEM_NONE,
615 item = elm_genlist_item_append(ad->gl, &itc_separator2,
617 ELM_GENLIST_ITEM_NONE,
619 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
621 ad->applist[i] = eina_list_nth_list(ad->applist[i], 0);
622 EINA_LIST_FOREACH(ad->applist[i], l, info) {
624 info->it = elm_genlist_item_append(ad->gl,
625 (i == TS_INUSE) ? &itc_dl : &itc_hl,
627 ELM_GENLIST_ITEM_NONE,
632 item = elm_genlist_item_append(ad->gl, &itc_nl,
634 ELM_GENLIST_ITEM_NONE,
641 Eina_Bool _update_list(void *data)
644 struct appdata *ad = data;
645 Eina_List *l, *l_next;
646 struct _task_info *info;
648 pthread_mutex_lock(&mutex_for_graph_update);
650 if(ad->applist[TS_INUSE] == NULL) {
651 _D("inuse is NULL\n");
652 return ECORE_CALLBACK_CANCEL;
654 ad->applist[TS_INUSE] = eina_list_nth_list(ad->applist[TS_INUSE], 0);
655 _D("%d\n", eina_list_count(ad->applist[TS_INUSE]));
657 EINA_LIST_FOREACH_SAFE(ad->applist[TS_INUSE], l, l_next, info) {
658 elm_genlist_item_update(info->it);
661 pthread_mutex_unlock(&mutex_for_graph_update);
662 return ECORE_CALLBACK_RENEW;
665 void *_update_pthread_cb(void *data)
668 struct appdata *ad = data;
671 Eina_List *l, *l_next;
672 struct _task_info *info;
676 if (ad->ending == EINA_FALSE) {
677 if(ad->applist[TS_INUSE] == NULL) {
678 _D("in use list is NULL\n");
679 return ECORE_CALLBACK_CANCEL;
682 _get_sysconf(&ncpu, &tick);
684 ad->applist[TS_INUSE] = eina_list_nth_list(ad->applist[TS_INUSE], 0);
685 if (eina_list_count(ad->applist[TS_INUSE]) < 1) {
686 _D("list count is 0\n");
690 EINA_LIST_FOREACH_SAFE(ad->applist[TS_INUSE], l, l_next, info) {
692 info->cpu = _get_cpu_ratio(info, ncpu, tick);
693 _D("%d / %lf\n", info->pid, info->cpu);
705 void _set_genlist(struct appdata *ad)
709 retm_if(ad == NULL, "Invalid argument: appdata is NULL\n");
713 aul_app_get_running_app_info(runapp_info_get, ad);
714 taskmanager_get_history_app_info(ad);
715 ret = _set_genlist_from_eina(ad);
721 void _init_pthread(void)
723 pthread_mutex_init(&pm, NULL);
724 pthread_cond_init(&pc, NULL);
727 void _fini_pthread(void)
735 void refresh_app_info(struct appdata *ad)
738 retm_if(ad == NULL, "Invalid argument: appdata is NULL\n");
740 _free_einalist_all(ad);
749 void _del_popup_timer(struct appdata *ad)
751 if (ad->popup_timer) {
752 ecore_timer_del(ad->popup_timer);
753 ad->popup_timer = NULL;
757 void taskmanager_free_info(struct _task_info *info)
760 if (info->app_name) {
761 free(info->app_name);
762 info->app_name = NULL;
764 if (info->pkg_name) {
765 free(info->pkg_name);
766 info->pkg_name = NULL;
768 if (info->icn_path) {
769 free(info->icn_path);
770 info->icn_path = NULL;
777 void _restart_pthread(struct appdata *ad)
781 if (eina_list_count(ad->applist[TS_INUSE]) > 0) {
783 pthread_create(&pt, NULL, _update_pthread_cb, ad);
785 if (ad->update_timer) {
786 ecore_timer_del(ad->update_timer);
787 ad->update_timer = NULL;
789 ad->update_timer = ecore_timer_add(2.0, _update_list, ad);
792 int response_end_inuse(struct appdata *ad)
795 Eina_List *l, *l_next;
796 struct _task_info *info;
797 Elm_Object_Item *egi;
799 retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
801 ad->ending = EINA_TRUE;
803 EINA_LIST_FOREACH_SAFE(ad->applist[TS_INUSE], l, l_next, info) {
804 if (info->it == g_egi) {
806 if (aul_terminate_pid(info->pid) < 0) {
807 kill(info->pid, SIGKILL);
809 // ad->applist[TS_INUSE] =
810 // eina_list_remove_list(ad->applist[TS_INUSE], l);
815 ad->ending = EINA_FALSE;
820 Eina_Bool _refresh_idler_cb(void *data)
823 struct appdata *ad = (struct appdata *)data;
824 retvm_if(data == NULL, ECORE_CALLBACK_CANCEL, "Invalid argument: appdata is NULL\n:");
826 _del_popup_timer(ad);
827 _del_progressbar(ad);
828 refresh_app_info(ad);
829 return ECORE_CALLBACK_CANCEL;
832 int response_end_all_inuse(struct appdata *ad)
835 struct _task_info *info;
837 retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
839 ad->ending = EINA_TRUE;
841 if(ad->update_timer) {
842 ecore_timer_del(ad->update_timer);
843 ad->update_timer = NULL;
846 ad->endcnt = eina_list_count(ad->applist[TS_INUSE]);
847 _D("set end count (%d)\n", ad->endcnt);
849 EINA_LIST_FOREACH(ad->applist[TS_INUSE], l, info) {
852 if (aul_terminate_pid(info->pid) < 0) {
853 kill(info->pid, SIGKILL);
856 // ad->applist[TS_INUSE] =
857 // eina_list_remove_list(ad->applist[TS_INUSE], l);
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 if (info->it == g_egi) {
877 if (rua_init() == -1) {
880 rua_delete_history_with_pkgname(info->pkg_name);
883 ad->applist[TS_HISTORY] =
884 eina_list_remove_list(ad->applist[TS_HISTORY], l);
887 bundle_free(info->b);
890 elm_object_item_del(info->it);
891 taskmanager_free_info(info);
896 refresh_app_info(ad);
897 _del_popup_timer(ad);
898 _del_progressbar(ad);
900 ad->mode = MODE_NONE;
904 int response_del_all_history(struct appdata *ad)
907 struct _task_info *info;
909 retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
911 if(ad->update_timer) {
912 _D("update timer is deleted\n");
913 ecore_timer_del(ad->update_timer);
914 ad->update_timer = NULL;
918 _show_progressbar(ad);
920 if (rua_init() == -1) {
924 EINA_LIST_FOREACH(ad->applist[TS_HISTORY], l, info) {
926 rua_delete_history_with_pkgname(info->pkg_name);
930 if (eina_list_count(ad->applist[TS_INUSE]) == 0) {
935 refresh_app_info(ad);
936 _del_popup_timer(ad);
937 _del_progressbar(ad);
939 ad->mode = MODE_NONE;
943 int response_kill_inuse(struct appdata *ad)
945 Eina_List *l, *l_next;
946 struct _task_info *info;
947 Elm_Object_Item *egi;
949 retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
951 _show_progressbar(ad);
953 EINA_LIST_FOREACH_SAFE(ad->applist[TS_INUSE], l, l_next, info) {
954 if (info->it == g_egi) {
956 kill(info->pid, SIGKILL);
959 ad->applist[TS_INUSE] =
960 eina_list_remove_list(ad->applist[TS_INUSE], l);
961 taskmanager_free_info(info);
965 refresh_app_info(ad);
966 _del_progressbar(ad);
971 int response_kill_all_inuse(struct appdata *ad)
974 struct _task_info *info;
976 retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
978 _show_progressbar(ad);
980 EINA_LIST_FOREACH(ad->applist[TS_INUSE], l, info) {
983 kill(info->pid, SIGKILL);
987 refresh_app_info(ad);
988 _del_progressbar(ad);