tizen 2.4 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_MAX
50 };
51
52 enum {
53     APPMGRUG_PKG_REQUEST_NONE,
54     APPMGRUG_PKG_REQUEST_UNINSTALL,
55     APPMGRUG_PKG_REQUEST_MOVE,
56     APPMGRUG_PKG_REQUEST_DISABLE,
57     APPMGRUG_PKG_REQUEST_ENABLE,
58     APPMGRUG_PKG_REQUEST_RESET
59 };
60
61 typedef struct _appmgr_pkginfo {
62         char *pkgid;
63         char *pkg_label;
64         char *icon_path;
65         char *pkg_type;
66         char *pkg_version;
67         char *main_appid;
68         int sz_total;
69         int sz_data;
70         long long sz_cache;
71         bool nodisplay;
72         bool removable;
73         bool taskmanage;
74         bool is_movable;
75         bool is_preload;
76         bool is_updated;
77         bool is_support_disable;
78         bool is_disable;
79
80         GList *appids;
81         pkgmgrinfo_installed_storage storage;
82
83         pkgmgr_client *pc_size;
84         pkgmgr_client *pc_request;
85         Setting_GenGroupItem_Data *total_size;
86         Setting_GenGroupItem_Data *data_size;
87         Setting_GenGroupItem_Data *app_size;
88
89         Setting_GenGroupItem_Data *first_prv;
90         Setting_GenGroupItem_Data *last_prv;
91
92         Elm_Object_Item *def_sep;
93         Evas_Object *gl_prv;
94
95         pthread_t tid;
96 } appmgr_pkginfo;
97
98 typedef struct _appmgr_listinfo {
99         Elm_Object_Item *item;
100
101         char *pkgid;
102         char *icon_path;
103         char *pkg_label;
104         char *mainappid;
105
106         int total_size;
107         bool valid_size;
108         bool is_preload;
109         bool is_update;
110         bool is_disabled;
111         GList *runinfos;
112         GList *def_appids;
113 } appmgr_listinfo;
114
115 typedef struct _appmgr_runinfo {
116         char *appid;
117         char *label;
118         bool can_kill;
119 } appmgr_runinfo;
120
121 typedef struct _SettingAppMgrUG {
122         ui_gadget_h ug;
123         int tabtype;
124         int sorttype;
125         int can_sizesort;
126         int pkg_request;
127
128         Evas_Object *sort_rdg;
129         char *sort_str;
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__ */