21082bc63690e2486e1869869b6013bcbf6b36bd
[apps/core/preloaded/taskmanager.git] / src / taskmanager.h
1 /*
2  * org.tizen.taskmgr
3  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4  *
5  * Licensed under the Flora License, Version 1.1 (the License);
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://floralicense.org/license/
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an AS IS BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18
19
20
21 #ifndef __TASKMANAGER_H__
22 #define __TASKMANAGER_H__
23
24 #include <Elementary.h>
25 #include <Ecore_X.h>
26 #include <utilX.h>
27 #include <bundle.h>
28
29 #if !defined(PACKAGE)
30 #define PACKAGE "taskmanager"
31 #endif
32
33 #ifndef PREFIX
34 #define PREFIX "/usr/apps/org.tizen."PACKAGE
35 #endif
36
37 #if !defined(RESDIR)
38 #       define RESDIR PREFIX"/res"
39 #endif
40
41 #if !defined(LOCALEDIR)
42 #define LOCALEDIR RESDIR"/locale"
43 #endif
44
45 #if !defined(EDJDIR)
46 #define EDJDIR RESDIR"/edje"PACKAGE
47 #endif
48
49 #if !defined(IMAGEDIR)
50 #       define IMAGEDIR RESDIR"/images/"PACKAGE
51 #endif
52
53 #define EDJ_NAME EDJDIR"/taskmgr.edj"
54 #define EDJ_THEME EDJDIR"/theme_taskmanager.edj"
55 #define GRP_TM "task_manager"
56
57 #define S_(str) dgettext("sys_string", str)
58 #define T_(str) gettext(str)
59
60 #define _BUF_MAX        256
61 #define _EDJ(x) elm_layout_edje_get(x)
62
63 #define POPUP_TIMER 1.0
64 #define POPUP_TERMINATE_TIMER 1.5
65
66 struct appdata {
67         Evas *evas;
68         Evas_Object *win, *ly, *nv, *gl;
69
70         Evas_Coord root_w, root_h;
71
72         Eina_List *applist[2];
73         /* runapp : 0, history: 1 */
74
75         Ecore_Timer *popup_timer;
76         Evas_Object *popup_ask;
77         Evas_Object *popup_progressbar;
78
79         Ecore_Timer *update_timer;
80         Ecore_Timer *exit_timer;
81
82         Ecore_Timer *killall_timer;
83
84         double mem_total;
85
86         int mode;
87         int ending;
88         int endcnt;
89 };
90
91 struct _task_info {
92         char *app_name;
93         char *pkg_name;
94         char *icn_path;
95         pid_t pid;
96         struct appdata *ad;
97         double mem, mem_total;
98         double cpu;
99         Elm_Object_Item *it;
100         int category;
101         bundle *b;
102         unsigned int oldutime, oldstime;
103         struct timeval oldtimev;
104 };
105
106         /* MODE_KILL_INUSE = MODE_END_INUSE * 2
107          * MODE_KILL_ALL_INUSE = MODE_END_ALL_INUSE * 2
108          */
109 enum task_mode {
110         MODE_NONE = 0,
111         MODE_END_INUSE,
112         MODE_KILL_INUSE,
113         MODE_END_ALL_INUSE,
114         MODE_DEL_HISTORY,
115         MODE_DEL_ALL_HISTORY,
116         MODE_KILL_ALL_INUSE,
117 };
118
119 enum task_status {
120         TS_INUSE = 0,
121         TS_HISTORY,
122         TS_MAX,
123 };
124
125 Evas_Object *load_edj(Evas_Object *parent, const char *file, const char *group);
126 int _unset_notification_level(Evas_Object *win);
127 int _set_notification_level(Evas_Object *win, Utilx_Notification_Level level);
128 void _key_grab(struct appdata *ad);
129 Eina_Bool _exit_cb(void *data);
130 void _check_show_state(void);
131
132 #endif
133 /* __TASKMANAGER_H___ */