2 * Copyright 2012 Samsung Electronics Co., Ltd
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
8 * http://www.tizenopensource.org/license
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.
20 #include <Elementary.h>
24 #include <ui-gadget.h>
33 # define APPDIR "/opt/apps/org.tizen.gallery"
37 # define PACKAGE "gallery"
40 #if !defined(LOCALEDIR)
41 # define LOCALEDIR APPDIR"/res/locale"
45 # define EDJDIR APPDIR"/res/edje"
48 #if !defined(IMAGEDIR)
49 # define IMAGEDIR APPDIR"/res/images/"
52 #define PKGNAME_GALLERY "org.tizen.gallery"
54 /******** EDJ File path ********/
56 #define GL_EDJ_FILE EDJDIR "/" PACKAGE ".edj"
58 /******** Groups name ********/
60 #define GL_GRP_VIEW_LAYOUT "gallery/view_layout"
61 #define GL_GRP_SEGMENT "gallery/segment_layout"
62 #define GL_GRP_GRIDVIEW "gallery/gridview"
63 #define GL_GRP_ENTRY "gallery/entry"
64 #define GL_GRP_PHOTOFRAME "photoframe"
66 /******* Part name ***********/
68 #define GL_NAVIFRAME_PREB_BTN "prev_btn"
69 #define GL_NAVIFRAME_TITLE_RIGHT_BTN "title_right_btn"
70 #define GL_NAVIFRAME_TITLE_LEFT_BTN "title_left_btn"
71 #define GL_NAVIFRAME_CONTROLBAR "controlbar"
73 #define GL_NAVIFRAME_TITLE_MORE_BTN "title_more_btn"
74 #define GL_NAVIFRAME_OPTIONHEAD "optionheader"
76 #define GL_POPUP_TEXT "title,text"
77 #define GL_NOCONTENTS_TEXT "elm.text"
78 #define GL_GRID_TEXT "elm.text"
79 #define GL_NAAVIFRAME_TEXT "elm.text.title"
81 /******** Style name ********/
83 #define GL_CLASS_GENGRID "gengrid"
84 #define GL_BUTTON_STYLE_RENAME "rename"
86 #define GL_BUTTON_STYLE_NAVI_MORE "naviframe/more/default"
87 #define GL_BUTTON_STYLE_NAVI_SLIDESHOW "naviframe/slideshow/gallery"
88 #define GL_BUTTON_STYLE_NAVI_DONE "naviframe/done/gallery"
89 #define GL_BUTTON_STYLE_NAVI_CANCEL "naviframe/cancel/gallery"
90 #define GL_BUTTON_STYLE_SWEEP "sweep"
91 #define GL_BUTTON_STYLE_SWEEP_DELETE "sweep/delete"
92 /* Button object style of previous button of naviframe */
93 #define GL_BUTTON_STYLE_NAVI_PRE "naviframe/back_btn/default"
95 #define GL_BUTTON_STYLE_NAVI_CTRL "naviframe_control"
98 #define GL_CHECKBOX_STYLE_GRID "gallery/grid"
99 #define GL_GENLIST_STYLE_DEFAULT "gallery/default"
100 #define GL_CONTROLBAR_STYLE_NAVI "naviframe"
102 #define GL_GENLIST_ITEM_STYLE_SWEEP3 "mode/gallery/slide3"
104 /******** Image path ********/
106 #define GL_DEFAULT_THUMB_ICON IMAGEDIR"T01_Nocontents_broken.png"
107 #define GL_DB_DEFAULT_THUMB "/opt/data/file-manager-service/.thumb/thumb_default.png"
108 #define GL_LOCK_ICON IMAGEDIR"T01_icon_lock.png"
110 #define Gl_VIDEO_PLAY_ICON IMAGEDIR"T01_btn_thumbnail_play.png"
111 #define GL_THUMB_BOOKMARK IMAGEDIR"T01_icon_thumbnail_bookmark.png"
112 #define GL_LIST_BOOKMARK IMAGEDIR"T01_list_icon_bookmark.png"
114 #define GL_CBAR_ICON_EDIT IMAGEDIR"T01_controlbar_icon_edit.png"
115 #define GL_CBAR_ICON_CANCEL IMAGEDIR"T01_controlbar_icon_cancel.png"
116 #define GL_CBAR_ICON_DONE IMAGEDIR"T01_controlbar_icon_done.png"
117 #define GL_CBAR_ICON_DELETE IMAGEDIR"T01_controlbar_icon_delete.png"
118 #define GL_CBAR_ICON_SHARE IMAGEDIR"T01_controlbar_icon_share02.png"
119 #define GL_CBAR_ICON_MOVE IMAGEDIR"T01_controlbar_icon_move.png"
120 #define GL_CBAR_ICON_CAMERA IMAGEDIR"T01_controlbar_icon_camera.png"
122 /******** String ********/
125 #define GL_MIME_IMAGE_ALL "image/*"
126 #define GL_MIME_VIDEO_ALL "video/*"
128 /******** Numerical value ********/
130 /* Window width and height */
131 #define GL_WIN_WIDTH 720
132 #define GL_WIN_HEIGHT 1280
134 /* Specified ID for customed items, which don't exist in DB */
135 #define GL_ALBUM_ALL_ID "GALLERY_ALBUM_ALL_ALBUMS_ID"
136 /* There are 7 thumbnails of 'Camera shots' and 'All' cover, but 4 for normal albums */
137 #define GL_ALBUM_COVER_THUMB_NUM 7
138 /* Normal albums cover have maximum 4 thumbnails */
139 #define GL_ALBUM_COVER_THUMB_NUM_SEC 4
141 /* Size of thumbnails in gridview */
142 #define GL_GRID_ITEM_SIZE_W 178
143 #define GL_GRID_ITEM_SIZE_H 182
144 /* Thumbnail would be enlarged if medias count is less than 7 */
145 #define GL_GRID_ITEM_ZOOM_LEVEL_01 4
146 #define GL_GRID_ITEM_ZOOM_LEVEL_02 2
147 #define GL_GRID_ITEM_ZOOM_LEVEL_03 (1.35)
148 #define GL_GRID_ITEM_ZOOM_LEVEL_01_CNT 1
149 #define GL_GRID_ITEM_ZOOM_LEVEL_02_CNT 6
151 /* String length of mtye item id */
152 #define GL_MTYPE_ITEN_ID_LEN_MAX 37
154 /* String length of album name */
155 #define GL_ALBUM_NAME_LEN_MAX GL_FILE_NAME_LEN_MAX
157 #define GL_DATE_INFO_LEN_MAX 256
158 #define GL_POPUP_DESC_LEN_MAX 256
159 #define GL_EXT_STR_COUNT_LEN 20
161 /* Maximum number of entry string, 255 Chars of album name (linux system) */
162 #define GL_ENTRY_STR_CHAR_MAX 255
165 #define GL_DEFAULT_YEAR 1900
167 #define GL_TIME_MSEC_PER_SEC 1000
169 #define GL_TIME_USEC_PER_SEC 1000000L
171 #define GL_TIME_USEC_PER_MSEC 1000
173 #define GL_TIME_SEC_PER_MIN 60
175 #define GL_TIME_MIN_PER_HOUR 60
177 #define GL_TIME_SEC_PER_HOUR (GL_TIME_MIN_PER_HOUR * GL_TIME_SEC_PER_MIN)
179 /* itoa length max -- 1(sign) + 10(2^31) + 1(NULL) */
180 #define GL_INTERGER_LEN_MAX 12
182 /* File system related String definition */
183 #define GL_ROOT_PATH_PHONE "/opt/media"
184 #define GL_ROOT_PATH_MMC "/opt/storage/sdcard"
185 #define GL_DEFAULT_PATH_IMAGES "/Images and videos"
187 /******** Enumeration ********/
189 typedef enum _gl_aul_launch_type
193 GL_AUL_T_SELECT_MULTIPLE,
194 GL_AUL_T_SELECT_IMFT,
195 GL_AUL_T_SELECT_SETAS,
196 GL_AUL_T_SELECT_ALBUM,
197 /* Launching from live-magazine, show 'All album' */
199 } gl_aul_launch_type;
203 GL_AUL_SETAS_T_WALLPAPER,
204 GL_AUL_SETAS_T_CROP_WALLPAPER,
205 GL_AUL_SETAS_T_CALLER_ID,
208 typedef enum _gl_aul_file_type
216 typedef enum _gl_view_mode
221 GL_VIEW_ALBUMS_RENAME,
225 GL_VIEW_VIDEOLIST_EDIT,
228 typedef enum _gl_ctrl_seg_mode
236 typedef enum _gl_entry_mode
240 GL_ENTRY_RENAME_ALBUM,
244 /******** Structure ********/
248 Elm_Genlist_Item_Class videolic; /* Genlist item class of list view */
249 /* Genlist item class of video list view for sweep */
250 Elm_Genlist_Item_Class sweeplic;
251 Evas_Object *videos_view;
252 Evas_Object *videos_nocontents;
253 int videos_cnt; /* Media items count append to listview */
255 char *sweep_file_path;
256 /* UUID of item selected for playing */
258 Evas_Object *share_btn;
259 Evas_Object *del_btn;
267 } gl_grid_touch_info;
271 Elm_Gengrid_Item_Class thumbgic; /* Gengrid item class of thumbnails view */
272 Evas_Object *edit_view;
273 Evas_Object *edit_layout;
275 Evas_Object *all_view;
276 Evas_Object *all_nocontents;
277 Evas_Object *images_view;
278 Evas_Object *images_nocontents;
280 Elm_Object_Item *edit_it;
281 /* Naviframe item pushed to stack */
282 Elm_Object_Item *nf_it;
283 Elm_Object_Item *nf_it_edit;
284 Elm_Object_Item *nf_it_select;
285 Evas_Object *segment;
286 gl_grid_touch_info grid_touch_info; /* Added for shrink effect while select thumbnail */
287 /* It's thumbnails icon size, not grid item size */
289 Ecore_Idler *grid_append_idler; /* Use idler to append other medias to gridview */
290 /* if album contains more than (GL_FIRST_VIEW_END_POS+1) medias */
291 int grid_view_mode; /* Types: gl_grid_mode; */
292 /* 1. Indicate grid view mode of thumbnails view */
293 /* 2. Set types for creating nocontents view */
294 int thumbs_cnt; /* Media items count appended to gridview */
295 int updated_thumbs_cnt; /* Media items count appended to gridview while refreshing */
296 bool back_to_normal; /* When back from edit mode, reset checkbox state */
298 #ifdef _USE_ROTATE_BG
299 Evas_Object *more_btn;
300 Evas_Object *left_btn;
301 Evas_Object *right_btn;
307 bool app_called_by_me; /* Indicates if any application invoked by Gallery */
308 ui_gadget_h ug_called_by_me;
311 int sort_type; /* Types: wminfo_media_sort_type; pass it to imageviewer */
312 ui_gadget_h gallery_ug_called_by_me; /* The gallery-ug called by Gallery for appsvc */
317 Elm_Gengrid_Item_Class albumgic; /* Gengrid item class of albums view */
318 Elm_Gengrid_Item_Class albumgic_blue; /* Gengrid item class of albums view */
319 Evas_Object *layout; /* Albums view layout object */
320 Evas_Object *view; /* Albums view object */
321 Evas_Object *edit_layout; /* Albums view layout object */
322 Evas_Object *edit_view; /* Albums view object */
324 Evas_Object *nocontents; /* Nocontents object */
325 /* Naviframe item pushed to stack */
326 Elm_Object_Item *nf_it;
327 Elm_Object_Item *nf_it_edit;
329 Elm_Object_Item *edit_it;
331 Elm_Object_Item *camera_it;
332 gl_item *cover_thumbs[GL_ALBUM_COVER_THUMB_NUM]; /* Media items of album cover */
333 gl_cluster *current_album; /* Album selected for showing thumbnails view/list view */
334 /* Album selected for rename/open locked album */
335 gl_cluster *selected_album;
336 /* Save destination album id while move/save */
338 char new_album_name[GL_ALBUM_NAME_LEN_MAX];
339 Eina_List *selected_albums_elist; /* List of all selected albums */
340 gl_cluster_list *cluster_list; /* List of all albums */
341 int albums_cnt; /* Albums count appended to gridview */
342 int album_medias_cnt; /* Media items count of a album, it is showed in album cover */
343 bool update_albums_list; /* Flag indicate to update albums list when back to normal view. */
344 /* 1. MMC Inserted/Removed in thumbnails edit mode; */
345 char dest_folder[GL_DIR_PATH_LEN_MAX]; /* The full path of destination album of movement */
346 bool move_new_album; /* True: move medias to album newly created, */
347 /* False: move to album already created */
348 /* Variables below are related to gallery launching */
349 service_h recv_service; /* The service received when app_reset */
350 bool gallery_launched;
351 /* Launching from shotcut(album added to home) */
352 bool aul_launch_by_mime;
358 char* aul_homescreen_path;
359 char* aul_lockscreen_path;
360 char* aul_callid_size;
361 char* aul_callid_path;
363 Ecore_Idler *create_albums_idler; /* Use idler to append albums to albums view */
364 /* Use idler to activate window when launching Gallery UG */
365 Ecore_Idler *activate_win_idler;
370 Evas_Object *editfield;
371 Evas_Object *imf_entry;
372 Ecore_IMF_Context *imf_context;
373 int entry_mode; /* Type: gl_entry_mode; Indicate usage of entry */
374 /* Button 'Done' in new album view */
375 Evas_Object *done_btn;
376 Evas_Object *cancel_btn;
377 Elm_Object_Item *nf_it;
378 /* Handle for play vibration */
380 /* Timer for closing vibration */
381 Ecore_Timer *vibration_timer;
386 Elm_Genlist_Item_Class popuplit;/* Genlist item class of list view in popupinfo.popup */
389 char popup_item_label[GL_ALBUM_NAME_LEN_MAX];/* Selected item label of list in popupinfo.popup */
390 /* Selectioninfo popup */
391 Evas_Object *selinfo;
392 Evas_Object *selinfo_ly;
393 Ecore_Timer *del_timer;
397 Eina_List *medias_elist;/* List of all selected medias of a album */
398 int images_cnt; /* Images count selected */
399 int drms_cnt; /* DRM files count selected */
400 int jpeg_cnt; /* JEPG files count selected */
401 /* All media count */
406 Evas_Object *pbar_popup;
408 Evas_Object *status_label;
410 * After progressbar showed completely, use timer to
411 * emit next signal to write pipe to continue to operate medias.
413 Ecore_Timer *start_thread_timer;
415 * After thread operation done, use idler to
416 * delete progressbar after it's showed completely(status is 100%).
418 Ecore_Idler *del_pbar_idler;
419 Ecore_Pipe *sync_pipe; /* Pipe for communication between main and child thread */
420 pthread_mutex_t pbar_lock; /* Lock for state of 'Cancel' button */
421 pthread_mutex_t refresh_lock; /* Lock for progressbar refreshing */
422 pthread_cond_t refresh_cond; /* Condition for progressbar refreshing */
423 int refresh_flag; /* Indicates progressbar updated or not while moving or deleting */
424 int pbar_cancel; /* State of 'Cancel' button on progressbar popup */
425 /* Medias count already operated */
433 Evas_Object *main_layout;
434 Evas_Object *naviframe;
436 int rotate_mode; /* Type: appcore_rm; Indicate rotation mode of whole application */
437 int view_mode; /* Type: gl_view_mode; Indicate view mode of whole application */
441 Eina_List *medias_elist;/* List of all medias of a album */
442 int medias_cnt; /* Count of all medias of a album */
443 int medias_op_type; /* Type: Move or Delete medias */
444 int mmc_state; /* MMC state(Inserted, Removed) */
445 int seg_mode; /* State of active segment: all, image or video */
446 Ecore_Job *rename_album_job;
451 gl_main_info maininfo; /* Global variables about webalbum */
452 gl_album_info albuminfo; /* Global variables about albums view */
453 gl_grid_info gridinfo; /* Global variables about thumbnails view */
454 gl_list_info listinfo; /* Global variables about videos list view */
455 gl_entry_info entryinfo; /* Global variables about entry */
456 gl_popup_info popupinfo; /* Global variables about popup */
457 gl_pbar_info pbarinfo; /* Global variables about progressbar */
458 gl_ug_info uginfo; /* Global variables about ug */
459 gl_selected_info selectedinfo; /* Global variables about files selected */
462 typedef struct _gl_appdata gl_appdata;
464 int gallery_reset_app(void *data);
470 #endif /* _GALLERY_H_ */