tizen 2.4 release
[apps/home/settings.git] / setting-storage / include / setting-storage.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_STORAGE_H__
20 #define __SETTING_STORAGE_H__
21
22 #include <string.h>
23 #include <pthread.h>
24 #include <cairo.h>
25
26 #include <Elementary.h>
27 #include <dd-deviced.h>
28 #include <package-manager.h>
29
30 #include "setting-common-view.h"
31 #include "setting-common-draw-widget.h"
32 #include "setting-storage-string.h"
33
34 extern const char *storageUg_MMC_stat;
35 extern const char *storageUg_ENCRYPT_stat;
36
37
38 #define SETTING_STORAGE_PIE_RECT_OFFSET (36 * WIDGET_SCALE_FACTOR)
39 #define SETTING_STORAGE_DEFAULT_STORAGE_APP_DESP_SIZE (240 * WIDGET_SCALE_FACTOR)
40
41 #define SETTING_STORAGE_POPUP_TIMER     2
42 #define SETTING_STORAGE_PROGRESSBAR_TIMEOUT 10
43
44
45 #define SAFE_STRDUP(src) (src)?strdup(src):NULL
46
47 typedef struct _Setting_Storage_Status {
48         double  dTotal;
49         double  dAvail;
50 } Setting_Storage_Status;
51
52
53 typedef struct _SettingStorageUG SettingStorageUG;
54
55 typedef struct {
56         pthread_t tid;
57
58         double video_total;
59         double audio_total;
60         double misces_total;
61
62         SettingStorageUG *ad;
63 } storageUg_worker_data;
64
65 struct _SettingStorageUG {
66         ui_gadget_h ug;
67
68         setting_view *main_view;
69         setting_view *default_view;
70         setting_view *misces_view;
71
72         Evas_Object *win;
73         Evas_Object *lo_parent;
74         Evas_Object *navi;
75
76         Evas_Object *lo_main;
77         Evas_Object *gl_main;
78
79         /* storage setting */
80         Evas_Object *popup;
81         Elm_Genlist_Item_Class itc_2text_3_parent;
82         Elm_Genlist_Item_Class itc_1icon_1text_sub;
83         Elm_Genlist_Item_Class itc_2text_2;
84         Elm_Genlist_Item_Class itc_group_item;
85         Elm_Genlist_Item_Class itc_2text_1icon_3;
86         Elm_Genlist_Item_Class itc_1text;
87         Elm_Genlist_Item_Class itc_1text_1icon;
88         Elm_Genlist_Item_Class itc_pie;
89         Elm_Genlist_Item_Class itc_notice;
90         Elm_Genlist_Item_Class itc_color_item;
91         Elm_Genlist_Item_Class itc_msic_file_item;
92
93         double sz_inter_total;
94         double sz_inter_avail;
95         double sz_sys;
96         double sz_apps;
97         double sz_pics_videos;
98         double sz_audio;
99         double sz_misces;
100         double sz_caches;
101
102         Setting_GenGroupItem_Data *total_space;
103         Setting_GenGroupItem_Data *sys_mem;
104         Setting_GenGroupItem_Data *apps;
105         Setting_GenGroupItem_Data *pics_videos;
106         Setting_GenGroupItem_Data *audio;
107         Setting_GenGroupItem_Data *misces;
108         Setting_GenGroupItem_Data *caches;
109         Setting_GenGroupItem_Data *avail;
110         pkgmgr_client *pc;
111         pkgmgr_client *pc_total_size;
112
113         /* pie sub_layout*/
114         Elm_Object_Item *pie_it;
115         cairo_t *cr;
116
117         Setting_GenGroupItem_Data *sd_card;
118         Setting_GenGroupItem_Data *sd_mount;
119         Setting_GenGroupItem_Data *sd_total;
120         Setting_GenGroupItem_Data *sd_avail;
121         Setting_GenGroupItem_Data *sd_format;
122         struct mmc_contents mmc_content;
123         int sd_request;
124
125         /* usb otg storage */
126         Setting_GenGroupItem_Data *usb_card;
127         Setting_GenGroupItem_Data *usb_mount;
128         Setting_GenGroupItem_Data *usb_total;
129         Setting_GenGroupItem_Data *usb_available;
130         Setting_GenGroupItem_Data *usb_unmount;
131         Setting_GenGroupItem_Data *usb_format;
132         Elm_Object_Item *usb_sep_item;
133
134         int usb_otg_status;
135         int usb_request;
136         char *usb_otg_path;
137
138         void *size_worker;
139
140         Ecore_Idler *update_idler;
141         Ecore_Timer *update_timer;
142
143         /* default storage */
144         Setting_GenGroupItem_Data *data_bt;
145         Setting_GenGroupItem_Data *data_nfc;
146         Setting_GenGroupItem_Data *data_wifidirect;
147         Setting_GenGroupItem_Data *data_installapp;
148
149         /* miscellaneous files list */
150         int misc_view_mode;                             /** 0 : default 1 : delete layout */
151
152         Elm_Object_Item *main_misces_navi_it;
153         Elm_Object_Item *misces_navi_it;
154
155         Evas_Object *gl_misces;                 /** genlist for misc list */
156         Evas_Object *misces_lo_noitem;
157
158         Eina_Bool misces_is_select_all;
159         Eina_List *misces_list;
160         Eina_List *misces_sel_list;
161         int misces_sz_all;
162         int misces_checked;
163         int misces_deleted;
164         bool misces_ctx_popup_selected;
165         void *del_worker;
166
167         Evas_Object *ly_select_all;             /** misc > 'select all' layout */
168         Evas_Object* ly_default;
169
170         Evas_Object *title_left_btn;
171         Evas_Object *title_right_btn;
172
173         int mmc_status;
174 };
175
176 #endif /*__SETTING_STORAGE_H__ */