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 // refresh_app_info(ad);
165 ad->mode = MODE_DEL_ALL_HISTORY;
166 snprintf(buf, sizeof(buf), T_("IDS_TASKMGR_POP_CLEAR_ALL_APP_HISTORY_Q"));
168 evas_object_del(ad->popup_ask);
169 ad->popup_ask = NULL;
171 ad->popup_ask = _add_popup_ask(ad->win, buf, ad);
174 static void end_inuse_cb(void *data, Evas_Object *obj, void *event_info)
176 ret_if(data == NULL);
178 struct _task_info *info_ev = (struct _task_info *)data;
179 struct appdata *ad = info_ev->ad;
180 char buf[_BUF_MAX] = { 0, };
182 ad->mode = MODE_END_INUSE;
183 snprintf(buf, _BUF_MAX, T_("IDS_TASKMGR_POP_CLOSE_PS_APP_Q_THIS_MAY_CAUSE_DATA_TO_BE_LOST"), info_ev->app_name);
185 evas_object_del(ad->popup_ask);
186 ad->popup_ask = NULL;
188 ad->popup_ask = _add_popup_ask(ad->win, buf, ad);
189 g_egi = (void *)info_ev->it;
190 // evas_object_data_set(ad->popup_ask, "selected_egi", (void *)info_ev->it);
193 static void delete_history_cb(void *data, Evas_Object *obj, void *event_info)
195 ret_if(data == NULL);
197 struct _task_info *info_ev = (struct _task_info *)data;
198 struct appdata *ad = info_ev->ad;
199 char buf[_BUF_MAX] = { 0, };
201 ad->mode = MODE_DEL_HISTORY;
203 snprintf(buf, _BUF_MAX, T_("IDS_TASKMGR_POP_CLEAR_PS_HISTORY_Q"), info_ev->app_name);
205 evas_object_del(ad->popup_ask);
206 ad->popup_ask = NULL;
208 ad->popup_ask = _add_popup_ask(ad->win, buf, ad);
209 g_egi = (void *)info_ev->it;
210 // evas_object_data_set(ad->popup_ask, "selected_egi", (void *)info_ev->it);
213 static void nl_sel(void *data, Evas_Object *obj, void *event_info)
216 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
217 elm_genlist_item_selected_set(item, EINA_FALSE);
221 static char *nl_text_get(void *data, Evas_Object *obj, const char *part)
223 char buf[_BUF_MAX] = { 0, };
225 if (!strcmp(part, "elm.text")) {
226 snprintf(buf, sizeof(buf), "%s", T_(nolist_text[(int)data]));
233 static void _gl_sel_app(void *data, Evas_Object *obj, void *event_info)
236 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
237 struct appdata *ad = (struct appdata *)data;
238 struct _task_info *info;
239 /* parameter to block double click */
240 static int selected = 0;
241 Elm_Object_Item *it = (Elm_Object_Item *) event_info;
243 elm_genlist_item_selected_set(it, EINA_FALSE);
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);
275 /* when application is dead */
276 if (info->pkg_name == NULL) {
277 util_show_popup_with_message(info->ad->win,
279 T_("IDS_TASKMGR_POP_UNABLE_TO_OPEN_APPLICATION"));
283 _unset_notification_level(info->ad->win);
285 if (!strcmp(info->pkg_name, "org.tizen.phone")) {
286 /* exception : Because dialer doesn't need bundle
287 * since being unifyed dialer, voice call and video call
289 aul_launch_app(info->pkg_name, NULL);
292 aul_launch_app(info->pkg_name, info->b);
299 static Evas_Object *_gl_content_get_app(void *data, Evas_Object *obj,
302 struct _task_info *info = (struct _task_info *)data;
303 char buf[_BUF_MAX] = { 0, };
305 Evas_Object *icon = NULL;
306 Evas_Object *btn = NULL;
308 Evas_Object *rt, *icon_ly = NULL;
310 retvm_if(data == NULL, NULL, "Invalid argument: task info is NULL\n");
312 if (!strcmp(part, "elm.icon.1")) {
313 snprintf(buf, sizeof(buf), "%s", info->icn_path);
314 retvm_if(buf == NULL, NULL, "%s icon is NULL\n", info->app_name);
315 if (!ecore_file_exists(buf) || strlen(buf) < 4)
316 snprintf((char *)buf, (size_t) sizeof(buf),
317 (const char *)IMAGEDIR "/icon_taskmgr.png");
319 if (!strncmp(&buf[strlen(buf) - 3], "edj", 3)) {
320 icon_ly = _add_layout(obj, buf, "icon");
323 icon_ly = elm_icon_add(obj);
324 elm_icon_file_set(icon_ly, buf, NULL);
327 icon = _add_layout(obj, EDJ_NAME, "icon");
328 retvm_if(icon == NULL, NULL, "Cannot add layout: icon\n");
330 rt = evas_object_rectangle_add(evas_object_evas_get(obj));
331 retvm_if(rt == NULL, NULL, "Failed to add rectangle\n");
333 evas_object_color_set(rt, 0, 0, 0, 0);
334 evas_object_size_hint_min_set(rt, 50, 50);
335 // evas_object_size_hint_min_set(rt, (int)(50.0 * scale),
336 // (int)(50.0 * scale));
337 // evas_object_size_hint_max_set(rt, (int)(50.0 * scale),
338 // (int)(50.0 * scale));
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);
354 // evas_object_size_hint_min_set(btn, (int)(90.0 * scale),
355 // (int)(47.0 * scale));
356 // evas_object_size_hint_max_set(btn, (int)(90.0 * scale),
357 // (int)(47.0 * scale));
359 evas_object_propagate_events_set(btn, EINA_FALSE);
367 static char *_gl_text_get_app(void *data, Evas_Object *obj, const char *part)
369 struct _task_info *info = (struct _task_info *)data;
370 char buf[_BUF_MAX] = { 0, };
373 retvm_if(data == NULL, NULL, "Invalid argument: task info is NULL\n");
374 retvm_if(part == NULL, NULL, "Invalid argument: part is NULL\n");
376 if (!strcmp(part, "elm.text.1")) {
377 snprintf(buf, _BUF_MAX, "%s", info->app_name);
380 } else if (!strcmp(part, "elm.text.2")) {
381 if (info->category == TS_INUSE) {
382 snprintf(buf, _BUF_MAX, "CPU: %.1f%%", info->cpu);
387 elm_object_signal_emit(info->it, "prog.hide.mem","taskmanager");
395 static void _bl_sel(void *data, Evas_Object *obj, void *event_info)
398 int mode = (int)data;
400 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
402 elm_genlist_item_selected_set(item, EINA_FALSE);
405 static char *_bl_text_get(void *data, Evas_Object *obj, const char *part)
407 if (!strcmp(part, "elm.text")) {
408 return strdup(T_(button_text[(int)data]));
414 static Evas_Object *_bl_content_get(void *data, Evas_Object *obj,
417 Evas_Object *btn = NULL;
418 struct appdata *ad = evas_object_data_get(obj, "appdata");
420 if (!strcmp(part, "elm.icon")) {
422 btn = elm_button_add(obj);
423 elm_object_style_set(btn, "default");
425 elm_object_text_set(btn, T_(button_text[(int)data]));
426 evas_object_smart_callback_add(btn, "clicked",
427 func_del[(int)data], ad);
428 elm_object_focus_set(btn, EINA_FALSE);
430 evas_object_size_hint_min_set(btn, 0, 50);
431 evas_object_size_hint_max_set(btn, 0, 50);
432 // evas_object_size_hint_min_set(btn, 0, (int)(47.0 * scale));
433 // evas_object_size_hint_max_set(btn, 0, (int)(47.0 * scale));
435 evas_object_propagate_events_set(btn, EINA_FALSE);
443 static char *_gl_text_get_title(void *data, Evas_Object *obj, const char *part)
447 if (!strcmp(part, "elm.text")) {
448 snprintf(buf, sizeof(buf), "%s (%d)",
449 T_(group_name[(int)data]), _get_grp_cnt((int)data));
455 static char *_gl_text_get_his(void *data, Evas_Object *obj, const char *part)
457 struct _task_info *info = (struct _task_info *)data;
458 char buf[_BUF_MAX] = { 0, };
461 if (!strcmp(part, "elm.text")) {
462 snprintf(buf, _BUF_MAX, "%s", info->app_name);
468 static Evas_Object *_gl_content_get_his(void *data, Evas_Object *obj,
471 struct _task_info *info = (struct _task_info *)data;
472 char buf[_BUF_MAX] = { 0, };
474 Evas_Object *icon = NULL;
475 Evas_Object *btn = NULL;
477 Evas_Object *rt, *icon_ly = NULL;
478 retvm_if(data == NULL, NULL, "Invalid argument: task info is NULL\n");
480 if (!strcmp(part, "elm.icon.1")) {
481 snprintf(buf, sizeof(buf), "%s", info->icn_path);
482 retvm_if(buf == NULL, NULL, "%s icon is NULL\n", info->app_name);
483 if (!ecore_file_exists(buf) || strlen(buf) < 4)
484 snprintf((char *)buf, (size_t) sizeof(buf),
485 (const char *)IMAGEDIR "/icon_taskmgr.png");
487 if (!strncmp(&buf[strlen(buf) - 3], "edj", 3)) {
488 icon_ly = _add_layout(obj, buf, "icon");
491 icon_ly = elm_icon_add(obj);
492 elm_icon_file_set(icon_ly, buf, NULL);
495 icon = _add_layout(obj, EDJ_NAME, "icon");
496 retvm_if (icon == NULL, NULL, "Cannot add layout: icon\n");
498 rt = evas_object_rectangle_add(evas_object_evas_get(obj));
499 retvm_if (rt == NULL, NULL, "Failed to add rectangle\n");
501 evas_object_color_set(rt, 0, 0, 0, 0);
502 evas_object_size_hint_min_set(rt, 50, 50);
503 // evas_object_size_hint_min_set(rt, (int)(50.0 * scale),
504 // (int)(50.0 * scale));
505 // evas_object_size_hint_max_set(rt, (int)(50.0 * scale),
506 // (int)(50.0 * scale));
507 elm_object_part_content_set(icon, "icon_ly", rt);
509 elm_object_part_content_set(icon, "icon", icon_ly);
513 } else if (!strcmp(part, "elm.icon.2")) {
514 btn = elm_button_add(obj);
515 elm_object_text_set(btn, S_("IDS_COM_OPT_DELETE"));
516 elm_object_style_set(btn, "default");
518 evas_object_smart_callback_add(btn, "clicked",
519 func_end[info->category], info);
520 elm_object_focus_set(btn, EINA_FALSE);
522 // evas_object_size_hint_min_set(btn, (int)(90.0 * scale),
523 // (int)(47.0 * scale));
524 // evas_object_size_hint_max_set(btn, (int)(90.0 * scale),
525 // (int)(47.0 * scale));
527 evas_object_propagate_events_set(btn, EINA_FALSE);
538 itc_gl.item_style = "grouptitle";
539 itc_gl.func.text_get = _gl_text_get_title;
541 itc_dl.item_style = "2text.2icon.7";
542 itc_dl.func.text_get = _gl_text_get_app;
543 itc_dl.func.content_get = _gl_content_get_app;
545 itc_hl.item_style = "1text.2icon.4";
546 itc_hl.func.text_get = _gl_text_get_his;
547 itc_hl.func.content_get = _gl_content_get_his;
549 itc_separator4.item_style = "dialogue/seperator.4";
550 itc_separator2.item_style = "dialogue/seperator.2";
552 itc_bl.item_style = "dialogue/bg/1icon";
553 // itc_bl.item_style = "1icon";
554 itc_bl.func.content_get = _bl_content_get;
556 itc_nl.item_style = "1text";
557 itc_nl.func.text_get = nl_text_get;
561 int check_genlist(struct appdata *ad)
563 Elm_Object_Item *egi;
564 struct _task_info *info;
567 egi = elm_genlist_first_item_get(ad->gl);
569 info = (struct _task_info *)elm_object_item_data_get(egi);
571 _D("%s info[0x%x]\n", (int)info < 3 ? "-" : info->app_name, info);
575 egi = elm_genlist_item_next_get(egi);
581 int _set_genlist_from_eina(struct appdata *ad)
585 Elm_Object_Item *git, *item;
586 struct _task_info *info;
589 retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
590 retvm_if(ad->gl == NULL, -1, "Invalid argument:genlist is NULL\n");
592 for (i = 0; i < TS_MAX; i++) {
593 git = elm_genlist_item_append(ad->gl, &itc_gl,
595 ELM_GENLIST_ITEM_NONE,
597 retvm_if(git == NULL, -1, "Failed append item\n");
598 elm_genlist_item_select_mode_set(git, EINA_TRUE);
600 if (eina_list_count(ad->applist[i]) > 0) {
602 item = elm_genlist_item_append(ad->gl, &itc_separator4,
604 ELM_GENLIST_ITEM_NONE,
606 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
609 item = elm_genlist_item_append(ad->gl, &itc_bl,
611 ELM_GENLIST_ITEM_NONE,
614 item = elm_genlist_item_append(ad->gl, &itc_separator2,
616 ELM_GENLIST_ITEM_NONE,
618 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
620 ad->applist[i] = eina_list_nth_list(ad->applist[i], 0);
621 EINA_LIST_FOREACH(ad->applist[i], l, info) {
623 info->it = elm_genlist_item_append(ad->gl,
624 (i == TS_INUSE) ? &itc_dl : &itc_hl,
626 ELM_GENLIST_ITEM_NONE,
631 item = elm_genlist_item_append(ad->gl, &itc_nl,
633 ELM_GENLIST_ITEM_NONE,
635 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
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)
708 retm_if(ad == NULL, "Invalid argument: appdata is NULL\n");
709 int ret = AUL_R_ERROR;
713 while (ret != AUL_R_OK)
714 ret = aul_app_get_running_app_info(runapp_info_get, ad);
716 taskmanager_get_history_app_info(ad);
717 _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;
802 // egi = evas_object_data_get(ad->popup_ask, "selected_egi");
804 EINA_LIST_FOREACH_SAFE(ad->applist[TS_INUSE], l, l_next, info) {
805 if (info->it == g_egi) {
807 if (aul_terminate_pid(info->pid) < 0) {
808 kill(info->pid, SIGKILL);
810 // ad->applist[TS_INUSE] =
811 // eina_list_remove_list(ad->applist[TS_INUSE], l);
816 ad->ending = EINA_FALSE;
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) {
853 if (aul_terminate_pid(info->pid) < 0) {
854 kill(info->pid, SIGKILL);
857 // ad->applist[TS_INUSE] =
858 // eina_list_remove_list(ad->applist[TS_INUSE], l);
862 ad->ending = EINA_FALSE;
866 int response_del_history(struct appdata *ad)
868 Eina_List *l, *l_next;
869 struct _task_info *info;
870 Elm_Object_Item *egi;
872 retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
874 _show_progressbar(ad);
875 // egi = evas_object_data_get(ad->popup_ask, "selected_egi");
876 EINA_LIST_FOREACH_SAFE(ad->applist[TS_HISTORY], l, l_next, info) {
877 if (info->it == g_egi) {
879 if (rua_init() == -1) {
882 rua_delete_history_with_pkgname(info->pkg_name);
885 ad->applist[TS_HISTORY] =
886 eina_list_remove_list(ad->applist[TS_HISTORY], l);
889 bundle_free(info->b);
892 elm_object_item_del(info->it);
893 taskmanager_free_info(info);
898 refresh_app_info(ad);
899 _del_popup_timer(ad);
900 _del_progressbar(ad);
902 ad->mode = MODE_NONE;
906 int response_del_all_history(struct appdata *ad)
909 struct _task_info *info;
911 retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
913 if(ad->update_timer) {
914 _D("update timer is deleted\n");
915 ecore_timer_del(ad->update_timer);
916 ad->update_timer = NULL;
920 _show_progressbar(ad);
922 if (rua_init() == -1) {
926 EINA_LIST_FOREACH(ad->applist[TS_HISTORY], l, info) {
928 rua_delete_history_with_pkgname(info->pkg_name);
932 if (eina_list_count(ad->applist[TS_INUSE]) == 0) {
937 refresh_app_info(ad);
938 _del_popup_timer(ad);
939 _del_progressbar(ad);
941 ad->mode = MODE_NONE;
945 int response_kill_inuse(struct appdata *ad)
947 Eina_List *l, *l_next;
948 struct _task_info *info;
949 Elm_Object_Item *egi;
951 retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
953 _show_progressbar(ad);
954 // egi = evas_object_data_get(ad->popup_ask, "selected_egi");
956 EINA_LIST_FOREACH_SAFE(ad->applist[TS_INUSE], l, l_next, info) {
957 if (info->it == g_egi) {
959 kill(info->pid, SIGKILL);
962 ad->applist[TS_INUSE] =
963 eina_list_remove_list(ad->applist[TS_INUSE], l);
964 taskmanager_free_info(info);
968 refresh_app_info(ad);
969 _del_progressbar(ad);
974 int response_kill_all_inuse(struct appdata *ad)
977 struct _task_info *info;
979 retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
981 _show_progressbar(ad);
983 EINA_LIST_FOREACH(ad->applist[TS_INUSE], l, info) {
986 kill(info->pid, SIGKILL);
990 refresh_app_info(ad);
991 _del_progressbar(ad);