apply FSL(Flora Software License)
[apps/core/preloaded/taskmanager.git] / src / taskmanager.h
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 #ifndef __TASKMANAGER_H__
19 #define __TASKMANAGER_H__
20
21 #include <Elementary.h>
22 #include <Ecore_X.h>
23 #include <utilX.h>
24 #include <bundle.h>
25
26 #if !defined(PACKAGE)
27 #define PACKAGE "taskmanager"
28 #endif
29
30 #ifndef PREFIX
31 #define PREFIX "/opt/apps/org.tizen."PACKAGE
32 #endif
33
34 #if !defined(RESDIR)
35 #       define RESDIR PREFIX"/res"
36 #endif
37
38 #if !defined(LOCALEDIR)
39 #define LOCALEDIR RESDIR"/locale"
40 #endif
41
42 #if !defined(EDJDIR)
43 #define EDJDIR RESDIR"/edje"PACKAGE
44 #endif
45
46 #if !defined(IMAGEDIR)
47 #       define IMAGEDIR RESDIR"/images/"PACKAGE
48 #endif
49
50 #define EDJ_NAME EDJDIR"/taskmgr.edj"
51 #define EDJ_THEME EDJDIR"/theme_taskmanager.edj"
52 #define GRP_TM "task_manager"
53
54 #define D_(str) dgettext("sys_string", str)
55 #define _BUF_MAX        256
56 #define _EDJ(x) elm_layout_edje_get(x)
57
58 #define POPUP_TIMER 1.0
59 #define POPUP_TERMINATE_TIMER 1.5
60
61 struct appdata {
62         Evas *evas;
63         Evas_Object *win, *ly, *nv, *gl;
64
65         Evas_Coord root_w, root_h;
66
67         Eina_List *applist[2];
68         /* runapp : 0, history: 1 */
69
70         Ecore_Timer *popup_timer;
71         Evas_Object *popup_ask;
72         Evas_Object *popup_progressbar;
73
74         Ecore_Timer *update_timer;
75
76         double mem_total;
77
78         int mode;
79         int ending;
80         int endcnt;
81 };
82
83 struct _task_info {
84         char *app_name;
85         char *pkg_name;
86         char *icn_path;
87         pid_t pid;
88         struct appdata *ad;
89         double mem, mem_total;
90         double cpu;
91         Elm_Object_Item *it;
92         int category;
93         bundle *b;
94         unsigned int oldutime, oldstime;
95         struct timeval oldtimev;
96 };
97
98         /* MODE_KILL_INUSE = MODE_END_INUSE * 2
99          * MODE_KILL_ALL_INUSE = MODE_END_ALL_INUSE * 2
100          */
101 enum task_mode {
102         MODE_NONE = 0,
103         MODE_END_INUSE,
104         MODE_KILL_INUSE,
105         MODE_END_ALL_INUSE,
106         MODE_DEL_HISTORY,
107         MODE_DEL_ALL_HISTORY,
108         MODE_KILL_ALL_INUSE,
109 };
110
111 enum task_status {
112         TS_INUSE = 0,
113         TS_HISTORY,
114         TS_MAX,
115 };
116
117 Evas_Object *load_edj(Evas_Object *parent, const char *file, const char *group);
118 int _unset_notification_level(Evas_Object *win);
119 int _set_notification_level(Evas_Object *win, Utilx_Notification_Level level);
120 Eina_Bool _exit_cb(void *data);
121
122 #endif
123 /* __TASKMANAGER_H___ */