tizen 2.3.1 release
[apps/home/settings.git] / setting-appmgr / include / setting-appmgr.h
1 /*
2  * setting
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19 #ifndef __SETTING_APPMGR_H__
20 #define __SETTING_APPMGR_H__
21
22 #include <pthread.h>
23 #include <glib.h>
24
25 #include <Elementary.h>
26 #include <pkgmgr-info.h>
27 #include <package-manager.h>
28
29 #include "setting-common-view.h"
30 #include "setting-common-draw-widget.h"
31 #include "setting-appmgr-string.h"
32
33 #define _S(s)   dgettext("sys_string", s)
34
35 #define SAFE_STRDUP(src) (src)?strdup(src):NULL
36
37 #define FREEandSTRDUP(dest, src) \
38         do{ \
39                 if (dest) { free(dest); dest=NULL; }\
40                 if (src || *src) dest = strdup(src); \
41         }while(false)
42
43 enum {
44     APPMGRUG_TAB_NONE,
45     APPMGRUG_TAB_DOWNLOAD,
46     APPMGRUG_TAB_RUNNING,
47     APPMGRUG_TAB_ALL,
48     APPMGRUG_TAB_DISABLED,
49     APPMGRUG_TAB_DEFAULT,
50     APPMGRUG_TAB_MAX
51 };
52
53 enum {
54     APPMGRUG_PKG_REQUEST_NONE,
55     APPMGRUG_PKG_REQUEST_UNINSTALL,
56     APPMGRUG_PKG_REQUEST_MOVE,
57     APPMGRUG_PKG_REQUEST_DISABLE,
58     APPMGRUG_PKG_REQUEST_ENABLE,
59     APPMGRUG_PKG_REQUEST_RESET
60 };
61
62 typedef struct _appmgr_pkginfo {
63         char *pkgid;
64         char *pkg_label;
65         char *icon_path;
66         char *pkg_type;
67         char *pkg_version;
68         char *main_appid;
69         int sz_total;
70         int sz_data;
71         int sz_cache;
72         bool nodisplay;
73         bool removable;
74         bool taskmanage;
75         bool is_movable;
76         bool is_preload;
77         bool is_updated;
78         bool is_support_disable;
79         bool is_disable;
80
81         GList *appids;
82         pkgmgrinfo_installed_storage storage;
83
84         pkgmgr_client *pc_size;
85         pkgmgr_client *pc_request;
86         Setting_GenGroupItem_Data *total_size;
87         Setting_GenGroupItem_Data *data_size;
88         Setting_GenGroupItem_Data *app_size;
89
90         Setting_GenGroupItem_Data *first_prv;
91         Setting_GenGroupItem_Data *last_prv;
92
93         Elm_Object_Item *def_sep;
94         Evas_Object *gl_prv;
95
96         pthread_t tid;
97 } appmgr_pkginfo;
98
99 typedef struct _appmgr_listinfo {
100         Elm_Object_Item *item;
101
102         int group_style;
103
104         char *pkgid;
105         char *icon_path;
106         char *pkg_label;
107         char *mainappid;
108
109         int total_size;
110         bool valid_size;
111         bool is_preload;
112         bool is_update;
113         bool is_disabled;
114         GList *runinfos;
115         GList *def_appids;
116 } appmgr_listinfo;
117
118 typedef struct _appmgr_runinfo {
119         char *appid;
120         char *label;
121         bool can_kill;
122 } appmgr_runinfo;
123
124 typedef struct _SettingAppMgrUG {
125         ui_gadget_h ug;
126         int tabtype;
127         int sorttype;
128         int can_sizesort;
129         int pkg_request;
130
131         setting_view *main_view;
132         setting_view *runinfo_view;
133         setting_view *pkginfo_view;
134
135         Evas_Object *win;
136         Evas_Object *lo_parent;
137
138         Evas_Object *lo_main;
139         Evas_Object *navi;
140         Evas_Object *popup;
141
142         /*main view */
143         Elm_Object_Item *navi_main_it;
144         Evas_Object *gl_main;
145         Evas_Object *lo_noitem;
146         int noitem_type;
147         Evas_Object *def_toolbar;
148         pkgmgr_client *pc_main;
149         pkgmgr_client *pc_all_size;
150         GList *pkg_list;
151         GList *old_pkg_list;
152         Ecore_Idler *size_idler;
153         void *reset_worker;
154         void *list_worker;
155         void *running_list_worker;
156
157         char *sel_pkgid;
158         char *sel_icon;
159         char *sel_label;
160         int sel_total;
161         int sel_data_size;
162         int sel_is_disabled;
163
164         int is_runlist_ready;
165
166         /*run info view */
167         Evas_Object *gl_run;
168         GList *runinfos;
169         appmgr_listinfo *info_run;
170
171         /*Pkg info view */
172         bool support_taskmanager;
173         Evas_Object *gl_pkg;
174         Evas_Object *pkg_toolbar;
175         char *pinfo_version;
176         appmgr_pkginfo *pkginfo;
177
178         Ecore_Timer *pkginfo_getsize_timer;
179
180         Elm_Genlist_Item_Class itc_main;
181         Elm_Genlist_Item_Class info_itc;
182         Elm_Genlist_Item_Class itc_sep;
183         Elm_Genlist_Item_Class itc_1txt_1ic_2;
184         Elm_Genlist_Item_Class itc_1txt;
185         Elm_Genlist_Item_Class itc_priv;
186         Elm_Genlist_Item_Class itc_multiline;
187         Elm_Genlist_Item_Class itc_grp_title;
188         Elm_Genlist_Item_Class itc_info_title;
189         Elm_Genlist_Item_Class itc_1ic;
190         Elm_Genlist_Item_Class itc_2txt_2;
191         Elm_Genlist_Item_Class itc_multiline_2txt;
192         Elm_Genlist_Item_Class itc_2button1;
193         Elm_Genlist_Item_Class itc_2button2;
194         Elm_Genlist_Item_Class itc_1button;
195
196         Setting_GenGroupItem_Data *cache_size;
197         Setting_GenGroupItem_Data *clear_cache;
198 } SettingAppMgrUG;
199
200 #define APPMGRUG_TIME(fmt, arg...) \
201         do { \
202                 struct timeval tv; \
203                 gettimeofday(&tv, NULL); \
204                 double now = tv.tv_sec * 1000 + (double)tv.tv_usec/1000; \
205                 SETTING_TRACE_DEBUG(fmt" time = %f ms", ##arg, now); \
206         }while(0)
207
208
209 extern setting_view setting_view_appmgr_pkginfo;
210 extern setting_view setting_view_appmgr_main;
211
212 #endif /*__SETTING_APPMGR_H__ */