diff options
author | Chandan <ch.kumar@samsung.com> | 2016-12-12 13:13:12 +0530 |
---|---|---|
committer | Chandan <ch.kumar@samsung.com> | 2016-12-12 13:13:39 +0530 |
commit | 2d2f198389930be81cc9e94ec16523e58995508c (patch) | |
tree | b955122ef29d7bba2ba4534c3f0b38bbd17a74da | |
parent | 2d8fca0d014dbbded85bef2ffde1fc94c6bb7a32 (diff) | |
download | attach-panel-document-2d2f198389930be81cc9e94ec16523e58995508c.tar.gz attach-panel-document-2d2f198389930be81cc9e94ec16523e58995508c.tar.bz2 attach-panel-document-2d2f198389930be81cc9e94ec16523e58995508c.zip |
Fixed Coding Guideline Issue
Change-Id: I773cbb9ae28cadd0da95cef4dad2eab27e16ef10
Signed-off-by: Chandan <ch.kumar@samsung.com>
-rw-r--r-- | include/attach-panel-document.h | 25 | ||||
-rw-r--r-- | include/doc-data-type.h | 39 | ||||
-rw-r--r-- | include/doc-data-util.h | 88 | ||||
-rw-r--r-- | include/doc-data.h | 24 | ||||
-rw-r--r-- | include/doc-db-update.h | 8 | ||||
-rw-r--r-- | include/doc-debug.h | 28 | ||||
-rw-r--r-- | include/doc-list.h | 29 | ||||
-rw-r--r-- | include/doc-local-data.h | 12 | ||||
-rw-r--r-- | include/doc-main-view.h | 5 | ||||
-rw-r--r-- | include/doc-strings.h | 2 | ||||
-rw-r--r-- | include/doc-ugdata.h | 260 | ||||
-rw-r--r-- | include/doc-ui-util.h | 24 | ||||
-rw-r--r-- | include/doc-util.h | 7 | ||||
-rw-r--r-- | src/attach-panel-document.c | 138 | ||||
-rw-r--r-- | src/doc-data-type.c | 15 | ||||
-rw-r--r-- | src/doc-data-util.c | 81 | ||||
-rw-r--r-- | src/doc-data.c | 50 | ||||
-rw-r--r-- | src/doc-db-update.c | 57 | ||||
-rw-r--r-- | src/doc-list.c | 402 | ||||
-rw-r--r-- | src/doc-local-data.c | 72 | ||||
-rw-r--r-- | src/doc-main-view.c | 8 | ||||
-rw-r--r-- | src/doc-ui-util.c | 79 | ||||
-rw-r--r-- | src/doc-util.c | 41 |
23 files changed, 816 insertions, 678 deletions
diff --git a/include/attach-panel-document.h b/include/attach-panel-document.h index c5742c1..d939e75 100644 --- a/include/attach-panel-document.h +++ b/include/attach-panel-document.h @@ -22,22 +22,22 @@ #ifdef __cplusplus extern "C" { -#endif /* __cplusplus */ +#endif /* __cplusplus */ #define DOC_UG_RES_DIR PREFIX"/res/" #define DOC_EDJ_DIR DOC_UG_RES_DIR"edje/"PACKAGE"/" #define DOC_EDJ_FILE DOC_EDJ_DIR"attach-panel-document.edj" #define DOC_GRP_LISTVIEW "document/listview" -#define DOC_BUNDLE_LAUNCH_TYPE "launch-type" +#define DOC_BUNDLE_LAUNCH_TYPE "launch-type" #define DOC_BUNDLE_SELECTION_MODE_SINGLE "single" #define DOC_BUNDLE_SELECTION_MODE_MULTI "multiple" -#define DOC_BUNDLE_FILE_TYPE "file-type" -#define DOC_LAUNCH_SELECT_ONE "select-one" -#define DOC_LAUNCH_SELECT_MULTIPLE "select-multiple" -#define DOC_FILE_TYPE_IMAGE "image" -#define DOC_FILE_TYPE_VIDEO "video" -#define DOC_FILE_SELECT_RETURN_COUNT "count" -#define DOC_FILE_SELECT_RETURN_PATH "path" +#define DOC_BUNDLE_FILE_TYPE "file-type" +#define DOC_LAUNCH_SELECT_ONE "select-one" +#define DOC_LAUNCH_SELECT_MULTIPLE "select-multiple" +#define DOC_FILE_TYPE_IMAGE "image" +#define DOC_FILE_TYPE_VIDEO "video" +#define DOC_FILE_SELECT_RETURN_COUNT "count" +#define DOC_FILE_SELECT_RETURN_PATH "path" /* MIME type */ @@ -52,8 +52,5 @@ extern "C" { #ifdef __cplusplus } -#endif /* __cplusplus */ - - -#endif /* __ATTACH_PANEL_DOCUMENT_H__ */ - +#endif /* __cplusplus */ +#endif /* __ATTACH_PANEL_DOCUMENT_H__ */ diff --git a/include/doc-data-type.h b/include/doc-data-type.h index 7fe035c..8f2d419 100644 --- a/include/doc-data-type.h +++ b/include/doc-data-type.h @@ -24,8 +24,7 @@ #define DOC_FREEIF(ptr) \ do { \ - if (ptr != NULL) \ - { \ + if (ptr != NULL) { \ free(ptr); \ ptr = NULL; \ } \ @@ -66,29 +65,29 @@ typedef struct _doc_folder_t doc_folder_s; typedef struct _doc_media_t doc_media_s; struct _doc_folder_t { - int gtype; /*self-defination type, when free this struct space, use it*/ - char *uuid; /*folder UUID*/ - char *display_name; /*folder name*/ - char *path; /*the full path of this folder*/ - int type; /*storage type*/ - time_t mtime; /*modified time*/ - int count; /*the media count in this folder*/ + int gtype; /*self-defination type, when free this struct space, use it */ + char *uuid; /*folder UUID */ + char *display_name; /*folder name */ + char *path; /*the full path of this folder */ + int type; /*storage type */ + time_t mtime; /*modified time */ + int count; /*the media count in this folder */ }; struct _doc_media_t { - int gtype; /*self-defination type, when free this struct space, use it*/ - media_info_h media_h; /*the handle of operating this media*/ - char *uuid; /*meida id*/ - int type; /*meida type, image or video*/ - char *thumb_url; /*the thumbnail full path of this meida file*/ - char *file_url; /*the full path of this meida file*/ - time_t mtime; /*modified time*/ - char *display_name; /*item name*/ - int mode; /* Show icon indicates different camera shot mode */ - media_content_storage_e storage_type; /* Storage type got from DB */ + int gtype; /*self-defination type, when free this struct space, use it */ + media_info_h media_h; /*the handle of operating this media */ + char *uuid; /*meida id */ + int type; /*meida type, image or video */ + char *thumb_url; /*the thumbnail full path of this meida file */ + char *file_url; /*the full path of this meida file */ + time_t mtime; /*modified time */ + char *display_name; /*item name */ + int mode; /* Show icon indicates different camera shot mode */ + media_content_storage_e storage_type; /* Storage type got from DB */ bool b_create_thumb; /* Request DB to create thumbnail */ }; int doc_data_type_free_item(void **item); -#endif /* __ATTACH_PANEL_DOCUMENT_H__ */ +#endif /* __ATTACH_PANEL_DOCUMENT_H__ */ diff --git a/include/doc-data-util.h b/include/doc-data-util.h index eff656f..bf3e3e6 100644 --- a/include/doc-data-util.h +++ b/include/doc-data-util.h @@ -44,54 +44,56 @@ extern "C" { #define DOC_CAMERA_PATH_MMC "/opt/storage/sdcard/DCIM/Camera" #define DOC_DOWNLOADS_PATH "/opt/usr/media/Downloads" -#define DOC_ROOT_PATH_MMC "/opt/storage/sdcard" +#define DOC_ROOT_PATH_MMC "/opt/storage/sdcard" #define DOC_GET_UNTIL_LAST_RECORD 65536 /* Fixme: Do not use 65536. */ #define DOC_GET_ALL_RECORDS -1 -typedef struct _doc_transfer_data_t doc_transfer_data_s; - -struct _doc_transfer_data_t { - void **userdata; - char *folder_id; - bool with_meta; - bool b_mtype; - int list_type; -}; - -typedef struct _doc_filter_t doc_filter_s; - -struct _doc_filter_t { - char cond[CONDITION_LENGTH]; /*set media type or favorite type, or other query statement*/ - media_content_collation_e collate_type; /*collate type*/ - media_content_order_e sort_type; /*sort type*/ - char sort_keyword[KEYWORD_LENGTH]; /*sort keyword*/ - int offset; /*offset*/ - int count; /*count*/ - bool with_meta; /*whether get image or video info*/ - int list_type; -}; - -typedef enum { - DOC_FOLDER_LIST_NONE, /**< */ - DOC_FOLDER_LIST_FIRST, /**< Get first several folders except Camera and Downloads */ - DOC_FOLDER_LIST_PATH, /**< Get a folder via path */ - DOC_FOLDER_LIST_ALL, /**< Get all folders except Camera and Downloads */ -} doc_folder_list_e; - -doc_item *doc_data_util_calloc_item(void); -int doc_data_util_free_mtype_items(Eina_List **elist); -int doc_data_util_free_item(doc_item *item); -doc_sel_item_s* doc_data_util_new_sel_item(doc_item *ditem); -int doc_data_util_free_sel_item(doc_sel_item_s *item); -int doc_data_util_create_filter(doc_filter_s *condition, filter_h *filter); -int doc_data_util_destroy_filter(filter_h filter); -bool doc_data_util_clone_media(media_info_h media, doc_media_s **pitem, - bool b_meta); + typedef struct _doc_transfer_data_t doc_transfer_data_s; + + struct _doc_transfer_data_t { + void **userdata; + char *folder_id; + bool with_meta; + bool b_mtype; + int list_type; + }; + + typedef struct _doc_filter_t doc_filter_s; + + struct _doc_filter_t { + char cond[CONDITION_LENGTH]; /*set media type or favorite type, or other query statement */ + media_content_collation_e collate_type; /*collate type */ + media_content_order_e sort_type; /*sort type */ + char sort_keyword[KEYWORD_LENGTH]; /*sort keyword */ + int offset; /*offset */ + int count; /*count */ + bool with_meta; /*whether get image or video info */ + int list_type; + }; + + typedef enum { + DOC_FOLDER_LIST_NONE, + /**< */ + DOC_FOLDER_LIST_FIRST, + /**< Get first several folders except Camera and Downloads */ + DOC_FOLDER_LIST_PATH, + /**< Get a folder via path */ + DOC_FOLDER_LIST_ALL,/**< Get all folders except Camera and Downloads */ + } doc_folder_list_e; + + doc_item *doc_data_util_calloc_item(void); + int doc_data_util_free_mtype_items(Eina_List ** elist); + int doc_data_util_free_item(doc_item * item); + doc_sel_item_s *doc_data_util_new_sel_item(doc_item * ditem); + int doc_data_util_free_sel_item(doc_sel_item_s * item); + int doc_data_util_create_filter(doc_filter_s * condition, + filter_h * filter); + int doc_data_util_destroy_filter(filter_h filter); + bool doc_data_util_clone_media(media_info_h media, + doc_media_s ** pitem, bool b_meta); #ifdef _cplusplus } #endif - -#endif //_DOC_DATA_UTIL_H_ - +#endif //_DOC_DATA_UTIL_H_ diff --git a/include/doc-data.h b/include/doc-data.h index e6c55a7..1f710da 100644 --- a/include/doc-data.h +++ b/include/doc-data.h @@ -25,18 +25,20 @@ extern "C" { #endif -typedef int (*doc_restore_selected_cb)(Eina_List *sel_id, doc_item *ditem); + typedef int (*doc_restore_selected_cb) (Eina_List * sel_id, + doc_item * ditem); -int doc_data_get_item_cnt(doc_ugdata *ugd, int *item_cnt); -int doc_data_get_sel_paths(doc_ugdata *ugd, char **filepath, char ***filepath_arr, int *cnt); -int doc_data_get_media_data(doc_ugdata *ugd, int type, int start_pos, - int end_pos, Eina_List **pmedias_elist, - doc_restore_selected_cb restore_cb, Eina_List *sel_id); -int doc_del_media_data_by_id(doc_ugdata* ugd, const char *media_id); -int doc_data_init(doc_ugdata* ugd); -int doc_data_finalize(doc_ugdata* ugd); + int doc_data_get_item_cnt(doc_ugdata * ugd, int *item_cnt); + int doc_data_get_sel_paths(doc_ugdata * ugd, char **filepath, + char ***filepath_arr, int *cnt); + int doc_data_get_media_data(doc_ugdata * ugd, int type, int start_pos, + int end_pos, Eina_List ** pmedias_elist, + doc_restore_selected_cb restore_cb, + Eina_List * sel_id); + int doc_del_media_data_by_id(doc_ugdata * ugd, const char *media_id); + int doc_data_init(doc_ugdata * ugd); + int doc_data_finalize(doc_ugdata * ugd); #ifdef _cplusplus } #endif -#endif /* _DOC_DATA_H_ */ - +#endif /* _DOC_DATA_H_ */ diff --git a/include/doc-db-update.h b/include/doc-db-update.h index 8d90f23..dddfae5 100644 --- a/include/doc-db-update.h +++ b/include/doc-db-update.h @@ -20,9 +20,7 @@ #include "doc-ugdata.h" -bool doc_db_update_reg_cb(doc_ugdata *ugd); -bool doc_db_update_finalize(doc_ugdata *ugd); - -#endif //_DOC_DB_UPDATE_H_ - +bool doc_db_update_reg_cb(doc_ugdata * ugd); +bool doc_db_update_finalize(doc_ugdata * ugd); +#endif //_DOC_DB_UPDATE_H_ diff --git a/include/doc-debug.h b/include/doc-debug.h index 852af25..7e4f807 100644 --- a/include/doc-debug.h +++ b/include/doc-debug.h @@ -30,12 +30,12 @@ extern "C" { #define LOG_TAG "ATTACH_PANEL_DOCUMENT" -typedef enum { - DEBUG_CRITICAL, - DEBUG_CHECK, - MB_DEBUG_LOG, - DEBUG_MAX -} DOCDebugType; + typedef enum { + DEBUG_CRITICAL, + DEBUG_CHECK, + MB_DEBUG_LOG, + DEBUG_MAX + } DOCDebugType; #ifdef _USE_DLOG_ #define doc_dbg(fmt, arg...) LOGD(fmt, ##arg) @@ -44,7 +44,7 @@ typedef enum { #else -#define doc_dbg(fmt,arg...) +#define doc_dbg(fmt, arg...) #define doc_dbgW(fmt, arg...) #define doc_dbgE(fmt, arg...) #endif @@ -71,11 +71,11 @@ typedef enum { } while (0) -#define DOC_CHECK_VAL(expr, val) doc_retvm_if(!(expr), val, "Invalid parameter, return ERROR code!") -#define DOC_CHECK_NULL(expr) doc_retvm_if(!(expr), NULL, "Invalid parameter, return NULL!") -#define DOC_CHECK_FALSE(expr) doc_retvm_if(!(expr), false, "Invalid parameter, return FALSE!") -#define DOC_CHECK_CANCEL(expr) doc_retvm_if(!(expr), ECORE_CALLBACK_CANCEL, "Invalid parameter, return ECORE_CALLBACK_CANCEL!") -#define DOC_CHECK(expr) doc_retm_if(!(expr), "Invalid parameter, return!") +#define DOC_CHECK_VAL(expr, val) doc_retvm_if(!(expr), val, "Invalid parameter, return ERROR code!") +#define DOC_CHECK_NULL(expr) doc_retvm_if(!(expr), NULL, "Invalid parameter, return NULL!") +#define DOC_CHECK_FALSE(expr) doc_retvm_if(!(expr), false, "Invalid parameter, return FALSE!") +#define DOC_CHECK_CANCEL(expr) doc_retvm_if(!(expr), ECORE_CALLBACK_CANCEL, "Invalid parameter, return ECORE_CALLBACK_CANCEL!") +#define DOC_CHECK(expr) doc_retm_if(!(expr), "Invalid parameter, return!") #include <time.h> @@ -84,6 +84,4 @@ typedef enum { #ifdef _cplusplus } #endif - -#endif //_DOC_DEBUG_H_ - +#endif //_DOC_DEBUG_H_ diff --git a/include/doc-list.h b/include/doc-list.h index 53a2e4c..a623fcf 100644 --- a/include/doc-list.h +++ b/include/doc-list.h @@ -23,8 +23,8 @@ typedef enum _FILE_TYPE fsFileType; enum _FILE_TYPE { FILE_TYPE_NONE = 0, - FILE_TYPE_DIR, /**< Folder category */ - FILE_TYPE_FILE, /**< File category */ + FILE_TYPE_DIR, /**< Folder category */ + FILE_TYPE_FILE, /**< File category */ FILE_TYPE_IMAGE, /**< Image category */ FILE_TYPE_VIDEO, /**< Video category */ FILE_TYPE_MUSIC, /**< Music category */ @@ -52,11 +52,11 @@ enum _FILE_TYPE { FILE_TYPE_CERTIFICATION, /**< certification file, *.pem */ FILE_TYPE_JAVA, /**< java file, *.jad, *.jar */ FILE_TYPE_WGT, /**< wrt , *.wgt, *.wgt */ - FILE_TYPE_TPK, /**< *.tpk>*/ - FILE_TYPE_SNB, /**<*.snb> */ - FILE_TYPE_GUL, /**<*.gul> */ - FILE_TYPE_HWP, /**<*.hwp> */ - FILE_TYPE_ETC, /**< Other files category */ + FILE_TYPE_TPK, /**< *.tpk>*/ + FILE_TYPE_SNB, /**<*.snb> */ + FILE_TYPE_GUL, /**<*.gul> */ + FILE_TYPE_HWP, /**<*.hwp> */ + FILE_TYPE_ETC, /**< Other files category */ FILE_TYPE_TASK, FILE_TYPE_EML, FILE_TYPE_CSV, @@ -65,7 +65,7 @@ enum _FILE_TYPE { }; /*************** Default Icon ***********************/ -#define DOC_DEFAULT_ICON "doc_icon_etc.png" +#define DOC_DEFAULT_ICON "doc_icon_etc.png" #define DOC_ICON_FOLDER "doc_icon_folder.png" #define DOC_ICON_IMAGE "doc_icon_images.png" #define DOC_ICON_VIDEO "doc_icon_video.png" @@ -83,7 +83,7 @@ enum _FILE_TYPE { #define DOC_ICON_VNOTE "doc_icon_vText.png" #define DOC_ICON_RSS "doc_icon_rss.png" #define DOC_ICON_JAVA "doc_icon_java.png" -#define DOC_ICON_MUSIC_PAUSE "doc_icon_control_pause.png" //NotFound +#define DOC_ICON_MUSIC_PAUSE "doc_icon_control_pause.png" //NotFound #define DOC_ICON_VIDEO_PLAY "doc_icon_video_play.png" #define DOC_ICON_TPK "doc_icon_tpk.png" #define DOC_ICON_SNB "doc_icon_snb.png" @@ -100,10 +100,9 @@ enum _FILE_TYPE { x = NULL;\ } \ } while (0) -void doc_list_change_selection_mode(doc_ugdata *ugd); -int doc_list_lang_update(doc_ugdata *ugd); -int doc_update_genlist(doc_ugdata *ugd); -int doc_create_genlist(doc_ugdata *ugd); - -#endif /* _DOC_LIST_H_ */ +void doc_list_change_selection_mode(doc_ugdata * ugd); +int doc_list_lang_update(doc_ugdata * ugd); +int doc_update_genlist(doc_ugdata * ugd); +int doc_create_genlist(doc_ugdata * ugd); +#endif /* _DOC_LIST_H_ */ diff --git a/include/doc-local-data.h b/include/doc-local-data.h index 9f29d18..b92d323 100644 --- a/include/doc-local-data.h +++ b/include/doc-local-data.h @@ -22,10 +22,10 @@ int doc_local_data_connect(void); int doc_local_data_disconnect(void); -int doc_local_data_get_folder_by_path(char *path, doc_folder_s **folder); -int doc_local_data_get_all_media_count(doc_filter_s *condtion, int *item_cnt); -int doc_local_data_get_all_folders_media_list(doc_filter_s *condition, - Eina_List **elist); - -#endif //_DOC_LOCAL_DATA_H_ +int doc_local_data_get_folder_by_path(char *path, doc_folder_s ** folder); +int doc_local_data_get_all_media_count(doc_filter_s * condtion, + int *item_cnt); +int doc_local_data_get_all_folders_media_list(doc_filter_s * condition, + Eina_List ** elist); +#endif //_DOC_LOCAL_DATA_H_ diff --git a/include/doc-main-view.h b/include/doc-main-view.h index a701100..6971203 100644 --- a/include/doc-main-view.h +++ b/include/doc-main-view.h @@ -21,7 +21,6 @@ #include "doc-ugdata.h" -int doc_main_view_create(doc_ugdata *ugd); - -#endif //__DOC_MAIN_VIEW_H__ +int doc_main_view_create(doc_ugdata * ugd); +#endif //__DOC_MAIN_VIEW_H__ diff --git a/include/doc-strings.h b/include/doc-strings.h index 9481d71..87376e5 100644 --- a/include/doc-strings.h +++ b/include/doc-strings.h @@ -41,4 +41,4 @@ extern "C" { #ifdef _cplusplus } #endif -#endif //_DOC_STRINGS_H_ +#endif //_DOC_STRINGS_H_ diff --git a/include/doc-ugdata.h b/include/doc-ugdata.h index 13b8fcc..22e41d6 100644 --- a/include/doc-ugdata.h +++ b/include/doc-ugdata.h @@ -28,142 +28,140 @@ #ifdef __cplusplus extern "C" { -#endif /* __cplusplus */ +#endif /* __cplusplus */ #define HALF_MODE_PORTRAIT_HEIGHT 362 #define FULL_MODE_PORTRAIT_HEIGHT 1036 #define LANDSCAPE_HEIGHT 528 -typedef enum { - DOC_FILE_SELECT_T_NONE, - DOC_FILE_SELECT_T_ONE, - DOC_FILE_SELECT_T_MULTIPLE, - DOC_FILE_SELECT_T_SLIDESHOW, -} doc_file_select_e; - -typedef enum { - DOC_FILE_T_NONE, - DOC_FILE_T_IMAGE, - DOC_FILE_T_VIDEO, - DOC_FILE_T_ALL, -} doc_file_type_e; - -typedef enum { - DOC_ROTATE_NONE, - DOC_ROTATE_PORTRAIT, - DOC_ROTATE_PORTRAIT_UPSIDEDOWN, - DOC_ROTATE_LANDSCAPE, - DOC_ROTATE_LANDSCAPE_UPSIDEDOWN, -} doc_rotate_mode; - -typedef enum { - DOC_UPDATE_NONE, - DOC_UPDATE_NORMAL, - DOC_UPDATE_MMC_REMOVED, - DOC_UPDATE_MMC_ADDED, - DOC_UPDATE_VIEW_INOTIFY -} doc_update_mode; - -typedef struct _doc_ugdata doc_ugdata; -typedef struct _doc_item doc_item; -typedef struct _doc_sel_item_t doc_sel_item_s; -typedef struct _doc_cluster doc_cluster; -typedef struct _doc_thumbs_t doc_thumbs_s; -typedef struct doc_db_noti_t doc_db_noti_s; - -typedef int (*doc_folder_append_cb)(doc_ugdata *ugd, doc_cluster *folder); -typedef int (*doc_rotate_view_cb)(doc_ugdata *ugd); - - -struct _doc_sel_item_t { - char *uuid; - char *file_url; - int store_type; - int valid; - int sequence; -}; - -struct _doc_item { - doc_media_s* item; - doc_ugdata* ugd; - Elm_Object_Item *elm_item; - bool checked; - int store_type; - int sequence; -}; - -struct _doc_cluster { - doc_ugdata *ugd; - int sel_cnt; /* Selected medias count of current folder */ - bool select; -}; - -typedef enum { - ATTACH_PANEL_NONE, - ATTACH_PANEL_FULL_MODE, - ATTACH_PANEL_HALF_MODE, -}_doc_attach_panel_display_mode; - -struct _doc_ugdata {//[ToDo] Check what all members needed. - Evas_Object *win; - Evas_Object *ly_parent; - Evas_Object *ly_main; - Evas_Object *bg; - Elm_Theme *th; - Evas_Object *naviframe; - Elm_Object_Item *nf_it; - Evas_Object *conform; - Elm_Win_Indicator_Opacity_Mode indi_o_mode; - Elm_Win_Indicator_Mode indi_mode; - bool overlap_mode; - int rotate_mode; - Eina_List *rotate_cbs; - Evas_Object *list_view; - Evas_Object *list_view_ly; - Evas_Object *nocontents; - Evas_Object *popup; - Ecore_Timer *del_timer; - ui_gadget_h ug_called_by_me; - ui_gadget_h ug; - char *ug_path; - app_control_h service; /*added for "ug_send_result"*/ - Eina_List *selected_elist; - Eina_Bool ck_state; - int file_select_mode; - int file_type_mode; - int max_count; - bool b_multifile; /* Multipe files selection */ - bool b_hide_indicator; - doc_thumbs_s *thumbs_d; - doc_db_noti_s *db_noti_d; - _doc_attach_panel_display_mode attach_panel_display_mode; - bool is_attach_panel; - long long int selsize; - long long int limitsize; -}; - -struct _doc_thumbs_t { - doc_ugdata *ugd; - Evas_Object *view; - Evas_Object *check; - Evas_Object *nocontents; - Evas_Object *layout; - Elm_Genlist_Item_Class *gic; - Elm_Object_Item *nf_it; - int store_type; - int tot_selected; - int medias_cnt; /* Data from DB */ - Eina_List *medias_elist; - bool b_multifile; /* Multiple file selection */ - bool b_mainview; /* First level view */ - bool b_editmode; - Evas_Object *genlist; -}; + typedef enum { + DOC_FILE_SELECT_T_NONE, + DOC_FILE_SELECT_T_ONE, + DOC_FILE_SELECT_T_MULTIPLE, + DOC_FILE_SELECT_T_SLIDESHOW, + } doc_file_select_e; + + typedef enum { + DOC_FILE_T_NONE, + DOC_FILE_T_IMAGE, + DOC_FILE_T_VIDEO, + DOC_FILE_T_ALL, + } doc_file_type_e; + + typedef enum { + DOC_ROTATE_NONE, + DOC_ROTATE_PORTRAIT, + DOC_ROTATE_PORTRAIT_UPSIDEDOWN, + DOC_ROTATE_LANDSCAPE, + DOC_ROTATE_LANDSCAPE_UPSIDEDOWN, + } doc_rotate_mode; + + typedef enum { + DOC_UPDATE_NONE, + DOC_UPDATE_NORMAL, + DOC_UPDATE_MMC_REMOVED, + DOC_UPDATE_MMC_ADDED, + DOC_UPDATE_VIEW_INOTIFY + } doc_update_mode; + + typedef struct _doc_ugdata doc_ugdata; + typedef struct _doc_item doc_item; + typedef struct _doc_sel_item_t doc_sel_item_s; + typedef struct _doc_cluster doc_cluster; + typedef struct _doc_thumbs_t doc_thumbs_s; + typedef struct doc_db_noti_t doc_db_noti_s; + + typedef int (*doc_folder_append_cb) (doc_ugdata * ugd, + doc_cluster * folder); + typedef int (*doc_rotate_view_cb) (doc_ugdata * ugd); + + + struct _doc_sel_item_t { + char *uuid; + char *file_url; + int store_type; + int valid; + int sequence; + }; + + struct _doc_item { + doc_media_s *item; + doc_ugdata *ugd; + Elm_Object_Item *elm_item; + bool checked; + int store_type; + int sequence; + }; + + struct _doc_cluster { + doc_ugdata *ugd; + int sel_cnt; /* Selected medias count of current folder */ + bool select; + }; + + typedef enum { + ATTACH_PANEL_NONE, + ATTACH_PANEL_FULL_MODE, + ATTACH_PANEL_HALF_MODE, + } _doc_attach_panel_display_mode; + + struct _doc_ugdata { //[ToDo] Check what all members needed. + Evas_Object *win; + Evas_Object *ly_parent; + Evas_Object *ly_main; + Evas_Object *bg; + Elm_Theme *th; + Evas_Object *naviframe; + Elm_Object_Item *nf_it; + Evas_Object *conform; + Elm_Win_Indicator_Opacity_Mode indi_o_mode; + Elm_Win_Indicator_Mode indi_mode; + bool overlap_mode; + int rotate_mode; + Eina_List *rotate_cbs; + Evas_Object *list_view; + Evas_Object *list_view_ly; + Evas_Object *nocontents; + Evas_Object *popup; + Ecore_Timer *del_timer; + ui_gadget_h ug_called_by_me; + ui_gadget_h ug; + char *ug_path; + app_control_h service; /*added for "ug_send_result" */ + Eina_List *selected_elist; + Eina_Bool ck_state; + int file_select_mode; + int file_type_mode; + int max_count; + bool b_multifile; /* Multipe files selection */ + bool b_hide_indicator; + doc_thumbs_s *thumbs_d; + doc_db_noti_s *db_noti_d; + _doc_attach_panel_display_mode attach_panel_display_mode; + bool is_attach_panel; + long long int selsize; + long long int limitsize; + }; + + struct _doc_thumbs_t { + doc_ugdata *ugd; + Evas_Object *view; + Evas_Object *check; + Evas_Object *nocontents; + Evas_Object *layout; + Elm_Genlist_Item_Class *gic; + Elm_Object_Item *nf_it; + int store_type; + int tot_selected; + int medias_cnt; /* Data from DB */ + Eina_List *medias_elist; + bool b_multifile; /* Multiple file selection */ + bool b_mainview; /* First level view */ + bool b_editmode; + Evas_Object *genlist; + }; #ifdef __cplusplus } -#endif /* __cplusplus */ - - -#endif /* __DOC_UGDATA_H__ */ - +#endif /* __cplusplus */ +#endif /* __DOC_UGDATA_H__ */ diff --git a/include/doc-ui-util.h b/include/doc-ui-util.h index 169c7df..0b363c7 100644 --- a/include/doc-ui-util.h +++ b/include/doc-ui-util.h @@ -29,18 +29,20 @@ extern "C" { #define _EDJ(o) elm_layout_edje_get(o) -Evas_Object* doc_ui_create_naviframe(doc_ugdata *ugd, Evas_Object *parent); -Evas_Object *doc_ui_create_main_ly(Evas_Object *parent); -Evas_Object* doc_ui_load_edj(Evas_Object *parent, const char *file, const char *group); -int doc_ui_set_translate_str(Evas_Object *obj, const char *str); -int doc_ui_set_translate_part_str(Evas_Object *obj, const char *part, - const char *str); -int doc_ui_set_translatable_item(Elm_Object_Item *nf_it, const char *str); -int doc_ui_get_indicator_state(doc_ugdata *ugd); -int doc_ui_hide_indicator(doc_ugdata *ugd); + Evas_Object *doc_ui_create_naviframe(doc_ugdata * ugd, + Evas_Object * parent); + Evas_Object *doc_ui_create_main_ly(Evas_Object * parent); + Evas_Object *doc_ui_load_edj(Evas_Object * parent, const char *file, + const char *group); + int doc_ui_set_translate_str(Evas_Object * obj, const char *str); + int doc_ui_set_translate_part_str(Evas_Object * obj, const char *part, + const char *str); + int doc_ui_set_translatable_item(Elm_Object_Item * nf_it, + const char *str); + int doc_ui_get_indicator_state(doc_ugdata * ugd); + int doc_ui_hide_indicator(doc_ugdata * ugd); #ifdef _cplusplus } #endif - -#endif //_DOC_UI_UTIL_H_ +#endif //_DOC_UI_UTIL_H_ diff --git a/include/doc-util.h b/include/doc-util.h index 6fc0b28..87c6d48 100644 --- a/include/doc-util.h +++ b/include/doc-util.h @@ -20,9 +20,8 @@ #include "attach-panel-document.h" -int doc_reg_db_update_noti(doc_ugdata* ugd); +int doc_reg_db_update_noti(doc_ugdata * ugd); int doc_dereg_db_update_noti(void); -Eina_Bool doc_update_view(doc_ugdata* ugd, int mode); +Eina_Bool doc_update_view(doc_ugdata * ugd, int mode); int doc_atoi(const char *number); -#endif //_DOC_UTIL_H_ - +#endif //_DOC_UTIL_H_ diff --git a/src/attach-panel-document.c b/src/attach-panel-document.c index d55ba83..c768266 100644 --- a/src/attach-panel-document.c +++ b/src/attach-panel-document.c @@ -32,7 +32,7 @@ #define DOC_BG_COLOR_DEFAULT 0 #define DOC_BG_COLOR_A 255 -static int _doc_create_main_view(doc_ugdata *ugd) +static int _doc_create_main_view(doc_ugdata * ugd) { DOC_CHECK_VAL(ugd, -1); DOC_CHECK_VAL(ugd->naviframe, -1); @@ -42,7 +42,7 @@ static int _doc_create_main_view(doc_ugdata *ugd) return 0; } -static Evas_Object *_doc_create_bg(Evas_Object *parent) +static Evas_Object *_doc_create_bg(Evas_Object * parent) { doc_dbg(""); DOC_CHECK_NULL(parent); @@ -51,21 +51,21 @@ static Evas_Object *_doc_create_bg(Evas_Object *parent) /* Show special color of background */ bg = evas_object_rectangle_add(evas_object_evas_get(parent)); evas_object_color_set(bg, DOC_BG_COLOR_DEFAULT, DOC_BG_COLOR_DEFAULT, - DOC_BG_COLOR_DEFAULT, DOC_BG_COLOR_A); + DOC_BG_COLOR_DEFAULT, DOC_BG_COLOR_A); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); + EVAS_HINT_EXPAND); evas_object_size_hint_align_set(bg, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(bg); return bg; } -static void _doc_win_rot_changed_cb(void *data, Evas_Object *obj, - void *event) +static void _doc_win_rot_changed_cb(void *data, Evas_Object * obj, + void *event) { DOC_CHECK(data); DOC_CHECK(obj); - doc_ugdata *ugd = (doc_ugdata *)data; + doc_ugdata *ugd = (doc_ugdata *) data; /* changed_ang value is 0 90 180 270 */ int changed_ang = elm_win_rotation_get(obj); @@ -95,7 +95,7 @@ static void _doc_win_rot_changed_cb(void *data, Evas_Object *obj, /* Update rotate mode and view */ int len = eina_list_count(ugd->rotate_cbs); - doc_rotate_view_cb rotate_cb = eina_list_nth(ugd->rotate_cbs, len - 1);//[ToDo] Really needed ?? + doc_rotate_view_cb rotate_cb = eina_list_nth(ugd->rotate_cbs, len - 1); //[ToDo] Really needed ?? if (rotate_cb) { doc_dbg("To rotate view"); rotate_cb(ugd); @@ -104,7 +104,7 @@ static void _doc_win_rot_changed_cb(void *data, Evas_Object *obj, } } -static int _doc_view_initialize(doc_ugdata *ugd) +static int _doc_view_initialize(doc_ugdata * ugd) { doc_dbg(""); DOC_CHECK_VAL(ugd, -1); @@ -130,7 +130,7 @@ static int _doc_view_initialize(doc_ugdata *ugd) return 0; } -static int _doc_create_view(doc_ugdata *ugd) +static int _doc_create_view(doc_ugdata * ugd) { doc_dbg(""); DOC_CHECK_VAL(ugd, -1); @@ -138,7 +138,7 @@ static int _doc_create_view(doc_ugdata *ugd) ugd->th = elm_theme_new(); DOC_CHECK_VAL(ugd->th, -1); elm_theme_ref_set(ugd->th, NULL); - elm_theme_extension_add(ugd->th, DOC_EDJ_FILE); //[ToDo] Really needed ?? + elm_theme_extension_add(ugd->th, DOC_EDJ_FILE); //[ToDo] Really needed ?? if (_doc_view_initialize(ugd) != 0) { doc_dbgE("Initialize view failed!"); @@ -158,15 +158,15 @@ static int _doc_create_view(doc_ugdata *ugd) return 0; } -static int _doc_close_view(doc_ugdata *ugd) +static int _doc_close_view(doc_ugdata * ugd) { DOC_CHECK_VAL(ugd, -1); /************* Remove Callbacks **************/ DOC_IF_DEL_TIMER(ugd->del_timer) - /* Remove win rotation callback */ - evas_object_smart_callback_del(ugd->win, "wm,rotation,changed", - _doc_win_rot_changed_cb); + /* Remove win rotation callback */ + evas_object_smart_callback_del(ugd->win, "wm,rotation,changed", + _doc_win_rot_changed_cb); doc_dereg_db_update_noti(); /************* Destroy UI objects **************/ @@ -177,8 +177,8 @@ static int _doc_close_view(doc_ugdata *ugd) ugd->ug_called_by_me = NULL; } DOC_IF_DEL_OBJ(ugd->popup) - DOC_IF_DEL_OBJ(ugd->ly_main) - if (ugd->th) { + DOC_IF_DEL_OBJ(ugd->ly_main) + if (ugd->th) { elm_theme_extension_del(ugd->th, DOC_EDJ_FILE); elm_theme_free(ugd->th); ugd->th = NULL; @@ -193,14 +193,14 @@ static int _doc_close_view(doc_ugdata *ugd) ugd->service = NULL; } DOC_FREEIF(ugd->ug_path); - /*Finalize db update callback*/ + /*Finalize db update callback */ doc_db_update_finalize(ugd); /* Disconnet with libmedia-info */ doc_data_finalize(ugd); return 0; } -static int _doc_parse_param_file(doc_ugdata *ugd, app_control_h service) +static int _doc_parse_param_file(doc_ugdata * ugd, app_control_h service) { DOC_CHECK_VAL(ugd, -1); DOC_CHECK_VAL(service, -1); @@ -239,7 +239,7 @@ static int _doc_parse_param_file(doc_ugdata *ugd, app_control_h service) } -DOC_DEFAULT_FILE_TYPE: + DOC_DEFAULT_FILE_TYPE: doc_dbg("file type is default, set default type(ALL)."); ugd->file_type_mode = DOC_FILE_T_ALL; @@ -247,7 +247,7 @@ DOC_DEFAULT_FILE_TYPE: } /* analysis parameters */ -static int _doc_parse_param(doc_ugdata *ugd, app_control_h service) +static int _doc_parse_param(doc_ugdata * ugd, app_control_h service) { DOC_CHECK_VAL(ugd, -1); DOC_CHECK_VAL(service, -1); @@ -259,36 +259,39 @@ static int _doc_parse_param(doc_ugdata *ugd, app_control_h service) doc_sdbg("operation [%s]", operation); #ifdef FEATURE_SIZE_CHECK - char *total_size = NULL; - int ret = app_control_get_extra_data(service, APP_CONTROL_DATA_TOTAL_SIZE, &(total_size)); - if (ret != APP_CONTROL_ERROR_NONE) { - if(total_size) { - ugd->limitsize = atol(total_size); - } else { - ugd->limitsize = -1; - } + char *total_size = NULL; + int ret = + app_control_get_extra_data(service, APP_CONTROL_DATA_TOTAL_SIZE, + &(total_size)); + if (ret != APP_CONTROL_ERROR_NONE) { + if (total_size) { + ugd->limitsize = atol(total_size); } else { ugd->limitsize = -1; } + } else { + ugd->limitsize = -1; + } #endif app_control_get_extra_data(service, APP_CONTROL_DATA_SELECTION_MODE, - &select_mode); + &select_mode); if (select_mode) { if (!strcasecmp(select_mode, DOC_BUNDLE_SELECTION_MODE_SINGLE)) { launch_type = strdup(DOC_LAUNCH_SELECT_ONE); - } else if (!strcasecmp(select_mode, DOC_BUNDLE_SELECTION_MODE_MULTI)) { + } else + if (!strcasecmp(select_mode, DOC_BUNDLE_SELECTION_MODE_MULTI)) { launch_type = strdup(DOC_LAUNCH_SELECT_MULTIPLE); } DOC_FREE(select_mode); } if (launch_type == NULL) { app_control_get_extra_data(service, DOC_BUNDLE_LAUNCH_TYPE, - &launch_type); + &launch_type); } if (launch_type == NULL) { if (operation && - !strcasecmp(operation, APP_CONTROL_OPERATION_PICK)) { + !strcasecmp(operation, APP_CONTROL_OPERATION_PICK)) { launch_type = strdup(DOC_LAUNCH_SELECT_ONE); doc_dbg("Set launch-type to default"); } else { @@ -315,7 +318,8 @@ static int _doc_parse_param(doc_ugdata *ugd, app_control_h service) ugd->max_count = -1; char *max_cnt = NULL; - app_control_get_extra_data(service, APP_CONTROL_DATA_TOTAL_COUNT, &max_cnt); + app_control_get_extra_data(service, APP_CONTROL_DATA_TOTAL_COUNT, + &max_cnt); if (max_cnt) { ugd->max_count = doc_atoi(max_cnt); DOC_FREE(max_cnt); @@ -339,7 +343,7 @@ static int _doc_parse_param(doc_ugdata *ugd, app_control_h service) return 0; } -static int _doc_get_rotate_value(doc_ugdata *ugd) +static int _doc_get_rotate_value(doc_ugdata * ugd) { DOC_CHECK_VAL(ugd, -1); DOC_CHECK_VAL(ugd->win, -1); @@ -373,7 +377,8 @@ static int _doc_get_rotate_value(doc_ugdata *ugd) * * @return */ -static void * _doc_create(ui_gadget_h ug, enum ug_mode mode, app_control_h service, void *priv) +static void *_doc_create(ui_gadget_h ug, enum ug_mode mode, + app_control_h service, void *priv) { doc_dbg("Enter..."); doc_ugdata *ugd = NULL; @@ -382,12 +387,12 @@ static void * _doc_create(ui_gadget_h ug, enum ug_mode mode, app_control_h servi DOC_CHECK_NULL(ug); doc_dbgW("attach-panel-document begins..."); - ugd = (doc_ugdata *)priv; + ugd = (doc_ugdata *) priv; ugd->ug = ug; ugd->attach_panel_display_mode = ATTACH_PANEL_NONE; /* Get window */ - ugd->win = (Evas_Object *)ug_get_window(); + ugd->win = (Evas_Object *) ug_get_window(); DOC_CHECK_NULL(ugd->win); /* Get conformant */ @@ -395,7 +400,7 @@ static void * _doc_create(ui_gadget_h ug, enum ug_mode mode, app_control_h servi DOC_CHECK_NULL(ugd->conform); /* Get caller layout */ - ugd->ly_parent = (Evas_Object *)ug_get_parent_layout(ug); + ugd->ly_parent = (Evas_Object *) ug_get_parent_layout(ug); DOC_CHECK_NULL(ugd->ly_parent); /* Bind text domain for internalization */ @@ -408,7 +413,7 @@ static void * _doc_create(ui_gadget_h ug, enum ug_mode mode, app_control_h servi #endif /* Add window rotation callback to rotate view as fast as possible */ evas_object_smart_callback_add(ugd->win, "wm,rotation,changed", - _doc_win_rot_changed_cb, (void *)ugd); + _doc_win_rot_changed_cb, (void *) ugd); _doc_get_rotate_value(ugd); app_control_clone(&(ugd->service), service); @@ -417,13 +422,14 @@ static void * _doc_create(ui_gadget_h ug, enum ug_mode mode, app_control_h servi doc_dbgE("doc_data_init failed!"); } - /*Register db udpate callback*/ + /*Register db udpate callback */ doc_db_update_reg_cb(ugd); /* Parse parameters passed from parent */ if (_doc_parse_param(ugd, service) != 0) { doc_dbgE("Failed to parse parameters!"); - ug_send_result_full(ugd->ug, ugd->service, APP_CONTROL_RESULT_FAILED); + ug_send_result_full(ugd->ug, ugd->service, + APP_CONTROL_RESULT_FAILED); return NULL; } char *contact_id = NULL; @@ -450,8 +456,7 @@ static void * _doc_create(ui_gadget_h ug, enum ug_mode mode, app_control_h servi return NULL; } } else { - doc_dbgE("Wrong file_select_mode[%d]", - ugd->file_select_mode); + doc_dbgE("Wrong file_select_mode[%d]", ugd->file_select_mode); } return ugd->ly_main; @@ -491,11 +496,11 @@ static void _doc_resume(ui_gadget_h ug, app_control_h service, void *priv) { doc_dbg("attach-panel-document resumed"); DOC_CHECK(priv); - doc_ugdata *ugd = (doc_ugdata *)priv; - /*update*/ + doc_ugdata *ugd = (doc_ugdata *) priv; + /*update */ if (ugd->ug_called_by_me == NULL && - ugd->file_select_mode != DOC_FILE_SELECT_T_SLIDESHOW) { + ugd->file_select_mode != DOC_FILE_SELECT_T_SLIDESHOW) { doc_update_view(ugd, DOC_UPDATE_NONE); } } @@ -512,7 +517,7 @@ static void _doc_destroy(ui_gadget_h ug, app_control_h service, void *priv) doc_dbgW("!! Destroying attach-panel-document !!"); DOC_CHECK(ug); DOC_CHECK(priv); - _doc_close_view((doc_ugdata *)priv); + _doc_close_view((doc_ugdata *) priv); doc_dbgW("!! Destroyed attach-panel-document !!"); } @@ -524,11 +529,12 @@ static void _doc_destroy(ui_gadget_h ug, app_control_h service, void *priv) * @param data * @param priv */ -static void _doc_message(ui_gadget_h ug, app_control_h msg, app_control_h service, void *priv) +static void _doc_message(ui_gadget_h ug, app_control_h msg, + app_control_h service, void *priv) { doc_dbg(""); DOC_CHECK(priv); - doc_ugdata *ugd = (doc_ugdata *)priv; + doc_ugdata *ugd = (doc_ugdata *) priv; char *display_mode = NULL; char *pd_selected = DOC_STR_PD_SELECTED; char *text = NULL; @@ -541,7 +547,8 @@ static void _doc_message(ui_gadget_h ug, app_control_h msg, app_control_h servic elm_win_screen_size_get(ugd->win, &win_x, &win_y, &win_w, &win_h); if (ugd->is_attach_panel) { doc_dbg("called by attach panel "); - app_control_get_extra_data(msg, APP_CONTROL_DATA_SELECTION_MODE, &display_mode); + app_control_get_extra_data(msg, APP_CONTROL_DATA_SELECTION_MODE, + &display_mode); if (display_mode) { if (!strcmp(display_mode, "single")) { @@ -558,7 +565,9 @@ static void _doc_message(ui_gadget_h ug, app_control_h msg, app_control_h servic Eina_List *l = NULL; doc_item *ditem = NULL; - elm_naviframe_item_title_enabled_set(ugd->nf_it, EINA_FALSE, EINA_FALSE); + elm_naviframe_item_title_enabled_set(ugd->nf_it, + EINA_FALSE, + EINA_FALSE); doc_update_genlist(ugd); } else if (display_mode && !strcmp(display_mode, "multiple")) { doc_dbg("multiple_selection"); @@ -571,16 +580,22 @@ static void _doc_message(ui_gadget_h ug, app_control_h msg, app_control_h servic elm_genlist_realized_items_update(ugd->thumbs_d->genlist); - ugd->thumbs_d->tot_selected = eina_list_count(ugd->selected_elist); + ugd->thumbs_d->tot_selected = + eina_list_count(ugd->selected_elist); - /*Update Title*/ - elm_naviframe_item_title_enabled_set(ugd->nf_it, EINA_TRUE, EINA_FALSE); - text = g_strdup_printf(pd_selected, ugd->thumbs_d->tot_selected); + /*Update Title */ + elm_naviframe_item_title_enabled_set(ugd->nf_it, EINA_TRUE, + EINA_FALSE); + text = + g_strdup_printf(pd_selected, + ugd->thumbs_d->tot_selected); elm_object_item_text_set(ugd->nf_it, text); /*Disable DONE Button if count is zero */ if (!ugd->thumbs_d->tot_selected) { - btn = elm_object_item_part_content_get(ugd->nf_it , DOC_NAVIFRAME_TITLE_RIGHT_BTN); + btn = + elm_object_item_part_content_get(ugd->nf_it, + DOC_NAVIFRAME_TITLE_RIGHT_BTN); if (btn == NULL) { doc_dbgE("Failed to get part information"); } @@ -601,10 +616,11 @@ static void _doc_message(ui_gadget_h ug, app_control_h msg, app_control_h servic * @param data * @param priv */ -static void _doc_event(ui_gadget_h ug, enum ug_event event, app_control_h service, void *priv) +static void _doc_event(ui_gadget_h ug, enum ug_event event, + app_control_h service, void *priv) { DOC_CHECK(priv); - doc_ugdata *ugd = (doc_ugdata *)priv; + doc_ugdata *ugd = (doc_ugdata *) priv; switch (event) { case UG_EVENT_LOW_MEMORY: @@ -646,7 +662,7 @@ static void _doc_event(ui_gadget_h ug, enum ug_event event, app_control_h servic return; -UG_ROTATE_EVENT: + UG_ROTATE_EVENT: /* Update rotate mode and view */ doc_dbg("rotate_mode: %d", ugd->rotate_mode); @@ -701,5 +717,3 @@ UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops) DOC_FREEIF(ops->priv); doc_dbgW("UG_MODULE_EXIT"); } - - diff --git a/src/doc-data-type.c b/src/doc-data-type.c index 9dc4893..0261ff7 100644 --- a/src/doc-data-type.c +++ b/src/doc-data-type.c @@ -19,7 +19,7 @@ #include "doc-data-type.h" #include "doc-debug.h" -static int _doc_data_type_free_media(doc_media_s **item) +static int _doc_data_type_free_media(doc_media_s ** item) { DOC_CHECK_VAL(item, -1); DOC_CHECK_VAL(*item, -1); @@ -43,7 +43,7 @@ static int _doc_data_type_free_media(doc_media_s **item) return 0; } -static int _doc_data_type_free_folder(doc_folder_s **folder) +static int _doc_data_type_free_folder(doc_folder_s ** folder) { DOC_CHECK_VAL(folder, -1); DOC_CHECK_VAL(*folder, -1); @@ -63,11 +63,11 @@ int doc_data_type_free_item(void **item) DOC_CHECK_VAL(*item, -1); int ret = -1; - if (((doc_folder_s *)*item)->gtype == DOC_TYPE_FOLDER) { - ret = _doc_data_type_free_folder((doc_folder_s **)item); - } else if (((doc_media_s *)*item)->gtype == DOC_TYPE_MEDIA || - ((doc_media_s *)*item)->gtype == DOC_TYPE_WEB_MEDIA) { - ret = _doc_data_type_free_media((doc_media_s **)item); + if (((doc_folder_s *) * item)->gtype == DOC_TYPE_FOLDER) { + ret = _doc_data_type_free_folder((doc_folder_s **) item); + } else if (((doc_media_s *) * item)->gtype == DOC_TYPE_MEDIA || + ((doc_media_s *) * item)->gtype == DOC_TYPE_WEB_MEDIA) { + ret = _doc_data_type_free_media((doc_media_s **) item); } if (ret < 0) { @@ -76,4 +76,3 @@ int doc_data_type_free_item(void **item) return 0; } } - diff --git a/src/doc-data-util.c b/src/doc-data-util.c index 5fd0f3e..8ef3746 100644 --- a/src/doc-data-util.c +++ b/src/doc-data-util.c @@ -22,7 +22,7 @@ */ doc_item *doc_data_util_calloc_item(void) { - doc_item *ditem = (doc_item*)calloc(1, sizeof(doc_item)); + doc_item *ditem = (doc_item *) calloc(1, sizeof(doc_item)); DOC_CHECK_NULL(ditem); return ditem; } @@ -30,11 +30,11 @@ doc_item *doc_data_util_calloc_item(void) /* * destroy a doc_item */ -static int _doc_data_util_free_item(doc_item* ditem) +static int _doc_data_util_free_item(doc_item * ditem) { if (ditem) { if (ditem->item) { - doc_data_type_free_item((void **)&(ditem->item)); + doc_data_type_free_item((void **) &(ditem->item)); ditem->item = NULL; } DOC_FREE(ditem); @@ -42,7 +42,7 @@ static int _doc_data_util_free_item(doc_item* ditem) return 0; } -int doc_data_util_free_mtype_items(Eina_List **elist) +int doc_data_util_free_mtype_items(Eina_List ** elist) { void *current = NULL; @@ -50,7 +50,7 @@ int doc_data_util_free_mtype_items(Eina_List **elist) doc_dbg("Clear Mitems list."); EINA_LIST_FREE(*elist, current) { if (current) { - doc_data_type_free_item((void **)¤t); + doc_data_type_free_item((void **) ¤t); current = NULL; } } @@ -61,7 +61,7 @@ int doc_data_util_free_mtype_items(Eina_List **elist) return 0; } -int doc_data_util_free_item(doc_item *item) +int doc_data_util_free_item(doc_item * item) { DOC_CHECK_VAL(item, -1); @@ -72,11 +72,12 @@ int doc_data_util_free_item(doc_item *item) /* * Create a doc_item for selected item */ -doc_sel_item_s* doc_data_util_new_sel_item(doc_item *ditem) +doc_sel_item_s *doc_data_util_new_sel_item(doc_item * ditem) { DOC_CHECK_NULL(ditem); DOC_CHECK_NULL(ditem->item); - doc_sel_item_s *item = (doc_sel_item_s *)calloc(1, sizeof(doc_sel_item_s)); + doc_sel_item_s *item = + (doc_sel_item_s *) calloc(1, sizeof(doc_sel_item_s)); DOC_CHECK_NULL(item); item->uuid = strdup(ditem->item->uuid); item->file_url = strdup(ditem->item->file_url); @@ -88,7 +89,7 @@ doc_sel_item_s* doc_data_util_new_sel_item(doc_item *ditem) /* * Free a doc_sel_item_s item */ -int doc_data_util_free_sel_item(doc_sel_item_s *item) +int doc_data_util_free_sel_item(doc_sel_item_s * item) { DOC_CHECK_VAL(item, -1); DOC_FREEIF(item->uuid); @@ -97,7 +98,8 @@ int doc_data_util_free_sel_item(doc_sel_item_s *item) return 0; } -int doc_data_util_create_filter(doc_filter_s *condition, filter_h *filter) +int doc_data_util_create_filter(doc_filter_s * condition, + filter_h * filter) { DOC_CHECK_VAL(filter, -1); DOC_CHECK_VAL(condition, -1); @@ -112,7 +114,7 @@ int doc_data_util_create_filter(doc_filter_s *condition, filter_h *filter) if (strlen(condition->cond) > 0) { ret = media_filter_set_condition(tmp_filter, condition->cond, - condition->collate_type); + condition->collate_type); if (ret != MEDIA_CONTENT_ERROR_NONE) { doc_dbgE("Fail to set condition!"); goto DOC_DATA_UTIL_FAILED; @@ -121,8 +123,8 @@ int doc_data_util_create_filter(doc_filter_s *condition, filter_h *filter) if (strlen(condition->sort_keyword) > 0) { ret = media_filter_set_order(tmp_filter, condition->sort_type, - condition->sort_keyword, - condition->collate_type); + condition->sort_keyword, + condition->collate_type); if (ret != MEDIA_CONTENT_ERROR_NONE) { doc_dbgE("Fail to set order!"); goto DOC_DATA_UTIL_FAILED; @@ -132,7 +134,7 @@ int doc_data_util_create_filter(doc_filter_s *condition, filter_h *filter) doc_dbg("offset: %d, count: %d", condition->offset, condition->count); if (condition->offset != -1) { ret = media_filter_set_offset(tmp_filter, condition->offset, - condition->count); + condition->count); if (ret != MEDIA_CONTENT_ERROR_NONE) { doc_dbgE("Fail to set offset!"); goto DOC_DATA_UTIL_FAILED; @@ -142,7 +144,7 @@ int doc_data_util_create_filter(doc_filter_s *condition, filter_h *filter) *filter = tmp_filter; return 0; -DOC_DATA_UTIL_FAILED: + DOC_DATA_UTIL_FAILED: if (tmp_filter) { media_filter_destroy(tmp_filter); @@ -164,60 +166,70 @@ int doc_data_util_destroy_filter(filter_h filter) return 0; } -bool doc_data_util_clone_media(media_info_h media, doc_media_s **pitem, - bool b_meta) +bool doc_data_util_clone_media(media_info_h media, doc_media_s ** pitem, + bool b_meta) { DOC_CHECK_FALSE(pitem); doc_media_s *item = NULL; *pitem = NULL; - item = (doc_media_s *)calloc(1, sizeof(doc_media_s)); + item = (doc_media_s *) calloc(1, sizeof(doc_media_s)); DOC_CHECK_FALSE(item); item->gtype = DOC_TYPE_MEDIA; - if (media_info_clone(&(item->media_h), media) != MEDIA_CONTENT_ERROR_NONE) { + if (media_info_clone(&(item->media_h), media) != + MEDIA_CONTENT_ERROR_NONE) { doc_dbgE("Clone media handle error"); goto DOC_DATA_UTIL_FAILED; } - if (media_info_get_media_id(media, &(item->uuid)) != MEDIA_CONTENT_ERROR_NONE) { + if (media_info_get_media_id(media, &(item->uuid)) != + MEDIA_CONTENT_ERROR_NONE) { doc_dbgE("Get media id error"); goto DOC_DATA_UTIL_FAILED; } - if (media_info_get_display_name(media, &(item->display_name)) != MEDIA_CONTENT_ERROR_NONE) { + if (media_info_get_display_name(media, &(item->display_name)) != + MEDIA_CONTENT_ERROR_NONE) { doc_dbgE("Get media display name error"); goto DOC_DATA_UTIL_FAILED; } - if (media_info_get_file_path(media, &(item->file_url)) != MEDIA_CONTENT_ERROR_NONE) { + if (media_info_get_file_path(media, &(item->file_url)) != + MEDIA_CONTENT_ERROR_NONE) { doc_dbgE("Get media file path error"); goto DOC_DATA_UTIL_FAILED; } - if (media_info_get_media_type(media, (media_content_type_e *)&(item->type)) != MEDIA_CONTENT_ERROR_NONE) { + if (media_info_get_media_type + (media, + (media_content_type_e *) & (item->type)) != + MEDIA_CONTENT_ERROR_NONE) { doc_dbgE("Get media type error"); goto DOC_DATA_UTIL_FAILED; } - if (media_info_get_thumbnail_path(media, &(item->thumb_url)) != MEDIA_CONTENT_ERROR_NONE) { + if (media_info_get_thumbnail_path(media, &(item->thumb_url)) != + MEDIA_CONTENT_ERROR_NONE) { doc_dbgE("Get media thumbnail path error"); goto DOC_DATA_UTIL_FAILED; } doc_sdbg("thumb_url: %s", item->thumb_url); - if (media_info_get_timeline(media, &(item->mtime)) != MEDIA_CONTENT_ERROR_NONE) { + if (media_info_get_timeline(media, &(item->mtime)) != + MEDIA_CONTENT_ERROR_NONE) { doc_dbgE("Get media modified time error"); goto DOC_DATA_UTIL_FAILED; } -/* if (media_info_get_mode(media, (media_content_mode_e *)&(item->mode)) != MEDIA_CONTENT_ERROR_NONE) { - doc_dbgE("Get media mode failed!"); - goto DOC_DATA_UTIL_FAILED; - }*/ + /* if (media_info_get_mode(media, (media_content_mode_e *)&(item->mode)) != MEDIA_CONTENT_ERROR_NONE) { + doc_dbgE("Get media mode failed!"); + goto DOC_DATA_UTIL_FAILED; + } */ media_content_storage_e storage_type = 0; - if (media_info_get_storage_type(media, &storage_type) != MEDIA_CONTENT_ERROR_NONE) { + if (media_info_get_storage_type(media, &storage_type) != + MEDIA_CONTENT_ERROR_NONE) { doc_dbgE("Get storage type failed!"); goto DOC_DATA_UTIL_FAILED; } - if (storage_type == MEDIA_CONTENT_STORAGE_INTERNAL) { /* The device's internal storage */ + if (storage_type == MEDIA_CONTENT_STORAGE_INTERNAL) { /* The device's internal storage */ item->storage_type = DOC_PHONE; - } else if (storage_type == MEDIA_CONTENT_STORAGE_EXTERNAL) { /* The device's external storage */ + } else if (storage_type == MEDIA_CONTENT_STORAGE_EXTERNAL) { /* The device's external storage */ item->storage_type = DOC_MMC; } else { doc_dbgE("Undefined mode[%d]!", storage_type); @@ -226,9 +238,8 @@ bool doc_data_util_clone_media(media_info_h media, doc_media_s **pitem, *pitem = item; return true; -DOC_DATA_UTIL_FAILED: + DOC_DATA_UTIL_FAILED: - doc_data_type_free_item((void **)(&item)); + doc_data_type_free_item((void **) (&item)); return false; } - diff --git a/src/doc-data.c b/src/doc-data.c index 080c32d..73a2b5c 100644 --- a/src/doc-data.c +++ b/src/doc-data.c @@ -19,7 +19,7 @@ #include "doc-debug.h" #include "doc-strings.h" -int doc_data_get_item_cnt(doc_ugdata *ugd, int *item_cnt) +int doc_data_get_item_cnt(doc_ugdata * ugd, int *item_cnt) { DOC_CHECK_VAL(item_cnt, -1); DOC_CHECK_VAL(ugd, -1); @@ -34,8 +34,7 @@ int doc_data_get_item_cnt(doc_ugdata *ugd, int *item_cnt) filter.count = DOC_GET_ALL_RECORDS; filter.with_meta = false; - g_strlcpy(filter.cond, DOC_CONDITION_LOCAL_DOCUMENT, - CONDITION_LENGTH); + g_strlcpy(filter.cond, DOC_CONDITION_LOCAL_DOCUMENT, CONDITION_LENGTH); err = doc_local_data_get_all_media_count(&filter, item_cnt); if (err < 0) { @@ -48,9 +47,11 @@ int doc_data_get_item_cnt(doc_ugdata *ugd, int *item_cnt) } /* Append items' path */ -int doc_data_get_sel_paths(doc_ugdata *ugd, char **filepath, char ***filepath_arr, int *cnt) +int doc_data_get_sel_paths(doc_ugdata * ugd, char **filepath, + char ***filepath_arr, int *cnt) { - if (filepath == NULL || ugd == NULL || ugd->selected_elist == NULL || filepath_arr == NULL) { + if (filepath == NULL || ugd == NULL || ugd->selected_elist == NULL + || filepath_arr == NULL) { doc_dbgE("Invalid input!"); return -1; } @@ -68,18 +69,18 @@ int doc_data_get_sel_paths(doc_ugdata *ugd, char **filepath, char ***filepath_ar EINA_LIST_FOREACH(ugd->selected_elist, l, sit) { if (sit) { g_string_append(selected_path, sit->file_url); - g_string_append_c(selected_path, ';'); - path_list = eina_list_append(path_list, sit); - _cnt++; - sit = NULL; - } + g_string_append_c(selected_path, ';'); + path_list = eina_list_append(path_list, sit); + _cnt++; + sit = NULL; } + } /* copy path from path_list to path_array */ int idx = 0; sit = NULL; if (_cnt > 0) { - *filepath_arr = (char **)calloc(_cnt, sizeof(char *)); + *filepath_arr = (char **) calloc(_cnt, sizeof(char *)); EINA_LIST_FREE(path_list, sit) { if (sit && sit->file_url) { (*filepath_arr)[idx] = strdup(sit->file_url); @@ -105,9 +106,10 @@ int doc_data_get_sel_paths(doc_ugdata *ugd, char **filepath, char ***filepath_ar return 0; } -int doc_data_get_media_data(doc_ugdata *ugd, int type, int start_pos, - int end_pos, Eina_List **pmedias_elist, - doc_restore_selected_cb restore_cb, Eina_List *sel_id) +int doc_data_get_media_data(doc_ugdata * ugd, int type, int start_pos, + int end_pos, Eina_List ** pmedias_elist, + doc_restore_selected_cb restore_cb, + Eina_List * sel_id) { DOC_CHECK_VAL(pmedias_elist, -1); DOC_CHECK_VAL(ugd, -1); @@ -117,8 +119,7 @@ int doc_data_get_media_data(doc_ugdata *ugd, int type, int start_pos, memset(&filter, 0, sizeof(doc_filter_s)); doc_dbg("--start_pos[%d], end_pos[%d]--", start_pos, end_pos); - g_strlcpy(filter.cond, DOC_CONDITION_LOCAL_DOCUMENT, - CONDITION_LENGTH); + g_strlcpy(filter.cond, DOC_CONDITION_LOCAL_DOCUMENT, CONDITION_LENGTH); filter.collate_type = MEDIA_CONTENT_COLLATE_NOCASE; filter.sort_type = MEDIA_CONTENT_ORDER_DESC; @@ -129,12 +130,11 @@ int doc_data_get_media_data(doc_ugdata *ugd, int type, int start_pos, doc_dbg("--All Folder--"); - err = doc_local_data_get_all_folders_media_list(&filter, - &itemlist); + err = doc_local_data_get_all_folders_media_list(&filter, &itemlist); if ((err == 0) && (itemlist != NULL)) { doc_media_s *item = NULL; - doc_item* ditem = NULL; + doc_item *ditem = NULL; EINA_LIST_FREE(itemlist, item) { if (item == NULL || item->uuid == NULL) { doc_dbgE("Invalid item!"); @@ -144,15 +144,14 @@ int doc_data_get_media_data(doc_ugdata *ugd, int type, int start_pos, ditem = doc_data_util_calloc_item(); if (ditem == NULL) { doc_dbgE("doc_data_util_calloc_item() failed"); - doc_data_type_free_item((void **)&item); + doc_data_type_free_item((void **) &item); continue; } ditem->item = item; ditem->ugd = ugd; ditem->store_type = type; - *pmedias_elist = eina_list_append(*pmedias_elist, - ditem); + *pmedias_elist = eina_list_append(*pmedias_elist, ditem); if (restore_cb && sel_id) { restore_cb(sel_id, ditem); @@ -170,7 +169,7 @@ int doc_data_get_media_data(doc_ugdata *ugd, int type, int start_pos, return err; } -int doc_del_media_data_by_id(doc_ugdata* ugd, const char *media_id) +int doc_del_media_data_by_id(doc_ugdata * ugd, const char *media_id) { DOC_CHECK_VAL(media_id, -1); int ret = media_info_delete_from_db(media_id); @@ -182,7 +181,7 @@ int doc_del_media_data_by_id(doc_ugdata* ugd, const char *media_id) return 0; } -int doc_data_init(doc_ugdata* ugd) +int doc_data_init(doc_ugdata * ugd) { doc_dbg("Connect to DB!"); DOC_CHECK_VAL(ugd, -1); @@ -195,7 +194,7 @@ int doc_data_init(doc_ugdata* ugd) return 0; } -int doc_data_finalize(doc_ugdata* ugd) +int doc_data_finalize(doc_ugdata * ugd) { doc_dbg("Free memory and disconnect with DB!"); DOC_CHECK_VAL(ugd, -1); @@ -208,4 +207,3 @@ int doc_data_finalize(doc_ugdata* ugd) return 0; } - diff --git a/src/doc-db-update.c b/src/doc-db-update.c index 0641b24..049a0fd 100644 --- a/src/doc-db-update.c +++ b/src/doc-db-update.c @@ -25,19 +25,19 @@ #define DOC_MONITOE_TIME_DELAY 1.0f struct doc_db_noti_t { - Ecore_Timer *db_timer; /*For update db data*/ - /*Make ture calling db update callback after other operations complete*/ + Ecore_Timer *db_timer; /*For update db data */ + /*Make ture calling db update callback after other operations complete */ Ecore_Idler *db_idl; //media_content_noti_h cloud_h; /* Notify handle fro cloud content updating in DB */ media_content_db_update_item_type_e update_item; media_content_db_update_type_e update_type; - int count; /* All media count got from DB */ + int count; /* All media count got from DB */ }; static Eina_Bool _doc_db_update_idler(void *data) { DOC_CHECK_FALSE(data); - doc_ugdata *ugd = (doc_ugdata *)data; + doc_ugdata *ugd = (doc_ugdata *) data; DOC_CHECK_FALSE(ugd->db_noti_d); doc_db_noti_s *db_noti = ugd->db_noti_d; doc_update_view(ugd, DOC_UPDATE_VIEW_INOTIFY); @@ -48,7 +48,7 @@ static Eina_Bool _doc_db_update_idler(void *data) static Eina_Bool _doc_db_update_timer_cb(void *data) { DOC_CHECK_FALSE(data); - doc_ugdata *ugd = (doc_ugdata *)data; + doc_ugdata *ugd = (doc_ugdata *) data; DOC_CHECK_FALSE(ugd->db_noti_d); doc_db_noti_s *db_noti = ugd->db_noti_d; @@ -59,7 +59,7 @@ static Eina_Bool _doc_db_update_timer_cb(void *data) return ECORE_CALLBACK_CANCEL; } -static int _doc_db_update_add_timer(doc_ugdata *ugd) +static int _doc_db_update_add_timer(doc_ugdata * ugd) { DOC_CHECK_VAL(ugd, -1); DOC_CHECK_VAL(ugd->db_noti_d, -1); @@ -67,19 +67,20 @@ static int _doc_db_update_add_timer(doc_ugdata *ugd) DOC_IF_DEL_TIMER(db_noti->db_timer); db_noti->db_timer = ecore_timer_add(DOC_MONITOE_TIME_DELAY, - _doc_db_update_timer_cb, ugd); + _doc_db_update_timer_cb, ugd); doc_dbgW("TIMER[1.0f] added!"); return 0; } static int _doc_db_update_op(media_content_error_e error, int pid, - media_content_db_update_item_type_e update_item, - media_content_db_update_type_e update_type, - media_content_type_e media_type, char *uuid, - char *path, char *mime_type, void *data) + media_content_db_update_item_type_e + update_item, + media_content_db_update_type_e update_type, + media_content_type_e media_type, char *uuid, + char *path, char *mime_type, void *data) { DOC_CHECK_VAL(data, -1); - doc_ugdata *ugd = (doc_ugdata *)data; + doc_ugdata *ugd = (doc_ugdata *) data; DOC_CHECK_VAL(ugd->db_noti_d, -1); doc_db_noti_s *db_noti = ugd->db_noti_d; @@ -88,7 +89,7 @@ static int _doc_db_update_op(media_content_error_e error, int pid, return -1; } if (update_item == MEDIA_ITEM_FILE && - MEDIA_CONTENT_TYPE_OTHERS != media_type) { + MEDIA_CONTENT_TYPE_OTHERS != media_type) { doc_dbg("Media type is wrong"); return -1; } else if (update_item == MEDIA_ITEM_DIRECTORY && media_type == -1) { @@ -102,8 +103,7 @@ static int _doc_db_update_op(media_content_error_e error, int pid, doc_dbg("old: %d, new: %d", db_noti->count, cnt); if (cnt == db_noti->count) { doc_dbg("Nothing changed"); - if (path && - !strcmp(path, DOC_ROOT_PATH_MMC)) { + if (path && !strcmp(path, DOC_ROOT_PATH_MMC)) { doc_dbg("MMC insert or remove!"); } else if (path) { doc_folder_s *folder = NULL; @@ -111,7 +111,7 @@ static int _doc_db_update_op(media_content_error_e error, int pid, if (!folder) { return -1; } else { - doc_data_type_free_item((void **)&folder); + doc_data_type_free_item((void **) &folder); doc_dbgW("Updated folder contains document"); } } else { @@ -130,24 +130,26 @@ static int _doc_db_update_op(media_content_error_e error, int pid, } static void _doc_db_update_cb(media_content_error_e error, int pid, - media_content_db_update_item_type_e update_item, - media_content_db_update_type_e update_type, - media_content_type_e media_type, char *uuid, - char *path, char *mime_type, void *data) + media_content_db_update_item_type_e + update_item, + media_content_db_update_type_e update_type, + media_content_type_e media_type, char *uuid, + char *path, char *mime_type, void *data) { - doc_dbg("update_item[%d], update_type[%d], media_type[%d]", update_item, - update_type, media_type); + doc_dbg("update_item[%d], update_type[%d], media_type[%d]", + update_item, update_type, media_type); DOC_CHECK(data); doc_dbg("uuid[%s], path[%s]", uuid, path); _doc_db_update_op(error, pid, update_item, update_type, media_type, - uuid, path, mime_type, data); + uuid, path, mime_type, data); } -bool doc_db_update_reg_cb(doc_ugdata *ugd) +bool doc_db_update_reg_cb(doc_ugdata * ugd) { DOC_CHECK_FALSE(ugd); - /*Init data*/ - doc_db_noti_s *db_noti = (doc_db_noti_s *)calloc(1, sizeof(doc_db_noti_s)); + /*Init data */ + doc_db_noti_s *db_noti = + (doc_db_noti_s *) calloc(1, sizeof(doc_db_noti_s)); DOC_CHECK_FALSE(db_noti); ugd->db_noti_d = db_noti; @@ -165,7 +167,7 @@ bool doc_db_update_reg_cb(doc_ugdata *ugd) return true; } -bool doc_db_update_finalize(doc_ugdata *ugd) +bool doc_db_update_finalize(doc_ugdata * ugd) { int ret = -1; doc_dbg("Unset db updated callback"); @@ -184,4 +186,3 @@ bool doc_db_update_finalize(doc_ugdata *ugd) DOC_FREE(ugd->db_noti_d); return true; } - diff --git a/src/doc-list.c b/src/doc-list.c index 8911f20..58cfd8d 100644 --- a/src/doc-list.c +++ b/src/doc-list.c @@ -55,29 +55,30 @@ static char *icon_array[FILE_TYPE_MAX] = { [FILE_TYPE_WGT] = DOC_ICON_TPK, }; -static Evas_Object* _doc_list_add_view(doc_ugdata *ugd, Evas_Object *parent) +static Evas_Object *_doc_list_add_view(doc_ugdata * ugd, + Evas_Object * parent) { doc_dbg(""); DOC_CHECK_NULL(parent); Evas_Object *layout = doc_ui_load_edj(parent, DOC_EDJ_FILE, - DOC_GRP_LISTVIEW); + DOC_GRP_LISTVIEW); DOC_CHECK_NULL(layout); evas_object_show(layout); return layout; } -static Eina_Bool _data_list_back_cb(void *data, Elm_Object_Item *it) +static Eina_Bool _data_list_back_cb(void *data, Elm_Object_Item * it) { doc_dbg(""); DOC_CHECK_FALSE(data); - doc_ugdata *ugd = (doc_ugdata *)data; + doc_ugdata *ugd = (doc_ugdata *) data; Eina_List *l = NULL; doc_item *item = NULL; void *pop_cb = evas_object_data_get(ugd->naviframe, - DOC_NAVIFRAME_POP_CB_KEY); + DOC_NAVIFRAME_POP_CB_KEY); if (pop_cb) { - Eina_Bool(*_pop_cb)(void * ugd); + Eina_Bool(*_pop_cb) (void *ugd); _pop_cb = pop_cb; if (_pop_cb(ugd)) { @@ -88,10 +89,14 @@ static Eina_Bool _data_list_back_cb(void *data, Elm_Object_Item *it) app_control_h app_control = NULL; app_control_create(&app_control); - app_control_add_extra_data(app_control, DOC_FILE_SELECT_RETURN_COUNT, "0"); - app_control_add_extra_data(app_control, DOC_FILE_SELECT_RETURN_PATH, NULL); - app_control_add_extra_data(app_control, APP_CONTROL_DATA_SELECTED, NULL); - app_control_add_extra_data_array(app_control, APP_CONTROL_DATA_PATH, NULL, 0); + app_control_add_extra_data(app_control, DOC_FILE_SELECT_RETURN_COUNT, + "0"); + app_control_add_extra_data(app_control, DOC_FILE_SELECT_RETURN_PATH, + NULL); + app_control_add_extra_data(app_control, APP_CONTROL_DATA_SELECTED, + NULL); + app_control_add_extra_data_array(app_control, APP_CONTROL_DATA_PATH, + NULL, 0); ug_send_result_full(ugd->ug, app_control, APP_CONTROL_RESULT_FAILED); app_control_destroy(app_control); @@ -107,34 +112,42 @@ static Eina_Bool _data_list_back_cb(void *data, Elm_Object_Item *it) } ugd->selected_elist = eina_list_free(ugd->selected_elist); - /*If return ture, ug will pop naviframe first.*/ + /*If return ture, ug will pop naviframe first. */ return EINA_FALSE; } -static void _doc_list_get_app_resource(const char *edj_file_in, char *edj_path_out, int edj_path_max) +static void _doc_list_get_app_resource(const char *edj_file_in, + char *edj_path_out, + int edj_path_max) { char *res_path = app_get_resource_path(); if (res_path) { - snprintf(edj_path_out, edj_path_max, "%s%s", res_path, edj_file_in); + snprintf(edj_path_out, edj_path_max, "%s%s", res_path, + edj_file_in); free(res_path); } } -static Evas_Object* _doc_list_show_thumb(Evas_Object *obj, const char *path) +static Evas_Object *_doc_list_show_thumb(Evas_Object * obj, + const char *path) { DOC_CHECK_NULL(obj); char full_path[100]; - snprintf(full_path, 100, "/usr/ug/res/images/ug-attach-panel-document/icons/%s", path); + snprintf(full_path, 100, + "/usr/ug/res/images/ug-attach-panel-document/icons/%s", path); Evas_Object *ic = elm_icon_add(obj); DOC_CHECK_NULL(ic); - if (!elm_image_file_set(ic, full_path, NULL)) + if (!elm_image_file_set(ic, full_path, NULL)) { doc_dbgE("Image set failed"); + } - evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); - evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, + 1); + evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); evas_object_size_hint_align_set(ic, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_image_resizable_set(ic, EINA_TRUE, EINA_TRUE); @@ -146,15 +159,15 @@ static Evas_Object* _doc_list_show_thumb(Evas_Object *obj, const char *path) return ic; } -static void _doc_list_navi_done_cb(void *data, Evas_Object *obj, void *ei) +static void _doc_list_navi_done_cb(void *data, Evas_Object * obj, void *ei) { doc_dbgE("Transferring Data to caller"); - doc_ugdata *ugd = (doc_ugdata*)data; + doc_ugdata *ugd = (doc_ugdata *) data; DOC_CHECK(ugd); /* file selection mode */ char *paths = NULL; - char **path_array = NULL; /* the array size is sel_cnt */ + char **path_array = NULL; /* the array size is sel_cnt */ int sel_cnt = 0; int i = 0; @@ -164,21 +177,23 @@ static void _doc_list_navi_done_cb(void *data, Evas_Object *obj, void *ei) goto DOC_SEND_RESULT_FINISHED; } - char t_str[32] = {0,}; + char t_str[32] = { 0, }; eina_convert_itoa(sel_cnt, t_str); app_control_add_extra_data(ugd->service, - DOC_FILE_SELECT_RETURN_COUNT, t_str); + DOC_FILE_SELECT_RETURN_COUNT, t_str); app_control_add_extra_data(ugd->service, DOC_FILE_SELECT_RETURN_PATH, - paths); - app_control_add_extra_data_array(ugd->service, APP_CONTROL_DATA_SELECTED, - (const char **)path_array, sel_cnt); + paths); + app_control_add_extra_data_array(ugd->service, + APP_CONTROL_DATA_SELECTED, + (const char **) path_array, sel_cnt); app_control_add_extra_data_array(ugd->service, APP_CONTROL_DATA_PATH, - (const char **)path_array, sel_cnt); - ug_send_result_full(ugd->ug, ugd->service, APP_CONTROL_RESULT_SUCCEEDED); + (const char **) path_array, sel_cnt); + ug_send_result_full(ugd->ug, ugd->service, + APP_CONTROL_RESULT_SUCCEEDED); ugd->selected_elist = eina_list_free(ugd->selected_elist); -DOC_SEND_RESULT_FINISHED: + DOC_SEND_RESULT_FINISHED: if (paths) { g_free(paths); @@ -196,11 +211,12 @@ DOC_SEND_RESULT_FINISHED: } } -static void _doc_list_check_state_changed_cb(void *data, Evas_Object *obj, void *ei) +static void _doc_list_check_state_changed_cb(void *data, Evas_Object * obj, + void *ei) { DOC_CHECK(obj); DOC_CHECK(data); - doc_item *item = (doc_item *)data; + doc_item *item = (doc_item *) data; DOC_CHECK(item->item); DOC_CHECK(item->item->file_url); DOC_CHECK(item->ugd); @@ -221,28 +237,29 @@ static void _doc_list_check_state_changed_cb(void *data, Evas_Object *obj, void if (state == EINA_TRUE) { if (!g_strcmp0(item->item->thumb_url, DEFAULT_THUMBNAIL)) { elm_check_state_set(obj, EINA_FALSE); - char *pStrWarning = g_strdup_printf( - DOC_STR_UNSUPPORTED_FILE); + char *pStrWarning = g_strdup_printf(DOC_STR_UNSUPPORTED_FILE); notification_status_message_post(pStrWarning); DOC_FREE(pStrWarning); doc_data_util_free_sel_item(sit); return; } - if ((ugd->max_count != -1) && (item->ugd->thumbs_d->tot_selected + 1 > ugd->max_count)) { + if ((ugd->max_count != -1) + && (item->ugd->thumbs_d->tot_selected + 1 > ugd->max_count)) { elm_check_state_set(obj, EINA_FALSE); char *noti_str = DOC_STR_MAX_PICTURES_SELECTED; - char *pStrWarning = g_strdup_printf( - noti_str, - ugd->max_count); + char *pStrWarning = g_strdup_printf(noti_str, + ugd->max_count); notification_status_message_post(pStrWarning); DOC_FREE(pStrWarning); doc_data_util_free_sel_item(sit); return; } #ifdef FEATURE_SIZE_CHECK - if (ugd->limitsize > 0 && ugd->selsize + stFileInfo.st_size > ugd->limitsize) { + if (ugd->limitsize > 0 + && ugd->selsize + stFileInfo.st_size > ugd->limitsize) { elm_check_state_set(obj, EINA_FALSE); - notification_status_message_post("Maximum Selection Exceeded."); + notification_status_message_post + ("Maximum Selection Exceeded."); doc_data_util_free_sel_item(sit); return; } @@ -258,7 +275,8 @@ static void _doc_list_check_state_changed_cb(void *data, Evas_Object *obj, void doc_sdbg("remove Path: %s", sit->file_url); EINA_LIST_FOREACH(ugd->selected_elist, l, sit1) { if (sit1 && !strcmp(sit->file_url, sit1->file_url)) { - ugd->selected_elist = eina_list_remove(ugd->selected_elist, sit1); + ugd->selected_elist = + eina_list_remove(ugd->selected_elist, sit1); doc_data_util_free_sel_item(sit1); } } @@ -274,7 +292,9 @@ static void _doc_list_check_state_changed_cb(void *data, Evas_Object *obj, void char *text = NULL; Evas_Object *btn = NULL; - btn = elm_object_item_part_content_get(ugd->nf_it , DOC_NAVIFRAME_TITLE_RIGHT_BTN); + btn = + elm_object_item_part_content_get(ugd->nf_it, + DOC_NAVIFRAME_TITLE_RIGHT_BTN); if (btn == NULL) { doc_dbgE("Failed to get part information"); } @@ -292,12 +312,12 @@ static void _doc_list_check_state_changed_cb(void *data, Evas_Object *obj, void } } -static Evas_Object* _doc_nocontent_create(void *data) +static Evas_Object *_doc_nocontent_create(void *data) { - doc_ugdata *ugd = (doc_ugdata *)data; + doc_ugdata *ugd = (doc_ugdata *) data; Evas_Object *layout = doc_ui_load_edj(ugd->list_view, DOC_EDJ_FILE, - "nocontent"); + "nocontent"); doc_dbg("Nocontents label: %s", DOC_STR_NO_ITEMS); Evas_Object *noc_lay = elm_layout_add(layout); @@ -306,13 +326,16 @@ static Evas_Object* _doc_nocontent_create(void *data) elm_layout_theme_set(noc_lay, "layout", "nocontents", "text"); doc_ui_set_translate_part_str(noc_lay, "elm.text", DOC_STR_NO_ITEMS); - doc_ui_set_translate_part_str(noc_lay, "elm.help.text", DOC_STR_NO_ITEMS_HELP_TEXT); + doc_ui_set_translate_part_str(noc_lay, "elm.help.text", + DOC_STR_NO_ITEMS_HELP_TEXT); elm_layout_signal_emit(noc_lay, "text,disabled", ""); elm_layout_signal_emit(noc_lay, "align.center", "elm"); elm_object_part_content_set(layout, "swallow", noc_lay); - evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, + EVAS_HINT_FILL); DOC_CHECK_NULL(layout); evas_object_show(layout); @@ -325,7 +348,7 @@ static Eina_Bool _doc_list_is_dir(const char *path) return 0; } - struct stat info = {0,}; + struct stat info = { 0, }; if (stat(path, &info) == 0) { if (S_ISDIR(info.st_mode)) { @@ -355,7 +378,8 @@ const char *_document_file_get(const char path[]) return file; } -static fsFileType _document_attr_get_category_by_file_ext(const char *file_ext) +static fsFileType _document_attr_get_category_by_file_ext(const char + *file_ext) { int i = 0; @@ -731,7 +755,7 @@ int _document_file_category(const char *filepath, fsFileType * category) } } -const char* _document_file_attr_get_default_icon_by_type(fsFileType ftype) +const char *_document_file_attr_get_default_icon_by_type(fsFileType ftype) { const char *icon_path = DOC_DEFAULT_ICON; @@ -743,7 +767,9 @@ const char* _document_file_attr_get_default_icon_by_type(fsFileType ftype) } -static Evas_Object* _doc_list_item_content_get(void *data, Evas_Object *obj, const char *part) +static Evas_Object *_doc_list_item_content_get(void *data, + Evas_Object * obj, + const char *part) { doc_item *item = NULL; @@ -752,7 +778,7 @@ static Evas_Object* _doc_list_item_content_get(void *data, Evas_Object *obj, con return NULL; } - item = (doc_item*)data; + item = (doc_item *) data; DOC_CHECK_NULL(item->item); DOC_CHECK_NULL(item->ugd); doc_ugdata *ugd = item->ugd; @@ -763,14 +789,16 @@ static Evas_Object* _doc_list_item_content_get(void *data, Evas_Object *obj, con if (!g_strcmp0(part, "elm.swallow.icon")) { fsFileType type = FILE_TYPE_NONE; _document_file_category(item->item->file_url, &type); - const char *thumb = _document_file_attr_get_default_icon_by_type(type); + const char *thumb = + _document_file_attr_get_default_icon_by_type(type); layout = _doc_list_show_thumb(obj, thumb); return layout; - } else if (!g_strcmp0(part, "elm.swallow.end") && ugd->thumbs_d->b_editmode == true) { - Evas_Object* ck = NULL; + } else if (!g_strcmp0(part, "elm.swallow.end") + && ugd->thumbs_d->b_editmode == true) { + Evas_Object *ck = NULL; ck = elm_check_add(obj); DOC_CHECK_NULL(ck); @@ -779,7 +807,8 @@ static Evas_Object* _doc_list_item_content_get(void *data, Evas_Object *obj, con elm_check_state_set(ck, item->checked); ugd->thumbs_d->check = ck; evas_object_smart_callback_add(ck, "changed", - _doc_list_check_state_changed_cb, item); + _doc_list_check_state_changed_cb, + item); evas_object_show(ck); return ck; @@ -788,9 +817,10 @@ static Evas_Object* _doc_list_item_content_get(void *data, Evas_Object *obj, con return layout; } -static char* _doc_list_text_get_cb(void *data, Evas_Object *obj, const char *part) +static char *_doc_list_text_get_cb(void *data, Evas_Object * obj, + const char *part) { - doc_item *ditem = (doc_item*)data; + doc_item *ditem = (doc_item *) data; DOC_CHECK_NULL(ditem->item); DOC_CHECK_NULL(ditem->ugd); doc_ugdata *ugd = ditem->ugd; @@ -799,11 +829,11 @@ static char* _doc_list_text_get_cb(void *data, Evas_Object *obj, const char *par return strdup(ditem->item->display_name); } -static int _doc_list_select_one(doc_item *ditem, char *file_url) +static int _doc_list_select_one(doc_item * ditem, char *file_url) { DOC_CHECK_VAL(file_url, -1); DOC_CHECK_VAL(ditem, -1); - doc_ugdata *ugd = (doc_ugdata *)ditem->ugd; + doc_ugdata *ugd = (doc_ugdata *) ditem->ugd; DOC_CHECK_VAL(ugd, -1); doc_sdbg("Service add:%s", file_url); @@ -816,27 +846,33 @@ static int _doc_list_select_one(doc_item *ditem, char *file_url) return ret; } - char **path_array = (char **)calloc(1, sizeof(char *)); + char **path_array = (char **) calloc(1, sizeof(char *)); if (!path_array) { doc_dbgW("failed to allocate path"); return ret; } path_array[0] = strdup(file_url); - ret = app_control_add_extra_data(ugd->service, DOC_FILE_SELECT_RETURN_PATH, file_url); + ret = + app_control_add_extra_data(ugd->service, + DOC_FILE_SELECT_RETURN_PATH, file_url); if (ret != APP_CONTROL_ERROR_NONE) { doc_dbgW("Add file path failed!"); } - ret = app_control_add_extra_data_array(ugd->service, APP_CONTROL_DATA_SELECTED, - (const char **)path_array, 1); - ret = app_control_add_extra_data_array(ugd->service, APP_CONTROL_DATA_PATH, - (const char **)path_array, 1); + ret = + app_control_add_extra_data_array(ugd->service, + APP_CONTROL_DATA_SELECTED, + (const char **) path_array, 1); + ret = + app_control_add_extra_data_array(ugd->service, + APP_CONTROL_DATA_PATH, + (const char **) path_array, 1); if (ret != APP_CONTROL_ERROR_NONE) { doc_dbgW("Add selected path failed!"); } ret = ug_send_result_full(ugd->ug, ugd->service, - APP_CONTROL_RESULT_SUCCEEDED); + APP_CONTROL_RESULT_SUCCEEDED); if (ret != 0) { doc_dbgW("Send result failed!"); } @@ -849,11 +885,11 @@ static int _doc_list_select_one(doc_item *ditem, char *file_url) return ret; } -static void _doc_list_item_sel_cb(void *data, Evas_Object *obj, void *ei) +static void _doc_list_item_sel_cb(void *data, Evas_Object * obj, void *ei) { DOC_CHECK(data); - doc_item *ditem = (doc_item*)data; + doc_item *ditem = (doc_item *) data; DOC_CHECK(ditem->item); DOC_CHECK(ditem->ugd); doc_ugdata *ugd = ditem->ugd; @@ -873,22 +909,26 @@ static void _doc_list_item_sel_cb(void *data, Evas_Object *obj, void *ei) doc_dbgE("Data Transfer Failed."); } } else if (ugd->file_select_mode == DOC_FILE_SELECT_T_MULTIPLE) { - Evas_Object *ck = elm_object_item_part_content_get((Elm_Object_Item *) ei, "elm.swallow.end"); + Evas_Object *ck = + elm_object_item_part_content_get((Elm_Object_Item *) ei, + "elm.swallow.end"); Eina_Bool bl = elm_check_state_get(ck); if (bl == EINA_FALSE) { if (!g_strcmp0(ditem->item->thumb_url, DEFAULT_THUMBNAIL)) { - char *pStrWarning = g_strdup_printf( - DOC_STR_UNSUPPORTED_FILE); + char *pStrWarning = + g_strdup_printf(DOC_STR_UNSUPPORTED_FILE); notification_status_message_post(pStrWarning); DOC_FREE(pStrWarning); return; } - if ((ugd->max_count != -1) && (ditem->ugd->thumbs_d->tot_selected + 1 > ugd->max_count)) { + if ((ugd->max_count != -1) + && (ditem->ugd->thumbs_d->tot_selected + 1 > + ugd->max_count)) { char *noti_str = DOC_STR_MAX_PICTURES_SELECTED; char *pStrWarning = g_strdup_printf(noti_str, - ugd->max_count); + ugd->max_count); notification_status_message_post(pStrWarning); DOC_FREE(pStrWarning); return; @@ -901,14 +941,17 @@ static void _doc_list_item_sel_cb(void *data, Evas_Object *obj, void *ei) #ifdef FEATURE_SIZE_CHECK struct stat stFileInfo; stat(sit->file_url, &stFileInfo); - if (ugd->limitsize > 0 && ugd->selsize + stFileInfo.st_size > ugd->limitsize) { - notification_status_message_post("Maximum Selection Exceeded."); + if (ugd->limitsize > 0 + && ugd->selsize + stFileInfo.st_size > ugd->limitsize) { + notification_status_message_post + ("Maximum Selection Exceeded."); doc_data_util_free_sel_item(sit); return; } #endif doc_sdbg("Append path: %s", sit->file_url); - ugd->selected_elist = eina_list_append(ugd->selected_elist, sit); + ugd->selected_elist = + eina_list_append(ugd->selected_elist, sit); elm_check_state_set(ck, EINA_TRUE); ditem->ugd->thumbs_d->tot_selected++; #ifdef FEATURE_SIZE_CHECK @@ -928,7 +971,8 @@ static void _doc_list_item_sel_cb(void *data, Evas_Object *obj, void *ei) doc_sdbg("remove Path: %s", sit->file_url); EINA_LIST_FOREACH(ugd->selected_elist, l, sit1) { if (sit1 && !strcmp(sit->file_url, sit1->file_url)) { - ugd->selected_elist = eina_list_remove(ugd->selected_elist, sit1); + ugd->selected_elist = + eina_list_remove(ugd->selected_elist, sit1); doc_data_util_free_sel_item(sit1); } } @@ -941,7 +985,9 @@ static void _doc_list_item_sel_cb(void *data, Evas_Object *obj, void *ei) doc_data_util_free_sel_item(sit); } - btn = elm_object_item_part_content_get(ugd->nf_it, DOC_NAVIFRAME_TITLE_RIGHT_BTN); + btn = + elm_object_item_part_content_get(ugd->nf_it, + DOC_NAVIFRAME_TITLE_RIGHT_BTN); if (btn == NULL) { doc_dbgE("Failed to get part information"); } @@ -953,28 +999,38 @@ static void _doc_list_item_sel_cb(void *data, Evas_Object *obj, void *ei) } if (ditem->ugd->thumbs_d->tot_selected >= 0) { - text = g_strdup_printf(pd_selected, ditem->ugd->thumbs_d->tot_selected); + text = + g_strdup_printf(pd_selected, + ditem->ugd->thumbs_d->tot_selected); elm_object_item_text_set(ditem->ugd->nf_it, text); } } } -static void _doc_list_navi_cancel_cb(void *data, Evas_Object *obj, void *ei) +static void _doc_list_navi_cancel_cb(void *data, Evas_Object * obj, + void *ei) { - doc_ugdata *app_data = (doc_ugdata *)data; + doc_ugdata *app_data = (doc_ugdata *) data; Eina_List *l = NULL; doc_item *ditem = NULL; - if (app_data->is_attach_panel && (app_data->attach_panel_display_mode == ATTACH_PANEL_FULL_MODE)) { + if (app_data->is_attach_panel + && (app_data->attach_panel_display_mode == + ATTACH_PANEL_FULL_MODE)) { int ret; app_control_h app_control = NULL; ret = app_control_create(&app_control); if (ret == APP_CONTROL_ERROR_NONE) { - app_control_add_extra_data(app_control, ATTACH_PANEL_FLICK_MODE_KEY, ATTACH_PANEL_FLICK_MODE_ENABLE); - app_control_add_extra_data_array(app_control, APP_CONTROL_DATA_PATH, - NULL, 0); - ret = ug_send_result_full(app_data->ug, app_control, APP_CONTROL_RESULT_FAILED); + app_control_add_extra_data(app_control, + ATTACH_PANEL_FLICK_MODE_KEY, + ATTACH_PANEL_FLICK_MODE_ENABLE); + app_control_add_extra_data_array(app_control, + APP_CONTROL_DATA_PATH, NULL, + 0); + ret = + ug_send_result_full(app_data->ug, app_control, + APP_CONTROL_RESULT_FAILED); } app_control_destroy(app_control); } @@ -989,25 +1045,29 @@ static void _doc_list_navi_cancel_cb(void *data, Evas_Object *obj, void *ei) elm_naviframe_item_pop(app_data->naviframe); } -void doc_list_change_selection_mode(doc_ugdata *ugd) +void doc_list_change_selection_mode(doc_ugdata * ugd) { DOC_CHECK(ugd); DOC_CHECK(ugd->thumbs_d); if (ugd->thumbs_d->genlist) { - if (ugd->is_attach_panel && (ugd->attach_panel_display_mode == ATTACH_PANEL_HALF_MODE)) { - elm_scroller_movement_block_set(ugd->thumbs_d->genlist, ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL); + if (ugd->is_attach_panel + && (ugd->attach_panel_display_mode == + ATTACH_PANEL_HALF_MODE)) { + elm_scroller_movement_block_set(ugd->thumbs_d->genlist, + ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL); } else if (ugd->is_attach_panel) { - elm_scroller_movement_block_set(ugd->thumbs_d->genlist, ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL); + elm_scroller_movement_block_set(ugd->thumbs_d->genlist, + ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL); } } } -static void _doc_list_move_stop_cb(void *data, Evas_Object *obj, void *ei) +static void _doc_list_move_stop_cb(void *data, Evas_Object * obj, void *ei) { doc_dbg(""); DOC_CHECK(data); - doc_ugdata *ugd = (doc_ugdata *)data; + doc_ugdata *ugd = (doc_ugdata *) data; int x, y, w, h; int ret; elm_scroller_region_get(obj, &x, &y, &w, &h); @@ -1016,16 +1076,22 @@ static void _doc_list_move_stop_cb(void *data, Evas_Object *obj, void *ei) ret = app_control_create(&app_control); if (ret == APP_CONTROL_ERROR_NONE) { if (y == 0) { - app_control_add_extra_data(app_control, ATTACH_PANEL_FLICK_MODE_KEY, ATTACH_PANEL_FLICK_MODE_ENABLE); + app_control_add_extra_data(app_control, + ATTACH_PANEL_FLICK_MODE_KEY, + ATTACH_PANEL_FLICK_MODE_ENABLE); } else { - app_control_add_extra_data(app_control, ATTACH_PANEL_FLICK_MODE_KEY, ATTACH_PANEL_FLICK_MODE_DISABLE); + app_control_add_extra_data(app_control, + ATTACH_PANEL_FLICK_MODE_KEY, + ATTACH_PANEL_FLICK_MODE_DISABLE); } - ret = ug_send_result_full(ugd->ug, app_control, APP_CONTROL_RESULT_SUCCEEDED); + ret = + ug_send_result_full(ugd->ug, app_control, + APP_CONTROL_RESULT_SUCCEEDED); } app_control_destroy(app_control); } -int _doc_ui_update_label_text(Elm_Object_Item *nf_it, int sel_cnt) +int _doc_ui_update_label_text(Elm_Object_Item * nf_it, int sel_cnt) { DOC_CHECK_VAL(nf_it, -1); doc_sdbg("Count: %d, text: %s", sel_cnt); @@ -1038,24 +1104,24 @@ int _doc_ui_update_label_text(Elm_Object_Item *nf_it, int sel_cnt) elm_object_item_text_set(nf_it, text); DOC_GFREEIF(text); } else { - /* Don't need to update text if it's called by language_changed_cb*/ + /* Don't need to update text if it's called by language_changed_cb */ elm_object_item_text_set(nf_it, pd_selected); doc_ui_set_translatable_item(nf_it, pd_selected); } return 0; } -static int _doc_list_get_sel_cnt(doc_ugdata *ugd) +static int _doc_list_get_sel_cnt(doc_ugdata * ugd) { if (ugd == NULL || ugd->selected_elist == NULL || - ugd->thumbs_d == NULL) { + ugd->thumbs_d == NULL) { return 0; } return eina_list_count(ugd->selected_elist); } -int _doc_list_update_lang(doc_ugdata *ugd) +int _doc_list_update_lang(doc_ugdata * ugd) { DOC_CHECK_VAL(ugd, -1); DOC_CHECK_VAL(ugd->thumbs_d, -1); @@ -1072,7 +1138,7 @@ int _doc_list_update_lang(doc_ugdata *ugd) return 0; } -int doc_list_lang_update(doc_ugdata *ugd) +int doc_list_lang_update(doc_ugdata * ugd) { DOC_CHECK_VAL(ugd, -1); @@ -1080,14 +1146,14 @@ int doc_list_lang_update(doc_ugdata *ugd) return 0; } -int doc_update_genlist(doc_ugdata *ugd) +int doc_update_genlist(doc_ugdata * ugd) { DOC_CHECK_VAL(ugd, -1); DOC_CHECK_VAL(ugd->thumbs_d, -1); int ret = 0; int i = 0; - doc_item* ditem = NULL; + doc_item *ditem = NULL; int item_cnt = 0; char *pd_selected = DOC_STR_PD_SELECTED; doc_sel_item_s *sit = NULL; @@ -1108,19 +1174,21 @@ int doc_update_genlist(doc_ugdata *ugd) ugd->thumbs_d->tot_selected = 0; ret = doc_data_get_media_data(ugd, - DOC_ALL, - 0, - DOC_GET_UNTIL_LAST_RECORD, - &(ugd->thumbs_d->medias_elist), - NULL, NULL); + DOC_ALL, + 0, + DOC_GET_UNTIL_LAST_RECORD, + &(ugd->thumbs_d->medias_elist), + NULL, NULL); if (ret != 0) { doc_dbgE("###Get items list over[%d]###", ret); return ret; } - ugd->thumbs_d->medias_cnt = eina_list_count(ugd->thumbs_d->medias_elist); - doc_dbg("List view updated media count: %d", ugd->thumbs_d->medias_cnt); + ugd->thumbs_d->medias_cnt = + eina_list_count(ugd->thumbs_d->medias_elist); + doc_dbg("List view updated media count: %d", + ugd->thumbs_d->medias_cnt); if (ugd->thumbs_d->medias_cnt == 0) { @@ -1131,17 +1199,19 @@ int doc_update_genlist(doc_ugdata *ugd) for (i = 0; i < ugd->thumbs_d->medias_cnt; i++) { ditem = eina_list_nth(ugd->thumbs_d->medias_elist, i); if (ditem == NULL || ditem->item == NULL || - ditem->item->uuid == NULL) { + ditem->item->uuid == NULL) { doc_dbgE("Invalid ditem!"); continue; } - if (sit && strcmp(sit->file_url, ditem->item->file_url) == 0) { + if (sit + && strcmp(sit->file_url, ditem->item->file_url) == 0) { flag = true; break; } } if (flag == false) { - ugd->selected_elist = eina_list_remove(ugd->selected_elist, sit); + ugd->selected_elist = + eina_list_remove(ugd->selected_elist, sit); doc_data_util_free_sel_item(sit); } } @@ -1157,7 +1227,7 @@ int doc_update_genlist(doc_ugdata *ugd) for (i = 0; i < ugd->thumbs_d->medias_cnt; i++) { ditem = eina_list_nth(ugd->thumbs_d->medias_elist, i); if (ditem == NULL || ditem->item == NULL || - ditem->item->uuid == NULL) { + ditem->item->uuid == NULL) { doc_dbgE("Invalid ditem!"); continue; } @@ -1174,7 +1244,9 @@ int doc_update_genlist(doc_ugdata *ugd) if (ugd->selected_elist) { EINA_LIST_FOREACH(ugd->selected_elist, l, sit) { - if (sit && strcmp(sit->file_url, ditem->item->file_url) == 0) { + if (sit + && strcmp(sit->file_url, + ditem->item->file_url) == 0) { ditem->checked = true; ugd->thumbs_d->tot_selected++; } @@ -1182,26 +1254,31 @@ int doc_update_genlist(doc_ugdata *ugd) } ditem->ugd = ugd; - ditem->elm_item = elm_genlist_item_append(ugd->thumbs_d->genlist, - ugd->thumbs_d->gic, - ditem, NULL, ELM_GENLIST_ITEM_NONE, _doc_list_item_sel_cb, - ditem); + ditem->elm_item = + elm_genlist_item_append(ugd->thumbs_d->genlist, + ugd->thumbs_d->gic, ditem, NULL, + ELM_GENLIST_ITEM_NONE, + _doc_list_item_sel_cb, ditem); item_cnt++; ditem->sequence = item_cnt + 1; evas_object_show(ugd->thumbs_d->genlist); - elm_object_part_content_set(ugd->list_view, "contents", ugd->thumbs_d->genlist); + elm_object_part_content_set(ugd->list_view, "contents", + ugd->thumbs_d->genlist); } } else { Evas_Object *nocontent_ly = _doc_nocontent_create(ugd); - elm_object_part_content_set(ugd->list_view, "contents", nocontent_ly); + elm_object_part_content_set(ugd->list_view, "contents", + nocontent_ly); } Evas_Object *btn = NULL; - btn = elm_object_item_part_content_get(ugd->nf_it , DOC_NAVIFRAME_TITLE_RIGHT_BTN); + btn = + elm_object_item_part_content_get(ugd->nf_it, + DOC_NAVIFRAME_TITLE_RIGHT_BTN); if (btn == NULL) { doc_dbgE("Failed to get part information"); } @@ -1218,7 +1295,7 @@ int doc_update_genlist(doc_ugdata *ugd) return 0; } -int doc_create_genlist(doc_ugdata *ugd) +int doc_create_genlist(doc_ugdata * ugd) { doc_dbgE(""); DOC_CHECK_VAL(ugd, -1); @@ -1230,12 +1307,12 @@ int doc_create_genlist(doc_ugdata *ugd) doc_dbgE("!!!!! List view !!!!!!!! is pushed in the naviframe"); int i = 0; - doc_item* ditem = NULL; + doc_item *ditem = NULL; int item_cnt = 0; int ret = -1; doc_thumbs_s *thumbs_d = NULL; - thumbs_d = (doc_thumbs_s *)calloc(1, sizeof(doc_thumbs_s)); + thumbs_d = (doc_thumbs_s *) calloc(1, sizeof(doc_thumbs_s)); DOC_CHECK_VAL(thumbs_d, -1); ugd->thumbs_d = thumbs_d; ugd->thumbs_d->store_type = DOC_ALL; @@ -1248,24 +1325,25 @@ int doc_create_genlist(doc_ugdata *ugd) ugd->file_select_mode = DOC_FILE_SELECT_T_ONE; ret = doc_data_get_media_data(ugd, - DOC_ALL, - 0, - DOC_GET_UNTIL_LAST_RECORD, - &(ugd->thumbs_d->medias_elist), - NULL, NULL); + DOC_ALL, + 0, + DOC_GET_UNTIL_LAST_RECORD, + &(ugd->thumbs_d->medias_elist), + NULL, NULL); if (ret != 0) { doc_dbgE("###Get items list over[%d]###", ret); } - ugd->thumbs_d->medias_cnt = eina_list_count(ugd->thumbs_d->medias_elist); + ugd->thumbs_d->medias_cnt = + eina_list_count(ugd->thumbs_d->medias_elist); doc_dbg("List view all medias count: %d", ugd->thumbs_d->medias_cnt); Evas_Object *genlist; - char edj_path[PATH_MAX] = {0, }; + char edj_path[PATH_MAX] = { 0, }; - _doc_list_get_app_resource(DOC_EDJ_FILE, edj_path, (int)PATH_MAX); + _doc_list_get_app_resource(DOC_EDJ_FILE, edj_path, (int) PATH_MAX); genlist = elm_genlist_add(ugd->list_view); ugd->thumbs_d->genlist = genlist; @@ -1274,11 +1352,14 @@ int doc_create_genlist(doc_ugdata *ugd) elm_scroller_bounce_set(genlist, EINA_FALSE, EINA_TRUE); elm_scroller_policy_set(genlist, ELM_SCROLLER_POLICY_OFF, - ELM_SCROLLER_POLICY_AUTO); - evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - - if (ugd->is_attach_panel && (ugd->attach_panel_display_mode != ATTACH_PANEL_FULL_MODE)) { - elm_scroller_movement_block_set(genlist, ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL); + ELM_SCROLLER_POLICY_AUTO); + evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + + if (ugd->is_attach_panel + && (ugd->attach_panel_display_mode != ATTACH_PANEL_FULL_MODE)) { + elm_scroller_movement_block_set(genlist, + ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL); } if (ugd->is_attach_panel) { @@ -1302,7 +1383,7 @@ int doc_create_genlist(doc_ugdata *ugd) for (i = 0; i < ugd->thumbs_d->medias_cnt; i++) { ditem = eina_list_nth(ugd->thumbs_d->medias_elist, i); if (ditem == NULL || ditem->item == NULL || - ditem->item->uuid == NULL) { + ditem->item->uuid == NULL) { doc_dbgE("Invalid doc item!"); continue; } @@ -1319,44 +1400,59 @@ int doc_create_genlist(doc_ugdata *ugd) ditem->ugd = ugd; ditem->elm_item = elm_genlist_item_append(genlist, - ugd->thumbs_d->gic, - ditem, NULL, ELM_GENLIST_ITEM_NONE, _doc_list_item_sel_cb, - ditem); + ugd->thumbs_d->gic, + ditem, NULL, + ELM_GENLIST_ITEM_NONE, + _doc_list_item_sel_cb, + ditem); item_cnt++; ditem->sequence = item_cnt + 1; evas_object_show(genlist); - elm_object_part_content_set(ugd->list_view, "contents", genlist); + elm_object_part_content_set(ugd->list_view, "contents", + genlist); } } else { Evas_Object *nocontent_ly = _doc_nocontent_create(ugd); - elm_object_part_content_set(ugd->list_view, "contents", nocontent_ly); + elm_object_part_content_set(ugd->list_view, "contents", + nocontent_ly); } char *pd_selected = DOC_STR_PD_SELECTED; - ugd->nf_it = elm_naviframe_item_push(ugd->naviframe, g_strdup_printf(pd_selected, ugd->thumbs_d->tot_selected), NULL, NULL, ugd->list_view, "basic/transparent"); - elm_object_item_color_class_color_set(ugd->nf_it, "bg", 150, 155, 158, 255); + ugd->nf_it = + elm_naviframe_item_push(ugd->naviframe, + g_strdup_printf(pd_selected, + ugd->thumbs_d-> + tot_selected), NULL, NULL, + ugd->list_view, "basic/transparent"); + elm_object_item_color_class_color_set(ugd->nf_it, "bg", 150, 155, 158, + 255); /* Cancel Button */ Evas_Object *btn1 = elm_button_add(ugd->naviframe); elm_object_style_set(btn1, "naviframe/title_left"); doc_ui_set_translate_str(btn1, "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB"); - elm_object_item_part_content_set(ugd->nf_it, DOC_NAVIFRAME_TITLE_LEFT_BTN, btn1); + elm_object_item_part_content_set(ugd->nf_it, + DOC_NAVIFRAME_TITLE_LEFT_BTN, btn1); evas_object_show(btn1); - evas_object_smart_callback_add(btn1, "clicked", _doc_list_navi_cancel_cb, ugd); + evas_object_smart_callback_add(btn1, "clicked", + _doc_list_navi_cancel_cb, ugd); - /* Done Button*/ + /* Done Button */ Evas_Object *btn2 = elm_button_add(ugd->naviframe); elm_object_style_set(btn2, "naviframe/title_right"); doc_ui_set_translate_str(btn2, "IDS_TPLATFORM_ACBUTTON_DONE_ABB"); elm_object_disabled_set(btn2, EINA_TRUE); - elm_object_item_part_content_set(ugd->nf_it, DOC_NAVIFRAME_TITLE_RIGHT_BTN, btn2); + elm_object_item_part_content_set(ugd->nf_it, + DOC_NAVIFRAME_TITLE_RIGHT_BTN, btn2); evas_object_show(btn2); - evas_object_smart_callback_add(btn2, "clicked", _doc_list_navi_done_cb, (void *)ugd); + evas_object_smart_callback_add(btn2, "clicked", _doc_list_navi_done_cb, + (void *) ugd); - elm_naviframe_item_title_enabled_set(ugd->nf_it, EINA_FALSE, EINA_FALSE); + elm_naviframe_item_title_enabled_set(ugd->nf_it, EINA_FALSE, + EINA_FALSE); elm_naviframe_item_pop_cb_set(ugd->nf_it, _data_list_back_cb, ugd); diff --git a/src/doc-local-data.c b/src/doc-local-data.c index 5550d82..e4dfac3 100644 --- a/src/doc-local-data.c +++ b/src/doc-local-data.c @@ -25,14 +25,15 @@ #include "doc-debug.h" -static bool _doc_local_data_clone_folder(media_folder_h folder, bool b_path, - doc_folder_s **pfolder) +static bool _doc_local_data_clone_folder(media_folder_h folder, + bool b_path, + doc_folder_s ** pfolder) { DOC_CHECK_FALSE(folder); DOC_CHECK_FALSE(pfolder); doc_folder_s *tmp_folder = NULL; - tmp_folder = (doc_folder_s *)calloc(1, sizeof(doc_folder_s)); + tmp_folder = (doc_folder_s *) calloc(1, sizeof(doc_folder_s)); if (tmp_folder == NULL) { doc_dbgE("Failed to calloc!"); return false; @@ -40,35 +41,40 @@ static bool _doc_local_data_clone_folder(media_folder_h folder, bool b_path, tmp_folder->gtype = DOC_TYPE_FOLDER; if (b_path) { - if (media_folder_get_path(folder, &(tmp_folder->path)) != MEDIA_CONTENT_ERROR_NONE) { + if (media_folder_get_path(folder, &(tmp_folder->path)) != + MEDIA_CONTENT_ERROR_NONE) { doc_dbgE("Get folder path failed!"); goto DOC_LOCAL_FAILED; } } - if (media_folder_get_folder_id(folder, &(tmp_folder->uuid)) != MEDIA_CONTENT_ERROR_NONE) { + if (media_folder_get_folder_id(folder, &(tmp_folder->uuid)) != + MEDIA_CONTENT_ERROR_NONE) { doc_dbgE("Get folder id failed!"); goto DOC_LOCAL_FAILED; } - if (media_folder_get_modified_time(folder, &(tmp_folder->mtime)) != MEDIA_CONTENT_ERROR_NONE) { + if (media_folder_get_modified_time(folder, &(tmp_folder->mtime)) != + MEDIA_CONTENT_ERROR_NONE) { doc_dbgE("Get modified time failed!"); goto DOC_LOCAL_FAILED; } media_content_storage_e storage_type; - if (media_folder_get_storage_type(folder, &storage_type) != MEDIA_CONTENT_ERROR_NONE) { + if (media_folder_get_storage_type(folder, &storage_type) != + MEDIA_CONTENT_ERROR_NONE) { doc_dbgE("Get storage type failed!"); goto DOC_LOCAL_FAILED; } - if (storage_type == MEDIA_CONTENT_STORAGE_INTERNAL) { /* The device's internal storage */ + if (storage_type == MEDIA_CONTENT_STORAGE_INTERNAL) { /* The device's internal storage */ tmp_folder->type = DOC_PHONE; - } else if (storage_type == MEDIA_CONTENT_STORAGE_EXTERNAL) { /* The device's external storage */ + } else if (storage_type == MEDIA_CONTENT_STORAGE_EXTERNAL) { /* The device's external storage */ tmp_folder->type = DOC_MMC; } else { doc_dbgE("Undefined mode[%d]!", storage_type); } - if (media_folder_get_name(folder, &(tmp_folder->display_name)) != MEDIA_CONTENT_ERROR_NONE) { + if (media_folder_get_name(folder, &(tmp_folder->display_name)) != + MEDIA_CONTENT_ERROR_NONE) { doc_dbgE("Get folder name failed!"); goto DOC_LOCAL_FAILED; } @@ -76,22 +82,23 @@ static bool _doc_local_data_clone_folder(media_folder_h folder, bool b_path, *pfolder = tmp_folder; return true; -DOC_LOCAL_FAILED: + DOC_LOCAL_FAILED: - doc_data_type_free_item((void **)(&tmp_folder)); + doc_data_type_free_item((void **) (&tmp_folder)); *pfolder = NULL; return false; } -static bool _doc_local_data_get_media_list_cb(media_info_h media, void *data) +static bool _doc_local_data_get_media_list_cb(media_info_h media, + void *data) { DOC_CHECK_FALSE(data); - doc_transfer_data_s *td = (doc_transfer_data_s *)data; + doc_transfer_data_s *td = (doc_transfer_data_s *) data; DOC_CHECK_FALSE(td->userdata); DOC_CHECK_FALSE(media); doc_media_s *item = NULL; - Eina_List **elist = (Eina_List **)(td->userdata); + Eina_List **elist = (Eina_List **) (td->userdata); if (doc_data_util_clone_media(media, &item, td->with_meta)) { *elist = eina_list_append(*elist, item); @@ -130,13 +137,13 @@ int doc_local_data_disconnect(void) } static bool _doc_local_data_get_folder_list_cb(media_folder_h folder, - void *data) + void *data) { DOC_CHECK_FALSE(data); - doc_transfer_data_s *tmp_data = (doc_transfer_data_s *)data; + doc_transfer_data_s *tmp_data = (doc_transfer_data_s *) data; DOC_CHECK_FALSE(tmp_data->userdata); DOC_CHECK_FALSE(folder); - Eina_List **elist = (Eina_List **)(tmp_data->userdata); + Eina_List **elist = (Eina_List **) (tmp_data->userdata); doc_folder_s *tmp_folder = NULL; char *path = NULL; @@ -148,8 +155,8 @@ static bool _doc_local_data_get_folder_list_cb(media_folder_h folder, if (tmp_data->list_type != DOC_FOLDER_LIST_PATH) { if (!g_strcmp0(DOC_CAMERA_PATH_PHONE, path) || - !g_strcmp0(DOC_CAMERA_PATH_MMC, path) || - !g_strcmp0(DOC_DOWNLOADS_PATH, path)) { + !g_strcmp0(DOC_CAMERA_PATH_MMC, path) || + !g_strcmp0(DOC_DOWNLOADS_PATH, path)) { doc_dbgW("Camera or Downloads!"); DOC_FREE(path); return true; @@ -168,7 +175,8 @@ static bool _doc_local_data_get_folder_list_cb(media_folder_h folder, return true; } -static int _doc_local_data_get_folder_list(doc_filter_s *condition, Eina_List **elilst) +static int _doc_local_data_get_folder_list(doc_filter_s * condition, + Eina_List ** elilst) { DOC_CHECK_VAL(elilst, -1); DOC_CHECK_VAL(condition, -1); @@ -183,15 +191,15 @@ static int _doc_local_data_get_folder_list(doc_filter_s *condition, Eina_List ** doc_transfer_data_s tran_data; memset(&tran_data, 0x00, sizeof(doc_transfer_data_s)); - tran_data.userdata = (void **)elilst; + tran_data.userdata = (void **) elilst; tran_data.folder_id = NULL; tran_data.with_meta = false; tran_data.list_type = condition->list_type; doc_dbg("Get folders--start"); ret = media_folder_foreach_folder_from_db(filter, - _doc_local_data_get_folder_list_cb, - &tran_data); + _doc_local_data_get_folder_list_cb, + &tran_data); doc_dbg("Get folders--over"); doc_data_util_destroy_filter(filter); @@ -204,7 +212,7 @@ static int _doc_local_data_get_folder_list(doc_filter_s *condition, Eina_List ** return 0; } -int doc_local_data_get_folder_by_path(char *path, doc_folder_s **folder) +int doc_local_data_get_folder_by_path(char *path, doc_folder_s ** folder) { DOC_CHECK_VAL(path, -1); DOC_CHECK_VAL(folder, -1); @@ -248,7 +256,7 @@ int doc_local_data_get_folder_by_path(char *path, doc_folder_s **folder) for (; i < len; i++) { _item = eina_list_nth(list, i); - doc_data_type_free_item((void **)(&_item)); + doc_data_type_free_item((void **) (&_item)); } eina_list_free(list); @@ -257,7 +265,8 @@ int doc_local_data_get_folder_by_path(char *path, doc_folder_s **folder) return ret; } -int doc_local_data_get_all_media_count(doc_filter_s *condtion, int *item_cnt) +int doc_local_data_get_all_media_count(doc_filter_s * condtion, + int *item_cnt) { DOC_CHECK_VAL(condtion, -1); DOC_CHECK_VAL(item_cnt, -1); @@ -284,8 +293,8 @@ int doc_local_data_get_all_media_count(doc_filter_s *condtion, int *item_cnt) return 0; } -int doc_local_data_get_all_folders_media_list(doc_filter_s *condition, - Eina_List **elist) +int doc_local_data_get_all_folders_media_list(doc_filter_s * condition, + Eina_List ** elist) { DOC_CHECK_VAL(elist, -1); DOC_CHECK_VAL(condition, -1); @@ -300,14 +309,14 @@ int doc_local_data_get_all_folders_media_list(doc_filter_s *condition, doc_transfer_data_s tran_data; memset(&tran_data, 0x00, sizeof(doc_transfer_data_s)); - tran_data.userdata = (void **)elist; + tran_data.userdata = (void **) elist; tran_data.folder_id = NULL; tran_data.with_meta = condition->with_meta; doc_dbg("Get all medias--start"); ret = media_info_foreach_media_from_db(filter, _doc_local_data_get_media_list_cb, - &tran_data); + &tran_data); doc_dbg("Get all medias--over"); doc_data_util_destroy_filter(filter); @@ -319,4 +328,3 @@ int doc_local_data_get_all_folders_media_list(doc_filter_s *condition, return 0; } - diff --git a/src/doc-main-view.c b/src/doc-main-view.c index 0bb6716..5d607da 100644 --- a/src/doc-main-view.c +++ b/src/doc-main-view.c @@ -20,18 +20,19 @@ #include "doc-ui-util.h" #include "doc-list.h" -static Evas_Object *_doc_main_create_ly(doc_ugdata *ugd, Evas_Object *parent) +static Evas_Object *_doc_main_create_ly(doc_ugdata * ugd, + Evas_Object * parent) { doc_dbg(""); DOC_CHECK_NULL(parent); Evas_Object *layout = doc_ui_load_edj(parent, DOC_EDJ_FILE, - DOC_GRP_LISTVIEW); + DOC_GRP_LISTVIEW); DOC_CHECK_NULL(layout); evas_object_show(layout); return layout; } -int doc_main_view_create(doc_ugdata *ugd) +int doc_main_view_create(doc_ugdata * ugd) { DOC_CHECK_VAL(ugd, -1); DOC_CHECK_VAL(ugd->naviframe, -1); @@ -42,4 +43,3 @@ int doc_main_view_create(doc_ugdata *ugd) doc_create_genlist(ugd); return 0; } - diff --git a/src/doc-ui-util.c b/src/doc-ui-util.c index 6f8c955..3bd7a22 100644 --- a/src/doc-ui-util.c +++ b/src/doc-ui-util.c @@ -23,7 +23,8 @@ #define DOC_NOBUT_EXIT_POPUP_HIDE_TIME_DELAY 3.0 -Evas_Object* doc_ui_load_edj(Evas_Object *parent, const char *file, const char *group) +Evas_Object *doc_ui_load_edj(Evas_Object * parent, const char *file, + const char *group) { DOC_CHECK_NULL(parent); DOC_CHECK_NULL(file); @@ -40,14 +41,16 @@ Evas_Object* doc_ui_load_edj(Evas_Object *parent, const char *file, const char * return NULL; } - evas_object_size_hint_weight_set(eo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(eo, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(eo, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(eo, EVAS_HINT_FILL, + EVAS_HINT_FILL); } return eo; } -Evas_Object *doc_ui_create_main_ly(Evas_Object *parent) +Evas_Object *doc_ui_create_main_ly(Evas_Object * parent) { DOC_CHECK_NULL(parent); Evas_Object *layout = NULL; @@ -58,24 +61,23 @@ Evas_Object *doc_ui_create_main_ly(Evas_Object *parent) /* Apply the layout style */ const char *profile = elm_config_profile_get(); doc_dbg("profile: %s", profile); - if (!g_strcmp0(profile, "mobile")) { - elm_layout_theme_set(layout, "layout", "application", - "default"); + if (!g_strcmp0(profile, "mobile")) { + elm_layout_theme_set(layout, "layout", "application", "default"); } else if (!g_strcmp0(profile, "extension")) { elm_layout_theme_set(layout, "layout", "application", - "noindicator"); + "noindicator"); } else { - elm_layout_theme_set(layout, "layout", "application", - "default"); + elm_layout_theme_set(layout, "layout", "application", "default"); } evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); + EVAS_HINT_EXPAND); evas_object_show(layout); return layout; } -Evas_Object* doc_ui_create_naviframe(doc_ugdata *ugd, Evas_Object *parent) +Evas_Object *doc_ui_create_naviframe(doc_ugdata * ugd, + Evas_Object * parent) { DOC_CHECK_NULL(ugd); DOC_CHECK_NULL(parent); @@ -96,17 +98,17 @@ Evas_Object* doc_ui_create_naviframe(doc_ugdata *ugd, Evas_Object *parent) } #if 0 -static int _doc_ui_reset_scroller_pos(Evas_Object *obj) +static int _doc_ui_reset_scroller_pos(Evas_Object * obj) { DOC_CHECK_VAL(obj, -1); - evas_object_data_set(obj, "prev_scroller_x", (void *)0); - evas_object_data_set(obj, "prev_scroller_y", (void *)0); - evas_object_data_set(obj, "prev_scroller_w", (void *)0); - evas_object_data_set(obj, "prev_scroller_h", (void *)0); + evas_object_data_set(obj, "prev_scroller_x", (void *) 0); + evas_object_data_set(obj, "prev_scroller_y", (void *) 0); + evas_object_data_set(obj, "prev_scroller_w", (void *) 0); + evas_object_data_set(obj, "prev_scroller_h", (void *) 0); return 0; } -static int _doc_ui_del_scroller_pos(Evas_Object *obj) +static int _doc_ui_del_scroller_pos(Evas_Object * obj) { DOC_CHECK_VAL(obj, -1); evas_object_data_del(obj, "prev_scroller_x"); @@ -116,7 +118,7 @@ static int _doc_ui_del_scroller_pos(Evas_Object *obj) return 0; } -static int _doc_ui_save_scroller_pos(Evas_Object *obj) +static int _doc_ui_save_scroller_pos(Evas_Object * obj) { DOC_CHECK_VAL(obj, -1); Evas_Coord x = 0; @@ -126,14 +128,14 @@ static int _doc_ui_save_scroller_pos(Evas_Object *obj) elm_scroller_region_get(obj, &x, &y, &w, &h); doc_dbg("(%dx%d), (%dx%d)", x, y, w, h); - evas_object_data_set(obj, "prev_scroller_x", (void *)x); - evas_object_data_set(obj, "prev_scroller_y", (void *)y); - evas_object_data_set(obj, "prev_scroller_w", (void *)w); - evas_object_data_set(obj, "prev_scroller_h", (void *)h); + evas_object_data_set(obj, "prev_scroller_x", (void *) x); + evas_object_data_set(obj, "prev_scroller_y", (void *) y); + evas_object_data_set(obj, "prev_scroller_w", (void *) w); + evas_object_data_set(obj, "prev_scroller_h", (void *) h); return 0; } -static int _doc_ui_restore_scroller_pos(Evas_Object *obj) +static int _doc_ui_restore_scroller_pos(Evas_Object * obj) { DOC_CHECK_VAL(obj, -1); Evas_Coord x = 0; @@ -141,10 +143,10 @@ static int _doc_ui_restore_scroller_pos(Evas_Object *obj) Evas_Coord w = 0; Evas_Coord h = 0; - x = (Evas_Coord)evas_object_data_get(obj, "prev_scroller_x"); - y = (Evas_Coord)evas_object_data_get(obj, "prev_scroller_y"); - w = (Evas_Coord)evas_object_data_get(obj, "prev_scroller_w"); - h = (Evas_Coord)evas_object_data_get(obj, "prev_scroller_h"); + x = (Evas_Coord) evas_object_data_get(obj, "prev_scroller_x"); + y = (Evas_Coord) evas_object_data_get(obj, "prev_scroller_y"); + w = (Evas_Coord) evas_object_data_get(obj, "prev_scroller_w"); + h = (Evas_Coord) evas_object_data_get(obj, "prev_scroller_h"); doc_dbg("(%dx%d), (%dx%d)", x, y, w, h); if (w > 0 && h > 0) { elm_scroller_region_show(obj, x, y, w, h); @@ -153,7 +155,7 @@ static int _doc_ui_restore_scroller_pos(Evas_Object *obj) } #endif -int doc_ui_set_translate_str(Evas_Object *obj, const char *str) +int doc_ui_set_translate_str(Evas_Object * obj, const char *str) { DOC_CHECK_VAL(str, -1); DOC_CHECK_VAL(obj, -1); @@ -162,7 +164,7 @@ int doc_ui_set_translate_str(Evas_Object *obj, const char *str) return 0; } -int doc_ui_set_translate_part_str(Evas_Object *obj, const char *part, +int doc_ui_set_translate_part_str(Evas_Object * obj, const char *part, const char *str) { DOC_CHECK_VAL(str, -1); @@ -176,7 +178,7 @@ int doc_ui_set_translate_part_str(Evas_Object *obj, const char *part, return 0; } -int doc_ui_set_translatable_item(Elm_Object_Item *nf_it, const char *str) +int doc_ui_set_translatable_item(Elm_Object_Item * nf_it, const char *str) { DOC_CHECK_VAL(str, -1); DOC_CHECK_VAL(nf_it, -1); @@ -185,30 +187,31 @@ int doc_ui_set_translatable_item(Elm_Object_Item *nf_it, const char *str) return 0; } -int doc_ui_get_indicator_state(doc_ugdata *ugd) +int doc_ui_get_indicator_state(doc_ugdata * ugd) { DOC_CHECK_VAL(ugd, -1); /* Save old view's indicator values */ ugd->indi_mode = elm_win_indicator_mode_get(ugd->win); ugd->indi_o_mode = elm_win_indicator_opacity_get(ugd->win); doc_dbgW("indi_o_mode: %d, indi_mode: %d", ugd->indi_o_mode, - ugd->indi_mode); + ugd->indi_mode); /* Save old view's overlap mode */ - ugd->overlap_mode = (int)evas_object_data_get(ugd->conform, "overlap"); + ugd->overlap_mode = + (int) evas_object_data_get(ugd->conform, "overlap"); doc_dbgW("overlap_mode: %d", ugd->overlap_mode); return 0; } -int doc_ui_hide_indicator(doc_ugdata *ugd) +int doc_ui_hide_indicator(doc_ugdata * ugd) { DOC_CHECK_VAL(ugd, -1); /* transparent indicator setting */ elm_win_indicator_mode_set(ugd->win, ELM_WIN_INDICATOR_SHOW); elm_win_indicator_opacity_set(ugd->win, ELM_WIN_INDICATOR_TRANSPARENT); /* Modify to start content from 0,0 */ - elm_object_signal_emit(ugd->conform, "elm,state,indicator,overlap", ""); + elm_object_signal_emit(ugd->conform, "elm,state,indicator,overlap", + ""); /* Save overlap mode when showing new view(ex: ug) */ - evas_object_data_set(ugd->conform, "overlap", (void *)EINA_TRUE); + evas_object_data_set(ugd->conform, "overlap", (void *) EINA_TRUE); return 0; } - diff --git a/src/doc-util.c b/src/doc-util.c index 98e7e76..85baf71 100644 --- a/src/doc-util.c +++ b/src/doc-util.c @@ -28,7 +28,11 @@ static int __externalStorageId = 0; -static bool _doc_util_getSupportedStorages_cb(int storageId, storage_type_e type, storage_state_e state, const char *path, void *userData) +static bool _doc_util_getSupportedStorages_cb(int storageId, + storage_type_e type, + storage_state_e state, + const char *path, + void *userData) { doc_dbg(""); @@ -40,12 +44,16 @@ static bool _doc_util_getSupportedStorages_cb(int storageId, storage_type_e type return true; } -static void _doc_db_update_sdcard_info(int storage_id, storage_state_e state, void *user_data) +static void _doc_db_update_sdcard_info(int storage_id, + storage_state_e state, + void *user_data) { doc_dbgW("Storage state changed!"); DOC_CHECK(user_data); - int error = storage_foreach_device_supported(_doc_util_getSupportedStorages_cb, NULL); + int error = + storage_foreach_device_supported(_doc_util_getSupportedStorages_cb, + NULL); if (error == STORAGE_ERROR_NONE) { storage_state_e mmc_state; int ret = storage_get_state(__externalStorageId, &mmc_state); @@ -57,18 +65,21 @@ static void _doc_db_update_sdcard_info(int storage_id, storage_state_e state, vo /* Update view */ if (mmc_state == STORAGE_STATE_MOUNTED) { doc_dbg("mmc_state[%d]: STORAGE_STATE_MOUNTED", mmc_state); - doc_update_view((doc_ugdata*)user_data, DOC_UPDATE_MMC_ADDED); + doc_update_view((doc_ugdata *) user_data, + DOC_UPDATE_MMC_ADDED); } else if (mmc_state == STORAGE_STATE_REMOVED) { doc_dbg("mmc_state[%d]: STORAGE_STATE_REMOVED", mmc_state); - doc_update_view((doc_ugdata*)user_data, DOC_UPDATE_MMC_REMOVED); + doc_update_view((doc_ugdata *) user_data, + DOC_UPDATE_MMC_REMOVED); } else if (mmc_state == STORAGE_STATE_UNMOUNTABLE) { doc_dbg("mmc_state[%d]: STORAGE_STATE_UNMOUNTABLE", mmc_state); - doc_update_view((doc_ugdata*)user_data, DOC_UPDATE_MMC_REMOVED); + doc_update_view((doc_ugdata *) user_data, + DOC_UPDATE_MMC_REMOVED); } } } -Eina_Bool doc_update_view(doc_ugdata* ugd, int mode) +Eina_Bool doc_update_view(doc_ugdata * ugd, int mode) { doc_dbg("mode: %d", mode); DOC_CHECK_FALSE(ugd); @@ -82,13 +93,15 @@ Eina_Bool doc_update_view(doc_ugdata* ugd, int mode) return EINA_TRUE; } -int doc_reg_db_update_noti(doc_ugdata* ugd) +int doc_reg_db_update_noti(doc_ugdata * ugd) { doc_dbg(""); DOC_CHECK_VAL(ugd, -1); int error_code = 0; - error_code = storage_set_state_changed_cb(__externalStorageId, _doc_db_update_sdcard_info, ugd); + error_code = + storage_set_state_changed_cb(__externalStorageId, + _doc_db_update_sdcard_info, ugd); if (error_code != STORAGE_ERROR_NONE) { doc_dbgE("storage_set_state_changed_cb failed!"); } @@ -100,7 +113,9 @@ int doc_dereg_db_update_noti(void) doc_dbg(""); int error_code = -1; - error_code = storage_unset_state_changed_cb(__externalStorageId, _doc_db_update_sdcard_info); + error_code = + storage_unset_state_changed_cb(__externalStorageId, + _doc_db_update_sdcard_info); if (error_code != STORAGE_ERROR_NONE) { doc_dbgE("storage_set_state_changed_cb failed!"); } @@ -117,7 +132,8 @@ int doc_atoi(const char *number) val = strtol(number, &endptr, 10); - if ((errno == ERANGE && (val == LONG_MAX || val == LONG_MIN)) || (errno != 0 && val == 0)) { + if ((errno == ERANGE && (val == LONG_MAX || val == LONG_MIN)) + || (errno != 0 && val == 0)) { doc_dbgE("strtol, val = %d", val); return -1; } @@ -127,6 +143,5 @@ int doc_atoi(const char *number) return -1; } - return (int)val; + return (int) val; } - |