From 6e9d33efaefdccec56aa04248b465f1a5907b36b Mon Sep 17 00:00:00 2001 From: Sheenu Date: Wed, 11 Nov 2015 10:29:49 +0530 Subject: [PATCH] format code as per guidelines Change-Id: Ic085eedd76cde4162d3fafd18d7c95d0b132a40a Signed-off-by: Sheenu --- src/common/file-operation/mf-cancel.c | 6 +- src/common/file-operation/mf-copy-internal.c | 217 +++++---- src/common/file-operation/mf-copy.c | 10 +- src/common/file-operation/mf-delete-internal.c | 12 +- src/common/file-operation/mf-delete.c | 2 +- src/common/file-operation/mf-fo-internal.c | 19 +- src/common/file-operation/mf-move-internal.c | 210 +++++---- src/common/file-operation/mf-move.c | 8 +- src/common/file-operation/mf-search-internal.c | 49 +- src/common/file-operation/mf-search.c | 16 +- src/common/file-system/mf-file-attr.c | 80 ++-- src/common/file-system/mf-fs-oper.c | 18 +- src/common/mf-callback.c | 335 +++++++------- src/common/mf-detail.c | 152 ++++--- src/common/mf-download-app.c | 63 +-- src/common/mf-error.c | 2 +- src/common/mf-file-util.c | 94 ++-- src/common/mf-fm-svc-wrapper.c | 213 ++++----- src/common/mf-fs-monitor.c | 51 +-- src/common/mf-inotify-handle.c | 29 +- src/common/mf-launch.c | 106 ++--- src/common/mf-log.c | 3 +- src/common/mf-media-content.c | 12 +- src/common/mf-media-data.c | 124 +++--- src/common/mf-storage-space.c | 266 +++++------ src/common/mf-ta.c | 159 ++++--- src/common/mf-ug-detail-fs.c | 316 ++++++++----- src/common/mf-ug-detail-media.c | 149 ++++--- src/common/mf-util.c | 509 ++++++++++----------- src/media-db/mf-media-db.c | 157 +++---- src/media-db/mf-media.c | 16 +- src/mf-main.c | 68 +-- src/thumbnail/mf-thumb-gen.c | 248 +++++------ src/widget/mf-category-view.c | 490 ++++++++++---------- src/widget/mf-context-popup.c | 207 +++++---- src/widget/mf-detail-view.c | 18 +- src/widget/mf-edit-view.c | 80 ++-- src/widget/mf-focus-ui.c | 2 +- src/widget/mf-gengrid.c | 205 ++++----- src/widget/mf-genlist.c | 199 +++++---- src/widget/mf-navi-bar.c | 111 ++--- src/widget/mf-normal-view.c | 5 +- src/widget/mf-object-item.c | 45 +- src/widget/mf-object.c | 25 +- src/widget/mf-popup.c | 593 +++++++++++++------------ src/widget/mf-recent-view.c | 11 +- src/widget/mf-root-view.c | 14 +- src/widget/mf-search-bar.c | 228 +++++----- src/widget/mf-search-view.c | 2 +- src/widget/mf-setting-view.c | 108 ++--- src/widget/mf-tray-item.c | 288 ++++++------ src/widget/mf-view.c | 105 +++-- 52 files changed, 3349 insertions(+), 3106 deletions(-) diff --git a/src/common/file-operation/mf-cancel.c b/src/common/file-operation/mf-cancel.c index 94821b8..1349664 100755 --- a/src/common/file-operation/mf-cancel.c +++ b/src/common/file-operation/mf-cancel.c @@ -57,8 +57,9 @@ gboolean mf_cancel_check_cancel(mf_cancel *cancel) gboolean do_cancel = FALSE; if (cancel) { g_mutex_lock(&cancel->s_mutex); - if (cancel->do_cancel) + if (cancel->do_cancel) { do_cancel = TRUE; + } g_mutex_unlock(&cancel->s_mutex); } return do_cancel; @@ -79,8 +80,9 @@ gboolean mf_cancel_is_cancelled(mf_cancel *cancel) gboolean is_cancelled = FALSE; if (cancel) { g_mutex_lock(&cancel->s_mutex); - if (cancel->is_cancel) + if (cancel->is_cancel) { is_cancelled = TRUE; + } g_mutex_unlock(&cancel->s_mutex); } return is_cancelled; diff --git a/src/common/file-operation/mf-copy-internal.c b/src/common/file-operation/mf-copy-internal.c index 83d2b5e..9d11f44 100755 --- a/src/common/file-operation/mf-copy-internal.c +++ b/src/common/file-operation/mf-copy-internal.c @@ -54,10 +54,10 @@ GSList *copy_list = NULL; #ifndef SAFE_FREE #define SAFE_FREE(x) do {\ - if ((x) != NULL) {\ - free(x); x = NULL;\ - } \ - } while (0) + if ((x) != NULL) {\ + free(x); x = NULL;\ + } \ + } while (0) #endif #define MSG_REPORT_PERIOD (1) @@ -80,9 +80,9 @@ static gchar *__mf_copy_change_root_name(const char *name, const char *old_root, GString *n = NULL; if ((strstr(name, old_root) == NULL) - || (name_len <= old_len) - || ((name[old_len] == '/' && name[old_len + 1] == '\0')) - || FALSE) { + || (name_len <= old_len) + || ((name[old_len] == '/' && name[old_len + 1] == '\0')) + || FALSE) { mf_fo_loge("invaild args - name : [%s], old_root : [%s]", name, old_root); return NULL; } @@ -107,7 +107,7 @@ static gchar *__mf_copy_change_root_name(const char *name, const char *old_root, int _mf_copy_copy_regfile(const char *src, struct stat *src_statp, const char *dst_file, unsigned long buf_size, mf_cancel *cancel, _mf_fo_msg_cb msg_cb, - void *msg_data) + void *msg_data) { mf_retvm_if(msg_cb == NULL, 0, "msg_cb is NULL"); FO_TRACE_BEGIN; @@ -212,13 +212,13 @@ int _mf_copy_copy_regfile(const char *src, struct stat *src_statp, const char *d } } //Prevent issue fix -/* - if (dst_info.st_blksize > 0) { - alloc_size = dst_info.st_blksize; - } - } else { - alloc_size = buf_size; - }*/ + /* + if (dst_info.st_blksize > 0) { + alloc_size = dst_info.st_blksize; + } + } else { + alloc_size = buf_size; + }*/ alloc_size = DEF_ALLLOC_SIZE; buf = malloc(alloc_size); @@ -241,7 +241,7 @@ int _mf_copy_copy_regfile(const char *src, struct stat *src_statp, const char *d if (cp_handle->msg.total_size > PER_HANDLE_MAX_SIZE) { dynamic_size = 64; } else if (cp_handle->msg.total_size <= PER_HANDLE_MAX_SIZE && - cp_handle->msg.total_size > PER_HANDLE_MIN_SIZE) { + cp_handle->msg.total_size > PER_HANDLE_MIN_SIZE) { dynamic_size = 8; } else { dynamic_size = 1; @@ -257,7 +257,7 @@ int _mf_copy_copy_regfile(const char *src, struct stat *src_statp, const char *d mf_error(">>>>>>>>>>>>>>>>>>>remain_size = %lld", remain_size); mf_error(">>>>>>>>>>>>>>>>>>>src_info.st_size = %lld", - (long long)src_info.st_size); + (long long)src_info.st_size); if (remain_size == 0 || remain_size < src_info.st_size) { err = MF_FO_ERR_SET(MF_FO_ERR_DST_CLASS | MF_FO_ERR_SPACE); msg_cb(MF_MSG_ERROR, cp_handle->dst_dir, 0, err, msg_data); @@ -265,8 +265,7 @@ int _mf_copy_copy_regfile(const char *src, struct stat *src_statp, const char *d } int sync_value = 0; ssize_t sync_msg_size = 0; - while ((r_size = fread(buf, 1, alloc_size, src_f)) > 0) - { + while ((r_size = fread(buf, 1, alloc_size, src_f)) > 0) { ssize_t total = r_size; void *buf_p = buf; sync_value++; @@ -423,7 +422,7 @@ static int __get_copy_directory_hierarchies(const char *pathname, const struct s { mf_fo_dir_list_info *info = NULL; mf_debug("pathname is [%s]\t type is [%d]\t", - pathname, type); + pathname, type); switch (type) { @@ -440,7 +439,7 @@ static int __get_copy_directory_hierarchies(const char *pathname, const struct s } case FTW_D: info = calloc(sizeof(mf_fo_dir_list_info), 1); - if (info !=NULL) { + if (info != NULL) { info->ftw_path = g_strdup(pathname); info->type = type; copy_list = g_slist_append(copy_list, info); @@ -811,119 +810,115 @@ int _mf_copy_copy_internal(const char *src, const char *dst_dir, mf_cancel *canc switch (result) { case MF_REQ_NONE: - case MF_REQ_MERGE: - { - struct stat dst_info; - if (stat(new_dst, &dst_info)) { - MF_FILE_ERROR_LOG(err_buf, "Fail to stat new_dst ", new_dst); + case MF_REQ_MERGE: { + struct stat dst_info; + if (stat(new_dst, &dst_info)) { + MF_FILE_ERROR_LOG(err_buf, "Fail to stat new_dst ", new_dst); + if (msg_func) { + msg_func(MF_MSG_ERROR, NULL, 0, errno, msg_data); + } + goto ERROR_FREE_MEM; + } + + if (S_ISDIR(src_info.st_mode)) { + if (!S_ISDIR(dst_info.st_mode)) { + mf_fo_loge("src[%s] is directory, but dst[%s] is already existed and not a directory", src, new_dst); + + err = MF_FO_ERR_SET(MF_FO_ERR_DST_CLASS | MF_FO_ERR_TYPE); if (msg_func) { - msg_func(MF_MSG_ERROR, NULL, 0, errno, msg_data); + msg_func(MF_MSG_ERROR, new_dst, 0, err, msg_data); } goto ERROR_FREE_MEM; } + /*just copy*/ + err = _mf_copy_copy_directory(src, &src_info, new_dst, cancel, msg_func, msg_data); + if (err == 0) { + //mf_media_content_scan_folder(new_dst); + } + } else if (S_ISREG(src_info.st_mode)) { + if (!S_ISREG(dst_info.st_mode)) { + mf_fo_loge("src[%s] is file, but dst[%s] is already existed and not a file", src, new_dst); + err = MF_FO_ERR_SET(MF_FO_ERR_DST_CLASS | MF_FO_ERR_TYPE); + if (msg_func) { + msg_func(MF_MSG_ERROR, new_dst, 0, err, msg_data); + } + goto ERROR_FREE_MEM; + } + /*just copy*/ + err = _mf_copy_copy_regfile(src, &src_info, new_dst, dst_info.st_blksize, cancel, msg_func, msg_data); + if (err == 0) { + //mf_media_content_scan_file(new_dst); + } + } + } + break; + case MF_REQ_RENAME: { + if (next_name) { if (S_ISDIR(src_info.st_mode)) { - if (!S_ISDIR(dst_info.st_mode)) { - mf_fo_loge("src[%s] is directory, but dst[%s] is already existed and not a directory", src, new_dst); - - err = MF_FO_ERR_SET(MF_FO_ERR_DST_CLASS | MF_FO_ERR_TYPE); + err = _mf_copy_copy_directory(src, &src_info, next_name, cancel, msg_func, msg_data); + if (err == 0) { + //mf_media_content_scan_folder(next_name); + } + } else if (S_ISREG(src_info.st_mode)) { + err = _mf_copy_copy_regfile(src, &src_info, next_name, 0, cancel, msg_func, msg_data); + if (err == 0) { + //mf_media_content_scan_file(next_name); + } + } + SAFE_FREE(next_name); + } else { + if (S_ISDIR(src_info.st_mode)) { + int errcode = 0; + next_name = _mf_fo_get_next_unique_dirname(new_dst, &errcode); + if (!next_name) { + mf_fo_loge("Fail to get next directory name [%s]", new_dst); + err = (_mf_fo_errno_to_mferr(errcode) | MF_FO_ERR_DST_CLASS); if (msg_func) { - msg_func(MF_MSG_ERROR, new_dst, 0, err, msg_data); + msg_func(MF_MSG_ERROR, NULL, 0, err, msg_data); } goto ERROR_FREE_MEM; } - /*just copy*/ - err = _mf_copy_copy_directory(src, &src_info, new_dst, cancel, msg_func, msg_data); + err = _mf_copy_copy_directory(src, &src_info, next_name, cancel, msg_func, msg_data); if (err == 0) { - //mf_media_content_scan_folder(new_dst); + //mf_media_content_scan_folder(next_name); } } else if (S_ISREG(src_info.st_mode)) { - if (!S_ISREG(dst_info.st_mode)) { - mf_fo_loge("src[%s] is file, but dst[%s] is already existed and not a file", src, new_dst); - err = MF_FO_ERR_SET(MF_FO_ERR_DST_CLASS | MF_FO_ERR_TYPE); + int errcode = 0; + next_name = _mf_fo_get_next_unique_filename(new_dst, &errcode); + if (!next_name) { + mf_fo_loge("Fail to get next file name [%s]", new_dst); + err = (_mf_fo_errno_to_mferr(errcode) | MF_FO_ERR_DST_CLASS); if (msg_func) { - msg_func(MF_MSG_ERROR, new_dst, 0, err, msg_data); + msg_func(MF_MSG_ERROR, NULL, 0, err, msg_data); } goto ERROR_FREE_MEM; } - /*just copy*/ - err = _mf_copy_copy_regfile(src, &src_info, new_dst, dst_info.st_blksize, cancel, msg_func, msg_data); + err = _mf_copy_copy_regfile(src, &src_info, next_name, 0, cancel, msg_func, msg_data); if (err == 0) { - //mf_media_content_scan_file(new_dst); + //mf_media_content_scan_file(next_name); } } - + SAFE_FREE(next_name); } - break; - case MF_REQ_RENAME: - { - if (next_name) { - if (S_ISDIR(src_info.st_mode)) { - err = _mf_copy_copy_directory(src, &src_info, next_name, cancel, msg_func, msg_data); - if (err == 0) { - //mf_media_content_scan_folder(next_name); - } - } else if (S_ISREG(src_info.st_mode)) { - err = _mf_copy_copy_regfile(src, &src_info, next_name, 0, cancel, msg_func, msg_data); - if (err == 0) { - //mf_media_content_scan_file(next_name); - } - } - SAFE_FREE(next_name); - } else { - if (S_ISDIR(src_info.st_mode)) { - int errcode = 0; - next_name = _mf_fo_get_next_unique_dirname(new_dst, &errcode); - if (!next_name) { - mf_fo_loge("Fail to get next directory name [%s]", new_dst); - err = (_mf_fo_errno_to_mferr(errcode) | MF_FO_ERR_DST_CLASS); - if (msg_func) { - msg_func(MF_MSG_ERROR, NULL, 0, err, msg_data); - } - goto ERROR_FREE_MEM; - } - err = _mf_copy_copy_directory(src, &src_info, next_name, cancel, msg_func, msg_data); - if (err == 0) { - //mf_media_content_scan_folder(next_name); - } - } else if (S_ISREG(src_info.st_mode)) { - int errcode = 0; - next_name = _mf_fo_get_next_unique_filename(new_dst, &errcode); - if (!next_name) { - mf_fo_loge("Fail to get next file name [%s]", new_dst); - err = (_mf_fo_errno_to_mferr(errcode) | MF_FO_ERR_DST_CLASS); - if (msg_func) { - msg_func(MF_MSG_ERROR, NULL, 0, err, msg_data); - } - goto ERROR_FREE_MEM; - } - err = _mf_copy_copy_regfile(src, &src_info, next_name, 0, cancel, msg_func, msg_data); - if (err == 0) { - //mf_media_content_scan_file(next_name); - } - } - SAFE_FREE(next_name); - } - } - break; - case MF_REQ_SKIP: - { - if (msg_func) { - unsigned long long size = 0; - /*1 TODO : Do i need to report error, if i fail to get size ?*/ - _mf_fo_get_total_item_size(src, &size); - msg_func(MF_MSG_SKIP, NULL, size, 0, msg_data); - } + } + break; + case MF_REQ_SKIP: { + if (msg_func) { + unsigned long long size = 0; + /*1 TODO : Do i need to report error, if i fail to get size ?*/ + _mf_fo_get_total_item_size(src, &size); + msg_func(MF_MSG_SKIP, NULL, size, 0, msg_data); } - break; - case MF_REQ_CANCEL: - { - if (cancel) { - mf_cancel_do_cancel(cancel); - } - goto CANCEL_FREE_MEM; + } + break; + case MF_REQ_CANCEL: { + if (cancel) { + mf_cancel_do_cancel(cancel); } - break; + goto CANCEL_FREE_MEM; + } + break; default: abort(); break; diff --git a/src/common/file-operation/mf-copy.c b/src/common/file-operation/mf-copy.c index b1345c9..7c10fa3 100755 --- a/src/common/file-operation/mf-copy.c +++ b/src/common/file-operation/mf-copy.c @@ -189,7 +189,7 @@ static void __mf_copy_req_cb(mf_fo_request *req, void *data) g_mutex_lock(&cp_handle->lock); if (ap->mf_Status.check == 1) { gint64 end_time; - end_time = g_get_monotonic_time () + 5 * G_TIME_SPAN_SECOND; + end_time = g_get_monotonic_time() + 5 * G_TIME_SPAN_SECOND; while (mf_request_flag_get(req)) { if (!g_cond_wait_until(&cp_handle->cond, &cp_handle->lock, end_time)) { mf_fo_loge("g_cond_wait_until is timeout, time is %lld", end_time); @@ -293,7 +293,7 @@ static void *__mf_copy_thread_func(void *data) mf_fo_loge("Fail to get size of %s", s_path); __mf_copy_msg_cb(MF_MSG_ERROR, s_path, 0, - (MF_FO_ERR_SRC_CLASS | _mf_fo_errno_to_mferr(-errcode)), cp_handle); + (MF_FO_ERR_SRC_CLASS | _mf_fo_errno_to_mferr(-errcode)), cp_handle); goto ERROR_END_THREAD; } else { @@ -324,7 +324,7 @@ static void *__mf_copy_thread_func(void *data) cp_handle->msg.current = s_path; g_mutex_unlock(&cp_handle->lock); ret = _mf_copy_copy_internal(s_path, cp_handle->dst_dir, cp_handle->cancel, - __mf_copy_msg_cb, __mf_copy_req_cb, cp_handle); + __mf_copy_msg_cb, __mf_copy_req_cb, cp_handle); if (ret > 0) { if (cp_handle->cancel) { @@ -342,7 +342,7 @@ static void *__mf_copy_thread_func(void *data) } c_stop = __mf_copy_get_time(); mf_fo_logi("## Total src size - %lld byte, size time : %lf sec, copy time : %lf sec", - cp_handle->msg.total_size, s_stop - s_start, c_stop - c_start); + cp_handle->msg.total_size, s_stop - s_start, c_stop - c_start); if (cancelled) { __mf_copy_msg_cb(MF_MSG_CANCELLED, NULL, 0, 0, cp_handle); } @@ -365,7 +365,7 @@ ERROR_END_THREAD: g_mutex_lock(&cp_handle->lock); int media_content_ret = media_content_scan_folder(cp_handle->dst_dir, true, __mf_media_scan_folder_completed_cb, cp_handle); - if(media_content_ret !=MEDIA_CONTENT_ERROR_NONE) { + if (media_content_ret != MEDIA_CONTENT_ERROR_NONE) { mf_error("media_content_scan_folder() is failed, media_content_ret = [%d]", media_content_ret); g_mutex_unlock(&cp_handle->lock); } else { diff --git a/src/common/file-operation/mf-delete-internal.c b/src/common/file-operation/mf-delete-internal.c index 32ab985..d4c77db 100755 --- a/src/common/file-operation/mf-delete-internal.c +++ b/src/common/file-operation/mf-delete-internal.c @@ -38,11 +38,11 @@ GSList *delete_list = NULL; #ifndef SAFE_FREE #define SAFE_FREE(x) do {\ - if ((x) != NULL) {\ - free(x); \ - x = NULL;\ - } \ - } while (0) + if ((x) != NULL) {\ + free(x); \ + x = NULL;\ + } \ + } while (0) #endif int _mf_delete_delete_regfile(const char *file, struct stat *file_statp, mf_cancel *cancel, _mf_fo_msg_cb msg_cb, void *msg_data) @@ -113,7 +113,7 @@ static int __get_delete_directory_hierarchies(const char *pathname, const struct { mf_fo_dir_list_info *info = NULL; mf_debug("pathname is [%s]\t type is [%d]\t", - pathname, type); + pathname, type); switch (type) { diff --git a/src/common/file-operation/mf-delete.c b/src/common/file-operation/mf-delete.c index d58194b..fcc59b2 100755 --- a/src/common/file-operation/mf-delete.c +++ b/src/common/file-operation/mf-delete.c @@ -257,7 +257,7 @@ static void *delete_thread(void *data) } c_stop = get_time(); mf_fo_logi("## Total src size - %lld byte, size time : %lf sec, delete time : %lf sec", - handle->msg.total_size, s_stop - s_start, c_stop - c_start); + handle->msg.total_size, s_stop - s_start, c_stop - c_start); if (cancelled) { /*cancel message*/ diff --git a/src/common/file-operation/mf-fo-internal.c b/src/common/file-operation/mf-fo-internal.c index 96dfe57..783acfe 100755 --- a/src/common/file-operation/mf-fo-internal.c +++ b/src/common/file-operation/mf-fo-internal.c @@ -36,11 +36,11 @@ GSList *dir_list = NULL; #ifndef SAFE_FREE #define SAFE_FREE(x) do { \ - if ((x) != NULL) {\ - free(x); \ - x = NULL;\ - } \ - } while (0) + if ((x) != NULL) {\ + free(x); \ + x = NULL;\ + } \ + } while (0) #endif #ifndef NAME_MAX @@ -106,7 +106,7 @@ static int __get_directory_hierarchies(const char *pathname, const struct stat * { mf_fo_dir_list_info *info = NULL; mf_debug("pathname is [%s]\t type is [%d]\t size is [%ld]", - pathname, type, statptr->st_size); + pathname, type, statptr->st_size); switch (type) { @@ -201,12 +201,12 @@ char *_mf_fo_get_next_unique_dirname(const char *name, int *errcode) } new_name = malloc(sizeof(char) * p_max); - + if (new_name) { int next_num = 0; long n_max = 0; - memset(new_name, 0, sizeof(char) * p_max); + memset(new_name, 0, sizeof(char) * p_max); n_max = __mf_fo_get_name_max(); do { @@ -494,8 +494,9 @@ int _mf_fo_errno_to_mferr(int err_no) void _mf_fo_free_directory_hierarchies(GSList **glist) { - if (*glist == NULL) + if (*glist == NULL) { return; + } GSList *list = *glist; while (list) { mf_fo_dir_list_info *info = NULL; diff --git a/src/common/file-operation/mf-move-internal.c b/src/common/file-operation/mf-move-internal.c index e2c6bbb..42a9482 100755 --- a/src/common/file-operation/mf-move-internal.c +++ b/src/common/file-operation/mf-move-internal.c @@ -40,11 +40,11 @@ GSList *move_list = NULL; #ifndef SAFE_FREE #define SAFE_FREE(x) do {\ - if ((x) != NULL) {\ - free(x); \ - x = NULL;\ - } \ - } while (0) + if ((x) != NULL) {\ + free(x); \ + x = NULL;\ + } \ + } while (0) #endif #define DIR_MODE_BIT (01777) @@ -61,9 +61,9 @@ static gchar *__mf_move_change_root_name(const char *name, const char *old_root, GString *n = NULL; if ((strstr(name, old_root) == NULL) - || (name_len <= old_len) - || ((name[old_len] == '/' && name[old_len + 1] == '\0')) - || FALSE) { + || (name_len <= old_len) + || ((name[old_len] == '/' && name[old_len + 1] == '\0')) + || FALSE) { mf_fo_loge("invaild args - name : [%s], old_root : [%s]", name, old_root); return NULL; } @@ -88,7 +88,7 @@ static gchar *__mf_move_change_root_name(const char *name, const char *old_root, int _mf_move_move_regfile(const char *src, struct stat *src_statp, const char *dst, - unsigned long buf_size, mf_cancel *cancel, _mf_fo_msg_cb msg_cb, void *msg_data) + unsigned long buf_size, mf_cancel *cancel, _mf_fo_msg_cb msg_cb, void *msg_data) { mode_t src_mode = 0; dev_t src_dev = 0; @@ -226,7 +226,7 @@ static int __get_move_directory_hierarchies(const char *pathname, const struct s MF_TRACE_BEGIN; mf_fo_dir_list_info *info = NULL; mf_debug("pathname is [%s]\t type is [%d]\t", - pathname, type); + pathname, type); switch (type) { case FTW_F: @@ -479,7 +479,7 @@ DO_CANCEL: } int _mf_move_move_internal(const char *src, const char *dst_dir, - mf_cancel *cancel, mf_req_callback request_callback, _mf_fo_msg_cb msg_callback, void *msg_data) + mf_cancel *cancel, mf_req_callback request_callback, _mf_fo_msg_cb msg_callback, void *msg_data) { char *src_basename = NULL; char *new_dst = NULL; @@ -684,28 +684,83 @@ int _mf_move_move_internal(const char *src, const char *dst_dir, switch (result) { case MF_REQ_NONE: - case MF_REQ_MERGE: - { - struct stat dst_info; - if (stat(new_dst, &dst_info)) { - MF_FILE_ERROR_LOG(err_buf, "Fail to stat new_dst", new_dst); + case MF_REQ_MERGE: { + struct stat dst_info; + if (stat(new_dst, &dst_info)) { + MF_FILE_ERROR_LOG(err_buf, "Fail to stat new_dst", new_dst); + if (msg_callback) { + msg_callback(MF_MSG_ERROR, NULL, 0, errno, msg_data); + } + goto ERROR_FREE_MEM; + } + + if (S_ISDIR(src_info.st_mode)) { + if (!S_ISDIR(dst_info.st_mode)) { + mf_fo_loge("src[%s] is directory, but dst[%s] is already existed and not a directory", src, new_dst); + + err = MF_FO_ERR_SET(MF_FO_ERR_DST_CLASS | MF_FO_ERR_TYPE); + if (msg_callback) { + msg_callback(MF_MSG_ERROR, new_dst, 0, err, msg_data); + } + goto ERROR_FREE_MEM; + } + err = _mf_move_move_directory(src, &src_info, new_dst, cancel, msg_callback, msg_data); + if (err == 0) { + err = _mf_delete_delete_directory(src, cancel, NULL, NULL); + if (err > 0) { + goto CANCEL_FREE_MEM; + } else if (err < 0) { + if (msg_callback) { + msg_callback(MF_MSG_ERROR, NULL, 0, err, msg_data); + } + goto ERROR_FREE_MEM; + } + mf_media_content_scan_folder(new_dst); + } + } else if (S_ISREG(src_info.st_mode)) { + if (!S_ISREG(dst_info.st_mode)) { + mf_fo_loge("src[%s] is file, but dst[%s] is already existed and not a file", src, new_dst); + err = MF_FO_ERR_SET(MF_FO_ERR_DST_CLASS | MF_FO_ERR_TYPE); if (msg_callback) { - msg_callback(MF_MSG_ERROR, NULL, 0, errno, msg_data); + msg_callback(MF_MSG_ERROR, new_dst, 0, err, msg_data); } goto ERROR_FREE_MEM; } + err = _mf_move_move_regfile(src, &src_info, new_dst, dst_info.st_blksize, cancel, msg_callback, msg_data); + if (err == 0) { + mf_media_content_scan_file(new_dst); + } + } + } + break; + case MF_REQ_RENAME: { + if (next_name) { if (S_ISDIR(src_info.st_mode)) { - if (!S_ISDIR(dst_info.st_mode)) { - mf_fo_loge("src[%s] is directory, but dst[%s] is already existed and not a directory", src, new_dst); - - err = MF_FO_ERR_SET(MF_FO_ERR_DST_CLASS | MF_FO_ERR_TYPE); + err = _mf_move_move_directory(src, &src_info, next_name, cancel, msg_callback, msg_data); + if (err == 0) { + mf_media_content_scan_folder(next_name); + } + } else if (S_ISREG(src_info.st_mode)) { + err = _mf_move_move_regfile(src, &src_info, next_name, 0, cancel, msg_callback, msg_data); + if (err == 0) { + mf_media_content_scan_file(next_name); + } + } + SAFE_FREE(next_name); + } else { + if (S_ISDIR(src_info.st_mode)) { + int errcode = 0; + next_name = _mf_fo_get_next_unique_dirname(new_dst, &errcode); + if (!next_name) { + mf_fo_loge("Fail to get next directory name [%s]", new_dst); + err = (_mf_fo_errno_to_mferr(errcode) | MF_FO_ERR_DST_CLASS); if (msg_callback) { - msg_callback(MF_MSG_ERROR, new_dst, 0, err, msg_data); + msg_callback(MF_MSG_ERROR, NULL, 0, err, msg_data); } goto ERROR_FREE_MEM; } - err = _mf_move_move_directory(src, &src_info, new_dst, cancel, msg_callback, msg_data); + err = _mf_move_move_directory(src, &src_info, next_name, cancel, msg_callback, msg_data); if (err == 0) { err = _mf_delete_delete_directory(src, cancel, NULL, NULL); if (err > 0) { @@ -716,102 +771,43 @@ int _mf_move_move_internal(const char *src, const char *dst_dir, } goto ERROR_FREE_MEM; } - mf_media_content_scan_folder(new_dst); + mf_media_content_scan_folder(next_name); } } else if (S_ISREG(src_info.st_mode)) { - if (!S_ISREG(dst_info.st_mode)) { - mf_fo_loge("src[%s] is file, but dst[%s] is already existed and not a file", src, new_dst); - err = MF_FO_ERR_SET(MF_FO_ERR_DST_CLASS | MF_FO_ERR_TYPE); + int errcode = 0; + next_name = _mf_fo_get_next_unique_filename(new_dst, &errcode); + if (!next_name) { + mf_fo_loge("Fail to get next file name [%s]", new_dst); + err = (_mf_fo_errno_to_mferr(errcode) | MF_FO_ERR_DST_CLASS); if (msg_callback) { - msg_callback(MF_MSG_ERROR, new_dst, 0, err, msg_data); + msg_callback(MF_MSG_ERROR, NULL, 0, err, msg_data); } goto ERROR_FREE_MEM; } - err = _mf_move_move_regfile(src, &src_info, new_dst, dst_info.st_blksize, cancel, msg_callback, msg_data); + err = _mf_move_move_regfile(src, &src_info, next_name, 0, cancel, msg_callback, msg_data); if (err == 0) { - mf_media_content_scan_file(new_dst); - } - } - - } - break; - case MF_REQ_RENAME: - { - if (next_name) { - if (S_ISDIR(src_info.st_mode)) { - err = _mf_move_move_directory(src, &src_info, next_name, cancel, msg_callback, msg_data); - if (err == 0) { - mf_media_content_scan_folder(next_name); - } - } else if (S_ISREG(src_info.st_mode)) { - err = _mf_move_move_regfile(src, &src_info, next_name, 0, cancel, msg_callback, msg_data); - if (err == 0) { - mf_media_content_scan_file(next_name); - } - } - SAFE_FREE(next_name); - } else { - if (S_ISDIR(src_info.st_mode)) { - int errcode = 0; - next_name = _mf_fo_get_next_unique_dirname(new_dst, &errcode); - if (!next_name) { - mf_fo_loge("Fail to get next directory name [%s]", new_dst); - err = (_mf_fo_errno_to_mferr(errcode) | MF_FO_ERR_DST_CLASS); - if (msg_callback) { - msg_callback(MF_MSG_ERROR, NULL, 0, err, msg_data); - } - goto ERROR_FREE_MEM; - } - err = _mf_move_move_directory(src, &src_info, next_name, cancel, msg_callback, msg_data); - if (err == 0) { - err = _mf_delete_delete_directory(src, cancel, NULL, NULL); - if (err > 0) { - goto CANCEL_FREE_MEM; - } else if (err < 0) { - if (msg_callback) { - msg_callback(MF_MSG_ERROR, NULL, 0, err, msg_data); - } - goto ERROR_FREE_MEM; - } - mf_media_content_scan_folder(next_name); - } - } else if (S_ISREG(src_info.st_mode)) { - int errcode = 0; - next_name = _mf_fo_get_next_unique_filename(new_dst, &errcode); - if (!next_name) { - mf_fo_loge("Fail to get next file name [%s]", new_dst); - err = (_mf_fo_errno_to_mferr(errcode) | MF_FO_ERR_DST_CLASS); - if (msg_callback) { - msg_callback(MF_MSG_ERROR, NULL, 0, err, msg_data); - } - goto ERROR_FREE_MEM; - } - err = _mf_move_move_regfile(src, &src_info, next_name, 0, cancel, msg_callback, msg_data); - if (err == 0) { - mf_media_content_scan_file(next_name); - } + mf_media_content_scan_file(next_name); } - SAFE_FREE(next_name); } + SAFE_FREE(next_name); } - break; - case MF_REQ_SKIP: - { - if (msg_callback) { - unsigned long long size = 0; - _mf_fo_get_total_item_size(src, &size); - msg_callback(MF_MSG_SKIP, NULL, size, 0, msg_data); - } + } + break; + case MF_REQ_SKIP: { + if (msg_callback) { + unsigned long long size = 0; + _mf_fo_get_total_item_size(src, &size); + msg_callback(MF_MSG_SKIP, NULL, size, 0, msg_data); } - break; - case MF_REQ_CANCEL: - { - if (cancel) { - mf_cancel_do_cancel(cancel); - } - goto CANCEL_FREE_MEM; + } + break; + case MF_REQ_CANCEL: { + if (cancel) { + mf_cancel_do_cancel(cancel); } - break; + goto CANCEL_FREE_MEM; + } + break; default: abort(); break; diff --git a/src/common/file-operation/mf-move.c b/src/common/file-operation/mf-move.c index bfc4e46..706f770 100755 --- a/src/common/file-operation/mf-move.c +++ b/src/common/file-operation/mf-move.c @@ -270,7 +270,7 @@ static void *__mf_move_thread_func(void *data) mf_fo_loge("Fail to get size of %s", s_path); __mf_move_msg_cb(MF_MSG_ERROR, s_path, 0, - (MF_FO_ERR_SRC_CLASS | _mf_fo_errno_to_mferr(-errcode)), handle); + (MF_FO_ERR_SRC_CLASS | _mf_fo_errno_to_mferr(-errcode)), handle); goto ERROR_END_THREAD; @@ -281,7 +281,7 @@ static void *__mf_move_thread_func(void *data) if (stat(s_path, &src_info)) { __mf_move_msg_cb(MF_MSG_ERROR, handle->dst_dir, 0, - (MF_FO_ERR_DST_CLASS | _mf_fo_errno_to_mferr(errno)), handle); + (MF_FO_ERR_DST_CLASS | _mf_fo_errno_to_mferr(errno)), handle); goto ERROR_END_THREAD; } @@ -291,7 +291,7 @@ static void *__mf_move_thread_func(void *data) n_size -= size; } else { mf_fo_loge("remain size [%lld], needed size [%lld], current item size [%lld] -[%s]", - r_size, n_size, size, s_path); + r_size, n_size, size, s_path); int err = MF_FO_ERR_SET(MF_FO_ERR_DST_CLASS | MF_FO_ERR_SPACE); @@ -348,7 +348,7 @@ static void *__mf_move_thread_func(void *data) } c_stop = __mf_move_get_time(); mf_fo_logi("## Total src size - %lld byte, size time : %lf sec, move time : %lf sec", - handle->msg.total_size, s_stop - s_start, c_stop - c_start); + handle->msg.total_size, s_stop - s_start, c_stop - c_start); if (cancelled) { __mf_move_msg_cb(MF_MSG_CANCELLED, NULL, 0, 0, handle); diff --git a/src/common/file-operation/mf-search-internal.c b/src/common/file-operation/mf-search-internal.c index 112ff2a..9ce45dc 100755 --- a/src/common/file-operation/mf-search-internal.c +++ b/src/common/file-operation/mf-search-internal.c @@ -90,8 +90,9 @@ inline static void __mf_search_args_free(ms_args_t *args) args->root_path = NULL; } - if (args->needle) + if (args->needle) { g_free(args->needle); + } g_free(args); } @@ -123,12 +124,12 @@ inline static void __mf_search_result_free(mf_search_result_t *result) #ifdef CHECK_RESTRICTED_PATH gboolean __mf_search_check_licet_path(const char *path) { - return (gboolean) (strstr(path, ROOT_UMS) || strstr(path, ROOT_MMC)); + return (gboolean)(strstr(path, ROOT_UMS) || strstr(path, ROOT_MMC)); } #endif /*CHECK_RESTRICTED_PATH*/ - /*This function is for testing and should be revised for performance before applying*/ +/*This function is for testing and should be revised for performance before applying*/ static inline gboolean __has_nonspacing_mark(const char *nstr) { if (nstr) { @@ -165,8 +166,9 @@ static gboolean __mf_search_NFD_strstr(const char *str, const char *needle) } } - if (s_len < n_len) + if (s_len < n_len) { return FALSE; + } if (__has_nonspacing_mark(str)) { const char *p_str = str; @@ -207,15 +209,15 @@ next: p_str = g_utf8_next_char(p_str); } } else { - return (gboolean) (!(!strstr(str, needle))); + return (gboolean)(!(!strstr(str, needle))); } return FALSE; } static GList *__mf_search_do_find(const char *root, - const char *needle, - mf_search_option option, - ms_handle_t *handle) + const char *needle, + mf_search_option option, + ms_handle_t *handle) { DIR *directory = NULL; GList *candidate = NULL; @@ -292,7 +294,7 @@ static GList *__mf_search_do_find(const char *root, result->is_end = FALSE; __mf_search_thread_unlock(handle); - }else { + } else { free(path); path = NULL; } @@ -336,7 +338,7 @@ static GList *__mf_search_do_find(const char *root, } /* we are not going to search /opt/media/SLP_Debug folder */ if ((strlen(result->current_dir) == strlen(PHONE_FOLDER)) && (strcmp(result->current_dir, PHONE_FOLDER) == 0) - && (strlen(entry->d_name) == strlen(DEBUG_FOLDER)) && (strcmp(entry->d_name, DEBUG_FOLDER) == 0)) { + && (strlen(entry->d_name) == strlen(DEBUG_FOLDER)) && (strcmp(entry->d_name, DEBUG_FOLDER) == 0)) { SECURE_DEBUG("[%s] is hidden folder. Skip it", entry->d_name); continue; } @@ -357,8 +359,7 @@ static GList *__mf_search_do_find(const char *root, if (up_name && needle) { up_needle = g_utf8_strup(needle, strlen(needle)); gchar *nor_str = g_utf8_strup(up_name, strlen(up_name)); - if (__mf_search_NFD_strstr(nor_str, up_needle)) - { + if (__mf_search_NFD_strstr(nor_str, up_needle)) { __mf_search_thread_lock(handle); result->dir_list = g_list_append(result->dir_list, (gpointer) g_strdup(path)); result->is_end = FALSE; @@ -504,14 +505,14 @@ int _mf_search_init(ms_handle_t **handle) } int _mf_search_start(ms_handle_t *handle, - const char **root_path, - unsigned int path_num, - const char *needle, - mf_search_option option, - void *user_data, - mf_search_filter_cb func, - int category, - int item_count) + const char **root_path, + unsigned int path_num, + const char *needle, + mf_search_option option, + void *user_data, + mf_search_filter_cb func, + int category, + int item_count) { ms_args_t *args = NULL; mf_search_result_t *result = NULL; @@ -568,8 +569,8 @@ int _mf_search_start(ms_handle_t *handle, } #endif /*CHECK_RESTRICTED_PATH*/ if (g_file_test(path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR) - && ((l_opt & MF_SEARCH_OPT_HIDDEN) || strncmp(path, ".", 1)) - && TRUE) { + && ((l_opt & MF_SEARCH_OPT_HIDDEN) || strncmp(path, ".", 1)) + && TRUE) { gchar *new_path = NULL; gssize len = strlen(path); @@ -723,8 +724,8 @@ void _mf_search_finalize(ms_handle_t **handle) if (ms_handle->state == MF_SEARCH_STATE_SEARCH) { mf_search_stop((mf_search_handle)ms_handle); } -/* __mf_search_cmd_lock(ms_handle); */ -/* __mf_search_cmd_unlock(ms_handle); */ + /* __mf_search_cmd_lock(ms_handle); */ + /* __mf_search_cmd_unlock(ms_handle); */ g_mutex_clear(&ms_handle->cmd_lock); diff --git a/src/common/file-operation/mf-search.c b/src/common/file-operation/mf-search.c index 7781731..f9889cb 100755 --- a/src/common/file-operation/mf-search.c +++ b/src/common/file-operation/mf-search.c @@ -54,14 +54,14 @@ int mf_search_init(mf_search_handle *handle) } int mf_search_start(mf_search_handle handle, - const char **root_path, - unsigned int path_num, - const char *needle, - mf_search_option option, - void *user_data, - mf_search_filter_cb func, - int category, - int item_count) + const char **root_path, + unsigned int path_num, + const char *needle, + mf_search_option option, + void *user_data, + mf_search_filter_cb func, + int category, + int item_count) { int ret = 0; if (!handle) { diff --git a/src/common/file-system/mf-file-attr.c b/src/common/file-system/mf-file-attr.c index 1e58750..de95c39 100755 --- a/src/common/file-system/mf-file-attr.c +++ b/src/common/file-system/mf-file-attr.c @@ -794,7 +794,7 @@ int mf_file_attr_is_valid_name(const char *filename) return MYFILE_ERR_INVALID_FILE_NAME; } #endif - + pattern = MYFILE_NAME_PATTERN; z = regcomp(®, pattern, cflags); @@ -910,8 +910,9 @@ int mf_file_attr_get_parent_path(const char *path, char **parent_path) SECURE_DEBUG("Path :::: [%s]", path); *parent_path = g_strdup(path); - if (*parent_path == NULL) + if (*parent_path == NULL) { return MYFILE_ERR_ALLOCATE_MEMORY_FAIL; + } const char *name = NULL; name = mf_file_get(path); @@ -922,8 +923,9 @@ int mf_file_attr_get_parent_path(const char *path, char **parent_path) ** strlen(parent_path) should large than strlen(name) normally. ** to take exception like input path is "", we add a if condition */ - if (strlen(*parent_path) > strlen(name)) + if (strlen(*parent_path) > strlen(name)) { (*parent_path)[strlen(*parent_path) - strlen(name) - 1] = '\0'; + } if (strlen(*parent_path) == 0) { free(*parent_path); @@ -1059,38 +1061,38 @@ int mf_file_attr_get_file_icon(const char *file_path, int *error_code, int view_ case FILE_TYPE_IMAGE: case FILE_TYPE_VIDEO: case FILE_TYPE_MUSIC: - case FILE_TYPE_SOUND: - { - - int err = 0; - mf_transfer_data_s tmp_data; - memset(&tmp_data, 0x00, sizeof(mf_transfer_data_s)); - tmp_data.file_path = file_path; - tmp_data.media = media_info; - //err = mf_file_attr_get_thumbnail(&tmp_data); - char *condition = NULL; - condition = g_strdup_printf("%s and MEDIA_PATH=\"%s\"", MF_CONDITION_IMAGE_VIDEO, tmp_data.file_path); - err = mf_media_content_data_get(&tmp_data, condition, __mf_local_data_get_media_thumbnail_cb); - if (err == 0) { - if (tmp_data.thumb_path && mf_file_exists(tmp_data.thumb_path)) { - SAFE_FREE_CHAR(icon_path); - icon_path = g_strdup(tmp_data.thumb_path); - thumbnail_type = MF_THUMBNAIL_TYPE_THUMBNAIL; - } else { - icon_path = g_strdup(mf_file_attr_get_default_icon_by_type(ftype)); - thumbnail_type = MF_THUMBNAIL_TYPE_DEFAULT; - *error_code = 1; - } + case FILE_TYPE_SOUND: { + + int err = 0; + mf_transfer_data_s tmp_data; + memset(&tmp_data, 0x00, sizeof(mf_transfer_data_s)); + tmp_data.file_path = file_path; + tmp_data.media = media_info; + //err = mf_file_attr_get_thumbnail(&tmp_data); + char *condition = NULL; + condition = g_strdup_printf("%s and MEDIA_PATH=\"%s\"", MF_CONDITION_IMAGE_VIDEO, tmp_data.file_path); + err = mf_media_content_data_get(&tmp_data, condition, __mf_local_data_get_media_thumbnail_cb); + if (err == 0) { + if (tmp_data.thumb_path && mf_file_exists(tmp_data.thumb_path)) { + SAFE_FREE_CHAR(icon_path); + icon_path = g_strdup(tmp_data.thumb_path); + thumbnail_type = MF_THUMBNAIL_TYPE_THUMBNAIL; } else { - if (error_code) - *error_code = err; - icon_path = g_strdup(mf_file_attr_get_default_icon_by_type(ftype)); thumbnail_type = MF_THUMBNAIL_TYPE_DEFAULT; + *error_code = 1; + } + } else { + if (error_code) { + *error_code = err; } - SAFE_FREE_CHAR(tmp_data.thumb_path); + + icon_path = g_strdup(mf_file_attr_get_default_icon_by_type(ftype)); + thumbnail_type = MF_THUMBNAIL_TYPE_DEFAULT; } - break; + SAFE_FREE_CHAR(tmp_data.thumb_path); + } + break; default: icon_path = g_strdup(mf_file_attr_get_default_icon_by_type(ftype)); thumbnail_type = MF_THUMBNAIL_TYPE_DEFAULT; @@ -1300,10 +1302,10 @@ int mf_file_attr_is_in_system_folder(char *fullpath, int level, bool * result) if (!g_strcmp0(parent_name, DEFAULT_FOLDER_IMAGE) && !g_strcmp0(name, SUB_FODER_WALLPAPER)) { *result = true; } else if (!g_strcmp0(parent_name, DEFAULT_FOLDER_ALERTS_AND_RINGTONES) - && (!g_strcmp0(name, SUB_FODER_ALERTS) || !g_strcmp0(name, SUB_FODER_RINGTONES))) { + && (!g_strcmp0(name, SUB_FODER_ALERTS) || !g_strcmp0(name, SUB_FODER_RINGTONES))) { *result = true; } else if (!g_strcmp0(parent_name, DEFAULT_FOLDER_MUSIC) - && (!g_strcmp0(name, SUB_FODER_FM) || !g_strcmp0(name, SUB_FODER_VOICE_RECORD))) { + && (!g_strcmp0(name, SUB_FODER_FM) || !g_strcmp0(name, SUB_FODER_VOICE_RECORD))) { *result = true; } else { *result = false; @@ -1456,8 +1458,7 @@ int mf_file_attr_media_has_video(const char *filename) } ret = metadata_extractor_set_path(handle, filename); - if (ret != METADATA_EXTRACTOR_ERROR_NONE) - { + if (ret != METADATA_EXTRACTOR_ERROR_NONE) { mf_error("metadata_extractor_set_path().. %d", ret); goto CATCH_ERROR; } @@ -1466,8 +1467,9 @@ int mf_file_attr_media_has_video(const char *filename) if (ret == METADATA_EXTRACTOR_ERROR_NONE && value) { if (g_strcmp0(value, "1") == 0) { mf_error("ret is [%d] value is [%s]", ret, "1"); - if (handle) - metadata_extractor_destroy(handle); + if (handle) { + metadata_extractor_destroy(handle); + } MF_TRACE_END; SAFE_FREE_CHAR(value); return 1; @@ -1477,14 +1479,16 @@ int mf_file_attr_media_has_video(const char *filename) mf_error("ret is [%d] value is [%s]", ret, value); SAFE_FREE_CHAR(value); - if (handle) + if (handle) { metadata_extractor_destroy(handle); + } MF_TRACE_END; return 0; CATCH_ERROR: - if (handle) + if (handle) { metadata_extractor_destroy(handle); + } MF_TRACE_END; return 0; diff --git a/src/common/file-system/mf-fs-oper.c b/src/common/file-system/mf-fs-oper.c index 52be2fa..9f30322 100755 --- a/src/common/file-system/mf-fs-oper.c +++ b/src/common/file-system/mf-fs-oper.c @@ -144,22 +144,22 @@ int mf_fs_oper_error(const char *src, const char *dst, int check_option) if (check_option & MF_ERROR_CHECK_SRC_PARENT_DIR_EXIST) { char *parent_path = NULL; if (mf_file_attr_get_parent_path(src, &parent_path)) { - if (!mf_file_exists(parent_path)) { + if (!mf_file_exists(parent_path)) { SAFE_FREE_CHAR(parent_path); - return MYFILE_ERR_DIR_NOT_FOUND; - } + return MYFILE_ERR_DIR_NOT_FOUND; } + } SAFE_FREE_CHAR(parent_path); } if (check_option & MF_ERROR_CHECK_DST_PARENT_DIR_EXIST) { char *parent_path = NULL; if (mf_file_attr_get_parent_path(dst, &parent_path)) { - if (!mf_file_exists(parent_path)) { + if (!mf_file_exists(parent_path)) { SAFE_FREE_CHAR(parent_path); - return MYFILE_ERR_DIR_NOT_FOUND; - } + return MYFILE_ERR_DIR_NOT_FOUND; } + } SAFE_FREE_CHAR(parent_path); } @@ -238,7 +238,7 @@ int mf_fs_oper_read_dir(const char *path, Eina_List ** dir_list, Eina_List ** fi } if ((ent->d_type & DT_DIR) != 0) { if ((strlen(path) == strlen(PHONE_FOLDER)) && (strcmp(path, PHONE_FOLDER) == 0) - && (strlen(ent->d_name) == strlen(DEBUG_FOLDER)) && (strcmp(ent->d_name, DEBUG_FOLDER) == 0)) { + && (strlen(ent->d_name) == strlen(DEBUG_FOLDER)) && (strcmp(ent->d_name, DEBUG_FOLDER) == 0)) { continue; } } @@ -805,8 +805,8 @@ int mf_fs_oper_rename_file(const char *src, const char *dst) { mf_debug(); int option = MF_ERROR_CHECK_SRC_ARG_VALID | MF_ERROR_CHECK_DST_ARG_VALID | - MF_ERROR_CHECK_SRC_EXIST | MF_ERROR_CHECK_DST_PATH_VALID | - MF_ERROR_CHECK_SRC_PATH_VALID | MF_ERROR_CHECK_SRC_PATH_VALID | MF_ERROR_CHECK_DST_PARENT_DIR_EXIST | MF_ERROR_CHECK_DUPLICATED; + MF_ERROR_CHECK_SRC_EXIST | MF_ERROR_CHECK_DST_PATH_VALID | + MF_ERROR_CHECK_SRC_PATH_VALID | MF_ERROR_CHECK_SRC_PATH_VALID | MF_ERROR_CHECK_DST_PARENT_DIR_EXIST | MF_ERROR_CHECK_DUPLICATED; int ret = mf_fs_oper_error(src, dst, option); if (ret != 0) { diff --git a/src/common/mf-callback.c b/src/common/mf-callback.c index 5328ece..e6d3c54 100755 --- a/src/common/mf-callback.c +++ b/src/common/mf-callback.c @@ -203,27 +203,28 @@ void mf_callback_app_rotate_cb(void *data, Evas_Object *obj, void *event) assert(ap); int changed_angle = elm_win_rotation_get(obj); -/* - enum ug_event new_event = UG_EVENT_ROTATE_PORTRAIT; - switch (changed_angle) { - case APP_DEVICE_ORIENTATION_0: - new_event = UG_EVENT_ROTATE_PORTRAIT; - break; - case APP_DEVICE_ORIENTATION_90: - new_event = UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN; - break; - case APP_DEVICE_ORIENTATION_180: - new_event = UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN; - break; - case APP_DEVICE_ORIENTATION_270: - new_event = UG_EVENT_ROTATE_LANDSCAPE; - break; + /* + enum ug_event new_event = UG_EVENT_ROTATE_PORTRAIT; + switch (changed_angle) { + case APP_DEVICE_ORIENTATION_0: + new_event = UG_EVENT_ROTATE_PORTRAIT; + break; + case APP_DEVICE_ORIENTATION_90: + new_event = UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN; + break; + case APP_DEVICE_ORIENTATION_180: + new_event = UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN; + break; + case APP_DEVICE_ORIENTATION_270: + new_event = UG_EVENT_ROTATE_LANDSCAPE; + break; + } + ug_send_event(new_event); + */ + const char *config = elm_config_profile_get(); + if (!strcmp(config, "desktop")) { + return; } - ug_send_event(new_event); -*/ - const char *config = elm_config_profile_get(); - if (!strcmp(config, "desktop")) - return; if (mf_view_is_root_view(ap)) { @@ -238,13 +239,14 @@ void mf_callback_app_rotate_cb(void *data, Evas_Object *obj, void *event) } else { if (changed_angle == APP_DEVICE_ORIENTATION_90 || changed_angle == APP_DEVICE_ORIENTATION_270) { evas_object_size_hint_min_set(ap->mf_MainWindow.pPopupBox, -1, - ELM_SCALE_SIZE(MF_POPUP_MENUSTYLE_HEIGHT(MF_SORT_BY_ITEM/2))); + ELM_SCALE_SIZE(MF_POPUP_MENUSTYLE_HEIGHT(MF_SORT_BY_ITEM / 2))); } else { evas_object_size_hint_min_set(ap->mf_MainWindow.pPopupBox, -1, - ELM_SCALE_SIZE(MF_POPUP_MENUSTYLE_HEIGHT(MF_SORT_BY_ITEM))); + ELM_SCALE_SIZE(MF_POPUP_MENUSTYLE_HEIGHT(MF_SORT_BY_ITEM))); } - if (ap->mf_Status.view_type != mf_view_root_category && ap->mf_Status.view_type != mf_view_recent && ap->mf_Status.view_type != mf_view_storage) + if (ap->mf_Status.view_type != mf_view_root_category && ap->mf_Status.view_type != mf_view_recent && ap->mf_Status.view_type != mf_view_storage) { mf_navi_bar_pathinfo_refresh(ap); + } } @@ -324,10 +326,10 @@ void mf_callback_click_cb(struct appdata *data, mfAction key, GString *path) { struct appdata *ap = (struct appdata *)data; mf_retm_if(ap == NULL, "ap is NULL"); - mf_retm_if (ap->mf_Status.path == NULL, "ap->mf_Status.path is NULL"); - mf_retm_if (ap->mf_Status.path->str == NULL, "ap->mf_Status.path->str is NULL"); - mf_retm_if (path == NULL, "path is NULL"); - mf_retm_if (path->str == NULL, "path->str is NULL"); + mf_retm_if(ap->mf_Status.path == NULL, "ap->mf_Status.path is NULL"); + mf_retm_if(ap->mf_Status.path->str == NULL, "ap->mf_Status.path->str is NULL"); + mf_retm_if(path == NULL, "path is NULL"); + mf_retm_if(path->str == NULL, "path->str is NULL"); if (mf_fm_svc_wrapper_is_dir(path)) { @@ -343,10 +345,10 @@ void mf_callback_click_cb(struct appdata *data, mfAction key, GString *path) GString *new_path = NULL; if (ap->mf_Status.more == MORE_SEARCH) { if (ap->mf_FileOperation.search_result_folder_list) { - mf_util_free_eina_list_with_data(&(ap->mf_FileOperation.search_result_folder_list), MYFILE_TYPE_ITEM_DATA); + mf_util_free_eina_list_with_data(&(ap->mf_FileOperation.search_result_folder_list), MYFILE_TYPE_ITEM_DATA); } if (ap->mf_FileOperation.search_result_file_list) { - mf_util_free_eina_list_with_data(&(ap->mf_FileOperation.search_result_file_list), MYFILE_TYPE_ITEM_DATA); + mf_util_free_eina_list_with_data(&(ap->mf_FileOperation.search_result_file_list), MYFILE_TYPE_ITEM_DATA); } elm_object_focus_set(ap->mf_MainWindow.pSearchEntry, EINA_FALSE); ap->mf_Status.more = MORE_DEFAULT; @@ -398,16 +400,18 @@ void mf_callback_illegal_char_popup_cb(void *data, Evas_Object *obj, void *event ap->mf_MainWindow.pNormalPopup = NULL; Evas_Object *entry = ap->mf_MainWindow.pEntry; - if (entry != NULL) + if (entry != NULL) { elm_object_focus_set(entry, EINA_TRUE); + } } else if ((g_strcmp0(label, mf_util_get_text(MF_BUTTON_LABEL_NO)) == 0) || (g_strcmp0(label, mf_util_get_text(LABEL_CANCEL)) == 0)) { evas_object_del(ap->mf_MainWindow.pNormalPopup); ap->mf_MainWindow.pNormalPopup = NULL; mf_callback_cancel_cb(ap, NULL, NULL); } else {//Fix the bug when pressing the back key. Evas_Object *entry = ap->mf_MainWindow.pEntry; - if (entry != NULL) + if (entry != NULL) { elm_object_focus_set(entry, EINA_TRUE); + } } } @@ -433,8 +437,8 @@ void mf_callback_cancel_cb(void *data, Evas_Object *obj, void *event_info) MF_TRACE_BEGIN; struct appdata *ap = (struct appdata *)data; mf_retm_if(ap == NULL, "ap is NULL"); - mf_retm_if (ap->mf_Status.path == NULL, "ap->mf_Status.path is NULL"); - mf_retm_if (ap->mf_Status.path->str == NULL, "ap->mf_Status.path->str is NULL"); + mf_retm_if(ap->mf_Status.path == NULL, "ap->mf_Status.path is NULL"); + mf_retm_if(ap->mf_Status.path->str == NULL, "ap->mf_Status.path->str is NULL"); mf_error("more is [%d]", ap->mf_Status.more); @@ -614,7 +618,7 @@ void mf_callback_cancel_cb(void *data, Evas_Object *obj, void *event_info) } else if (ap->mf_Status.view_type == mf_view_recent) { mf_navi_bar_title_content_set(ap, MF_LABEL_RECTENT_FILES); } else { - mf_navi_bar_title_content_set(ap,ap->mf_MainWindow.naviframe_title); + mf_navi_bar_title_content_set(ap, ap->mf_MainWindow.naviframe_title); elm_naviframe_item_title_enabled_set(ap->mf_MainWindow.pNaviItem, EINA_TRUE, EINA_TRUE); } } else if (ap->mf_Status.more != MORE_EDIT_RENAME) { @@ -710,7 +714,7 @@ static void __mf_callback_refresh_rename(void *data, GString *pre_name, GString } if (g_string_equal(item_data->m_ItemName, pre_name)) { - + int hiden_state = 0; mf_util_get_pref_value(PREF_TYPE_HIDEN_STATE, &hiden_state); if (hiden_state == MF_HIDEN_HIDE) { @@ -956,11 +960,11 @@ void mf_callback_rename_save_cb(void *ad, Evas_Object *obj, void *event_info) } else { mf_callback_monitor_media_db_update_flag_set(EINA_TRUE); if (item_data->file_type != FILE_TYPE_DIR) { - if(strstr (from->str,"/.") != NULL && strstr (to->str, "/.") == NULL) { + if (strstr(from->str, "/.") != NULL && strstr(to->str, "/.") == NULL) { mf_media_content_scan_file(to->str); - } else if(strstr (from->str,"/.") == NULL && strstr (to->str, "/.") != NULL) { + } else if (strstr(from->str, "/.") == NULL && strstr(to->str, "/.") != NULL) { mf_media_content_scan_file(from->str); - } else if(strstr (from->str,"/.") == NULL && strstr (to->str, "/.") == NULL){ + } else if (strstr(from->str, "/.") == NULL && strstr(to->str, "/.") == NULL) { mf_media_content_scan_file(from->str); mf_media_content_scan_file(to->str); } @@ -1032,12 +1036,11 @@ INVAILD_NAME_EXIT: } } - if (ap->mf_Status.more == MORE_THUMBNAIL_RENAME || ap->mf_Status.more == MORE_EDIT_RENAME) - { + if (ap->mf_Status.more == MORE_THUMBNAIL_RENAME || ap->mf_Status.more == MORE_EDIT_RENAME) { //ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT_TWO_BTN, NULL, message,LABEL_CANCEL, MF_BUTTON_LABEL_OK, NULL, mf_callback_illegal_char_popup_cb, ap); mf_callback_entry_unfocus(pEntry); mf_popup_second_popup_create(ap, ap->mf_MainWindow.pWindow, message, - MF_BUTTON_LABEL_OK, mf_popup_show_vk_cb, ap); + MF_BUTTON_LABEL_OK, mf_popup_show_vk_cb, ap); mf_callback_monitor_media_db_update_flag_set(EINA_FALSE); mf_callback_monitor_internal_update_flag_set(EINA_FALSE); return; @@ -1130,7 +1133,7 @@ void mf_callback_new_folder_save_cb(void *data, Evas_Object *obj, void *event_in mf_object_entry_unfocus(ap->mf_MainWindow.pEntry); name = mf_callback_entry_text_get(ap->mf_MainWindow.pEntry); - SECURE_DEBUG("ap is [%p], name is [%s]", ap,name); + SECURE_DEBUG("ap is [%p], name is [%s]", ap, name); if (name) { if (strlen(name)) { @@ -1194,7 +1197,7 @@ void mf_callback_new_folder_save_cb(void *data, Evas_Object *obj, void *event_in ap->mf_MainWindow.pEntry = NULL; SAFE_FREE_OBJ(ap->mf_MainWindow.pNewFolderPopup); mf_view_update(ap); - //Prevent issue + //Prevent issue /*if (ap->mf_Status.more == MORE_DEFAULT && noContentFlag) { mf_navi_bar_set_ctrlbar_item_disable(ap->mf_MainWindow.pNaviItem, CTRL_DISABLE_NOCONTENT_VIEW, false); }*/ @@ -1227,7 +1230,7 @@ ERROR_EXIT_CREATE: ap->mf_MainWindow.pEntry = NULL; SAFE_FREE_OBJ(ap->mf_MainWindow.pNewFolderPopup); ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT_BTN, NULL, message, - MF_BUTTON_LABEL_OK, NULL, NULL, mf_popup_error_exit_cb, ap); + MF_BUTTON_LABEL_OK, NULL, NULL, mf_popup_error_exit_cb, ap); return; @@ -1267,7 +1270,7 @@ void mf_callback_list_by_response_cb(void *data, Evas_Object *obj, void *event_i assert(ap); SAFE_FREE_OBJ(ap->mf_MainWindow.pNormalPopup); - + Evas_Object *playout = ap->mf_MainWindow.pNaviLayout; mf_retm_if(playout == NULL, "get conformant failed"); Evas_Object *newContent = NULL; @@ -1307,9 +1310,9 @@ void mf_callback_list_by_view_cb(void *data, Evas_Object *obj, void *event_info) assert(ap); SAFE_FREE_OBJ(ap->mf_MainWindow.pContextPopup); - + mf_sort_by_respones_func_set(mf_callback_list_by_response_cb); - ap->mf_MainWindow.pNormalPopup = mf_popup_sort_by_create(LABEL_SORT_BY_CHAP,mf_callback_popup_deleted_cb, ap); + ap->mf_MainWindow.pNormalPopup = mf_popup_sort_by_create(LABEL_SORT_BY_CHAP, mf_callback_popup_deleted_cb, ap); } /****************************** @@ -1511,8 +1514,8 @@ void mf_callback_edit_rename_cb(void *data, Evas_Object *obj, void *event_info) evas_object_hide(ap->mf_MainWindow.pButton); } if (ap->mf_MainWindow.pNaviItem) { - Evas_Object *unset = elm_object_item_part_content_unset(ap->mf_MainWindow.pNaviItem, "prev_btn"); - evas_object_hide(unset); + Evas_Object *unset = elm_object_item_part_content_unset(ap->mf_MainWindow.pNaviItem, "prev_btn"); + evas_object_hide(unset); } //__mf_callback_edit_share_view(ap); @@ -1525,7 +1528,7 @@ void mf_callback_edit_delete_recent_cb(void *data, Evas_Object *obj, void *event MF_TRACE_BEGIN; mf_retm_if(data == NULL, "data is NULL"); struct appdata *ap = (struct appdata *)data; - + SAFE_FREE_OBJ(ap->mf_MainWindow.pContextPopup); if (ap->mf_MainWindow.pButton) { elm_object_part_content_unset(ap->mf_MainWindow.pNaviLayout, "search_icon"); @@ -1585,12 +1588,12 @@ void mf_callback_delete_recent_files_confirm_cb(void *data, Evas_Object *obj, vo int count = mf_edit_file_count_get(); if (count > 1) { ap->mf_MainWindow.pDeleteConfirmPopup = mf_popup_create_delete_confirm_popup(ap, MF_LABEL_REMOVE, - MF_LABEL_DELETE_RECENT_Q, - LABEL_CANCEL, MF_LABEL_REMOVE, mf_callback_do_delete_recent_files, ap, count); + MF_LABEL_DELETE_RECENT_Q, + LABEL_CANCEL, MF_LABEL_REMOVE, mf_callback_do_delete_recent_files, ap, count); } else { ap->mf_MainWindow.pDeleteConfirmPopup = mf_popup_create_delete_confirm_popup(ap, MF_LABEL_REMOVE, - MF_LABEL_DELETE_THIS_RECENT, - LABEL_CANCEL, MF_LABEL_REMOVE, mf_callback_do_delete_recent_files, ap, count); + MF_LABEL_DELETE_THIS_RECENT, + LABEL_CANCEL, MF_LABEL_REMOVE, mf_callback_do_delete_recent_files, ap, count); } } @@ -1599,7 +1602,7 @@ void mf_callback_edit_unintall_cb(void *data, Evas_Object *obj, void *event_info MF_TRACE_BEGIN; mf_retm_if(data == NULL, "data is NULL"); struct appdata *ap = (struct appdata *)data; - + SAFE_FREE_OBJ(ap->mf_MainWindow.pContextPopup); ap->mf_Status.more = MORE_EDIT_UNINSTALL; __mf_callback_edit_share_view(ap); @@ -1622,15 +1625,16 @@ void mf_callback_edit_unintall_cb(void *data, Evas_Object *obj, void *event_info **/ void mf_callback_icu_update_cb(app_event_info_h event_info, void *data) { -/* - ug_send_event(UG_EVENT_REGION_CHANGE); -*/ + /* + ug_send_event(UG_EVENT_REGION_CHANGE); + */ mf_debug("region changed"); assert(data); struct appdata *ap = (struct appdata *)data; - if (ap->mf_Status.flagIcuInit == FALSE) + if (ap->mf_Status.flagIcuInit == FALSE) { return; + } /* finalize the previous icu session */ mf_util_icu_finalize(ap); /* start a new icu session*/ @@ -1642,14 +1646,16 @@ void mf_callback_icu_update_cb(app_event_info_h event_info, void *data) return ; } - if (ap->mf_Status.more != MORE_DEFAULT) + if (ap->mf_Status.more != MORE_DEFAULT) { return ; + } /*get current genlist */ Evas_Object *currgenlist = ap->mf_MainWindow.pNaviGenlist; - if (currgenlist == NULL) + if (currgenlist == NULL) { return ; + } /*create new genlist */ mf_view_update(ap); return ; @@ -1710,8 +1716,9 @@ void mf_callback_rename_create_cb(void *data, Evas_Object *obj, void *event_info SAFE_FREE_OBJ(ap->mf_MainWindow.pContextPopup); - if (ap->mf_Status.more == MORE_THUMBNAIL_RENAME) + if (ap->mf_Status.more == MORE_THUMBNAIL_RENAME) { return; + } mf_view_state_set_with_pre(ap, MORE_THUMBNAIL_RENAME); mf_popup_rename_func_reset(); @@ -1774,7 +1781,7 @@ void mf_callback_long_clicked_cb(void *data, Evas_Object *obj, void *event_info) MF_TRACE_BEGIN; struct appdata *ap = (struct appdata *)data; mf_retm_if(ap == NULL, "ap is NULL"); - evas_object_smart_callback_del (ap->mf_MainWindow.pEntry, "clicked", (Evas_Smart_Cb) mf_callback_clicked_cb); + evas_object_smart_callback_del(ap->mf_MainWindow.pEntry, "clicked", (Evas_Smart_Cb) mf_callback_clicked_cb); // elm_entry_select_none(ap->mf_MainWindow.pEntry); MF_TRACE_END; } @@ -1784,7 +1791,7 @@ void mf_callback_max_len_reached_cb(void *data, Evas_Object *obj, void *event_in MF_TRACE_BEGIN; struct appdata *ap = (struct appdata *)data; mf_retm_if(ap == NULL, "ap is NULL"); - char *message = g_strdup_printf(mf_util_get_text(MF_LABEL_MAX_CHARACTER_REACHED),MYFILE_FILE_NAME_CHAR_COUNT_MAX); + char *message = g_strdup_printf(mf_util_get_text(MF_LABEL_MAX_CHARACTER_REACHED), MYFILE_FILE_NAME_CHAR_COUNT_MAX); mf_popup_indicator_popup(data, message); SAFE_FREE_CHAR(message); //mf_callback_entry_unfocus(obj); @@ -1869,7 +1876,7 @@ void mf_callback_progress_bar_state_cb(void *data) MF_TRACE_BEGIN; struct appdata *ap = (struct appdata *)data; mf_retm_if(ap == NULL, "ap is NULL"); - mf_retm_if (ap->mf_MainWindow.pProgressPopup == NULL, "ap->mf_MainWindow.pProgressPopup is NULL"); + mf_retm_if(ap->mf_MainWindow.pProgressPopup == NULL, "ap->mf_MainWindow.pProgressPopup is NULL"); mf_fo_msg *msg = ap->mf_FileOperation.pMessage; char lable[10] = { '\0', }; @@ -1882,12 +1889,11 @@ void mf_callback_progress_bar_state_cb(void *data) total_count = ap->mf_FileOperation.iTotalCount; count = msg->current_index; mf_error("processing ,current_size[%d], total_size[%ld]", msg->current_size, - msg->total_size); + msg->total_size); value = (double)msg->current_size / msg->total_size; //add protection to avoid the percent passed 100% - if (value>1 && count <= total_count) - { - value = (double)count/total_count; + if (value > 1 && count <= total_count) { + value = (double)count / total_count; } elm_progressbar_value_set(ap->mf_FileOperation.progress_bar, value); //mf_error("processing ,count=%d, total_count=%d, value is [%f]",count, total_count,value); @@ -2049,7 +2055,7 @@ void mf_callback_copy_move_cb(void *data, Evas_Object *obj, void *event_info) if (mf_util_get_eina_list_len(ap->mf_FileRecordList.value_saver) < 1) { ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT_BTN, NULL, MF_LABEL_NOTHING_SELECTED, - MF_BUTTON_LABEL_OK, NULL, NULL, mf_callback_warning_popup_cb, ap); + MF_BUTTON_LABEL_OK, NULL, NULL, mf_callback_warning_popup_cb, ap); return; } @@ -2077,7 +2083,7 @@ void mf_callback_details_cb(void *data, Evas_Object *obj, void *event_info) { mf_retm_if(data == NULL, "data is NULL"); struct appdata *ap = mf_get_appdata(); - + SAFE_FREE_OBJ(ap->mf_MainWindow.pLongpressPopup); SAFE_FREE_OBJ(ap->mf_MainWindow.pContextPopup); if (mf_edit_file_count_get() == 1) { @@ -2098,7 +2104,7 @@ void mf_callback_details_cb(void *data, Evas_Object *obj, void *event_info) Eina_List *select_list = mf_edit_get_all_selected_files(); if (mf_util_get_eina_list_len(select_list) < 1) { ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT_BTN, NULL, MF_LABEL_NOTHING_SELECTED, - MF_BUTTON_LABEL_OK, NULL, NULL, mf_callback_warning_popup_cb, ap); + MF_BUTTON_LABEL_OK, NULL, NULL, mf_callback_warning_popup_cb, ap); return; } @@ -2201,11 +2207,11 @@ void mf_callback_paste_here_cb(void *data, Evas_Object *obj, void *event_info) int count = 0; gchar *pDestPath = NULL; - mf_retm_if (ap->mf_FileOperation.source == NULL, "ap->mf_FileOperation.source is NULL"); - mf_retm_if (ap->mf_FileOperation.source->str == NULL, "ap->mf_FileOperation.source is NULL"); + mf_retm_if(ap->mf_FileOperation.source == NULL, "ap->mf_FileOperation.source is NULL"); + mf_retm_if(ap->mf_FileOperation.source->str == NULL, "ap->mf_FileOperation.source is NULL"); - mf_retm_if (ap->mf_Status.path == NULL, "ap->mf_Status.path is NULL"); - mf_retm_if (ap->mf_Status.path->str == NULL, "ap->mf_Status.path->str is NULL"); + mf_retm_if(ap->mf_Status.path == NULL, "ap->mf_Status.path is NULL"); + mf_retm_if(ap->mf_Status.path->str == NULL, "ap->mf_Status.path->str is NULL"); ap->mf_FileOperation.destination = ap->mf_Status.path; @@ -2308,11 +2314,11 @@ void mf_callback_move_here_cb(void *data, Evas_Object *obj, void *event_info) int count = 0; gchar *pDestPath = NULL; - mf_retm_if (ap->mf_FileOperation.source == NULL, "ap->mf_FileOperation.source is NULL"); - mf_retm_if (ap->mf_FileOperation.source->str == NULL, "ap->mf_FileOperation.source is NULL"); + mf_retm_if(ap->mf_FileOperation.source == NULL, "ap->mf_FileOperation.source is NULL"); + mf_retm_if(ap->mf_FileOperation.source->str == NULL, "ap->mf_FileOperation.source is NULL"); - mf_retm_if (ap->mf_Status.path == NULL, "ap->mf_Status.path is NULL"); - mf_retm_if (ap->mf_Status.path->str == NULL, "ap->mf_Status.path->str is NULL"); + mf_retm_if(ap->mf_Status.path == NULL, "ap->mf_Status.path is NULL"); + mf_retm_if(ap->mf_Status.path->str == NULL, "ap->mf_Status.path->str is NULL"); ap->mf_FileOperation.destination = ap->mf_Status.path; @@ -2418,8 +2424,8 @@ static void __mf_callback_confirm_delete(void *data, Evas_Object *obj, void *eve if (mf_util_get_eina_list_len(ap->mf_FileRecordList.value_saver) < 1) { ap->mf_MainWindow.pNormalPopup = - mf_popup_create_popup(ap, POPMODE_TEXT_BTN, NULL, MF_LABEL_NOTHING_SELECTED, - MF_BUTTON_LABEL_OK, NULL, NULL, mf_callback_warning_popup_cb, ap); + mf_popup_create_popup(ap, POPMODE_TEXT_BTN, NULL, MF_LABEL_NOTHING_SELECTED, + MF_BUTTON_LABEL_OK, NULL, NULL, mf_callback_warning_popup_cb, ap); } else { GList *pSourceList = NULL; int count = 0; @@ -2444,7 +2450,7 @@ static void __mf_callback_confirm_delete(void *data, Evas_Object *obj, void *eve ap->mf_FileOperation.iOperationSuccessFlag = TRUE; mf_fs_monitor_remove_dir_watch(); ap->mf_MainWindow.pProgressPopup = - mf_popup_create_pb_popup(ap, LABEL_DELETE, MF_MSG_DELETING, count, mf_callback_progress_bar_cancel_cb, ap); + mf_popup_create_pb_popup(ap, LABEL_DELETE, MF_MSG_DELETING, count, mf_callback_progress_bar_cancel_cb, ap); } else { mf_util_exception_func(ap); } @@ -2485,13 +2491,13 @@ void mf_callback_delete_cb(void *data, Evas_Object *obj, void *event_info) int count = mf_edit_file_count_get(); if (count > 1) { ap->mf_MainWindow.pDeleteConfirmPopup = mf_popup_create_delete_confirm_popup(ap, LABEL_DELETE, - MF_LABEL_ITEMS_WILL_DELETE, - LABEL_CANCEL, LABEL_DELETE, __mf_callback_confirm_delete, ap, count); + MF_LABEL_ITEMS_WILL_DELETE, + LABEL_CANCEL, LABEL_DELETE, __mf_callback_confirm_delete, ap, count); } else { ap->mf_MainWindow.pDeleteConfirmPopup = mf_popup_create_delete_confirm_popup(ap, - LABEL_DELETE, - MF_LABEL_THIS_ITEM_WILL_DELETE, - LABEL_CANCEL, LABEL_DELETE, __mf_callback_confirm_delete, ap, count); + LABEL_DELETE, + MF_LABEL_THIS_ITEM_WILL_DELETE, + LABEL_CANCEL, LABEL_DELETE, __mf_callback_confirm_delete, ap, count); } } @@ -2568,14 +2574,14 @@ void mf_callback_operation_request_cancel_cb(void *data, Evas_Object *obj, void void mf_callback_popup_cancel_cb(void *data, Evas_Object *obj, void *event_info) { - struct appdata *ap =(struct appdata *)data; + struct appdata *ap = (struct appdata *)data; SAFE_FREE_OBJ(ap->mf_MainWindow.pNormalPopup); mf_request_set_result(ap->mf_FileOperation.pRequest, MF_REQ_CANCEL); } void mf_callback_rename_cb(void *data, Evas_Object *obj, void *event_info) { - struct appdata *ap =(struct appdata *)data; + struct appdata *ap = (struct appdata *)data; ap->mf_Status.req = MF_REQ_RENAME; mf_request_set_result(ap->mf_FileOperation.pRequest, MF_REQ_RENAME); SAFE_FREE_OBJ(ap->mf_MainWindow.pNormalPopup); @@ -2583,7 +2589,7 @@ void mf_callback_rename_cb(void *data, Evas_Object *obj, void *event_info) void mf_callback_replace_cb(void *data, Evas_Object *obj, void *event_info) { - struct appdata *ap =(struct appdata *)data; + struct appdata *ap = (struct appdata *)data; ap->mf_Status.req = MF_REQ_NONE; mf_request_set_result(ap->mf_FileOperation.pRequest, MF_REQ_NONE); SAFE_FREE_OBJ(ap->mf_MainWindow.pNormalPopup); @@ -2610,18 +2616,18 @@ void mf_callback_thread_pipe_cb(void *data, void *buffer, unsigned int nbyte) if (pPipeMsg->msg_type == MF_MSG_REQUEST && ap->mf_Status.check != 1) { GString *path = g_string_new(pPipeMsg->current); - if(mf_fm_svc_wrapper_is_dir(path) == FILE_TYPE_DIR) { + if (mf_fm_svc_wrapper_is_dir(path) == FILE_TYPE_DIR) { char *label = gettext(MF_LABEL_SAME_FOLDER_LABEL); ap->file_name = mf_fm_svc_get_file_name(path); char *message = g_strdup_printf(label, ap->file_name); ap->mf_MainWindow.pNormalPopup = mf_popup_replace_create(MF_LABEL_SAME_FOLDER, message, mf_callback_popup_cancel_cb, - mf_callback_replace_cb, mf_callback_rename_cb, ap); + mf_callback_replace_cb, mf_callback_rename_cb, ap); } else { char *label = gettext(MF_LABEL_SAME_FILE_LABEL); ap->file_name = mf_fm_svc_get_file_name(path); char *message = g_strdup_printf(label, ap->file_name); ap->mf_MainWindow.pNormalPopup = mf_popup_replace_create(MF_LABEL_SAME_FILE, message, mf_callback_popup_cancel_cb, - mf_callback_replace_cb, mf_callback_rename_cb, ap); + mf_callback_replace_cb, mf_callback_rename_cb, ap); } } mf_util_set_pm_lock(ap, EINA_TRUE); @@ -2637,7 +2643,7 @@ void mf_callback_thread_pipe_cb(void *data, void *buffer, unsigned int nbyte) ap->mf_MainWindow.pProgressPopup = NULL; } ap->mf_MainWindow.pFinishPopup = mf_popup_create_popup(ap, POPMODE_TEXT_NOT_DISABLED, NULL, - MF_LABEL_CANCELING, NULL, NULL, NULL, NULL, NULL); + MF_LABEL_CANCELING, NULL, NULL, NULL, NULL, NULL); mf_msg_request_handled_send(); ap->mf_FileOperation.iOperationSuccessFlag = FALSE; break; @@ -2753,8 +2759,7 @@ void mf_callback_thread_pipe_cb(void *data, void *buffer, unsigned int nbyte) } else { ap->mf_FileOperation.pOperationMsg = message; } - } - else { + } else { if (ap->mf_Status.more == MORE_DATA_COPYING) { ap->mf_FileOperation.pOperationMsg = MF_MSG_COPY_FAILED; } else if (ap->mf_Status.more == MORE_DATA_MOVING) { @@ -2827,13 +2832,14 @@ static void __mf_callback_mmc_connected(void *data) { struct appdata *ap = (struct appdata *)data; mf_retm_if(ap == NULL, "appdata is NULL"); - mf_retm_if (ap->mf_Status.path == NULL || ap->mf_Status.path->str == NULL, "mf_Status.path is NULL"); + mf_retm_if(ap->mf_Status.path == NULL || ap->mf_Status.path->str == NULL, "mf_Status.path is NULL"); Evas_Object *entry = NULL; ap->mf_Status.iStorageState |= MYFILE_MMC; - if (ap->mf_Status.more == MORE_SEARCH || (ap->mf_Status.more == MORE_RENAME && mf_view_get_pre_state(ap) == MORE_SEARCH)) + if (ap->mf_Status.more == MORE_SEARCH || (ap->mf_Status.more == MORE_RENAME && mf_view_get_pre_state(ap) == MORE_SEARCH)) { return; + } if (ap->mf_Status.view_type != mf_view_storage && ap->mf_Status.view_type != mf_view_root) { return; @@ -2901,7 +2907,7 @@ static void __mf_callback_mmc_removed(void *data, MF_STORAGE storage) { struct appdata *ap = (struct appdata *)data; mf_retm_if(ap == NULL, "appdata is NULL"); - mf_retm_if (ap->mf_Status.path == NULL || ap->mf_Status.path->str == NULL, "mf_Status.path is NULL"); + mf_retm_if(ap->mf_Status.path == NULL || ap->mf_Status.path->str == NULL, "mf_Status.path is NULL"); Evas_Object *entry = NULL; MF_STORAGE optStorage = MYFILE_NONE; @@ -2939,7 +2945,7 @@ static void __mf_callback_mmc_removed(void *data, MF_STORAGE storage) */ mf_media_delete_recent_files_by_type(ap->mf_MainWindow.mfd_handle, MYFILE_MMC); if (ap->mf_Status.view_type == mf_view_recent) { - mf_recent_view_content_refresh(ap); + mf_recent_view_content_refresh(ap); } if (ap->mf_MainWindow.pNewFolderPopup) { mf_list_data_t *item_data = (mf_list_data_t *)evas_object_data_get(ap->mf_MainWindow.pNewFolderPopup, "item_data"); @@ -2947,7 +2953,7 @@ static void __mf_callback_mmc_removed(void *data, MF_STORAGE storage) SAFE_FREE_OBJ(ap->mf_MainWindow.pNewFolderPopup); } } - if(mf_fm_svc_wrapper_get_location(ap->mf_Status.path->str) == MYFILE_MMC) { + if (mf_fm_svc_wrapper_get_location(ap->mf_Status.path->str) == MYFILE_MMC) { if (ap->mf_MainWindow.pLongpressPopup) { SAFE_FREE_OBJ(ap->mf_MainWindow.pLongpressPopup); } @@ -3056,16 +3062,16 @@ static void __mf_callback_mmc_removed(void *data, MF_STORAGE storage) case MORE_DATA_COPYING: case MORE_DATA_MOVING: mf_debug("===================== MMC remove =================="); - if(strncmp(ap->mf_MainWindow.record.path , storage_loc, strlen(storage_loc)) == 0) { + if (strncmp(ap->mf_MainWindow.record.path , storage_loc, strlen(storage_loc)) == 0) { if (ap->mf_MainWindow.pNormalPopup) { - evas_object_del(ap->mf_MainWindow.pNormalPopup); - ap->mf_MainWindow.pNormalPopup = NULL; + evas_object_del(ap->mf_MainWindow.pNormalPopup); + ap->mf_MainWindow.pNormalPopup = NULL; } mf_request_set_result(ap->mf_FileOperation.pRequest, MF_REQ_SKIP); } if (ap->mf_MainWindow.record.location == optStorage) { ap->mf_MainWindow.pMmcRemovedPopup = mf_popup_create_popup(ap, POPMODE_TEXT_NOT_DISABLED, NULL, - MF_LABEL_MMC_REMOVED, NULL, NULL, NULL, NULL, NULL); + MF_LABEL_MMC_REMOVED, NULL, NULL, NULL, NULL, NULL); } break; @@ -3106,7 +3112,7 @@ static void __mf_callback_mmc_removed(void *data, MF_STORAGE storage) mf_debug("===================== MMC remove =================="); ap->mf_MainWindow.pMmcRemovedPopup = mf_popup_create_popup(ap, POPMODE_TEXT_NOT_DISABLED, NULL, - MF_LABEL_MMC_REMOVED, NULL, NULL, NULL, NULL, NULL); + MF_LABEL_MMC_REMOVED, NULL, NULL, NULL, NULL, NULL); /*ToDo: check whether get the error before this; */ if (ap->mf_FileOperation.pCancel) { mf_cancel_do_cancel(ap->mf_FileOperation.pCancel); @@ -3151,7 +3157,7 @@ static void __mf_callback_mmc_removed(void *data, MF_STORAGE storage) ap->mf_MainWindow.pProgressPopup = NULL; } ap->mf_MainWindow.pMmcRemovedPopup = mf_popup_create_popup(ap, POPMODE_TEXT_NOT_DISABLED, NULL, - MF_LABEL_MMC_REMOVED, NULL, NULL, NULL, NULL, NULL); + MF_LABEL_MMC_REMOVED, NULL, NULL, NULL, NULL, NULL); mf_navi_bar_reset(ap); mf_view_update(ap); @@ -3160,7 +3166,7 @@ static void __mf_callback_mmc_removed(void *data, MF_STORAGE storage) case MORE_DELETE: mf_debug("===================== MMC remove =================="); ap->mf_MainWindow.pMmcRemovedPopup = mf_popup_create_popup(ap, POPMODE_TEXT_NOT_DISABLED, NULL, - MF_LABEL_MMC_REMOVED, NULL, NULL, NULL, NULL, NULL); + MF_LABEL_MMC_REMOVED, NULL, NULL, NULL, NULL, NULL); if (ap->mf_FileOperation.pCancel) { mf_cancel_do_cancel(ap->mf_FileOperation.pCancel); } @@ -3190,7 +3196,7 @@ static void __mf_callback_storage_changed_cb(int storage_id, storage_state_e sta { struct appdata *ap = (struct appdata *)data; mf_retm_if(ap == NULL, "appdata is NULL"); - mf_retm_if (ap->mf_Status.path == NULL || ap->mf_Status.path->str == NULL, "mf_Status.path is NULL"); + mf_retm_if(ap->mf_Status.path == NULL || ap->mf_Status.path->str == NULL, "mf_Status.path is NULL"); int optStorage = MYFILE_NONE; if (STORAGE_STATE_MOUNTED == state) { @@ -3345,16 +3351,15 @@ void mf_callback_genlist_imf_changed_cb(void *data, Evas_Object *obj, void *even if (elm_object_focus_get(obj)) { if (entry_empty) { elm_object_item_signal_emit(params->item, "elm,state,eraser,hide", ""); - } - else - { + } else { elm_object_item_signal_emit(params->item, "elm,state,eraser,show", ""); } } if (mf_file_attr_is_valid_name(name) != MYFILE_ERR_NONE) { strncpy(new_str, name, MYFILE_FILE_NAME_LEN_MAX - 1); - if (strlen(name) > 0) + if (strlen(name) > 0) { new_str[strlen(name) - 1] = '\0'; + } elm_entry_entry_set(ap->mf_MainWindow.pEntry, new_str); elm_entry_cursor_end_set(ap->mf_MainWindow.pEntry); elm_object_focus_set(ap->mf_MainWindow.pEntry, EINA_FALSE); @@ -3364,7 +3369,7 @@ void mf_callback_genlist_imf_changed_cb(void *data, Evas_Object *obj, void *even } mf_callback_entry_unfocus(ap->mf_MainWindow.pEntry); ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT_BTN, NULL, MF_MSG_RENAME_ILLEGAL_CHAR, MF_BUTTON_LABEL_OK, NULL, - NULL, mf_popup_show_vk_cb, ap); + NULL, mf_popup_show_vk_cb, ap); } SAFE_FREE_CHAR(name); MF_TRACE_END; @@ -3395,7 +3400,7 @@ void mf_callback_longpress_rename_cb(void *data, Evas_Object *obj, void *event_i ap->mf_FileOperation.rename_item = it; //__mf_callback_idle_rename(data); SAFE_DEL_ECORE_TIMER(ap->mf_Status.rename_timer); - ap->mf_Status.rename_timer = ecore_timer_add(0.05,(Ecore_Task_Cb)mf_callback_idle_rename, data); + ap->mf_Status.rename_timer = ecore_timer_add(0.05, (Ecore_Task_Cb)mf_callback_idle_rename, data); return; } @@ -3429,7 +3434,7 @@ void mf_callback_detail_ctx_cb(void *data, Evas_Object *obj, void *event_info) //mf_launch_load_ug(ap, itemData->m_ItemName->str, MF_LOAD_UG_DETAIL, EINA_FALSE); __mf_load_detail_data(ap, itemData->m_ItemName->str, EINA_FALSE); - + ap->mf_Status.preViewType = ap->mf_Status.view_type; ap->mf_Status.view_type = mf_view_detail; mf_view_update(ap); @@ -3499,9 +3504,9 @@ void mf_callback_delete_button_cb(void *data, Evas_Object *obj, void *event_info SAFE_FREE_OBJ(ap->mf_MainWindow.pNormalPopup); ap->mf_FileOperation.idle_delete_item = params->item; ap->mf_MainWindow.pDeleteConfirmPopup = mf_popup_create_delete_confirm_popup(ap, MF_LABEL_DELETE_ITEM, - MF_LABEL_THIS_ITEM_WILL_DELETE, - LABEL_CANCEL, LABEL_DELETE, - __mf_callback_delete_in_idle, ap, 1); + MF_LABEL_THIS_ITEM_WILL_DELETE, + LABEL_CANCEL, LABEL_DELETE, + __mf_callback_delete_in_idle, ap, 1); } void mf_callback_view_as_cb(void *data, Evas_Object *obj, void *event_info) @@ -3569,12 +3574,12 @@ void mf_callback_more_button_cb(void *data, Evas_Object *obj, void *event_info) } else { if (ap->mf_Status.more == MORE_DEFAULT) { mf_context_popup_create_more(ap, more); - } else if (ap->mf_Status.more == MORE_SEARCH){ + } else if (ap->mf_Status.more == MORE_SEARCH) { mf_context_popup_create_more(ap, more); } else if (ap->mf_Status.more == MORE_INTERNAL_MOVE - || ap->mf_Status.more == MORE_DATA_MOVING - || ap->mf_Status.more == MORE_INTERNAL_COPY - || ap->mf_Status.more == MORE_DATA_COPYING) { + || ap->mf_Status.more == MORE_DATA_MOVING + || ap->mf_Status.more == MORE_INTERNAL_COPY + || ap->mf_Status.more == MORE_DATA_COPYING) { if (ap->mf_Status.view_type != mf_view_root && ap->mf_Status.view_type != mf_view_storage) { mf_context_popup_create_more(ap, more); } @@ -3621,18 +3626,18 @@ void mf_callback_extension_cb(void *data, Evas_Object *obj, void *event_info) void mf_callback_profile_changed_cb(void *data, Evas_Object *obj, void *event_info) { - MF_TRACE_BEGIN; + MF_TRACE_BEGIN; t_start; - mf_retm_if(data == NULL, "data is NULL"); - struct appdata *ap = (struct appdata *)data; - const char *profile = elm_config_profile_get(); - - if (!strcmp(profile, "desktop")) { - elm_object_item_part_content_set(ap->mf_MainWindow.pNaviItem, "prev_btn", NULL); - elm_win_indicator_mode_set(ap->mf_MainWindow.pWindow, ELM_WIN_INDICATOR_HIDE); - } else { // mobile - elm_win_indicator_mode_set(ap->mf_MainWindow.pWindow, ELM_WIN_INDICATOR_SHOW); - } + mf_retm_if(data == NULL, "data is NULL"); + struct appdata *ap = (struct appdata *)data; + const char *profile = elm_config_profile_get(); + + if (!strcmp(profile, "desktop")) { + elm_object_item_part_content_set(ap->mf_MainWindow.pNaviItem, "prev_btn", NULL); + elm_win_indicator_mode_set(ap->mf_MainWindow.pWindow, ELM_WIN_INDICATOR_HIDE); + } else { // mobile + elm_win_indicator_mode_set(ap->mf_MainWindow.pWindow, ELM_WIN_INDICATOR_SHOW); + } t_end; MF_TRACE_END; } @@ -3645,7 +3650,7 @@ void mf_callback_share_cb(void *data, Evas_Object *obj, void *event_info) if (mf_edit_file_count_get() > MF_SHARE_ITEM_COUNT_MAX) { //P131118-02783 by wangyan , add detailed maximum number in the popup message while share char limit_str[256] = {0}; - snprintf(limit_str, sizeof(limit_str)-1, mf_util_get_text(MF_LABEL_REACH_MAX_SHARE_COUNT), MF_SHARE_ITEM_COUNT_MAX); + snprintf(limit_str, sizeof(limit_str) - 1, mf_util_get_text(MF_LABEL_REACH_MAX_SHARE_COUNT), MF_SHARE_ITEM_COUNT_MAX); ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT_BTN, NULL, limit_str/*MF_LABEL_REACH_MAX_SHARE_COUNT*/, MF_BUTTON_LABEL_OK, NULL, NULL, mf_callback_warning_popup_cb, ap); return; } @@ -3695,17 +3700,16 @@ void mf_callback_thumb_created_cb(media_content_error_e error, const char *path, SAFE_FREE_CHAR(pListData->thumb_path); if (pListData->file_type == FILE_TYPE_MUSIC || pListData->file_type == FILE_TYPE_SOUND) { - if (strcmp(path,MF_MUSIC_DEFAULT_THUMBNAIL_FROM_DB) == 0) { - mf_debug("if in get the path from db is [%s]",path); + if (strcmp(path, MF_MUSIC_DEFAULT_THUMBNAIL_FROM_DB) == 0) { + mf_debug("if in get the path from db is [%s]", path); pListData->thumb_path = g_strdup(MF_ICON_MUSIC_THUMBNAIL); pListData->thumbnail_type = MF_THUMBNAIL_DEFAULT; - }else - { - mf_debug("else in get the path from db is [%s]",path); + } else { + mf_debug("else in get the path from db is [%s]", path); pListData->thumb_path = g_strdup(path); pListData->thumbnail_type = MF_THUMBNAIL_THUMB; } - }else { + } else { pListData->thumb_path = g_strdup(path); pListData->thumbnail_type = MF_THUMBNAIL_THUMB; } @@ -3737,7 +3741,7 @@ bool mf_callback_create_thumbnail(void *data, media_thumbnail_completed_cb callb if (g_mf_create_thumbnail_count < MF_MAX_MAKE_THUNBNAIL_COUNT) {//Fixed P140827-07370 ret = media_info_create_thumbnail(pListData->media, callback, - pListData); + pListData); if (ret != MEDIA_CONTENT_ERROR_NONE) { mf_debug("Failed to create thumbnail! ret is [%d]", ret); if (pListData->file_type == FILE_TYPE_IMAGE || pListData->file_type == FILE_TYPE_VIDEO) { @@ -3809,12 +3813,15 @@ void mf_callback_naviframe_title_clicked_cb(void *data, Evas_Object *obj, void * struct appdata *ap = (struct appdata*)data; Elm_Object_Item *navi_it = event_info; - if (!navi_it) return; + if (!navi_it) { + return; + } Evas_Object *label = elm_object_item_part_content_get(navi_it, "elm.swallow.title"); - if (!label || (ap->mf_Status.more == MORE_EDIT)) + if (!label || (ap->mf_Status.more == MORE_EDIT)) { return; + } elm_label_slide_go(label); } @@ -3827,11 +3834,15 @@ static void __mf_callback_sip_imf_show_cb(void *data, Evas_Object *obj, void *ev Evas_Object *nf = ap->mf_MainWindow.pNaviBar; - if (!nf) return; + if (!nf) { + return; + } Elm_Object_Item *navi_it = elm_naviframe_top_item_get(nf); - if (!navi_it) return; + if (!navi_it) { + return; + } elm_object_item_signal_emit(navi_it, "elm,state,toolbar,instant_open", ""); MF_TRACE_END; @@ -3846,11 +3857,15 @@ static void __mf_callback_sip_imf_hide_cb(void *data, Evas_Object *obj, void *ev Evas_Object *nf = ap->mf_MainWindow.pNaviBar; - if (!nf) return; + if (!nf) { + return; + } Elm_Object_Item *navi_it = elm_naviframe_top_item_get(nf); - if (!navi_it) return; + if (!navi_it) { + return; + } elm_object_item_signal_emit(navi_it, "elm,state,toolbar,instant_close", ""); MF_TRACE_END; @@ -3893,8 +3908,9 @@ void mf_callback_imf_state_callback_del(void *data) void mf_callback_entry_focused_cb(void *data, Evas_Object *obj, void *event_info) { - if (!elm_entry_is_empty(obj)) + if (!elm_entry_is_empty(obj)) { elm_object_signal_emit(data, "elm,state,eraser,show", ""); + } elm_object_signal_emit(data, "elm,state,rename,hide", ""); } @@ -3923,8 +3939,7 @@ void mf_callback_keydown_cb(void *data, Evas *e, Evas_Object *obj, void *event_i struct appdata *ap = (struct appdata *)data; Evas_Event_Key_Down *ev = event_info; - if (!strcmp(ev->keyname, "Escape")) // if ESC key is down - { + if (!strcmp(ev->keyname, "Escape")) { // if ESC key is down elm_naviframe_item_pop_cb_set(ap->mf_MainWindow.pNaviItem, mf_callback_navi_backbutton_clicked_cb, ap); } } @@ -4014,14 +4029,14 @@ void mf_callback_item_remove_from_recent_files_cb(void *data, Evas_Object *obj, SAFE_FREE_OBJ(ap->mf_MainWindow.pLongpressPopup); ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, - POPMODE_TEXT_TWO_BTN, - MF_LABEL_REMOVE_FILE, - MF_LABEL_REMOVE_FROME_RECENT, - LABEL_CANCEL, - MF_LABEL_REMOVE, - NULL, - __mf_callback_recent_files_confirm_delete, - item_data); + POPMODE_TEXT_TWO_BTN, + MF_LABEL_REMOVE_FILE, + MF_LABEL_REMOVE_FROME_RECENT, + LABEL_CANCEL, + MF_LABEL_REMOVE, + NULL, + __mf_callback_recent_files_confirm_delete, + item_data); //elm_object_item_del(item_data->item); diff --git a/src/common/mf-detail.c b/src/common/mf-detail.c index a0d40c0..bd50c48 100755 --- a/src/common/mf-detail.c +++ b/src/common/mf-detail.c @@ -34,10 +34,11 @@ void mf_detail_widget_object_text_set(Evas_Object *obj, const char *ID, const ch { const char *domain; - if (strstr(ID, "IDS_COM")) + if (strstr(ID, "IDS_COM")) { domain = "sys_string"; - else + } else { domain = DETAIL_UG_PKGNAME; + } elm_object_domain_translatable_part_text_set(obj, part, domain, ID); } @@ -47,10 +48,11 @@ void mf_detail_widget_object_item_text_set(Elm_Object_Item *item, const char *ID { const char *domain; - if (strstr(ID, "IDS_COM")) + if (strstr(ID, "IDS_COM")) { domain = "sys_string"; - else + } else { domain = DETAIL_UG_PKGNAME; + } elm_object_item_domain_translatable_part_text_set(item, part, domain, ID); } @@ -58,10 +60,11 @@ void mf_detail_widget_object_item_translate_set(Elm_Object_Item *item, const cha { const char *domain; - if (strstr(ID, "IDS_COM")) + if (strstr(ID, "IDS_COM")) { domain = "sys_string"; - else + } else { domain = DETAIL_UG_PKGNAME; + } elm_object_item_domain_text_translatable_set(item, domain, EINA_TRUE); } @@ -204,9 +207,10 @@ void mf_ug_detail_view_destroy_data(void *data) void mf_detail_data_destroy(void *data) { MF_TRACE_BEGIN; - if (data == NULL) + if (data == NULL) { return; - + } + struct appdata *ap = (struct appdata *)data; if (ap->mf_Status.detail) { mf_ug_detail_view_destroy_data(ap->mf_Status.detail); @@ -227,29 +231,29 @@ static void _mf_update_size_string(struct detailData *detail, char *filesize) unit = strdup(mf_detail_widget_get_text(MF_UG_DETAIL_LABEL_SIZE_B)); if (unit != NULL && strstr(unit, mf_detail_widget_get_text(MF_UG_DETAIL_LABEL_SIZE_B))) {//Sometimes, the string isn't translated. size = detail->mf_Info.dsize; - strncpy(unit ,"B", sizeof("B")); + strncpy(unit , "B", sizeof("B")); } - + } else if (detail->mf_Info.unit_num == UG_SIZE_KB) { unit = strdup(mf_detail_widget_get_text(MF_UG_DETAIL_LABEL_SIZE_K)); if (unit != NULL && strstr(unit, mf_detail_widget_get_text(MF_UG_DETAIL_LABEL_SIZE_K))) {//Sometimes, the string isn't translated. size = 1024 * detail->mf_Info.dsize; - strncpy(unit ,"KB", sizeof("KB")); + strncpy(unit , "KB", sizeof("KB")); } } else if (detail->mf_Info.unit_num == UG_SIZE_MB) { unit = strdup(mf_detail_widget_get_text(MF_UG_DETAIL_LABEL_SIZE_M)); if (unit != NULL && strstr(unit, mf_detail_widget_get_text(MF_UG_DETAIL_LABEL_SIZE_M))) {//Sometimes, the string isn't translated. size = 1024 * 1024 * detail->mf_Info.dsize; - strncpy(unit ,"MB", sizeof("MB")); + strncpy(unit , "MB", sizeof("MB")); } } else if (detail->mf_Info.unit_num == UG_SIZE_GB) { unit = strdup(mf_detail_widget_get_text(MF_UG_DETAIL_LABEL_SIZE_G)); - if (unit !=NULL && strstr(unit, mf_detail_widget_get_text(MF_UG_DETAIL_LABEL_SIZE_G))) {//Sometimes, the string isn't translated. - size = 1024 * 1024 * 1024 *detail->mf_Info.dsize; - strncpy(unit ,"GB", sizeof("GB")); + if (unit != NULL && strstr(unit, mf_detail_widget_get_text(MF_UG_DETAIL_LABEL_SIZE_G))) { //Sometimes, the string isn't translated. + size = 1024 * 1024 * 1024 * detail->mf_Info.dsize; + strncpy(unit , "GB", sizeof("GB")); } } - + snprintf(filesize, UG_FILE_SIZE_LEN_MAX, "%.1f %s (%.0f bytes)", detail->mf_Info.dsize, unit, size); SAFE_FREE_CHAR(unit); // snprintf(filesize, UG_FILE_SIZE_LEN_MAX, "%llu %s", detail->mf_Info.dsize, unit); @@ -280,7 +284,7 @@ static char *__mf_ug_detail_view_get_gl_label(void *data, Evas_Object *obj, cons struct detailData *detail = (struct detailData *)params->detail; ug_detail_retvm_if(detail == NULL, NULL, "detail is NULL"); - + if (strcmp(part, "elm.text.main.left.top") == 0) { if (params->m_ItemName && params->m_ItemName->str) { return strdup(mf_detail_widget_get_text(params->m_ItemName->str)); @@ -425,8 +429,9 @@ static void __mf_ug_detail_view_del_gl(void *data, Evas_Object * obj) static char *__mf_ug_detail_view_get_gl_label_title(void *data, Evas_Object *obj, const char *part) { UG_DETAIL_TRACE_BEGIN; - if (!strcmp(part, "elm.text.main")) + if (!strcmp(part, "elm.text.main")) { return strdup(data); + } return NULL; } @@ -484,8 +489,8 @@ mf_ug_detail_view_create_genlist(Evas_Object *parent, void *data) { UG_DETAIL_TRACE_BEGIN; - ug_detail_retvm_if(parent == NULL,NULL, "parent is NULL"); - ug_detail_retvm_if(data == NULL,NULL, "data is NULL"); + ug_detail_retvm_if(parent == NULL, NULL, "parent is NULL"); + ug_detail_retvm_if(data == NULL, NULL, "data is NULL"); struct detailData *detail = (struct detailData *) data; Evas_Object *genlist = NULL; @@ -495,7 +500,7 @@ mf_ug_detail_view_create_genlist(Evas_Object *parent, void *data) elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS); evas_object_smart_callback_add(genlist, "language,changed", - __mf_ug_genlist_lang_changed, detail); + __mf_ug_genlist_lang_changed, detail); evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL); @@ -570,8 +575,9 @@ static void __mf_ug_detail_view_create_genlist_folder(void *data, Evas_Object *g for (index = 0; index < 5; index++) { m_TempItem = (struct MF_LIST_Item_S *) malloc(sizeof(struct MF_LIST_Item_S)); - if (m_TempItem == NULL) + if (m_TempItem == NULL) { continue; + } memset(m_TempItem, 0, sizeof(struct MF_LIST_Item_S)); @@ -610,8 +616,9 @@ static void __mf_ug_detail_view_create_genlist_multi(void *data, Evas_Object *ge for (index = 0; index < 2; index++) { m_TempItem = (struct MF_LIST_Item_S *) malloc(sizeof(struct MF_LIST_Item_S)); - if (m_TempItem == NULL) + if (m_TempItem == NULL) { continue; + } memset(m_TempItem, 0, sizeof(struct MF_LIST_Item_S)); @@ -640,41 +647,41 @@ static void __mf_ug_detail_view_create_genlist_multi(void *data, Evas_Object *ge ******************************/ static void __mf_ug_detail_view_create_genlist_gps(void *data) { -/* - UG_DETAIL_TRACE_BEGIN; - struct detailData *detail = (struct detailData *)data; - ug_detail_retm_if(detail == NULL, "detail is NULL"); + /* + UG_DETAIL_TRACE_BEGIN; + struct detailData *detail = (struct detailData *)data; + ug_detail_retm_if(detail == NULL, "detail is NULL"); - Evas_Object *genlist = NULL; - int index = 0; - Elm_Object_Item *git = NULL; - Elm_Object_Item *it = NULL; - struct MF_LIST_Item_S *m_TempItem = NULL; - char *m_ItemName[FILE_EXIF_INFO_NUM] = { '\0' }; + Evas_Object *genlist = NULL; + int index = 0; + Elm_Object_Item *git = NULL; + Elm_Object_Item *it = NULL; + struct MF_LIST_Item_S *m_TempItem = NULL; + char *m_ItemName[FILE_EXIF_INFO_NUM] = { '\0' }; - ug_detail_retm_if(genlist == NULL, "genlist is NULL"); + ug_detail_retm_if(genlist == NULL, "genlist is NULL"); - m_ItemName[0] = MF_UG_DETAIL_LABEL_LATITUDE; - m_ItemName[1] = MF_UG_DETAIL_LABEL_LONGITUDE; + m_ItemName[0] = MF_UG_DETAIL_LABEL_LATITUDE; + m_ItemName[1] = MF_UG_DETAIL_LABEL_LONGITUDE; - git = elm_genlist_item_append(genlist, &detail->mf_Status.title_itc, strdup(mf_detail_widget_get_text(MF_UG_DETAIL_LABEL_INFORMATION)), - NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); - elm_genlist_item_select_mode_set(git, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + git = elm_genlist_item_append(genlist, &detail->mf_Status.title_itc, strdup(mf_detail_widget_get_text(MF_UG_DETAIL_LABEL_INFORMATION)), + NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); + elm_genlist_item_select_mode_set(git, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - for (index = 0; index < FILE_EXIF_INFO_NUM; index++) { - m_TempItem = (struct MF_LIST_Item_S *) malloc(sizeof(struct MF_LIST_Item_S)); - if (m_TempItem == NULL) - continue; + for (index = 0; index < FILE_EXIF_INFO_NUM; index++) { + m_TempItem = (struct MF_LIST_Item_S *) malloc(sizeof(struct MF_LIST_Item_S)); + if (m_TempItem == NULL) + continue; - memset(m_TempItem, 0, sizeof(struct MF_LIST_Item_S)); - m_TempItem->m_ItemName = g_string_new(m_ItemName[index]); - m_TempItem->detail = detail; - it = elm_genlist_item_append(genlist, &detail->mf_Status.itc, m_TempItem, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); - elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + memset(m_TempItem, 0, sizeof(struct MF_LIST_Item_S)); + m_TempItem->m_ItemName = g_string_new(m_ItemName[index]); + m_TempItem->detail = detail; + it = elm_genlist_item_append(genlist, &detail->mf_Status.itc, m_TempItem, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); + elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - } - UG_DETAIL_TRACE_END; - */ + } + UG_DETAIL_TRACE_END; + */ } /****************************** @@ -708,7 +715,7 @@ static void __mf_ug_detail_view_create_genlist_file(void *data, Evas_Object *gen ug_detail_retm_if(genlist == NULL, "genlist is NULL"); if (detail->mf_Status.view_type == VIEW_FILE_NORMAL - ) { + ) { char *m_ItemName[FOLDER_NORMDETILES_NUM] = { '\0' }; m_ItemName[0] = MF_UG_DETAIL_LABEL_NAME; @@ -718,8 +725,9 @@ static void __mf_ug_detail_view_create_genlist_file(void *data, Evas_Object *gen m_ItemName[3] = MF_UG_DETAIL_LABEL_LOCATION; for (index = 0; index < FOLDER_NORMDETILES_NUM; index++) { m_TempItem = (struct MF_LIST_Item_S *) malloc(sizeof(struct MF_LIST_Item_S)); - if (m_TempItem == NULL) + if (m_TempItem == NULL) { continue; + } memset(m_TempItem, 0, sizeof(struct MF_LIST_Item_S)); @@ -727,19 +735,18 @@ static void __mf_ug_detail_view_create_genlist_file(void *data, Evas_Object *gen m_TempItem->detail = detail; if (index == 0 || index == 4) { it = elm_genlist_item_append(genlist, &detail->mf_Status.multiline_itc, m_TempItem, NULL, ELM_GENLIST_ITEM_NONE, - NULL, NULL); + NULL, NULL); elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); } else { it = elm_genlist_item_append(genlist, &detail->mf_Status.itc, m_TempItem, NULL, ELM_GENLIST_ITEM_NONE, - NULL, NULL); + NULL, NULL); elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); } } - } - else if ( - detail->mf_Status.view_type == VIEW_FILE_IMAGE - || detail->mf_Status.view_type == VIEW_FILE_VIDEO) { + } else if ( + detail->mf_Status.view_type == VIEW_FILE_IMAGE + || detail->mf_Status.view_type == VIEW_FILE_VIDEO) { char *m_ItemName[FILE_DETILES_NUM] = { '\0' }; m_ItemName[0] = MF_UG_DETAIL_LABEL_NAME; @@ -750,8 +757,9 @@ static void __mf_ug_detail_view_create_genlist_file(void *data, Evas_Object *gen m_ItemName[3] = MF_UG_DETAIL_LABEL_LOCATION; for (index = 0; index < FILE_DETILES_NUM; index++) { m_TempItem = (struct MF_LIST_Item_S *) malloc(sizeof(struct MF_LIST_Item_S)); - if (m_TempItem == NULL) + if (m_TempItem == NULL) { continue; + } memset(m_TempItem, 0, sizeof(struct MF_LIST_Item_S)); @@ -759,11 +767,11 @@ static void __mf_ug_detail_view_create_genlist_file(void *data, Evas_Object *gen m_TempItem->detail = detail; if (index == 0 || index == FILE_DETILES_NUM - 1) { it = elm_genlist_item_append(genlist, &detail->mf_Status.multiline_itc, m_TempItem, NULL, ELM_GENLIST_ITEM_NONE, - NULL, NULL); + NULL, NULL); elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); } else { it = elm_genlist_item_append(genlist, &detail->mf_Status.itc, m_TempItem, NULL, ELM_GENLIST_ITEM_NONE, - NULL, NULL); + NULL, NULL); elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); } } @@ -779,13 +787,14 @@ static void __mf_ug_detail_view_create_genlist_file(void *data, Evas_Object *gen m_ItemName[3] = MF_UG_DETAIL_LABEL_LOCATION; git = elm_genlist_item_append(genlist, &detail->mf_Status.title_itc, strdup(mf_detail_widget_get_text(MF_UG_DETAIL_LABEL_BASIC)), - NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); + NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); elm_genlist_item_select_mode_set(git, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); for (index = 0; index < FILE_DETILES_NUM; index++) { m_TempItem = (struct MF_LIST_Item_S *) malloc(sizeof(struct MF_LIST_Item_S)); - if (m_TempItem == NULL) + if (m_TempItem == NULL) { continue; + } memset(m_TempItem, 0, sizeof(struct MF_LIST_Item_S)); @@ -794,11 +803,11 @@ static void __mf_ug_detail_view_create_genlist_file(void *data, Evas_Object *gen if (index == 0 || index == FILE_DETILES_NUM - 1) { it = elm_genlist_item_append(genlist, &detail->mf_Status.multiline_itc, m_TempItem, NULL, ELM_GENLIST_ITEM_NONE, - NULL, NULL); + NULL, NULL); elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); } else { it = elm_genlist_item_append(genlist, &detail->mf_Status.itc, m_TempItem, NULL, ELM_GENLIST_ITEM_NONE, - NULL, NULL); + NULL, NULL); elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); } } @@ -922,8 +931,8 @@ void mf_ug_detail_get_params_path(Eina_List **dest_list, const char *path_list) } void mf_ug_detail_get_multi_information(Eina_List *list, int *total_file_count, - int *total_folder_count, - unsigned long long int *total_size) + int *total_folder_count, + unsigned long long int *total_size) { Eina_List *l = NULL; char *file_path = NULL; @@ -938,8 +947,9 @@ void mf_ug_detail_get_multi_information(Eina_List *list, int *total_file_count, } else { file_count++; Node_Info *pNode = (Node_Info *) malloc(sizeof(Node_Info)); - if (pNode == NULL) + if (pNode == NULL) { return; + } memset(pNode, 0, sizeof(Node_Info)); mf_ug_detaill_fs_get_file_stat(file_path, &pNode); @@ -963,7 +973,7 @@ struct detailData * mf_ug_detail_multi_info_extract(const char *path) { UG_DETAIL_TRACE_BEGIN; - ug_detail_retvm_if(path == NULL,false, "path is null"); + ug_detail_retvm_if(path == NULL, false, "path is null"); Eina_List *path_list = NULL; int file_count = 0; @@ -980,7 +990,7 @@ mf_ug_detail_multi_info_extract(const char *path) mf_ug_detail_get_params_path(&path_list, path); mf_ug_detail_get_multi_information(path_list, &file_count, - &folder_count, &original_size); + &folder_count, &original_size); size = (double)original_size; while (size >= BASIC_SIZE) { diff --git a/src/common/mf-download-app.c b/src/common/mf-download-app.c index b43c442..ab113d8 100755 --- a/src/common/mf-download-app.c +++ b/src/common/mf-download-app.c @@ -22,8 +22,7 @@ #include "mf-file-util.h" static GList *download_app_list = NULL; -typedef struct -{ +typedef struct { pthread_t tid; int alive; @@ -33,40 +32,43 @@ typedef struct downloadapp_data *ad; Ecore_Idler *worker_idler; -}download_app_worker; +} download_app_worker; int count;//wangyan for test static inline char *mf_download_app_strdup(const char *str) { - if (str != NULL) + if (str != NULL) { return strdup(str); - else + } else { return NULL; + } } static inline char *mf_download_app_check_icon(const char *icon_path) { - if (EINA_TRUE == mf_file_exists(icon_path)) + if (EINA_TRUE == mf_file_exists(icon_path)) { return strdup(icon_path); - else + } else { return NULL; + } } static void mf_download_app_get_listinfo(package_info_h handle, - downloadapp_listinfo *info) + downloadapp_listinfo *info) { MF_TRACE_BEGIN; int ret = 0; char *value; - mf_ret_if(NULL == handle,-1); - mf_ret_if(NULL == info,-1); + mf_ret_if(NULL == handle, -1); + mf_ret_if(NULL == info, -1); value = NULL; ret = pkgmgrinfo_pkginfo_get_pkgid(handle, &value); - if (ret < 0) + if (ret < 0) { mf_error("pkgmgrinfo_pkginfo_get_pkgid() Fail(%d)", ret); + } info->pkgid = mf_download_app_strdup(value); @@ -74,26 +76,30 @@ static void mf_download_app_get_listinfo(package_info_h handle, value = NULL; ret = package_info_get_label(handle, &value); - if (ret != PACKAGE_MANAGER_ERROR_NONE) + if (ret != PACKAGE_MANAGER_ERROR_NONE) { mf_error("package_info_get_label() Fail(%d)", ret); + } info->pkg_label = mf_download_app_strdup(value); value = NULL; ret = package_info_get_package(handle, &value); - if (ret != PACKAGE_MANAGER_ERROR_NONE) + if (ret != PACKAGE_MANAGER_ERROR_NONE) { mf_error("package_info_get_package() Fail(%d)", ret); + } info->mainappid = mf_download_app_strdup(value); value = NULL; ret = package_info_get_icon(handle, &value); - if (ret != PACKAGE_MANAGER_ERROR_NONE) + if (ret != PACKAGE_MANAGER_ERROR_NONE) { mf_error("package_info_get_icon() Fail(%d)", ret); + } info->icon_path = mf_download_app_check_icon(value); ret = package_info_is_preload_package(handle, &info->is_preload); - if (ret != PACKAGE_MANAGER_ERROR_NONE) + if (ret != PACKAGE_MANAGER_ERROR_NONE) { mf_error("package_info_is_preload_package() Fail(%d)", ret); + } //ret = package_info_is_update(handle, &info->is_update); //if (ret != PACKAGE_MANAGER_ERROR_NONE) @@ -101,8 +107,9 @@ static void mf_download_app_get_listinfo(package_info_h handle, value = NULL; ret = package_info_get_type(handle, &value); - if (ret != PACKAGE_MANAGER_ERROR_NONE) + if (ret != PACKAGE_MANAGER_ERROR_NONE) { mf_error("package_info_get_type() Fail(%d)", ret); + } info->pkg_type = mf_download_app_strdup(value); MF_TRACE_END; } @@ -127,12 +134,13 @@ static int mf_download_app_list_iter(package_info_h handle, void *data) if (info->is_preload && !info->is_update) { invalid = 1; //not download app - mf_error("------------------[%s] app is not donwload app---------------------",info->pkgid); + mf_error("------------------[%s] app is not donwload app---------------------", info->pkgid); } if (invalid == 0) { - mf_error("------------------[%s] app is donwload app, count is [%d]---------------------",info->pkgid,count); - if (count <= 15)//wangyan for test + mf_error("------------------[%s] app is donwload app, count is [%d]---------------------", info->pkgid, count); + if (count <= 15) { //wangyan for test *pkg_list = g_list_append(*pkg_list, info); + } } MF_TRACE_END; @@ -168,7 +176,7 @@ int mf_download_app_list_get(downloadapp_data *da) void mf_download_app_list_get_cb(int fn_result, downloadapp_data *da) { MF_TRACE_BEGIN; - mf_ret_if(NULL == da,-1); + mf_ret_if(NULL == da, -1); if (MYFILE_ERR_NONE != fn_result) { mf_error("appmgrUg_get_listinfos() Fail(%d)", fn_result); @@ -191,8 +199,9 @@ void mf_download_app_list_get_cb(int fn_result, downloadapp_data *da) void mf_download_app_destroy_data(downloadapp_data *da) { - if (da->list_worker) + if (da->list_worker) { da->list_worker = NULL; + } //destroy data } @@ -205,8 +214,9 @@ static Eina_Bool _async_worker_idler(void *data) pthread_join(worker->tid, NULL); worker->alive = FALSE; - if (worker->cb) + if (worker->cb) { worker->cb(worker->fn_ret, worker->ad); + } //g_hash_table_remove(async_worker_hashT, worker); @@ -236,7 +246,7 @@ static void* _async_worker_thread(void *data) } void* mf_download_app_start_async_worker(async_fn fn, callback_fn cb, - downloadapp_data *ad) + downloadapp_data *ad) { MF_TRACE_BEGIN; int ret; @@ -262,8 +272,9 @@ void* mf_download_app_start_async_worker(async_fn fn, callback_fn cb, //g_hash_table_add(async_worker_hashT, worker); ret = pthread_create(&worker->tid, NULL, _async_worker_thread, worker); - if (ret) + if (ret) { mf_error("phread_create() Fail(%d)", ret); + } worker->alive = TRUE; @@ -273,7 +284,7 @@ void* mf_download_app_start_async_worker(async_fn fn, callback_fn cb, GList *mf_download_app_data_list_get() { - mf_info("download_app_list count in data list get: [%d]",g_list_length(download_app_list)); + mf_info("download_app_list count in data list get: [%d]", g_list_length(download_app_list)); return download_app_list; } @@ -294,7 +305,7 @@ void mf_download_app_main(void *data) da->data = (struct appdata *)data; da->list_worker = NULL; da->list_worker = mf_download_app_start_async_worker(mf_download_app_list_get, - mf_download_app_list_get_cb, da); + mf_download_app_list_get_cb, da); MF_TRACE_END; } #endif diff --git a/src/common/mf-error.c b/src/common/mf-error.c index 4f27680..873854c 100755 --- a/src/common/mf-error.c +++ b/src/common/mf-error.c @@ -24,7 +24,7 @@ int mf_error_erron_to_mferror(int err_no) int err = MYFILE_ERR_NONE; char buf[256] = {0,}; char *str = (char *)strerror_r(err_no, buf, 256); - + mf_error("err_no is [%d] error - %s", err_no, str); switch (err_no) { #ifdef EINVAL diff --git a/src/common/mf-file-util.c b/src/common/mf-file-util.c index b181835..a5b94f2 100644 --- a/src/common/mf-file-util.c +++ b/src/common/mf-file-util.c @@ -25,10 +25,11 @@ static mode_t default_mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S const char *mf_file_get(const char path[]) { char *file = NULL; - if ((file = strrchr(path, '/'))) + if ((file = strrchr(path, '/'))) { file++; - else + } else { file = (char *) path; + } return file; } @@ -43,8 +44,9 @@ char *mf_dir_get(const char path[]) if (!p) { return strdup(path); } - if (p == buf) + if (p == buf) { return strdup("/"); + } *p = 0; return strdup(buf); } @@ -53,10 +55,11 @@ int mf_file_exists(const char *path) { struct stat info = {0,}; - if (stat(path, &info) == 0) + if (stat(path, &info) == 0) { return 1; - else + } else { return 0; + } } Eina_Bool mf_is_dir(const char *path) @@ -84,15 +87,15 @@ int mf_is_dir_empty(const char *path) DIR *dirp = NULL; dirp = opendir(path); - if (!dirp) + if (!dirp) { return -1; + } while ((readdir_r(dirp, &ent_struct, &dp) == 0) && dp) { - if (stat(dp->d_name, &info) == 0 && (strcmp(dp->d_name, ".")) && (strcmp(dp->d_name, ".."))) - { - closedir(dirp); - return 0; - } + if (stat(dp->d_name, &info) == 0 && (strcmp(dp->d_name, ".")) && (strcmp(dp->d_name, ".."))) { + closedir(dirp); + return 0; + } } closedir(dirp); return 1; @@ -100,22 +103,24 @@ int mf_is_dir_empty(const char *path) int mf_mkdir(const char *dir) { - if (mkdir(dir, default_mode) < 0) + if (mkdir(dir, default_mode) < 0) { return 0; - else + } else { return 1; + } } static int mf_mkpath_if_not_exists(const char *path) { struct stat st = {0,}; - if (stat(path, &st) < 0) + if (stat(path, &st) < 0) { return mf_mkdir(path); - else if (!S_ISDIR(st.st_mode)) + } else if (!S_ISDIR(st.st_mode)) { return 0; - else + } else { return 1; + } } int mf_mkpath(const char *path) @@ -123,17 +128,20 @@ int mf_mkpath(const char *path) char ss[PATH_MAX] = {0,}; unsigned int i = 0; - if (mf_is_dir(path)) + if (mf_is_dir(path)) { return 1; + } for (i = 0; path[i] != '\0'; ss[i] = path[i], i++) { - if (i == sizeof(ss) - 1) + if (i == sizeof(ss) - 1) { return 0; + } if ((path[i] == '/') && (i > 0)) { ss[i] = '\0'; - if (!mf_mkpath_if_not_exists(ss)) + if (!mf_mkpath_if_not_exists(ss)) { return 0; + } } } ss[i] = '\0'; @@ -160,21 +168,23 @@ char *mf_strip_ext(const char *path) return file; } -int mf_file_unlink (const char *filename) +int mf_file_unlink(const char *filename) { int status = unlink(filename); - if (status < 0) + if (status < 0) { return 0; - else + } else { return 1; + } } int mf_file_size(const char *filename) { struct stat info = {0,}; if (stat(filename, &info) == 0) { - if (!S_ISDIR(info.st_mode)) + if (!S_ISDIR(info.st_mode)) { return info.st_size; + } } return 0; @@ -183,10 +193,11 @@ int mf_file_size(const char *filename) int mf_file_rmdir(const char *filename) { int status = rmdir(filename); - if (status < 0) + if (status < 0) { return 0; - else + } else { return 1; + } } Eina_List *mf_file_ls(const char *dir) @@ -198,8 +209,9 @@ Eina_List *mf_file_ls(const char *dir) Eina_List *list = NULL; dirp = opendir(dir); - if (!dirp) + if (!dirp) { return NULL; + } while ((readdir_r(dirp, &ent_struct, &dp) == 0) && dp) { if ((strcmp(dp->d_name , ".")) && (strcmp(dp->d_name , ".."))) { @@ -232,15 +244,17 @@ int mf_file_recursive_rm(const char *dir) if (dirp) { while ((readdir_r(dirp, &ent_struct, &dp) == 0) && dp) { if ((strcmp(dp->d_name , ".")) && (strcmp(dp->d_name, ".."))) { - if (!mf_file_recursive_rm(dp->d_name)) + if (!mf_file_recursive_rm(dp->d_name)) { ret = 0; + } } } closedir(dirp); } - if (!mf_file_rmdir(dir)) + if (!mf_file_rmdir(dir)) { ret = 0; + } return ret; } else { @@ -248,7 +262,7 @@ int mf_file_recursive_rm(const char *dir) } } -int mf_file_cp(const char *src,const char *dst) +int mf_file_cp(const char *src, const char *dst) { FILE *f1 = NULL; FILE *f2 = NULL; @@ -258,15 +272,18 @@ int mf_file_cp(const char *src,const char *dst) size_t num; int ret = 1; - if (!realpath(src, realpath1)) + if (!realpath(src, realpath1)) { return 0; + } - if (realpath(dst, realpath2) && !strcmp(realpath1, realpath2)) + if (realpath(dst, realpath2) && !strcmp(realpath1, realpath2)) { return 0; + } f1 = fopen(src, "rb"); - if (!f1) + if (!f1) { return 0; + } f2 = fopen(dst, "wb"); if (!f2) { @@ -275,8 +292,9 @@ int mf_file_cp(const char *src,const char *dst) } while ((num = fread(buf, 1, sizeof(buf), f1)) > 0) { - if (fwrite(buf, 1, num, f2) != num) + if (fwrite(buf, 1, num, f2) != num) { ret = 0; + } } fclose(f1); @@ -288,14 +306,15 @@ int mf_file_cp(const char *src,const char *dst) int mf_file_mv(const char *src, const char *dst) { struct stat info = {0,}; - if (stat(dst, &info) == 0) + if (stat(dst, &info) == 0) { return 0; + } if (rename(src, dst)) { memset(&info, 0x00, sizeof(struct stat)); if (stat(src, &info) == 0) { if (S_ISREG(info.st_mode)) { - mf_file_cp(src, dst); + mf_file_cp(src, dst); if (chmod(dst, info.st_mode) < 0) { mf_debug("failed to set attributes"); } @@ -313,8 +332,9 @@ int mf_file_mv(const char *src, const char *dst) int mf_remove(const char *filename) { int status = remove(filename); - if (status < 0) + if (status < 0) { return 0; - else + } else { return 1; + } } diff --git a/src/common/mf-fm-svc-wrapper.c b/src/common/mf-fm-svc-wrapper.c index c88a3d2..574c046 100755 --- a/src/common/mf-fm-svc-wrapper.c +++ b/src/common/mf-fm-svc-wrapper.c @@ -37,15 +37,15 @@ #define MF_PATH_INFO_LEN_THRESHOLD 4 #define MF_PATH_INFO_SEP elm_entry_utf8_to_markup("/") typedef struct { - int len_orig; - int len_trans; - char *original; - char *transfer; - bool flag_trans; + int len_orig; + int len_trans; + char *original; + char *transfer; + bool flag_trans; } pNode; -static int __mf_fm_svc_wrapper_get_unique_name(const char *default_dir_full_path, char *original_file_name, - char **unique_file_name, int file_name_type, void *data); +static int __mf_fm_svc_wrapper_get_unique_name(const char *default_dir_full_path, char *original_file_name, + char **unique_file_name, int file_name_type, void *data); /********************* **Function name: __mf_fm_svc_wrapper_COMESFROM **Parameter: @@ -185,15 +185,15 @@ int mf_fm_svc_wrapper_detect_recursion(GString *from, GString *to) } GString *from_parent = mf_fm_svc_wrapper_get_file_parent_path(from); - if (from_parent == NULL) { - return ret; - } + if (from_parent == NULL) { + return ret; + } GString *to_parent = mf_fm_svc_wrapper_get_file_parent_path(to); - if (to_parent == NULL) { - SAFE_FREE_GSTRING(from_parent); - return ret; - } + if (to_parent == NULL) { + SAFE_FREE_GSTRING(from_parent); + return ret; + } if (strncmp(from->str, to_parent->str, lensrc) == 0) { SAFE_FREE_GSTRING(from_parent); SAFE_FREE_GSTRING(to_parent); @@ -207,12 +207,13 @@ int mf_fm_svc_wrapper_detect_recursion(GString *from, GString *to) char *mf_fm_svc_wrapper_get_root_path_by_location(int location) { - if (location == MYFILE_PHONE) + if (location == MYFILE_PHONE) { return g_strdup(PHONE_FOLDER); - else if (location == MYFILE_MMC) + } else if (location == MYFILE_MMC) { return g_strdup(MEMORY_FOLDER); - else + } else { return NULL; + } } /********************* @@ -230,8 +231,9 @@ char *mf_fm_svc_wrapper_get_root_path_by_location(int location) int mf_fm_svc_wrapper_file_auto_rename(void *data, GString *fullpath, int file_name_type, GString **filename) { struct appdata *ap = (struct appdata *)data; - if (ap == NULL) + if (ap == NULL) { mf_debug("appdata is NULL"); + } assert(ap); GString *parent_path = mf_fm_svc_wrapper_get_file_parent_path(fullpath); @@ -362,28 +364,28 @@ int mf_fm_svc_wrapper_classify_dir_list(Eina_List *dir_list, Eina_List **default Eina_List *l = NULL; EINA_LIST_FOREACH(dir_list, l, pNode) { - if (pNode) { - char *real_name = NULL; - bool result = false; - GString *foldername = NULL; - real_name = g_strconcat(pNode->path, "/", pNode->name, NULL); - - if (real_name) { - foldername = g_string_new(real_name); - SAFE_FREE_CHAR(real_name); - } else { - continue; - } - int error_code = mf_fm_svc_wrapper_get_folder_foldersystem(foldername, &result); - - if (error_code == 0 && result == true) { - mf_debug("in default"); - *default_dir_list = eina_list_append(*default_dir_list, pNode); - } else { - mf_debug("in else"); - *user_dir_list = eina_list_append(*user_dir_list, pNode); - } - } + if (pNode) { + char *real_name = NULL; + bool result = false; + GString *foldername = NULL; + real_name = g_strconcat(pNode->path, "/", pNode->name, NULL); + + if (real_name) { + foldername = g_string_new(real_name); + SAFE_FREE_CHAR(real_name); + } else { + continue; + } + int error_code = mf_fm_svc_wrapper_get_folder_foldersystem(foldername, &result); + + if (error_code == 0 && result == true) { + mf_debug("in default"); + *default_dir_list = eina_list_append(*default_dir_list, pNode); + } else { + mf_debug("in else"); + *user_dir_list = eina_list_append(*user_dir_list, pNode); + } + } } return error_code; } @@ -518,16 +520,16 @@ unsigned long mf_fm_svc_wrapper_get_free_space(int state) struct statvfs info; char *path = NULL; - if (state == MYFILE_PHONE) { - if (storage_get_internal_memory_size(&info) < 0) + if (state == MYFILE_PHONE) { + if (storage_get_internal_memory_size(&info) < 0) { return 0; + } } else if (state == MYFILE_MMC) { path = MEMORY_FOLDER; if (-1 == statvfs(path, &info)) { return 0; } - } - else { + } else { return 0; } @@ -711,7 +713,7 @@ char *mf_fm_svc_path_info_retrench(const char *string) mf_retvm_if(string == NULL, g_strdup(MF_PATH_INFO_TRANS_OMIT), "input path is NULL"); char *retrench = NULL; char *utf8_string = elm_entry_utf8_to_markup(string); - if (utf8_string && strlen (string) > MF_PATH_INFO_LEN_THRESHOLD) { + if (utf8_string && strlen(string) > MF_PATH_INFO_LEN_THRESHOLD) { if (g_utf8_strlen(utf8_string, -1) > 2) { retrench = calloc(1, MF_PATH_INFO_RETRENCH); if (retrench) { @@ -782,29 +784,27 @@ char *mf_fm_svc_path_info_translate(char *path_info, int path_info_max_len) params = result; count = g_strv_length(result); - if (count > MF_PATH_INFO_LEVEL_BOUNDARY) - { + if (count > MF_PATH_INFO_LEVEL_BOUNDARY) { top = MF_PATH_INFO_LEVEL_BOUNDARY; flag = FALSE; max_len = path_info_max_len - MF_PATH_INFO_LEVEL_BOUNDARY - MF_PATH_INFO_HEAD_LEN(omit);//(2 is length of ..) ../aa../bb../*** - } - else - { + } else { top = count; flag = TRUE; - max_len = path_info_max_len - (count-1); + max_len = path_info_max_len - (count - 1); } for (i = top; i > 1; i--) { pNode *nodeB = calloc(sizeof(pNode), 1); if (nodeB) { - nodeB->original = elm_entry_utf8_to_markup(params[count -i]); + nodeB->original = elm_entry_utf8_to_markup(params[count - i]); nodeB->len_orig = strlen(params[count - i]); - nodeB->transfer = mf_fm_svc_path_info_retrench(params[count-i]); - if (nodeB->transfer) + nodeB->transfer = mf_fm_svc_path_info_retrench(params[count - i]); + if (nodeB->transfer) { nodeB->len_trans = strlen(nodeB->transfer); - else + } else { mf_error("nodeB->transfer is NULL"); + } nodeB->flag_trans = FALSE; total_len += nodeB->len_orig; @@ -824,8 +824,9 @@ char *mf_fm_svc_path_info_translate(char *path_info, int path_info_max_len) } } - if (total_len <= max_len) - break; + if (total_len <= max_len) { + break; + } } @@ -834,24 +835,25 @@ char *mf_fm_svc_path_info_translate(char *path_info, int path_info_max_len) } char *temp = NULL; char *sep = MF_PATH_INFO_SEP; - EINA_LIST_FOREACH(temp_list, l, pnode) - { - if (pnode) { - pNode *node = (pNode *)pnode; - temp = output; - if (node->flag_trans == TRUE) { - if (output != NULL) - output = g_strconcat(output, sep, node->transfer, NULL); - else - output = g_strdup(node->transfer); - } else { - if (output != NULL) - output = g_strconcat(output, sep ,node->original, NULL); - else - output = g_strdup(node->original); - } - SAFE_FREE_CHAR(temp); - } + EINA_LIST_FOREACH(temp_list, l, pnode) { + if (pnode) { + pNode *node = (pNode *)pnode; + temp = output; + if (node->flag_trans == TRUE) { + if (output != NULL) { + output = g_strconcat(output, sep, node->transfer, NULL); + } else { + output = g_strdup(node->transfer); + } + } else { + if (output != NULL) { + output = g_strconcat(output, sep , node->original, NULL); + } else { + output = g_strdup(node->original); + } + } + SAFE_FREE_CHAR(temp); + } } temp = output; char *last_string = params[count - 1]; @@ -866,10 +868,11 @@ char *mf_fm_svc_path_info_translate(char *path_info, int path_info_max_len) const char *end = NULL; gboolean ret = FALSE; - if (utf8_last != NULL) + if (utf8_last != NULL) { ret = g_utf8_validate(utf8_last, d_value, &end); - else + } else { mf_error("utf8_last is NULL"); + } if (ret == TRUE) { d_value = last_len - strlen(end); utf8_last[d_value] = '\0'; @@ -912,7 +915,7 @@ char *mf_fm_svc_path_info_translate(char *path_info, int path_info_max_len) ** get the unique name of the file name *********************/ static int __mf_fm_svc_wrapper_get_unique_name(const char *default_dir_full_path, char *original_file_name, char **unique_file_name, - int file_name_type, void *data) + int file_name_type, void *data) { //mf_debug("%s %d\n", __func__, __LINE__); assert(unique_file_name); @@ -992,24 +995,26 @@ static int __mf_fm_svc_wrapper_get_unique_name(const char *default_dir_full_path } if (bExt == 0) { - if (file_name_type == FILE_NAME_WITH_BRACKETS) + if (file_name_type == FILE_NAME_WITH_BRACKETS) { new_file_name = g_strdup_printf("%s(%d).%s", file_name_without_ext, nCount, file_ext); - else - new_file_name = g_strdup_printf("%s_%d.%s", file_name_without_ext, nCount, file_ext); } else { + new_file_name = g_strdup_printf("%s_%d.%s", file_name_without_ext, nCount, file_ext); + } + } else { - if (file_name_type == FILE_NAME_WITH_BRACKETS) + if (file_name_type == FILE_NAME_WITH_BRACKETS) { new_file_name = g_strdup_printf("%s(%d)", file_name_without_ext, nCount); - else + } else { new_file_name = g_strdup_printf("%s_%d", file_name_without_ext, nCount); + } } - //mf_debug("new_file_name [%s]", new_file_name); - //mf_debug("original_file_name [%s]", new_file_name); + //mf_debug("new_file_name [%s]", new_file_name); + //mf_debug("original_file_name [%s]", new_file_name); SAFE_FREE_CHAR(file_name_without_ext); #ifdef MYFILE_CHECK_DIR_FILE_PATH_MAXIMUM_LENGTH if (mf_util_character_count_get(new_file_name) > MYFILE_FILE_NAME_LEN_MAX || - mf_util_character_count_get(dir_rel_path) + slash + mf_util_charactor_count_get(new_file_name) > MYFILE_FILE_PATH_LEN_MAX) { + mf_util_character_count_get(dir_rel_path) + slash + mf_util_charactor_count_get(new_file_name) > MYFILE_FILE_PATH_LEN_MAX) { SECURE_DEBUG("......(%s/%s) exceeds maximum length: %d...", dir_rel_path, new_file_name, MYFILE_FILE_PATH_LEN_MAX); error_code = MYFILE_ERR_EXCEED_MAX_LENGTH; goto Exception; @@ -1017,13 +1022,13 @@ static int __mf_fm_svc_wrapper_get_unique_name(const char *default_dir_full_path #endif SECURE_DEBUG("new name is %s\n", new_file_name); //prevent issue fix - /* if (error_code != 0) { - original_file_name = g_strdup(new_file_name); - error_code = MYFILE_ERR_DUPLICATED_NAME; - SAFE_FREE_CHAR(new_file_name); - SAFE_FREE_CHAR(file_ext); - continue; - } else*/ + /* if (error_code != 0) { + original_file_name = g_strdup(new_file_name); + error_code = MYFILE_ERR_DUPLICATED_NAME; + SAFE_FREE_CHAR(new_file_name); + SAFE_FREE_CHAR(file_ext); + continue; + } else*/ { error_code = mf_file_attr_is_duplicated_name(default_dir_full_path, new_file_name); if (error_code == 0) { @@ -1081,8 +1086,8 @@ char *mf_fm_svc_wrapper_translate_path(const char *original_path, MF_TRANS_OPTIO case MF_TRANS_OPTION_POPUP: if (strlen(original_path) > MF_TRANSLATE_LENGTH) { new_path = - g_strconcat(mf_util_get_text(MF_LABEL_DEVICE_MEMORY), MF_TRANSLATE_OMIT_PART, mf_file_get(original_path), "/", - NULL); + g_strconcat(mf_util_get_text(MF_LABEL_DEVICE_MEMORY), MF_TRANSLATE_OMIT_PART, mf_file_get(original_path), "/", + NULL); } else { root_len = strlen(PHONE_FOLDER); new_path = g_strconcat(mf_util_get_text(MF_LABEL_DEVICE_MEMORY), original_path + root_len, "/", NULL); @@ -1103,8 +1108,8 @@ char *mf_fm_svc_wrapper_translate_path(const char *original_path, MF_TRANS_OPTIO case MF_TRANS_OPTION_POPUP: if (strlen(original_path) > MF_TRANSLATE_LENGTH) { new_path = - g_strconcat(mf_util_get_text(MF_LABEL_SD_CARD), MF_TRANSLATE_OMIT_PART, mf_file_get(original_path), - NULL); + g_strconcat(mf_util_get_text(MF_LABEL_SD_CARD), MF_TRANSLATE_OMIT_PART, mf_file_get(original_path), + NULL); } else { root_len = strlen(MEMORY_FOLDER); new_path = g_strconcat(mf_util_get_text(MF_LABEL_SD_CARD), original_path + root_len, "/", NULL); @@ -1152,7 +1157,7 @@ Eina_List *mf_fm_svc_wrapper_level_path_get(const char *original_path, int view_ default: return NULL; } - current_path = current_path+strlen(root_path)+1; + current_path = current_path + strlen(root_path) + 1; path_list = eina_list_append(path_list, g_strdup(root_path)); gchar **result = NULL; gchar **params = NULL; @@ -1166,10 +1171,10 @@ Eina_List *mf_fm_svc_wrapper_level_path_get(const char *original_path, int view_ } path_list = eina_list_append(path_list, level_path); } - + g_strfreev(result); - - }else { + + } else { path_list = eina_list_append(path_list, g_strdup(original_path)); } } @@ -1212,8 +1217,8 @@ char *mf_fm_svc_get_file_name(GString *path) filename = mf_fm_svc_wrapper_get_file_name(path); if (filename != NULL) { - guide_text = mf_fm_svc_get_file_name_without_ext(filename->str); - SAFE_FREE_GSTRING(filename); + guide_text = mf_fm_svc_get_file_name_without_ext(filename->str); + SAFE_FREE_GSTRING(filename); } return guide_text; } @@ -1230,7 +1235,7 @@ int mf_fm_svc_wrapper_create_p(const char *fullpath) } if (!mf_mkpath(fullpath)) { error_code = MYFILE_ERR_DIR_CREATE_FAIL; - goto EXIT; + goto EXIT; } EXIT: diff --git a/src/common/mf-fs-monitor.c b/src/common/mf-fs-monitor.c index 6203739..ea08e48 100755 --- a/src/common/mf-fs-monitor.c +++ b/src/common/mf-fs-monitor.c @@ -71,13 +71,13 @@ Eina_Bool __mf_fs_monitor_dir_pipe_add_cb(void *data) SAFE_FREE_CHAR(ap->mf_Status.EnterFrom); ap->mf_Status.EnterFrom = mf_genlist_first_item_name_get(ap->mf_MainWindow.pNaviGenlist); } - if (ap->mf_Status.more == MORE_EDIT - || ap->mf_Status.more == MORE_SHARE_EDIT - || ap->mf_Status.more == MORE_EDIT_COPY - || ap->mf_Status.more == MORE_EDIT_MOVE - || ap->mf_Status.more == MORE_EDIT_DELETE - || ap->mf_Status.more == MORE_EDIT_DETAIL - ) { + if (ap->mf_Status.more == MORE_EDIT + || ap->mf_Status.more == MORE_SHARE_EDIT + || ap->mf_Status.more == MORE_EDIT_COPY + || ap->mf_Status.more == MORE_EDIT_MOVE + || ap->mf_Status.more == MORE_EDIT_DELETE + || ap->mf_Status.more == MORE_EDIT_DETAIL + ) { pre_more = ap->mf_Status.more; ap->mf_Status.more = MORE_DEFAULT; folder_list = mf_edit_get_selected_folder_list(); @@ -85,13 +85,13 @@ Eina_Bool __mf_fs_monitor_dir_pipe_add_cb(void *data) } mf_object_box_clear(ap->mf_MainWindow.pNaviBox); mf_view_update(ap); - if (pre_more == MORE_EDIT - || pre_more == MORE_SHARE_EDIT - || pre_more == MORE_EDIT_COPY - || pre_more == MORE_EDIT_MOVE - || pre_more == MORE_EDIT_DELETE - || pre_more == MORE_EDIT_DETAIL - ) { + if (pre_more == MORE_EDIT + || pre_more == MORE_SHARE_EDIT + || pre_more == MORE_EDIT_COPY + || pre_more == MORE_EDIT_MOVE + || pre_more == MORE_EDIT_DELETE + || pre_more == MORE_EDIT_DETAIL + ) { ap->mf_Status.more = pre_more; mf_edit_view_refresh(ap, &file_list, &folder_list); } @@ -108,14 +108,14 @@ static void __mf_callback_dir_pipe_cb(void *data, void *buffer, unsigned int nby struct appdata *ap = (struct appdata *)data; mf_retm_if(ap == NULL, "appdata is NULL"); if (!(ap->mf_Status.more == MORE_DEFAULT - || ap->mf_Status.more == MORE_INTERNAL_COPY - || ap->mf_Status.more == MORE_INTERNAL_MOVE - || ap->mf_Status.more == MORE_EDIT - || ap->mf_Status.more == MORE_EDIT_COPY - || ap->mf_Status.more == MORE_EDIT_MOVE - || ap->mf_Status.more == MORE_EDIT_DELETE - || ap->mf_Status.more == MORE_THUMBNAIL_RENAME - || ap->mf_Status.more == MORE_EDIT_DETAIL)) { + || ap->mf_Status.more == MORE_INTERNAL_COPY + || ap->mf_Status.more == MORE_INTERNAL_MOVE + || ap->mf_Status.more == MORE_EDIT + || ap->mf_Status.more == MORE_EDIT_COPY + || ap->mf_Status.more == MORE_EDIT_MOVE + || ap->mf_Status.more == MORE_EDIT_DELETE + || ap->mf_Status.more == MORE_THUMBNAIL_RENAME + || ap->mf_Status.more == MORE_EDIT_DETAIL)) { return; } if (ap->mf_Status.view_type == mf_view_root || ap->mf_Status.view_type == mf_view_root_category || ap->mf_Status.view_type == mf_view_storage) { @@ -138,8 +138,9 @@ static void __mf_callback_dir_pipe_cb(void *data, void *buffer, unsigned int nby fs_monitor_update_timer = ecore_timer_add(1, (Ecore_Task_Cb)__mf_fs_monitor_dir_pipe_add_cb, ap); SAFE_FREE_CHAR(fs_monitor_update_item_name); } - if (msg->name) + if (msg->name) { free(msg->name); + } mf_inotify_handle_request_handled_send(); } } @@ -166,7 +167,7 @@ int mf_fs_monitor_add_dir_watch(const char *path, void *data) SAFE_FREE_CHAR(fs_monitor_dir_path); SAFE_FREE_CHAR(fs_monitor_update_item_name); - + SAFE_DEL_ECORE_TIMER(fs_monitor_update_timer); monitor_refresh_start_flag = EINA_FALSE; fs_monitor_dir_path = g_strdup(path); @@ -194,7 +195,7 @@ int mf_fs_monitor_create(void *data) if (fs_monitor_pipe) { ecore_pipe_del(fs_monitor_pipe); } - + SAFE_DEL_ECORE_TIMER(fs_monitor_update_timer); monitor_refresh_start_flag = EINA_FALSE; diff --git a/src/common/mf-inotify-handle.c b/src/common/mf-inotify-handle.c index f739392..2bb9639 100755 --- a/src/common/mf-inotify-handle.c +++ b/src/common/mf-inotify-handle.c @@ -132,28 +132,34 @@ static gpointer __mf_inotify_handle_watch_thread(gpointer user_data) mf_inotify_event s_event = MF_INOTI_NONE; SECURE_DEBUG("mask=%x dir=%s len=%d name=%s", - pevent->mask, (pevent->mask & IN_ISDIR) ? "yes" : "no", pevent->len, (pevent->len) ? pevent->name : NULL); + pevent->mask, (pevent->mask & IN_ISDIR) ? "yes" : "no", pevent->len, (pevent->len) ? pevent->name : NULL); if (pevent->len && strncmp(pevent->name, ".", 1) == 0) { s_event = MF_INOTI_NONE; } else if (pevent->mask & IN_ISDIR) { - if (pevent->mask & IN_DELETE_SELF) + if (pevent->mask & IN_DELETE_SELF) { s_event = MF_INOTI_DELETE_SELF; + } - if (pevent->mask & IN_MOVE_SELF) + if (pevent->mask & IN_MOVE_SELF) { s_event = MF_INOTI_MOVE_SELF; + } - if (pevent->mask & IN_CREATE) + if (pevent->mask & IN_CREATE) { s_event = MF_INOTI_CREATE; + } - if (pevent->mask & IN_DELETE) + if (pevent->mask & IN_DELETE) { s_event = MF_INOTI_DELETE; + } - if (pevent->mask & IN_MOVED_FROM) + if (pevent->mask & IN_MOVED_FROM) { s_event = MF_INOTI_MOVE_OUT; + } - if (pevent->mask & IN_MOVED_TO) + if (pevent->mask & IN_MOVED_TO) { s_event = MF_INOTI_MOVE_IN; + } } else { if (pevent->mask & IN_CREATE) { s_event = MF_INOTI_NONE; @@ -169,14 +175,17 @@ static gpointer __mf_inotify_handle_watch_thread(gpointer user_data) handle->prev_event = 0; } - if (pevent->mask & IN_DELETE) + if (pevent->mask & IN_DELETE) { s_event = MF_INOTI_DELETE; + } - if (pevent->mask & IN_MOVED_FROM) + if (pevent->mask & IN_MOVED_FROM) { s_event = MF_INOTI_MOVE_OUT; + } - if (pevent->mask & IN_MOVED_TO) + if (pevent->mask & IN_MOVED_TO) { s_event = MF_INOTI_MOVE_IN; + } } mf_debug("s_event : %d, prev_event: %x, callback : %p", s_event, handle->prev_event, handle->callback); diff --git a/src/common/mf-launch.c b/src/common/mf-launch.c index 7e7b52c..8145db0 100755 --- a/src/common/mf-launch.c +++ b/src/common/mf-launch.c @@ -102,25 +102,25 @@ static int __mf_launch_get_share_files(mf_launch_share_u *selected_files, Eina_L Eina_List *l = NULL; char *first_file = NULL; GString *fullpath = NULL; - EINA_LIST_FOREACH(selected_list, l, fullpath) { - if (fullpath != NULL) { - if (first_file == NULL && selected_files->multi_files == NULL) { - first_file = g_strdup(fullpath->str); - } else { - if (selected_files->multi_files == NULL) { - selected_files->multi_files = calloc(eina_list_count(selected_list), sizeof(char *)); - if (selected_files->multi_files) { - selected_files->multi_files[0] = g_strdup(first_file); - SAFE_FREE_CHAR(first_file); - selected_files->multi_files[file_count] = g_strdup(fullpath->str); - } - } else { + EINA_LIST_FOREACH(selected_list, l, fullpath) { + if (fullpath != NULL) { + if (first_file == NULL && selected_files->multi_files == NULL) { + first_file = g_strdup(fullpath->str); + } else { + if (selected_files->multi_files == NULL) { + selected_files->multi_files = calloc(eina_list_count(selected_list), sizeof(char *)); + if (selected_files->multi_files) { + selected_files->multi_files[0] = g_strdup(first_file); + SAFE_FREE_CHAR(first_file); selected_files->multi_files[file_count] = g_strdup(fullpath->str); } + } else { + selected_files->multi_files[file_count] = g_strdup(fullpath->str); } - file_count++; } + file_count++; } + } if (first_file) { selected_files->single_file = first_file; @@ -147,7 +147,7 @@ void mf_launch_item_share_file(void *data, Evas_Object * obj, void *event_info) mf_error(" app_control_create failed"); return ; } - mf_error("item_data->m_ItemName->str is %s",item_data->m_ItemName->str); + mf_error("item_data->m_ItemName->str is %s", item_data->m_ItemName->str); char prefix_file[BUFF_SIZE] = {0,}; snprintf(prefix_file, BUFF_SIZE, "%s%s", MF_SHARE_FILE_PREFIX, item_data->m_ItemName->str); @@ -165,14 +165,14 @@ void mf_launch_item_share_file(void *data, Evas_Object * obj, void *event_info) } //app_control_add_extra_data_array(handle, MF_SHARE_SVC_FILE_PATH, &item_data->m_ItemName->str, 1); app_control_add_extra_data(handle, MF_SHARE_SVC_FILE_PATH, item_data->m_ItemName->str); -/* - ret = app_control_set_window(handle, elm_win_xwindow_get(ap->mf_MainWindow.pWindow)); - if (ret != APP_CONTROL_ERROR_NONE) { - app_control_destroy(handle); - mf_debug("app_control_set_window()... [0x%x]", ret); - return; - } -*/ + /* + ret = app_control_set_window(handle, elm_win_xwindow_get(ap->mf_MainWindow.pWindow)); + if (ret != APP_CONTROL_ERROR_NONE) { + app_control_destroy(handle); + mf_debug("app_control_set_window()... [0x%x]", ret); + return; + } + */ ret = app_control_send_launch_request(handle, NULL, NULL); if (ret == APP_CONTROL_ERROR_APP_NOT_FOUND) { mf_popup_create_popup(ap, POPMODE_TEXT, NULL, MF_LABEL_NO_APP, NULL, NULL, NULL, NULL, NULL); @@ -212,7 +212,7 @@ void mf_launch_item_share(void *data, Evas_Object * obj, void *event_info) mf_info("pLongpressPopup is deleted"); SAFE_FREE_OBJ(ap->mf_MainWindow.pLongpressPopup); //other files will share directly - mf_launch_item_share_file(data,obj,event_info); + mf_launch_item_share_file(data, obj, event_info); MF_TRACE_END; } @@ -338,13 +338,13 @@ bool mf_launch_share(void *data) } else { goto END; } -/* - ret = app_control_set_window(handle, elm_win_xwindow_get(ap->mf_MainWindow.pWindow)); - if (ret != APP_CONTROL_ERROR_NONE) { - mf_debug("app_control_set_window()... [0x%x]", ret); - goto END; - } -*/ + /* + ret = app_control_set_window(handle, elm_win_xwindow_get(ap->mf_MainWindow.pWindow)); + if (ret != APP_CONTROL_ERROR_NONE) { + mf_debug("app_control_set_window()... [0x%x]", ret); + goto END; + } + */ ret = app_control_set_launch_mode(handle, APP_CONTROL_LAUNCH_MODE_GROUP); if (ret != APP_CONTROL_ERROR_NONE) { @@ -484,13 +484,13 @@ void mf_launch_load_storage(void *data) mf_debug("app_control_set_operation()... [0x%x]", ret); goto END; } -/* - ret = app_control_set_window(app_control, elm_win_xwindow_get(ap->mf_MainWindow.pWindow)); - if (ret != APP_CONTROL_ERROR_NONE) { - mf_debug("app_control_set_uri()... [0x%x]", ret); - goto END; - } -*/ + /* + ret = app_control_set_window(app_control, elm_win_xwindow_get(ap->mf_MainWindow.pWindow)); + if (ret != APP_CONTROL_ERROR_NONE) { + mf_debug("app_control_set_uri()... [0x%x]", ret); + goto END; + } + */ ret = app_control_set_app_id(app_control, STORAGE_UG_NAME); if (ret != APP_CONTROL_ERROR_NONE) { mf_debug("app_control_set_uri()... [0x%x]", ret); @@ -576,7 +576,7 @@ void mf_launch_add_recent_files(void *data, const char *path) if (list) { int index = 0; int list_len = eina_list_count(list); - for (; (list_len-index) >= RECENT_FILES_COUNT_MAX; index++) { + for (; (list_len - index) >= RECENT_FILES_COUNT_MAX; index++) { char *cross_path = eina_list_nth(list, index); mf_media_delete_recent_files(ap->mf_MainWindow.mfd_handle, cross_path); } @@ -618,10 +618,10 @@ void mf_launch_load_ug_myfile(void *data) app_control_add_extra_data(app_control, "file_type", ap->mf_Bundle.file_type); app_control_add_extra_data(app_control, "marked_mode", ap->mf_Bundle.marked_mode); //ug = ug_create(NULL, MYFILE_UG_NAME, UG_MODE_FULLVIEW, service, &cbs); -/* - ret = app_control_set_window(app_control, elm_win_xwindow_get(ap->mf_MainWindow.pWindow)); - mf_retm_if(ret != APP_CONTROL_ERROR_NONE, "service create failed"); -*/ + /* + ret = app_control_set_window(app_control, elm_win_xwindow_get(ap->mf_MainWindow.pWindow)); + mf_retm_if(ret != APP_CONTROL_ERROR_NONE, "service create failed"); + */ ret = app_control_set_app_id(app_control, MYFILE_UG_NAME); if (ret != APP_CONTROL_ERROR_NONE) { app_control_destroy(app_control); @@ -690,8 +690,8 @@ int mf_launch_service(void *data, char *path) app_control_add_extra_data(app_control, "Path", path); app_control_set_launch_mode(app_control, APP_CONTROL_LAUNCH_MODE_GROUP); } else if (category == FILE_TYPE_SOUND - || category == FILE_TYPE_MUSIC - || category == FILE_TYPE_VOICE) { + || category == FILE_TYPE_MUSIC + || category == FILE_TYPE_VOICE) { mf_debug("category is sound"); app_control_add_extra_data(app_control, "View By", "By Folder"); @@ -700,19 +700,19 @@ int mf_launch_service(void *data, char *path) if (sort_type == MYFILE_SORT_BY_NAME_A2Z) { app_control_add_extra_data(app_control, "sort_type", "MYFILE_SORT_BY_NAME_A2Z"); - } else if(sort_type == MYFILE_SORT_BY_SIZE_S2L) { + } else if (sort_type == MYFILE_SORT_BY_SIZE_S2L) { app_control_add_extra_data(app_control, "sort_type", "MYFILE_SORT_BY_SIZE_S2L"); - } else if(sort_type == MYFILE_SORT_BY_DATE_O2R) { + } else if (sort_type == MYFILE_SORT_BY_DATE_O2R) { app_control_add_extra_data(app_control, "sort_type", "MYFILE_SORT_BY_DATE_O2R"); - } else if(sort_type == MYFILE_SORT_BY_TYPE_A2Z) { + } else if (sort_type == MYFILE_SORT_BY_TYPE_A2Z) { app_control_add_extra_data(app_control, "sort_type", "MYFILE_SORT_BY_TYPE_A2Z"); - } else if(sort_type == MYFILE_SORT_BY_NAME_Z2A) { + } else if (sort_type == MYFILE_SORT_BY_NAME_Z2A) { app_control_add_extra_data(app_control, "sort_type", "MYFILE_SORT_BY_NAME_Z2A"); - } else if(sort_type == MYFILE_SORT_BY_SIZE_L2S) { + } else if (sort_type == MYFILE_SORT_BY_SIZE_L2S) { app_control_add_extra_data(app_control, "sort_type", "MYFILE_SORT_BY_SIZE_L2S"); - } else if(sort_type == MYFILE_SORT_BY_DATE_R2O) { + } else if (sort_type == MYFILE_SORT_BY_DATE_R2O) { app_control_add_extra_data(app_control, "sort_type", "MYFILE_SORT_BY_DATE_R2O"); - } else if(sort_type == MYFILE_SORT_BY_TYPE_Z2A) { + } else if (sort_type == MYFILE_SORT_BY_TYPE_Z2A) { app_control_add_extra_data(app_control, "sort_type", "MYFILE_SORT_BY_TYPE_Z2A"); } if (ap->mf_Status.view_type != mf_view_root_category) { @@ -752,7 +752,7 @@ int mf_launch_service(void *data, char *path) ap->mf_Status.launch_path = g_strdup(path); mf_debug("app_control_send_launch_request()... [0x%x]", ret); /*reflesh recent files list in root view */ - mf_info("ap->mf_Status.view_type is %d, ap->mf_Status.flag_tab is %d",ap->mf_Status.view_type,ap->mf_Status.flag_tab); + mf_info("ap->mf_Status.view_type is %d, ap->mf_Status.flag_tab is %d", ap->mf_Status.view_type, ap->mf_Status.flag_tab); if (ap->mf_Status.view_type == mf_view_root && ap->mf_Status.flag_tab == MF_TAB_RIGHT && ap->mf_Status.more == MORE_DEFAULT) { //__mf_root_view_recent_files_content_create(ap); } diff --git a/src/common/mf-log.c b/src/common/mf-log.c index 692f161..26bb766 100755 --- a/src/common/mf-log.c +++ b/src/common/mf-log.c @@ -64,8 +64,9 @@ void mf_log_finalize() int mf_log_record(char *filename, const char *function, int line, char *fmt, ...) { - if (g_fp == NULL) + if (g_fp == NULL) { return MYFILE_ERR_INVALID_ARG; + } char *message = NULL; va_list arg_ptr; diff --git a/src/common/mf-media-content.c b/src/common/mf-media-content.c index acfdf1a..cc8c0cc 100755 --- a/src/common/mf-media-content.c +++ b/src/common/mf-media-content.c @@ -69,7 +69,7 @@ int mf_media_content_create_filter(filter_h *filter, mf_condition_s *condition) } if (condition->cond) { ret = media_filter_set_condition(tmp_filter, condition->cond, - condition->collate_type); + condition->collate_type); if (ret != MEDIA_CONTENT_ERROR_NONE) { mf_debug("Fail to set condition"); goto ERROR; @@ -98,8 +98,8 @@ int mf_media_content_create_filter(filter_h *filter, mf_condition_s *condition) */ *filter = tmp_filter; return ret; - ERROR: - if (tmp_filter) { +ERROR: + if (tmp_filter) { media_filter_destroy(tmp_filter); tmp_filter = NULL; } @@ -148,7 +148,7 @@ int mf_media_content_data_count_get(const char *condition) return count; } -int mf_media_content_data_get(void *data, char *condition, bool (*func) (media_info_h media, void *data)) +int mf_media_content_data_get(void *data, char *condition, bool (*func)(media_info_h media, void *data)) { filter_h filter = NULL; int ret = -1; @@ -167,8 +167,8 @@ int mf_media_content_data_get(void *data, char *condition, bool (*func) (media_i } ret = media_info_foreach_media_from_db(filter, - (media_info_cb)func, - data); + (media_info_cb)func, + data); if (ret != 0) { mf_debug("Fail to parse folders in db: %d", ret); } diff --git a/src/common/mf-media-data.c b/src/common/mf-media-data.c index 85137e7..d50cac3 100755 --- a/src/common/mf-media-data.c +++ b/src/common/mf-media-data.c @@ -36,9 +36,10 @@ static int __mf_media_data_sort_by_size_cb_L2S(const void *d1, const void *d2); void mf_media_data_item_free(media_data_s **item_data) { - if (*item_data == NULL) + if (*item_data == NULL) { return; - + } + SAFE_FREE_CHAR((*item_data)->fullpath); SAFE_FREE_CHAR((*item_data)->display_name); SAFE_FREE_CHAR((*item_data)->thumbnail_path); @@ -84,15 +85,15 @@ media_data_s *mf_media_data_get_by_media_handle(media_info_h media) } - if (content_type == MEDIA_CONTENT_TYPE_IMAGE) /* The device's internal storage */ + if (content_type == MEDIA_CONTENT_TYPE_IMAGE) { /* The device's internal storage */ item_data->file_type = FILE_TYPE_IMAGE; - else if (content_type == MEDIA_CONTENT_TYPE_VIDEO) /* The device's external storage */ + } else if (content_type == MEDIA_CONTENT_TYPE_VIDEO) { /* The device's external storage */ item_data->file_type = FILE_TYPE_VIDEO; - else if (content_type == MEDIA_CONTENT_TYPE_SOUND) + } else if (content_type == MEDIA_CONTENT_TYPE_SOUND) { item_data->file_type = FILE_TYPE_SOUND; - else if (content_type == MEDIA_CONTENT_TYPE_MUSIC) /* The cloud storage - 101 */ + } else if (content_type == MEDIA_CONTENT_TYPE_MUSIC) { /* The cloud storage - 101 */ item_data->file_type = FILE_TYPE_MUSIC; - else if (content_type == MEDIA_CONTENT_TYPE_OTHERS) { + } else if (content_type == MEDIA_CONTENT_TYPE_OTHERS) { fsFileType ftype = FILE_TYPE_NONE; int ret = mf_file_attr_get_file_category(item_data->fullpath, &ftype); if (ret != MYFILE_ERR_NONE || ftype == FILE_TYPE_NONE || ftype == FILE_TYPE_ETC) { @@ -100,70 +101,71 @@ media_data_s *mf_media_data_get_by_media_handle(media_info_h media) } item_data->file_type = ftype; - } - else { + } else { mf_debug("content_type[%d]!", content_type); } switch (item_data->file_type) { - case FILE_TYPE_IMAGE: - case FILE_TYPE_VIDEO: - case FILE_TYPE_MUSIC: - case FILE_TYPE_SOUND: - case FILE_TYPE_DOC: - case FILE_TYPE_PDF: - case FILE_TYPE_PPT: - case FILE_TYPE_EXCEL: - case FILE_TYPE_TXT: - case FILE_TYPE_HWP: - case FILE_TYPE_SPD: - case FILE_TYPE_SNB: - if (mf_file_exists(item_data->fullpath)) {//Fixed the P131126-04292, sometimes, if the file isn't existed - //if (content_type != MEDIA_CONTENT_TYPE_SOUND && content_type != MEDIA_CONTENT_TYPE_MUSIC) {//For sound file, don't need to get thumbnail. - int retcode = media_info_get_thumbnail_path(media, &(item_data->thumbnail_path)); - if (retcode != MEDIA_CONTENT_ERROR_NONE) { - mf_debug("Get media thumbnail path failed!![%d]", retcode); - goto MF_LOCAL_FAILED; - } - //} - //mf_debug("thumb_url: %s", item_data->thumbnail_path); - - media_content_storage_e storage_type = 0; - if (media_info_get_storage_type(media, &storage_type) != MEDIA_CONTENT_ERROR_NONE) { - mf_debug("Get storage type failed!"); - goto MF_LOCAL_FAILED; - } - if (storage_type == MEDIA_CONTENT_STORAGE_INTERNAL) /* The device's internal storage */ - item_data->storage_type = MYFILE_PHONE; - else if (storage_type == MEDIA_CONTENT_STORAGE_EXTERNAL) /* The device's external storage */ - item_data->storage_type = MYFILE_MMC; - else - mf_debug("Undefined mode[%d]!", storage_type); - unsigned long long file_size = 0; - media_info_get_size(media, &file_size); - item_data->size = file_size; - - time_t added_time = {0}; - int ret = media_info_get_modified_time(media, &added_time); - if (ret == MEDIA_CONTENT_ERROR_NONE)//Fix prevent problem - item_data->create_date = added_time; - - return item_data; - } else{ - mf_media_data_item_free(&item_data); + case FILE_TYPE_IMAGE: + case FILE_TYPE_VIDEO: + case FILE_TYPE_MUSIC: + case FILE_TYPE_SOUND: + case FILE_TYPE_DOC: + case FILE_TYPE_PDF: + case FILE_TYPE_PPT: + case FILE_TYPE_EXCEL: + case FILE_TYPE_TXT: + case FILE_TYPE_HWP: + case FILE_TYPE_SPD: + case FILE_TYPE_SNB: + if (mf_file_exists(item_data->fullpath)) {//Fixed the P131126-04292, sometimes, if the file isn't existed + //if (content_type != MEDIA_CONTENT_TYPE_SOUND && content_type != MEDIA_CONTENT_TYPE_MUSIC) {//For sound file, don't need to get thumbnail. + int retcode = media_info_get_thumbnail_path(media, &(item_data->thumbnail_path)); + if (retcode != MEDIA_CONTENT_ERROR_NONE) { + mf_debug("Get media thumbnail path failed!![%d]", retcode); + goto MF_LOCAL_FAILED; + } + //} + //mf_debug("thumb_url: %s", item_data->thumbnail_path); + + media_content_storage_e storage_type = 0; + if (media_info_get_storage_type(media, &storage_type) != MEDIA_CONTENT_ERROR_NONE) { + mf_debug("Get storage type failed!"); + goto MF_LOCAL_FAILED; + } + if (storage_type == MEDIA_CONTENT_STORAGE_INTERNAL) { /* The device's internal storage */ + item_data->storage_type = MYFILE_PHONE; + } else if (storage_type == MEDIA_CONTENT_STORAGE_EXTERNAL) { /* The device's external storage */ + item_data->storage_type = MYFILE_MMC; + } else { + mf_debug("Undefined mode[%d]!", storage_type); + } + unsigned long long file_size = 0; + media_info_get_size(media, &file_size); + item_data->size = file_size; + + time_t added_time = {0}; + int ret = media_info_get_modified_time(media, &added_time); + if (ret == MEDIA_CONTENT_ERROR_NONE) { //Fix prevent problem + item_data->create_date = added_time; } - break; - default: + + return item_data; + } else { mf_media_data_item_free(&item_data); - break; - } - return NULL; + } + break; + default: + mf_media_data_item_free(&item_data); + break; + } + return NULL; MF_LOCAL_FAILED: - mf_media_data_item_free(&item_data); - return NULL; + mf_media_data_item_free(&item_data); + return NULL; } diff --git a/src/common/mf-storage-space.c b/src/common/mf-storage-space.c index 3efd806..de34a64 100755 --- a/src/common/mf-storage-space.c +++ b/src/common/mf-storage-space.c @@ -47,36 +47,36 @@ static bool __mf_storage_main_media_item_cb(media_info_h media, void *data) mf_file_attr_get_file_category(file_path, &file_type); //mf_error(">>>>file_path = %s, file_type=%d, FILE_TYPE_DOC=%d,FILE_TYPE_TXT=%d", file_path, file_type, FILE_TYPE_DOC,FILE_TYPE_TXT); switch (file_type) { - case FILE_TYPE_DOC: - case FILE_TYPE_PDF: - case FILE_TYPE_PPT: - case FILE_TYPE_EXCEL: - case FILE_TYPE_TXT: - case FILE_TYPE_HWP: - case FILE_TYPE_SPD: - case FILE_TYPE_SNB:{ - //mf_error(">>>>file_type = %d", file_type); - if (!mf_file_exists(file_path)) { - free(file_path); - file_path = NULL; - return true; - } - if (file_path != NULL) { - free(file_path); - file_path = NULL; - } - - media_info_get_size(media, &size); - //mf_error(">>>>size = %d", size); - status->total_size += size; - break; + case FILE_TYPE_DOC: + case FILE_TYPE_PDF: + case FILE_TYPE_PPT: + case FILE_TYPE_EXCEL: + case FILE_TYPE_TXT: + case FILE_TYPE_HWP: + case FILE_TYPE_SPD: + case FILE_TYPE_SNB: { + //mf_error(">>>>file_type = %d", file_type); + if (!mf_file_exists(file_path)) { + free(file_path); + file_path = NULL; + return true; } - default: - if (file_path != NULL) { - free(file_path); - file_path = NULL; - } - break; + if (file_path != NULL) { + free(file_path); + file_path = NULL; + } + + media_info_get_size(media, &size); + //mf_error(">>>>size = %d", size); + status->total_size += size; + break; + } + default: + if (file_path != NULL) { + free(file_path); + file_path = NULL; + } + break; } } else { char *file_path = NULL; @@ -90,8 +90,9 @@ static bool __mf_storage_main_media_item_cb(media_info_h media, void *data) free(file_path); return true; } - if (file_path != NULL) + if (file_path != NULL) { free(file_path); + } media_info_get_size(media, &size); status->total_size += size; @@ -321,45 +322,49 @@ void __mf_storage_main_pipe_cb(void *data, void *buffer, unsigned int nbyte) mf_debug("update_info : %d", update_info->type); switch (update_info->type) { - case MF_STORAGE_IMAGE:{ - if (storage_status->update_cb) - storage_status->update_cb(mf_tray_item_category_image, update_info, storage_status->pUserData); + case MF_STORAGE_IMAGE: { + if (storage_status->update_cb) { + storage_status->update_cb(mf_tray_item_category_image, update_info, storage_status->pUserData); + } - storage_status->image_size_info.total_size = update_info->total_size; - storage_status->image_size_info.type= update_info->type; - break; - } - case MF_STORAGE_VIDEO:{ - if (storage_status->update_cb) - storage_status->update_cb(mf_tray_item_category_video, update_info, storage_status->pUserData); - storage_status->video_size_info.total_size = update_info->total_size; - storage_status->video_size_info.type= update_info->type; - break; - } - case MF_STORAGE_SOUND:{ - if (storage_status->update_cb) - storage_status->update_cb(mf_tray_item_category_sounds, update_info, storage_status->pUserData); - storage_status->sound_size_info.total_size = update_info->total_size; - storage_status->sound_size_info.type= update_info->type; - break; - } - case MF_STORAGE_DOCUMENT:{ - if (storage_status->update_cb) - storage_status->update_cb(mf_tray_item_category_document, update_info, storage_status->pUserData); - storage_status->document_size_info.total_size = update_info->total_size; - storage_status->document_size_info.type= update_info->type; - break; - } - case MF_STORAGE_RECENT:{ - /*if (storage_status->update_cb) - storage_status->update_cb(mf_tray_item_category_recent, update_info, storage_status->pUserData); - storage_status->recent_size_info.total_size = update_info->total_size; - storage_status->recent_size_info.type= update_info->type;*/ - break; - } - default: - mf_error("wrong update type"); - break; + storage_status->image_size_info.total_size = update_info->total_size; + storage_status->image_size_info.type = update_info->type; + break; + } + case MF_STORAGE_VIDEO: { + if (storage_status->update_cb) { + storage_status->update_cb(mf_tray_item_category_video, update_info, storage_status->pUserData); + } + storage_status->video_size_info.total_size = update_info->total_size; + storage_status->video_size_info.type = update_info->type; + break; + } + case MF_STORAGE_SOUND: { + if (storage_status->update_cb) { + storage_status->update_cb(mf_tray_item_category_sounds, update_info, storage_status->pUserData); + } + storage_status->sound_size_info.total_size = update_info->total_size; + storage_status->sound_size_info.type = update_info->type; + break; + } + case MF_STORAGE_DOCUMENT: { + if (storage_status->update_cb) { + storage_status->update_cb(mf_tray_item_category_document, update_info, storage_status->pUserData); + } + storage_status->document_size_info.total_size = update_info->total_size; + storage_status->document_size_info.type = update_info->type; + break; + } + case MF_STORAGE_RECENT: { + /*if (storage_status->update_cb) + storage_status->update_cb(mf_tray_item_category_recent, update_info, storage_status->pUserData); + storage_status->recent_size_info.total_size = update_info->total_size; + storage_status->recent_size_info.type= update_info->type;*/ + break; + } + default: + mf_error("wrong update type"); + break; } } @@ -397,60 +402,59 @@ static void *__mf_storage_main_thread_start_routine(void *data) } switch (type) { - case MF_STORAGE_IMAGE: - { - double images_size = __mf_storage_main_picture_status_get(); - mf_debug("images_size = %f", images_size); - - Update_Info images_info; - memset(&images_info, 0, sizeof(Update_Info)); - images_info.type = MF_STORAGE_IMAGE; - images_info.total_size = images_size; - if (storage_status->pipe) - ecore_pipe_write(storage_status->pipe, &images_info, sizeof(images_info)); + case MF_STORAGE_IMAGE: { + double images_size = __mf_storage_main_picture_status_get(); + mf_debug("images_size = %f", images_size); + + Update_Info images_info; + memset(&images_info, 0, sizeof(Update_Info)); + images_info.type = MF_STORAGE_IMAGE; + images_info.total_size = images_size; + if (storage_status->pipe) { + ecore_pipe_write(storage_status->pipe, &images_info, sizeof(images_info)); } - break; - case MF_STORAGE_VIDEO: - { - double video_size = __mf_storage_main_video_status_get(); - mf_debug("video_size = %f", video_size); - - Update_Info video_info; - memset(&video_info, 0, sizeof(Update_Info)); - video_info.type = MF_STORAGE_VIDEO; - video_info.total_size = video_size; - if (storage_status->pipe) - ecore_pipe_write(storage_status->pipe, &video_info, sizeof(video_info)); + } + break; + case MF_STORAGE_VIDEO: { + double video_size = __mf_storage_main_video_status_get(); + mf_debug("video_size = %f", video_size); + + Update_Info video_info; + memset(&video_info, 0, sizeof(Update_Info)); + video_info.type = MF_STORAGE_VIDEO; + video_info.total_size = video_size; + if (storage_status->pipe) { + ecore_pipe_write(storage_status->pipe, &video_info, sizeof(video_info)); } - break; - case MF_STORAGE_SOUND: - { - double sound_size = __mf_storage_main_sound_status_get(); - mf_debug("sound_size = %f", sound_size); - - Update_Info sound_info; - memset(&sound_info, 0, sizeof(Update_Info)); - sound_info.type = MF_STORAGE_SOUND; - sound_info.total_size = sound_size; - if (storage_status->pipe) - ecore_pipe_write(storage_status->pipe, &sound_info, sizeof(sound_info)); + } + break; + case MF_STORAGE_SOUND: { + double sound_size = __mf_storage_main_sound_status_get(); + mf_debug("sound_size = %f", sound_size); + + Update_Info sound_info; + memset(&sound_info, 0, sizeof(Update_Info)); + sound_info.type = MF_STORAGE_SOUND; + sound_info.total_size = sound_size; + if (storage_status->pipe) { + ecore_pipe_write(storage_status->pipe, &sound_info, sizeof(sound_info)); } - break; - case MF_STORAGE_DOCUMENT: - { - double document_size = __mf_storage_main_document_status_get(); - mf_debug("document_size = %f", document_size); - - Update_Info document_info; - memset(&document_info, 0, sizeof(Update_Info)); - document_info.type = MF_STORAGE_DOCUMENT; - document_info.total_size = document_size; - if (storage_status->pipe) - ecore_pipe_write(storage_status->pipe, &document_info, sizeof(document_info)); + } + break; + case MF_STORAGE_DOCUMENT: { + double document_size = __mf_storage_main_document_status_get(); + mf_debug("document_size = %f", document_size); + + Update_Info document_info; + memset(&document_info, 0, sizeof(Update_Info)); + document_info.type = MF_STORAGE_DOCUMENT; + document_info.total_size = document_size; + if (storage_status->pipe) { + ecore_pipe_write(storage_status->pipe, &document_info, sizeof(document_info)); } - break; - case MF_STORAGE_RECENT: - { + } + break; + case MF_STORAGE_RECENT: { /*double recent_size = __mf_storage_main_recent_status_get(); mf_debug("recent_size = %f", recent_size); @@ -460,13 +464,12 @@ static void *__mf_storage_main_thread_start_routine(void *data) recent_info.total_size = recent_size; if (storage_status->pipe) ecore_pipe_write(storage_status->pipe, &recent_info, sizeof(Update_Info));*/ - } + } + break; + default: { + mf_debug("type = %d", type); break; - default: - { - mf_debug("type = %d", type); - break; - } + } } pthread_mutex_lock(&storage_status->update_mutex); storage_status->type++; @@ -518,16 +521,13 @@ int mf_storage_create(void* app_data) storage_status->pipe = NULL; } storage_status->pipe = ecore_pipe_add(__mf_storage_main_pipe_cb, storage_status); - if (storage_status->pipe) - { + if (storage_status->pipe) { int ret = pthread_create(&storage_status->tid, NULL, __mf_storage_main_thread_start_routine, storage_status); if (ret != 0) { mf_error("fail to pthread_create"); } mf_debug("thread id = %ld", storage_status->tid); - } - else - { + } else { mf_error("fail to ecore_pipe_add"); } MF_TRACE_END; @@ -543,8 +543,9 @@ int mf_storage_destroy(void* app_data) pthread_mutex_lock(&storage_status->update_data_mutex); storage_status->is_update_data = false; - if (ap->mf_Status.view_type != mf_view_root || ap->mf_Status.more != MORE_DEFAULT) + if (ap->mf_Status.view_type != mf_view_root || ap->mf_Status.more != MORE_DEFAULT) { storage_status->update_cb = NULL; + } pthread_mutex_unlock(&storage_status->update_data_mutex); pthread_mutex_lock(&storage_status->exit_mutex); @@ -555,8 +556,7 @@ int mf_storage_destroy(void* app_data) storage_status->type = MF_STORAGE_SLEEP; //pthread_cond_signal(&storage_status->wait_cond); pthread_mutex_unlock(&storage_status->update_mutex); - if (storage_status->tid > 0) - { + if (storage_status->tid > 0) { void *thread_ret = NULL; ret = pthread_join(storage_status->tid, &thread_ret); if (ret != 0) { @@ -611,7 +611,7 @@ int mf_storage_refresh(void* app_data) bool mf_storage_get_recent_files_size_cb(MFRitem *Ritem, void *user_data) { if (Ritem && Ritem->path) { - SECURE_ERROR("Ritem->path is [%s]mf_file_exists is [%d] access(dst_dir, R_OK | W_OK) is [%d] ",Ritem->path, mf_file_exists(Ritem->path), access(Ritem->path, R_OK | W_OK)); + SECURE_ERROR("Ritem->path is [%s]mf_file_exists is [%d] access(dst_dir, R_OK | W_OK) is [%d] ", Ritem->path, mf_file_exists(Ritem->path), access(Ritem->path, R_OK | W_OK)); if (mf_file_exists(Ritem->path)) { off_t size = 0; mf_file_attr_get_file_size(Ritem->path, &size); diff --git a/src/common/mf-ta.c b/src/common/mf-ta.c index db2e9cd..e1a46bc 100755 --- a/src/common/mf-ta.c +++ b/src/common/mf-ta.c @@ -46,16 +46,19 @@ static int mf_g_enable = 1; int mf_ta_init(void) { - if (mf_g_accums) + if (mf_g_accums) { return 0; + } mf_g_cps = (mf_ta_checkpoint **) malloc(MF_TA_MAX_CHECKPOINT * sizeof(mf_ta_checkpoint *)); - if (!mf_g_cps) + if (!mf_g_cps) { return -1; + } mf_g_accums = (mf_ta_accum_item **) malloc(MF_TA_MAX_CHECKPOINT * sizeof(mf_ta_accum_item *)); - if (!mf_g_accums) + if (!mf_g_accums) { return -1; + } mf_g_accum_first_time = 0xFFFFFFFF; @@ -64,8 +67,9 @@ int mf_ta_init(void) int mf_ta_release(void) { - if (!mf_g_accums) + if (!mf_g_accums) { return 0; + } __mf_ta_free_cps(); __mf_ta_free_accums(); @@ -106,24 +110,30 @@ int mf_ta_add_checkpoint(char *name, int show, char *filename, int line) mf_ta_checkpoint *cp = NULL; struct timeval t; - if (!mf_g_enable) + if (!mf_g_enable) { return -1; + } - if (!mf_g_accums) + if (!mf_g_accums) { return 0; + } - if (mf_g_cp_index == MF_TA_MAX_CHECKPOINT) + if (mf_g_cp_index == MF_TA_MAX_CHECKPOINT) { return -1; + } - if (!name) + if (!name) { return -1; + } - if (strlen(name) == 0) + if (strlen(name) == 0) { return -1; + } cp = (mf_ta_checkpoint *) malloc(sizeof(mf_ta_checkpoint)); - if (!cp) + if (!cp) { return -1; + } cp->name = (char *)malloc(strlen(name) + 1); if (!cp->name) { @@ -132,8 +142,9 @@ int mf_ta_add_checkpoint(char *name, int show, char *filename, int line) } strncpy(cp->name, name, strlen(name)); - if (show) + if (show) { SECURE_DEBUG("[CHECK-POINT] %s...(%s:%d)\n", name, filename, line); + } gettimeofday(&t, NULL); cp->timestamp = t.tv_sec * 1000000L + t.tv_usec; @@ -151,8 +162,9 @@ int mf_ta_add_checkpoint(char *name, int show, char *filename, int line) void mf_ta_show_checkpoints(void) { int i = 0; - if (!mf_g_accums) + if (!mf_g_accums) { return; + } SECURE_DEBUG("BEGIN RESULT ============================\n"); for (i = 0; i < mf_g_cp_index; i++) { @@ -163,8 +175,9 @@ void mf_ta_show_checkpoints(void) void mf_ta_show_diff(char *name1, char *name2) { - if (!mf_g_accums) + if (!mf_g_accums) { return; + } SECURE_DEBUG("Time takes from [%s] to [%s] : %ld us.\n", name1, name2, mf_ta_get_diff(name1, name2)); @@ -174,24 +187,29 @@ unsigned long mf_ta_get_diff(char *name1, char *name2) { int cp1, cp2; - if (!mf_g_accums) + if (!mf_g_accums) { return 0; + } /* fail if bad param. */ - if (!name1 || !name2) + if (!name1 || !name2) { return -1; + } /* fail if same. */ - if (strcmp(name1, name2) == 0) + if (strcmp(name1, name2) == 0) { return -1; + } /*get index */ - if ((cp1 = __mf_ta_get_cp_index(name1)) == -1) + if ((cp1 = __mf_ta_get_cp_index(name1)) == -1) { return -1; + } - if ((cp2 = __mf_ta_get_cp_index(name2)) == -1) + if ((cp2 = __mf_ta_get_cp_index(name2)) == -1) { return -1; + } /* NOTE : * return value must be positive value. @@ -209,8 +227,9 @@ static int __mf_ta_get_cp_index(char *name) /* find index */ for (i = 0; i < mf_g_cp_index; i++) { - if (strcmp(name, mf_g_cps[i]->name) == 0) + if (strcmp(name, mf_g_cps[i]->name) == 0) { return i; + } } return -1; @@ -224,8 +243,9 @@ static int __mf_ta_get_accum_index(char *name) /* find index */ for (i = 0; i < mf_g_accum_index; i++) { - if (strcmp(name, mf_g_accums[i]->name) == 0) + if (strcmp(name, mf_g_accums[i]->name) == 0) { return i; + } } return -1; @@ -235,13 +255,15 @@ static void __mf_ta_free_cps(void) { int i = 0; - if (!mf_g_cps) + if (!mf_g_cps) { return; + } for (i = 0; i < mf_g_cp_index; i++) { if (mf_g_cps[i]) { - if (mf_g_cps[i]->name) + if (mf_g_cps[i]->name) { free(mf_g_cps[i]->name); + } free(mf_g_cps[i]); @@ -259,13 +281,15 @@ static void __mf_ta_free_accums(void) { int i = 0; - if (!mf_g_accums) + if (!mf_g_accums) { return; + } for (i = 0; i < mf_g_accum_index; i++) { if (mf_g_accums[i]) { - if (mf_g_accums[i]->name) + if (mf_g_accums[i]->name) { free(mf_g_accums[i]->name); + } free(mf_g_accums[i]); @@ -288,29 +312,35 @@ int mf_ta_accum_item_begin(char *name, int show, char *filename, int line) int name_len = 0; struct timeval t; - if (!mf_g_enable) + if (!mf_g_enable) { return -1; + } - if (!mf_g_accums) + if (!mf_g_accums) { return 0; + } - if (mf_g_accum_index == MF_TA_MAX_ACCUM) + if (mf_g_accum_index == MF_TA_MAX_ACCUM) { return -1; + } - if (!name) + if (!name) { return -1; + } name_len = strlen(name); - if (name_len == 0) + if (name_len == 0) { return -1; + } /* if 'name' is new one. create new item. */ if ((index = __mf_ta_get_accum_index(name)) == -1) { accum = (mf_ta_accum_item *) malloc(sizeof(mf_ta_accum_item)); - if (!accum) + if (!accum) { return -1; + } /*clear first. */ memset(accum, 0, sizeof(mf_ta_accum_item)); @@ -328,8 +358,9 @@ int mf_ta_accum_item_begin(char *name, int show, char *filename, int line) mf_g_accums[mf_g_accum_index] = accum; mf_g_accum_index++; - if (mf_g_accum_longest_name < name_len) + if (mf_g_accum_longest_name < name_len) { mf_g_accum_longest_name = name_len; + } } else { accum = mf_g_accums[index]; @@ -352,12 +383,14 @@ int mf_ta_accum_item_begin(char *name, int show, char *filename, int line) if (accum->first_start == 0) { /* assum that timestamp never could be zero. */ accum->first_start = accum->timestamp; - if (mf_g_accum_first_time > accum->first_start) + if (mf_g_accum_first_time > accum->first_start) { mf_g_accum_first_time = accum->first_start; + } } - if (show) + if (show) { SECURE_DEBUG("[ACCUM BEGIN] %s : %ld ---(%s:%d)\n", name, accum->timestamp, filename, line); + } accum->num_calls++; @@ -371,24 +404,29 @@ int mf_ta_accum_item_end(char *name, int show, char *filename, int line) int index = 0; struct timeval t; - if (!mf_g_enable) + if (!mf_g_enable) { return -1; + } - if (!mf_g_accums) + if (!mf_g_accums) { return 0; + } /* get time first for more accuracy. */ gettimeofday(&t, NULL); - if (mf_g_accum_index == MF_TA_MAX_ACCUM) + if (mf_g_accum_index == MF_TA_MAX_ACCUM) { return -1; + } - if (!name) + if (!name) { return -1; + } - if (strlen(name) == 0) + if (strlen(name) == 0) { return -1; + } /* varify the 'name' is already exist. */ if ((index = __mf_ta_get_accum_index(name)) == -1) { @@ -420,8 +458,9 @@ int mf_ta_accum_item_end(char *name, int show, char *filename, int line) accum->elapsed_max = tval > accum->elapsed_max ? tval : accum->elapsed_max; accum->elapsed_min = tval < accum->elapsed_min ? tval : accum->elapsed_min; - if (show) + if (show) { SECURE_DEBUG("[ACCUM END] %s : %ld + %u ---(%s:%d)\n", name, accum->elapsed_accum, tval, filename, line); + } /* add elapsed time */ accum->elapsed_accum += tval; @@ -432,8 +471,9 @@ int mf_ta_accum_item_end(char *name, int show, char *filename, int line) void __mf_ta_print_some_info(FILE *fp) { - if (!fp) + if (!fp) { return; + } /* comment */ { @@ -468,7 +508,7 @@ void __mf_ta_print_some_info(FILE *fp) fprintf(fp, "Process priority : %d\n", getpriority(PRIO_PROCESS, getpid())); getrusage(RUSAGE_SELF, &r_usage); fprintf(fp, "CPU usage : User = %ld.%06ld, System = %ld.%06ld\n", - r_usage.ru_utime.tv_sec, r_usage.ru_utime.tv_usec, r_usage.ru_stime.tv_sec, r_usage.ru_stime.tv_usec); + r_usage.ru_utime.tv_sec, r_usage.ru_utime.tv_usec, r_usage.ru_stime.tv_sec, r_usage.ru_stime.tv_usec); } @@ -492,8 +532,9 @@ void mf_ta_show_accum_result(int direction) char format[256]; FILE *fp = stderr; - if (!mf_g_accums) + if (!mf_g_accums) { return; + } switch (direction) { case MF_TA_SHOW_STDOUT: @@ -502,42 +543,44 @@ void mf_ta_show_accum_result(int direction) case MF_TA_SHOW_STDERR: fp = stderr; break; - case MF_TA_SHOW_FILE: - { - fp = fopen(MF_TA_RESULT_FILE, "wt"); - if (!fp) - return; + case MF_TA_SHOW_FILE: { + fp = fopen(MF_TA_RESULT_FILE, "wt"); + if (!fp) { + return; } } + } __mf_ta_print_some_info(fp); #ifdef MF_TA_UNIT_MSEC snprintf(format, sizeof(format), - "[%%3d] %%-%ds | \ttotal : %%4ld\tcalls : %%3ld\tavg : %%4ld\tmin : %%4ld\tmax : %%4ld\tstart : %%4lu\tend : %%4lu\tunpair : %%3ld\n", - mf_g_accum_longest_name); + "[%%3d] %%-%ds | \ttotal : %%4ld\tcalls : %%3ld\tavg : %%4ld\tmin : %%4ld\tmax : %%4ld\tstart : %%4lu\tend : %%4lu\tunpair : %%3ld\n", + mf_g_accum_longest_name); fprintf(fp, "BEGIN RESULT ACCUM============================ : NumOfItems : %d, unit(msec)\n", mf_g_accum_index); #else snprintf(format, sizeof(format), - "[%%3d] %%-%ds : \ttotal : %%ld\t:calls : %%ld\t:avg : %%ld\tmin : %%ld\tmax : %%ld\tstart : %%lu\tend : %%lu\tunpair : %%ld\n", - mf_g_accum_longest_name); + "[%%3d] %%-%ds : \ttotal : %%ld\t:calls : %%ld\t:avg : %%ld\tmin : %%ld\tmax : %%ld\tstart : %%lu\tend : %%lu\tunpair : %%ld\n", + mf_g_accum_longest_name); fprintf(fp, "BEGIN RESULT ACCUM============================ : NumOfItems : %d, unit(usec)\n", mf_g_accum_index); #endif for (i = 0; i < mf_g_accum_index; i++) { /*prevent 'devide by zero' error */ - if (mf_g_accums[i]->num_calls == 0) + if (mf_g_accums[i]->num_calls == 0) { mf_g_accums[i]->num_calls = 1; + } fprintf(fp, format, i, mf_g_accums[i]->name, mf_g_accums[i]->elapsed_accum, mf_g_accums[i]->num_calls, - (mf_g_accums[i]->elapsed_accum == 0) ? 0 : (int)(mf_g_accums[i]->elapsed_accum / mf_g_accums[i]->num_calls), - mf_g_accums[i]->elapsed_min, - mf_g_accums[i]->elapsed_max, - mf_g_accums[i]->first_start - mf_g_accum_first_time, - mf_g_accums[i]->last_end - mf_g_accum_first_time, mf_g_accums[i]->num_unpair); + (mf_g_accums[i]->elapsed_accum == 0) ? 0 : (int)(mf_g_accums[i]->elapsed_accum / mf_g_accums[i]->num_calls), + mf_g_accums[i]->elapsed_min, + mf_g_accums[i]->elapsed_max, + mf_g_accums[i]->first_start - mf_g_accum_first_time, + mf_g_accums[i]->last_end - mf_g_accum_first_time, mf_g_accums[i]->num_unpair); } fprintf(fp, "END RESULT ACCUM ============================\n"); - if (direction == MF_TA_SHOW_FILE) + if (direction == MF_TA_SHOW_FILE) { fclose(fp); + } } #endif diff --git a/src/common/mf-ug-detail-fs.c b/src/common/mf-ug-detail-fs.c index 40c43a8..744eb03 100755 --- a/src/common/mf-ug-detail-fs.c +++ b/src/common/mf-ug-detail-fs.c @@ -155,28 +155,27 @@ int mf_ug_detaill_fs_get_file_stat(const char *filename, Node_Info **node) struct stat statbuf = {0}; struct tm tmtime; - if (!filename || !node) + if (!filename || !node) { return UG_MYFILE_ERR_GET_STAT_FAIL; + } - if (stat(filename, &statbuf) == -1) + if (stat(filename, &statbuf) == -1) { return UG_MYFILE_ERR_GET_STAT_FAIL; + } - if (*node == NULL) + if (*node == NULL) { return UG_MYFILE_ERR_GET_STAT_FAIL; + } - (*node)->size = (LONG_LONG_UNSIGNED_INT)statbuf.st_size; - //(*node)->size = (LONG_LONG_UNSIGNED_INT)12*1024*1024*1024;//for testing for 12G - time_t temptime = statbuf.st_mtime; + (*node)->size = (LONG_LONG_UNSIGNED_INT)statbuf.st_size; + //(*node)->size = (LONG_LONG_UNSIGNED_INT)12*1024*1024*1024;//for testing for 12G + time_t temptime = statbuf.st_mtime; - if (temptime == 0 && !g_strcmp0(filename, UG_MEMORY_FOLDER)) - { - if(stat(UG_MEMORY_DEV_FOLDER, &statbuf) == -1) - { + if (temptime == 0 && !g_strcmp0(filename, UG_MEMORY_FOLDER)) { + if (stat(UG_MEMORY_DEV_FOLDER, &statbuf) == -1) { temptime = time(NULL); localtime_r(&temptime, &tmtime); - } - else - { + } else { temptime = statbuf.st_mtime; } } @@ -188,8 +187,9 @@ int mf_ug_detaill_fs_get_file_stat(const char *filename, Node_Info **node) int mf_ug_detail_fs_is_dir(const char *filepath) { - if (filepath == NULL) + if (filepath == NULL) { return EINA_FALSE; + } return mf_is_dir(filepath); } @@ -210,12 +210,14 @@ int mf_ug_detail_fs_is_dir(const char *filepath) int mf_ug_detail_fs_get_file_ext(const char *filepath, char *file_ext) { - if (filepath == NULL || file_ext == NULL) + if (filepath == NULL || file_ext == NULL) { return UG_MYFILE_ERR_SRC_ARG_INVALID; + } const char *filename = mf_file_get(filepath); - if (filename == NULL) + if (filename == NULL) { return UG_MYFILE_ERR_INVALID_FILE_NAME; + } char *pdot = strrchr(filename, '.'); if (!pdot) { @@ -240,47 +242,58 @@ int mf_ug_detail_fs_get_file_ext(const char *filepath, char *file_ext) static File_Type __mf_ug_detail_fs_get_category_by_file_ext(const char *file_ext, const char *fullpath) { int i = 0; - if (file_ext == NULL) + if (file_ext == NULL) { return FILE_TYPE_ETC; + } - if (file_ext[0] == '.') + if (file_ext[0] == '.') { i = 1; + } switch (file_ext[i]) { case 'a': case 'A': - if (strcasecmp("ASF", &file_ext[i]) == 0) - return FILE_TYPE_VIDEO; /*2010.3.12. dsp.shin appended*/ + if (strcasecmp("ASF", &file_ext[i]) == 0) { + return FILE_TYPE_VIDEO; /*2010.3.12. dsp.shin appended*/ + } - if (strcasecmp("AMR", &file_ext[i]) == 0) + if (strcasecmp("AMR", &file_ext[i]) == 0) { return FILE_TYPE_VOICE; + } - if (strcasecmp("AWB", &file_ext[i]) == 0) - return FILE_TYPE_VOICE; /*2009.4.8 han. open wideband amr*/ + if (strcasecmp("AWB", &file_ext[i]) == 0) { + return FILE_TYPE_VOICE; /*2009.4.8 han. open wideband amr*/ + } - if (strcasecmp("AAC", &file_ext[i]) == 0) + if (strcasecmp("AAC", &file_ext[i]) == 0) { return FILE_TYPE_MUSIC; + } - if (strcasecmp("AVI", &file_ext[i]) == 0) + if (strcasecmp("AVI", &file_ext[i]) == 0) { return FILE_TYPE_VIDEO; + } - if (strcasecmp("AAC", &file_ext[i]) == 0) - return FILE_TYPE_MUSIC; /*2010.4.12 shyeon.kim appended*/ + if (strcasecmp("AAC", &file_ext[i]) == 0) { + return FILE_TYPE_MUSIC; /*2010.4.12 shyeon.kim appended*/ + } break; case 'b': case 'B': - if (strcasecmp("BMP", &file_ext[i]) == 0) + if (strcasecmp("BMP", &file_ext[i]) == 0) { return FILE_TYPE_IMAGE; + } break; case 'd': case 'D': - if (strcasecmp("DOC", &file_ext[i]) == 0) + if (strcasecmp("DOC", &file_ext[i]) == 0) { return FILE_TYPE_DOC; + } - if (strcasecmp("DOCX", &file_ext[i]) == 0) + if (strcasecmp("DOCX", &file_ext[i]) == 0) { return FILE_TYPE_DOC; + } if (strcasecmp("DIVX", &file_ext[i]) == 0) { { @@ -290,119 +303,150 @@ static File_Type __mf_ug_detail_fs_get_category_by_file_ext(const char *file_ext break; case 'g': case 'G': - if (strcasecmp("GIF", &file_ext[i]) == 0) + if (strcasecmp("GIF", &file_ext[i]) == 0) { return FILE_TYPE_IMAGE; + } - if (strcasecmp("G72", &file_ext[i]) == 0) + if (strcasecmp("G72", &file_ext[i]) == 0) { return FILE_TYPE_MUSIC; + } break; case 'h': case 'H': - if (strcasecmp("H263", &file_ext[i]) == 0) + if (strcasecmp("H263", &file_ext[i]) == 0) { return FILE_TYPE_MUSIC; + } - if (strcasecmp("HTML", &file_ext[i]) == 0) + if (strcasecmp("HTML", &file_ext[i]) == 0) { return FILE_TYPE_HTML; + } - if (strcasecmp("HTM", &file_ext[i]) == 0) + if (strcasecmp("HTM", &file_ext[i]) == 0) { return FILE_TYPE_HTML; + } break; case 'i': case 'I': - if (strcasecmp("IMY", &file_ext[i]) == 0) + if (strcasecmp("IMY", &file_ext[i]) == 0) { return FILE_TYPE_SOUND; + } - if (strcasecmp("IPK", &file_ext[i]) == 0) + if (strcasecmp("IPK", &file_ext[i]) == 0) { return FILE_TYPE_APP; + } break; case 'j': case 'J': /*2009.5.7 han. added for java*/ - if (strcasecmp("JAD", &file_ext[i]) == 0) + if (strcasecmp("JAD", &file_ext[i]) == 0) { return FILE_TYPE_JAVA; + } - if (strcasecmp("JAR", &file_ext[i]) == 0) + if (strcasecmp("JAR", &file_ext[i]) == 0) { return FILE_TYPE_JAVA; + } - if (strcasecmp("JPG", &file_ext[i]) == 0) + if (strcasecmp("JPG", &file_ext[i]) == 0) { return FILE_TYPE_IMAGE; + } - if (strcasecmp("JPEG", &file_ext[i]) == 0) + if (strcasecmp("JPEG", &file_ext[i]) == 0) { return FILE_TYPE_IMAGE; + } /*2008.5.1 han. MTA issue.*/ - if (strcasecmp("JPE", &file_ext[i]) == 0) + if (strcasecmp("JPE", &file_ext[i]) == 0) { return FILE_TYPE_IMAGE; + } break; case 'm': case 'M': - if (strcasecmp("MMF", &file_ext[i]) == 0) + if (strcasecmp("MMF", &file_ext[i]) == 0) { return FILE_TYPE_SOUND; + } - if (strcasecmp("MP3", &file_ext[i]) == 0) + if (strcasecmp("MP3", &file_ext[i]) == 0) { return FILE_TYPE_MUSIC; + } - if (strcasecmp("MID", &file_ext[i]) == 0) + if (strcasecmp("MID", &file_ext[i]) == 0) { return FILE_TYPE_SOUND; + } - if (strcasecmp("MIDI", &file_ext[i]) == 0) + if (strcasecmp("MIDI", &file_ext[i]) == 0) { return FILE_TYPE_SOUND; + } - if (strcasecmp("MP4", &file_ext[i]) == 0) + if (strcasecmp("MP4", &file_ext[i]) == 0) { return FILE_TYPE_VIDEO; + } /*"mp4" may be music*/ - if (strcasecmp("MPG", &file_ext[i]) == 0) + if (strcasecmp("MPG", &file_ext[i]) == 0) { return FILE_TYPE_VIDEO; + } - if (strcasecmp("MPEG", &file_ext[i]) == 0) + if (strcasecmp("MPEG", &file_ext[i]) == 0) { return FILE_TYPE_VIDEO; + } - if (strcasecmp("M4A", &file_ext[i]) == 0) + if (strcasecmp("M4A", &file_ext[i]) == 0) { return FILE_TYPE_MUSIC; + } - if (strcasecmp("M3G", &file_ext[i]) == 0) + if (strcasecmp("M3G", &file_ext[i]) == 0) { return FILE_TYPE_FLASH; + } - if (strcasecmp("MXMF", &file_ext[i]) == 0) + if (strcasecmp("MXMF", &file_ext[i]) == 0) { return FILE_TYPE_SOUND; + } - if (strcasecmp("MKV", &file_ext[i]) == 0) - return FILE_TYPE_VIDEO; /*2010.4.12 shyeon.kim appended*/ + if (strcasecmp("MKV", &file_ext[i]) == 0) { + return FILE_TYPE_VIDEO; /*2010.4.12 shyeon.kim appended*/ + } - if (strcasecmp("MKA", &file_ext[i]) == 0) - return FILE_TYPE_MUSIC; /*2010.4.12 shyeon.kim appended*/ + if (strcasecmp("MKA", &file_ext[i]) == 0) { + return FILE_TYPE_MUSIC; /*2010.4.12 shyeon.kim appended*/ + } break; case 'o': case 'O': - if (strcasecmp("opml", &file_ext[i]) == 0) + if (strcasecmp("opml", &file_ext[i]) == 0) { return FILE_TYPE_RSS; + } break; case 'p': case 'P': - if (strcasecmp("PNG", &file_ext[i]) == 0) + if (strcasecmp("PNG", &file_ext[i]) == 0) { return FILE_TYPE_IMAGE; + } - if (strcasecmp("PJPEG", &file_ext[i]) == 0) + if (strcasecmp("PJPEG", &file_ext[i]) == 0) { return FILE_TYPE_IMAGE; + } - if (strcasecmp("PDF", &file_ext[i]) == 0) + if (strcasecmp("PDF", &file_ext[i]) == 0) { return FILE_TYPE_PDF; + } - if (strcasecmp("PPT", &file_ext[i]) == 0) + if (strcasecmp("PPT", &file_ext[i]) == 0) { return FILE_TYPE_PPT; + } - if (strcasecmp("PPTX", &file_ext[i]) == 0) + if (strcasecmp("PPTX", &file_ext[i]) == 0) { return FILE_TYPE_PPT; + } - if (strcasecmp("PEM", &file_ext[i]) == 0) + if (strcasecmp("PEM", &file_ext[i]) == 0) { return FILE_TYPE_CERTIFICATION; + } break; /* 2008.3.5 han.*/ @@ -411,98 +455,124 @@ static File_Type __mf_ug_detail_fs_get_category_by_file_ext(const char *file_ext break; case 's': case 'S': - if (strcasecmp("SDP", &file_ext[i]) == 0) + if (strcasecmp("SDP", &file_ext[i]) == 0) { return FILE_TYPE_VIDEO; + } - if (strcasecmp("SPM", &file_ext[i]) == 0) + if (strcasecmp("SPM", &file_ext[i]) == 0) { return FILE_TYPE_SOUND; + } - if (strcasecmp("SMP", &file_ext[i]) == 0) + if (strcasecmp("SMP", &file_ext[i]) == 0) { return FILE_TYPE_SOUND; + } - if (strcasecmp("SPF", &file_ext[i]) == 0) + if (strcasecmp("SPF", &file_ext[i]) == 0) { return FILE_TYPE_SOUND; + } - if (strcasecmp("SWF", &file_ext[i]) == 0) + if (strcasecmp("SWF", &file_ext[i]) == 0) { return FILE_TYPE_FLASH; + } - if (strcasecmp("SCN", &file_ext[i]) == 0) + if (strcasecmp("SCN", &file_ext[i]) == 0) { return FILE_TYPE_MOVIE_MAKER; + } - if (strcasecmp("SVG", &file_ext[i]) == 0) + if (strcasecmp("SVG", &file_ext[i]) == 0) { return FILE_TYPE_SVG; + } - if (strcasecmp("SVGZ", &file_ext[i]) == 0) - return FILE_TYPE_SVG; /* 2009.4.17 han.*/ + if (strcasecmp("SVGZ", &file_ext[i]) == 0) { + return FILE_TYPE_SVG; /* 2009.4.17 han.*/ + } break; case 't': case 'T': - if (strcasecmp("TXT", &file_ext[i]) == 0) + if (strcasecmp("TXT", &file_ext[i]) == 0) { return FILE_TYPE_TXT; + } - if (strcasecmp("THM", &file_ext[i]) == 0) + if (strcasecmp("THM", &file_ext[i]) == 0) { return FILE_TYPE_THEME; + } break; case 'v': case 'V': - if (strcasecmp("VCF", &file_ext[i]) == 0) + if (strcasecmp("VCF", &file_ext[i]) == 0) { return FILE_TYPE_VCONTACT; + } - if (strcasecmp("VCS", &file_ext[i]) == 0) + if (strcasecmp("VCS", &file_ext[i]) == 0) { return FILE_TYPE_VCALENDAR; + } - if (strcasecmp("VNT", &file_ext[i]) == 0) + if (strcasecmp("VNT", &file_ext[i]) == 0) { return FILE_TYPE_VNOTE; + } - if (strcasecmp("VBM", &file_ext[i]) == 0) + if (strcasecmp("VBM", &file_ext[i]) == 0) { return FILE_TYPE_VBOOKMARK; + } break; case 'w': case 'W': - if (strcasecmp("WAV", &file_ext[i]) == 0) - return FILE_TYPE_SOUND; /*modified by dsp.shin, 2010.3.13. to support music player*/ + if (strcasecmp("WAV", &file_ext[i]) == 0) { + return FILE_TYPE_SOUND; /*modified by dsp.shin, 2010.3.13. to support music player*/ + } /*2008.10.17 han.*/ - if (strcasecmp("WBMP", &file_ext[i]) == 0) + if (strcasecmp("WBMP", &file_ext[i]) == 0) { return FILE_TYPE_IMAGE; + } - if (strcasecmp("WGT", &file_ext[i]) == 0) + if (strcasecmp("WGT", &file_ext[i]) == 0) { return FILE_TYPE_WGT; + } - if (strcasecmp("WMA", &file_ext[i]) == 0) + if (strcasecmp("WMA", &file_ext[i]) == 0) { return FILE_TYPE_MUSIC; + } - if (strcasecmp("WMV", &file_ext[i]) == 0) + if (strcasecmp("WMV", &file_ext[i]) == 0) { return FILE_TYPE_VIDEO; + } break; case 'x': case 'X': - if (strcasecmp("XLS", &file_ext[i]) == 0) + if (strcasecmp("XLS", &file_ext[i]) == 0) { return FILE_TYPE_EXCEL; + } - if (strcasecmp("XLSX", &file_ext[i]) == 0) + if (strcasecmp("XLSX", &file_ext[i]) == 0) { return FILE_TYPE_EXCEL; + } - if (strcasecmp("XMF", &file_ext[i]) == 0) + if (strcasecmp("XMF", &file_ext[i]) == 0) { return FILE_TYPE_SOUND; + } - if (strcasecmp("XHTML", &file_ext[i]) == 0) + if (strcasecmp("XHTML", &file_ext[i]) == 0) { return FILE_TYPE_HTML; + } break; case '3': - if (strcasecmp("3GP", &file_ext[i]) == 0) + if (strcasecmp("3GP", &file_ext[i]) == 0) { return FILE_TYPE_VIDEO; + } - if (strcasecmp("3GPP", &file_ext[i]) == 0) + if (strcasecmp("3GPP", &file_ext[i]) == 0) { return FILE_TYPE_VIDEO; + } - if (strcasecmp("3G2", &file_ext[i]) == 0) + if (strcasecmp("3G2", &file_ext[i]) == 0) { return FILE_TYPE_VIDEO; + } /*"3GP", "3GPP" may be music*/ break; @@ -514,8 +584,9 @@ static File_Type __mf_ug_detail_fs_get_category_by_file_ext(const char *file_ext int mf_ug_detail_fs_get_file_type(const char *filepath, File_Type * category) { - if (filepath == NULL || category == NULL) + if (filepath == NULL || category == NULL) { return UG_MYFILE_ERR_SRC_ARG_INVALID; + } int i = 0; int flag = 0; @@ -571,8 +642,9 @@ int mf_ug_detail_fs_get_file_type(const char *filepath, File_Type * category) *********************/ int mf_ug_detail_fs_get_store_type(const char *filepath, Mf_Storage *store_type) { - if (filepath == NULL || store_type == NULL) + if (filepath == NULL || store_type == NULL) { return UG_MYFILE_ERR_SRC_ARG_INVALID; + } if (g_str_has_prefix(filepath, UG_PHONE_FOLDER)) { *store_type = D_MYFILE_PHONE; @@ -601,8 +673,9 @@ int mf_ug_detail_fs_get_store_type(const char *filepath, Mf_Storage *store_type) *********************/ int mf_ug_detail_fs_get_logi_path(const char *full_path, char *path) { - if (full_path == NULL || path == NULL) + if (full_path == NULL || path == NULL) { return UG_MYFILE_ERR_STORAGE_TYPE_ERROR; + } Mf_Storage store_type = 0; int root_len = 0; @@ -623,8 +696,9 @@ int mf_ug_detail_fs_get_logi_path(const char *full_path, char *path) /*size of path is UG_MYFILE_DIR_PATH_LEN_MAX+1*/ g_strlcpy(path, full_path + root_len, UG_MYFILE_DIR_PATH_LEN_MAX); - if (strlen(path) == 0) + if (strlen(path) == 0) { g_strlcpy(path, "/", UG_MYFILE_DIR_PATH_LEN_MAX); + } return UG_MYFILE_ERR_NONE; @@ -635,8 +709,9 @@ GString *mf_ug_detail_fs_parse_file_type(GString * path) GString *catetory = NULL; File_Type category_t = FILE_TYPE_NONE; - if (path != NULL) + if (path != NULL) { mf_ug_detail_fs_get_file_type(path->str, &category_t); + } switch (category_t) { case FILE_TYPE_NONE: /**< Default */ @@ -777,8 +852,9 @@ GString *mf_ug_detail_fs_parse_file_type(GString * path) ******************************/ int mf_ug_detail_fs_get_list_len(const Eina_List *list) { - if (list == NULL) + if (list == NULL) { return 0; + } return eina_list_count(list); } @@ -787,8 +863,9 @@ View_Style mf_ug_detail_fs_get_view_type(char *path, GString * category) { myfile_dlog("%s %d\n", __func__, __LINE__); - if (path == NULL) + if (path == NULL) { return VIEW_NONE; + } if (mf_ug_detail_fs_is_dir(path)) { return VIEW_DIR; @@ -810,20 +887,23 @@ View_Style mf_ug_detail_fs_get_view_type(char *path, GString * category) static int __mf_ug_detail_fs_get_parent_path(const char *path, char *parent_path) { - if (path == NULL || parent_path == NULL) + if (path == NULL || parent_path == NULL) { return UG_MYFILE_ERR_SRC_ARG_INVALID; + } /*parent_path size is UG_MYFILE_DIR_PATH_LEN_MAX+1*/ g_strlcpy(parent_path, path, UG_MYFILE_DIR_PATH_LEN_MAX); const char *name = NULL; name = mf_file_get(path); - if (name == NULL) + if (name == NULL) { return UG_MYFILE_ERR_SRC_ARG_INVALID; + } parent_path[strlen(parent_path) - strlen(name) - 1] = '\0'; - if (strlen(parent_path) == 0) + if (strlen(parent_path) == 0) { g_strlcpy(parent_path, "/", UG_MYFILE_DIR_PATH_LEN_MAX); + } myfile_dlog("%s %d\n", __func__, __LINE__); @@ -837,12 +917,14 @@ GString *mf_ug_detail_fs_get_parent(char *fullpath) char path[UG_MYFILE_DIR_PATH_LEN_MAX + 1] = { '\0', }; int error_code = 0; - if (fullpath == NULL) + if (fullpath == NULL) { return NULL; + } error_code = __mf_ug_detail_fs_get_parent_path(fullpath, path); - if (error_code != 0) + if (error_code != 0) { return NULL; + } ret = g_string_new(path); myfile_dlog("%s %d\n", __func__, __LINE__); @@ -865,8 +947,9 @@ GString *mf_ug_detail_fs_get_parent(char *fullpath) *********************/ int mf_ug_detail_fs_read_dir(char *path, Eina_List **dir_list, Eina_List **file_list) { - if (path == NULL) + if (path == NULL) { return UG_MYFILE_ERR_DIR_OPEN_FAIL; + } DIR *pDir = NULL; struct dirent ent_struct; @@ -878,29 +961,32 @@ int mf_ug_detail_fs_read_dir(char *path, Eina_List **dir_list, Eina_List **file_ int ret = 0; pDir = opendir(path); - if (pDir == NULL) + if (pDir == NULL) { return UG_MYFILE_ERR_DIR_OPEN_FAIL; + } while ((readdir_r(pDir, &ent_struct, &ent) == 0) && ent) { if (strncmp(ent->d_name, ".", 1) == 0 || strcmp(ent->d_name, "..") == 0) { continue; } /*only deal with dirs and regular files*/ - if ((ent->d_type & DT_DIR) == 0 && (ent->d_type & DT_REG) == 0) + if ((ent->d_type & DT_DIR) == 0 && (ent->d_type & DT_REG) == 0) { continue; + } #ifdef DEBUG_FOLDER_OPTION if ((ent->d_type & DT_DIR) != 0) { if ((strlen(path) == strlen(UG_PHONE_FOLDER)) && (g_strcmp0(path, UG_PHONE_FOLDER) == 0) && - (strlen(ent->d_name) == strlen(DEBUG_FOLDER)) && (g_strcmp0(ent->d_name, DEBUG_FOLDER) == 0)) { + (strlen(ent->d_name) == strlen(DEBUG_FOLDER)) && (g_strcmp0(ent->d_name, DEBUG_FOLDER) == 0)) { continue; } } #endif Node_Info *pNode = (Node_Info *) malloc(sizeof(Node_Info)); - if (pNode == NULL) + if (pNode == NULL) { continue; + } memset(pNode, 0, sizeof(Node_Info)); /*get path*/ @@ -969,8 +1055,9 @@ int mf_ug_detail_fs_get_file_list(GString *folder_name, Eina_List **dir_list, Ei myfile_dlog("%s %d\n", __func__, __LINE__); - if (folder_name == NULL || folder_name->str == NULL || folder_name->len == 0) + if (folder_name == NULL || folder_name->str == NULL || folder_name->len == 0) { return 0; + } int error_code = 0; if (folder_name != NULL) { @@ -990,7 +1077,7 @@ LONG_LONG_UNSIGNED_INT mf_ug_detail_fs_get_storage_size(char *path) if (statvfs(path, &statbuf) == -1) { return use_space; } else { - use_space = (statbuf.f_blocks - statbuf.f_bfree)*statbuf.f_bsize; + use_space = (statbuf.f_blocks - statbuf.f_bfree) * statbuf.f_bsize; } } return use_space; @@ -1007,8 +1094,9 @@ LONG_LONG_UNSIGNED_INT mf_ug_detail_fs_get_folder_size(char *path) if (mf_ug_detail_fs_is_dir(path)) { size = mf_ug_detail_fs_get_storage_size(path); - if (size != 0) + if (size != 0) { return size; + } int error_code = 0; error_code = mf_ug_detail_fs_get_file_list(fullpath, &dir_list, &file_list); @@ -1021,8 +1109,9 @@ LONG_LONG_UNSIGNED_INT mf_ug_detail_fs_get_folder_size(char *path) for (i = 0; i < file_list_len; i++) { Node_Info *pNode = NULL; pNode = (Node_Info *) eina_list_nth(file_list, i); - if (pNode == NULL) + if (pNode == NULL) { continue; + } size += pNode->size; } i = 0; @@ -1030,8 +1119,9 @@ LONG_LONG_UNSIGNED_INT mf_ug_detail_fs_get_folder_size(char *path) Node_Info *pNode = NULL; char *full_path = NULL; pNode = (Node_Info *) eina_list_nth(dir_list, i); - if (pNode == NULL) + if (pNode == NULL) { continue; + } full_path = g_strconcat(pNode->path, "/", pNode->name, NULL); myfile_dlog("full_path is [%s]\n", full_path); size += (mf_ug_detail_fs_get_folder_size(full_path)); diff --git a/src/common/mf-ug-detail-media.c b/src/common/mf-ug-detail-media.c index 5bc4e13..d0ccaa3 100755 --- a/src/common/mf-ug-detail-media.c +++ b/src/common/mf-ug-detail-media.c @@ -139,48 +139,48 @@ static struct _ftype_by_mime mime_type[] = { static void __mf_ug_detail_media_set_default_timezone_id() { - i18n_uchar utimezone_id [UG_ICU_ARR_LENGTH] = {0}; - char timezone_buffer[UG_ICU_ARR_LENGTH] = {0}; - char timezone_id[UG_ICU_ARR_LENGTH] = {0}; - char *buffer = NULL; - int timezone_str_size; - int retcode = -1; - - retcode = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_TIMEZONE, &buffer); - if (retcode != SYSTEM_SETTINGS_ERROR_NONE) - { - mf_error("[ERR] failed to get the timezone"); - } - if (buffer) - strncpy(timezone_id, buffer, sizeof(timezone_id)-1); - timezone_str_size = readlink("/opt/etc/localtime", timezone_buffer, sizeof(timezone_buffer)-1); - free(buffer); - - if (timezone_str_size > 0) { - char *ptr, *sp, *zone= NULL, *city= NULL; - ptr = strtok_r(timezone_buffer, "/", &sp); - - while ((ptr = strtok_r(NULL, "/", &sp))) - { - zone = city; - city = ptr; - } - - if (zone != NULL && city != NULL) { - if (strcmp("zoneinfo", zone) == 0) - snprintf(timezone_id, UG_ICU_ARR_LENGTH, "%s", city); - else - snprintf(timezone_id, UG_ICU_ARR_LENGTH, "%s/%s", zone, city); - } - } - - if (*timezone_id) { - i18n_ustring_copy_ua_n(utimezone_id, timezone_id, sizeof(timezone_buffer)/2); - retcode = i18n_ucalendar_set_default_timezone(utimezone_id); - if (retcode != I18N_ERROR_NONE) { - myfile_dlog("Failed to set default time zone[%d]!", retcode); - } - } + i18n_uchar utimezone_id [UG_ICU_ARR_LENGTH] = {0}; + char timezone_buffer[UG_ICU_ARR_LENGTH] = {0}; + char timezone_id[UG_ICU_ARR_LENGTH] = {0}; + char *buffer = NULL; + int timezone_str_size; + int retcode = -1; + + retcode = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_TIMEZONE, &buffer); + if (retcode != SYSTEM_SETTINGS_ERROR_NONE) { + mf_error("[ERR] failed to get the timezone"); + } + if (buffer) { + strncpy(timezone_id, buffer, sizeof(timezone_id) - 1); + } + timezone_str_size = readlink("/opt/etc/localtime", timezone_buffer, sizeof(timezone_buffer) - 1); + free(buffer); + + if (timezone_str_size > 0) { + char *ptr, *sp, *zone = NULL, *city = NULL; + ptr = strtok_r(timezone_buffer, "/", &sp); + + while ((ptr = strtok_r(NULL, "/", &sp))) { + zone = city; + city = ptr; + } + + if (zone != NULL && city != NULL) { + if (strcmp("zoneinfo", zone) == 0) { + snprintf(timezone_id, UG_ICU_ARR_LENGTH, "%s", city); + } else { + snprintf(timezone_id, UG_ICU_ARR_LENGTH, "%s/%s", zone, city); + } + } + } + + if (*timezone_id) { + i18n_ustring_copy_ua_n(utimezone_id, timezone_id, sizeof(timezone_buffer) / 2); + retcode = i18n_ucalendar_set_default_timezone(utimezone_id); + if (retcode != I18N_ERROR_NONE) { + myfile_dlog("Failed to set default time zone[%d]!", retcode); + } + } } static char *__mf_ug_detail_media_get_best_pattern(const char *locale, i18n_uchar *customSkeleton, i18n_udate date) @@ -193,11 +193,12 @@ static char *__mf_ug_detail_media_get_best_pattern(const char *locale, i18n_ucha char formattedString[UG_ICU_ARR_LENGTH] = {0,}; int32_t bestPatternLength, formattedLength; - __mf_ug_detail_media_set_default_timezone_id(); + __mf_ug_detail_media_set_default_timezone_id(); status = i18n_udatepg_create(locale, &generator); - if ((status != I18N_ERROR_NONE) || (generator == NULL)) + if ((status != I18N_ERROR_NONE) || (generator == NULL)) { return NULL; + } status = i18n_udatepg_get_best_pattern(generator, customSkeleton, i18n_ustring_get_length(customSkeleton), bestPattern, UG_ICU_ARR_LENGTH, &bestPatternLength); if (bestPatternLength <= 0) { @@ -205,7 +206,7 @@ static char *__mf_ug_detail_media_get_best_pattern(const char *locale, i18n_ucha return NULL; } - status= i18n_udate_create(I18N_UDATE_MEDIUM, I18N_UDATE_MEDIUM, locale, NULL, -1, bestPattern, -1, &formatter); + status = i18n_udate_create(I18N_UDATE_MEDIUM, I18N_UDATE_MEDIUM, locale, NULL, -1, bestPattern, -1, &formatter); if ((status != I18N_ERROR_NONE) || (formatter == NULL)) { i18n_udatepg_destroy(generator); return NULL; @@ -222,8 +223,9 @@ static char *__mf_ug_detail_media_get_best_pattern(const char *locale, i18n_ucha i18n_udatepg_destroy(generator); i18n_udate_destroy(formatter); - if (strlen(formattedString) == 0) + if (strlen(formattedString) == 0) { return NULL; + } return g_strdup(formattedString); } @@ -235,12 +237,12 @@ char *mf_ug_detail_media_get_icu_date(i18n_udate date) i18n_uchar customSkeleton[UG_ICU_ARR_LENGTH] = { 0, }; int skeletonLength = 0; bool timeformat = false; - int retcode = -1; + int retcode = -1; - retcode = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, &timeformat); - if (retcode != SYSTEM_SETTINGS_ERROR_NONE) { - myfile_dlog("Failed to get timeformat info[%d]!", retcode); - } + retcode = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, &timeformat); + if (retcode != SYSTEM_SETTINGS_ERROR_NONE) { + myfile_dlog("Failed to get timeformat info[%d]!", retcode); + } if (timeformat == false) { skeleton = g_strdup(UG_DATE_FORMAT_12); @@ -272,7 +274,7 @@ char *mf_ug_detail_media_get_icu_date(i18n_udate date) if (find) { int diff = find - region; if (diff > 0) { - region[diff-1] = '\0'; + region[diff - 1] = '\0'; } } } @@ -370,8 +372,9 @@ void mf_ug_detail_media_get_file_location(void *data, char *path) } logic_path = (char *)malloc(UG_MYFILE_DIR_PATH_LEN_MAX + 1); - if (logic_path == NULL) + if (logic_path == NULL) { return; + } memset(logic_path, 0, UG_MYFILE_DIR_PATH_LEN_MAX + 1); @@ -434,13 +437,13 @@ static void __mf_ug_detail_media_get_file_contains(void *data, char *path) int count = 1; EINA_LIST_FOREACH(file_list, l, filenode) { if (filenode) { - ug_detail_debug("[file %d [%s]]",count, filenode->name); + ug_detail_debug("[file %d [%s]]", count, filenode->name); count++; } } count = 1; EINA_LIST_FOREACH(dir_list, l, filenode) { - ug_detail_debug("[folder %d [%s]]",count, filenode->name); + ug_detail_debug("[folder %d [%s]]", count, filenode->name); count++; } buf = g_strdup_printf("%d %s %s %d %s", file_list_len, MF_UG_DETAIL_LABELL_FILES, ",", dir_list_len, MF_UG_DETAIL_LABELL_FOLDERS); @@ -474,11 +477,13 @@ static void __mf_ug_detail_media_get_file_size(void *data, Node_Info *pNode, cha } /** malloc for File_size */ - if (pNode != NULL) + if (pNode != NULL) { original_size = pNode->size; + } - if (mf_ug_detail_fs_is_dir(path)) + if (mf_ug_detail_fs_is_dir(path)) { original_size = mf_ug_detail_fs_get_folder_size(path); + } size = (double)original_size; @@ -506,8 +511,9 @@ static void __mf_ug_detail_media_get_file_date(void *data, Node_Info *pNode) } ap->mf_Info.create_date = (char *)malloc(UG_FILE_CREATE_DATE_MAX + 1); - if (ap->mf_Info.create_date == NULL) + if (ap->mf_Info.create_date == NULL) { return; + } memset(ap->mf_Info.create_date, 0, UG_FILE_CREATE_DATE_MAX + 1); @@ -583,8 +589,9 @@ void mf_ug_detail_media_get_file_ext(void *data, char *path) ap->mf_Info.file_ext = (char *)malloc(UG_FILE_EXT_LEN_MAX); - if (ap->mf_Info.file_ext == NULL) + if (ap->mf_Info.file_ext == NULL) { return; + } memset(ap->mf_Info.file_ext, 0, UG_FILE_EXT_LEN_MAX); int ret = mf_ug_detail_fs_get_file_ext(path, ap->mf_Info.file_ext); @@ -625,16 +632,19 @@ static int __mf_ug_detail_media_get_exif_gps_info(const char *file_full_path, do //ExifIfd ifd; ExifTag tag; char buf[UG_EXIF_ARR_LENGTH + 1] = { 0, }; - if (file_full_path == NULL) + if (file_full_path == NULL) { return -1; + } - if (gps_value == NULL) + if (gps_value == NULL) { return -1; + } /** get exifdata*/ ed = exif_data_new_from_file(file_full_path); - if (!ed) + if (!ed) { return -1; + } //ifd = ifdtype; tag = tagtype; @@ -720,13 +730,15 @@ static int __mf_ug_detail_media_get_exif_gps_info(const char *file_full_path, do static bool __mf_ug_detail_media_extract_image_meta_latitude(char *file_full_path, double *lat) { double value = 0.0; - if (file_full_path == NULL || lat == NULL) + if (file_full_path == NULL || lat == NULL) { return false; + } /** check if the file exists*/ int ret = access(file_full_path, 0); - if (ret == -1) + if (ret == -1) { return false; + } /** get laitude value by path*/ if (__mf_ug_detail_media_get_exif_gps_info(file_full_path, &value, EXIF_IFD_GPS, EXIF_TAG_GPS_LATITUDE) == 0) { @@ -756,13 +768,15 @@ static bool __mf_ug_detail_media_extract_image_meta_latitude(char *file_full_pat static bool __mf_ug_detail_media_extract_image_meta_lontitude(char *file_full_path, double *lon) { double value = 0.0; - if (file_full_path == NULL || lon == NULL) + if (file_full_path == NULL || lon == NULL) { return false; + } /** check if the file exists*/ int ret = access(file_full_path, 0); - if (ret == -1) + if (ret == -1) { return false; + } /** get lontitude by path*/ if (__mf_ug_detail_media_get_exif_gps_info(file_full_path, &value, EXIF_IFD_GPS, EXIF_TAG_GPS_LONGITUDE) == 0) { @@ -795,8 +809,9 @@ void mf_ug_detail_media_get_common_info(void *data, char *path) myfile_dlog("*******************%s %d\n", __func__, __LINE__); Node_Info *pNode = (Node_Info *) malloc(sizeof(Node_Info)); - if (pNode == NULL) + if (pNode == NULL) { return; + } memset(pNode, 0, sizeof(Node_Info)); mf_ug_detaill_fs_get_file_stat(path, &pNode); diff --git a/src/common/mf-util.c b/src/common/mf-util.c index 6dd03e6..744ccc5 100755 --- a/src/common/mf-util.c +++ b/src/common/mf-util.c @@ -175,13 +175,14 @@ void mf_util_action_storage_insert(void *data, char *pItemLabel) fsNodeInfo *pNode = NULL; if ((ap->mf_Status.view_type == mf_view_storage || ap->mf_Status.view_type == mf_view_root) - && (ap->mf_Status.more == MORE_DEFAULT || ap->mf_Status.more == MORE_INTERNAL_COPY || ap->mf_Status.more == MORE_INTERNAL_MOVE || ap->mf_Status.more == MORE_INTERNAL_DECOMPRESS)) { + && (ap->mf_Status.more == MORE_DEFAULT || ap->mf_Status.more == MORE_INTERNAL_COPY || ap->mf_Status.more == MORE_INTERNAL_MOVE || ap->mf_Status.more == MORE_INTERNAL_DECOMPRESS)) { Evas_Object *parent = NULL; parent = ap->mf_MainWindow.pNaviGenlist; if ((ap->mf_Status.iStorageState & MYFILE_MMC) && !__mf_util_storage_exist_check(parent, MYFILE_MMC)) { pNode = (fsNodeInfo *) malloc(sizeof(fsNodeInfo)); - if (pNode == NULL) + if (pNode == NULL) { return; + } memset(pNode, 0, sizeof(fsNodeInfo)); /*set path */ pNode->path = g_strdup(STORAGE_PARENT); @@ -219,7 +220,7 @@ void mf_util_operation_alloc_failed(void *data) struct appdata *ap = (struct appdata *)data; ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT, NULL, MF_MSG_MEMORY_NOT_ENOUGH, - NULL, NULL, NULL, (Evas_Smart_Cb) elm_exit, NULL); + NULL, NULL, NULL, (Evas_Smart_Cb) elm_exit, NULL); } /****************************** @@ -264,7 +265,7 @@ void mf_util_refresh_screen(void *data) } else { mf_gengrid_align_set(ap->mf_MainWindow.pNaviGengrid, count); } - }else{//Fixed P140416-05429 by jian12.li + } else { //Fixed P140416-05429 by jian12.li int count = elm_genlist_items_count(ap->mf_MainWindow.pNaviGenlist); if (count == 0) { ap->mf_Status.flagNoContent = EINA_TRUE; @@ -313,7 +314,7 @@ void mf_util_refresh_screen(void *data) } SAFE_FREE_CHAR(ap->mf_Status.entry_path); ap->mf_Status.entry_more = MORE_DEFAULT; - /*3. refresh the content of the view */ + /*3. refresh the content of the view */ if (ap->mf_Status.view_type != mf_view_root_category && ap->mf_Status.more != MORE_SEARCH) { mf_navi_bar_recover_info_box(ap); } @@ -391,7 +392,7 @@ void mf_util_refresh_screen(void *data) } else if (ap->mf_Status.view_type == mf_view_recent) { mf_navi_bar_title_content_set(ap, MF_LABEL_RECTENT_FILES); } else { - mf_navi_bar_title_content_set(ap,ap->mf_MainWindow.naviframe_title); + mf_navi_bar_title_content_set(ap, ap->mf_MainWindow.naviframe_title); elm_naviframe_item_title_enabled_set(ap->mf_MainWindow.pNaviItem, EINA_TRUE, EINA_TRUE); } } else if (ap->mf_Status.more != MORE_EDIT_RENAME) { @@ -406,8 +407,8 @@ void mf_util_refresh_screen(void *data) } else { if (ap->mf_Status.view_type == mf_view_root_category - && (ap->mf_Status.more == MORE_COMPRESS || ap->mf_Status.more == MORE_DECOMPRESS - || ap->mf_Status.more == MORE_DECOMPRESS_HERE)) { + && (ap->mf_Status.more == MORE_COMPRESS || ap->mf_Status.more == MORE_DECOMPRESS + || ap->mf_Status.more == MORE_DECOMPRESS_HERE)) { ap->mf_Status.more = MORE_DEFAULT; message = MF_LABEL_SUCCESS; mf_category_view_create(ap, true); @@ -473,20 +474,19 @@ void mf_util_refresh_screen(void *data) EXIT_WITH_POPUP: mf_error("ap->mf_FileOperation.message_type is [%d] message is [%s]", - ap->mf_FileOperation.message_type, message); - if (message == NULL) - { - mf_error("Message NULL..!!"); - return; - } + ap->mf_FileOperation.message_type, message); + if (message == NULL) { + mf_error("Message NULL..!!"); + return; + } if (ap->mf_FileOperation.message_type == message_type_notification) { mf_popup_indicator_popup(ap, mf_util_get_text(message)); ap->mf_FileOperation.pOperationMsg = NULL; } else { ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT_BTN, NULL, - message, MF_BUTTON_LABEL_OK, - NULL, NULL, mf_callback_warning_popup_cb, ap); + message, MF_BUTTON_LABEL_OK, + NULL, NULL, mf_callback_warning_popup_cb, ap); ap->mf_FileOperation.pOperationMsg = NULL; } @@ -518,7 +518,7 @@ bool mf_util_check_forbidden_operation(void *data) ** 1. Recursion move/copy ** 2. move with same file in the same folder */ - MF_TRACE_BEGIN + MF_TRACE_BEGIN mf_retvm_if(data == NULL, false, "passed data is NULL"); struct appdata *ap = (struct appdata *)data; @@ -609,8 +609,8 @@ int mf_util_check_disk_space(void *data) */ if (free_space == 0) { ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT_BTN, NULL, - MF_LABE_NOT_ENOUGH_MEMORY_DELETE_SOME_ITEMS_AND_TRY_AGAIN, MF_BUTTON_LABEL_OK, - NULL, NULL, mf_callback_warning_popup_cb, ap); + MF_LABE_NOT_ENOUGH_MEMORY_DELETE_SOME_ITEMS_AND_TRY_AGAIN, MF_BUTTON_LABEL_OK, + NULL, NULL, mf_callback_warning_popup_cb, ap); mf_debug("Not Enough free size\n"); return MYFILE_ERR_NO_FREE_SPACE; } @@ -687,8 +687,8 @@ void mf_util_normal_item_data_free(mfItemData_s **item_data) ret = media_info_cancel_thumbnail((*item_data)->media); } if (ret == MEDIA_CONTENT_ERROR_NONE) { - media_info_destroy((*item_data)->media); - (*item_data)->media = NULL; + media_info_destroy((*item_data)->media); + (*item_data)->media = NULL; } } free((*item_data)); @@ -707,18 +707,24 @@ void do_list_pointer_protect(Eina_List *list) mf_warning("ap->category_list = %p", ap->mf_FileOperation.category_list); mf_warning("ap->recent_list = %p", ap->mf_FileOperation.recent_list);*/ - if (list==ap->mf_FileOperation.search_result_folder_list) + if (list == ap->mf_FileOperation.search_result_folder_list) { ap->mf_FileOperation.search_result_folder_list = NULL; - if (list==ap->mf_FileOperation.search_result_file_list) + } + if (list == ap->mf_FileOperation.search_result_file_list) { ap->mf_FileOperation.search_result_file_list = NULL; - if (list==ap->mf_FileOperation.folder_list) + } + if (list == ap->mf_FileOperation.folder_list) { ap->mf_FileOperation.folder_list = NULL; - if (list==ap->mf_FileOperation.file_list) + } + if (list == ap->mf_FileOperation.file_list) { ap->mf_FileOperation.file_list = NULL; - if (list==ap->mf_FileOperation.category_list) + } + if (list == ap->mf_FileOperation.category_list) { ap->mf_FileOperation.category_list = NULL; - if (list==ap->mf_FileOperation.recent_list) + } + if (list == ap->mf_FileOperation.recent_list) { ap->mf_FileOperation.recent_list = NULL; + } } @@ -777,43 +783,45 @@ void mf_util_free_eina_list_with_data(Eina_List **list, MYFILE_CONTENT_TYPE type static void __mf_util_icu_set_default_timezone_id() { - i18n_uchar utimezone_id [MYFILE_ICU_ARR_LENGTH] = {0}; - char timezone_buffer[MYFILE_ICU_ARR_LENGTH] = {0}; - char timezone_id[MYFILE_ICU_ARR_LENGTH] = {0}; - char *buffer = NULL; - int timezone_str_size; - int retcode = -1; - - retcode = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_TIMEZONE, &buffer); - if (retcode != SYSTEM_SETTINGS_ERROR_NONE) { - mf_error("[ERR] failed to get the timezone"); + i18n_uchar utimezone_id [MYFILE_ICU_ARR_LENGTH] = {0}; + char timezone_buffer[MYFILE_ICU_ARR_LENGTH] = {0}; + char timezone_id[MYFILE_ICU_ARR_LENGTH] = {0}; + char *buffer = NULL; + int timezone_str_size; + int retcode = -1; + + retcode = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_TIMEZONE, &buffer); + if (retcode != SYSTEM_SETTINGS_ERROR_NONE) { + mf_error("[ERR] failed to get the timezone"); + } + if (buffer) { + strncpy(timezone_id, buffer, sizeof(timezone_id) - 1); + } + timezone_str_size = readlink("/opt/etc/localtime", timezone_buffer, sizeof(timezone_buffer) - 1); + SAFE_FREE_CHAR(buffer); + + if (timezone_str_size > 0) { + char *ptr, *sp, *zone = NULL, *city = NULL; + ptr = strtok_r(timezone_buffer, "/", &sp); + + while ((ptr = strtok_r(NULL, "/", &sp))) { + zone = city; + city = ptr; } - if (buffer) - strncpy(timezone_id, buffer, sizeof(timezone_id)-1); - timezone_str_size = readlink("/opt/etc/localtime", timezone_buffer, sizeof(timezone_buffer)-1); - SAFE_FREE_CHAR(buffer); - - if (timezone_str_size > 0) { - char *ptr, *sp, *zone= NULL, *city= NULL; - ptr = strtok_r(timezone_buffer, "/", &sp); - - while ((ptr = strtok_r(NULL, "/", &sp))) { - zone = city; - city = ptr; - } - - if (zone != NULL && city != NULL) { - if (strcmp("zoneinfo", zone) == 0) - snprintf(timezone_id, MYFILE_ICU_ARR_LENGTH, "%s", city); - else - snprintf(timezone_id, MYFILE_ICU_ARR_LENGTH, "%s/%s", zone, city); - } - } - - if (*timezone_id) { - i18n_ustring_copy_ua_n(utimezone_id, timezone_id, sizeof(timezone_buffer)/2); - retcode = i18n_ucalendar_set_default_timezone(utimezone_id); - } + + if (zone != NULL && city != NULL) { + if (strcmp("zoneinfo", zone) == 0) { + snprintf(timezone_id, MYFILE_ICU_ARR_LENGTH, "%s", city); + } else { + snprintf(timezone_id, MYFILE_ICU_ARR_LENGTH, "%s/%s", zone, city); + } + } + } + + if (*timezone_id) { + i18n_ustring_copy_ua_n(utimezone_id, timezone_id, sizeof(timezone_buffer) / 2); + retcode = i18n_ucalendar_set_default_timezone(utimezone_id); + } } int mf_util_icu_init(void *data) @@ -861,7 +869,7 @@ int mf_util_icu_init(void *data) if (find) { int diff = find - region; if (diff > 0) { - region[diff-1] = '\0'; + region[diff - 1] = '\0'; } } } @@ -896,7 +904,7 @@ int mf_util_icu_init(void *data) SAFE_FREE_CHAR(region); MF_TRACE_END; return MYFILE_ERR_NONE; - } +} void mf_util_icu_finalize(void *data) { @@ -938,7 +946,7 @@ char *mf_util_icu_translate(void *data, i18n_udate date, bool is_init_checking) int32_t formattedLength; status = i18n_udate_format_date(ap->mf_Status.formatter, date, formatted, MYFILE_ICU_ARR_LENGTH, - NULL, &formattedLength); + NULL, &formattedLength); if ((status != I18N_ERROR_NONE) || (formattedLength <= 0)) { mf_debug("firmatterdLength < 0"); @@ -956,173 +964,169 @@ char *mf_util_icu_translate(void *data, i18n_udate date, bool is_init_checking) int mf_util_get_pref_value(MYFILE_PREF_TYPE type, int *value) { - int ret = MYFILE_ERR_NONE; - switch (type) { - case PREF_TYPE_SORT_TYPE: - { - ret = preference_get_int(MF_LIST_BY, value); - if (ret < 0) { - mf_warning("fail to get list_by value, set it default"); - ret = preference_set_int(MF_LIST_BY, MYFILE_SORT_BY_DATE_R2O); - *value = MYFILE_SORT_BY_DATE_R2O; - mf_debug("set int : %d", ret); - } else { - if (*value <= MYFILE_SORT_BY_NONE || *value >= MYFILE_SORT_BY_MAX) - { - mf_warning("invaild list by type[%d], set it default", *value); - ret = preference_set_int(MF_LIST_BY, MYFILE_SORT_BY_DATE_R2O); - mf_debug("set int : %d", ret); - *value = MYFILE_SORT_BY_DATE_R2O; - } - } - return MYFILE_ERR_NONE; - } - break; - - case PREF_TYPE_VIEW_STYLE: - ret = preference_get_int(MF_VIEW_STYLE, value); - if (ret < 0) { - mf_warning("fail to get list_by value, set it default"); - ret = preference_set_int(MF_VIEW_STYLE, MF_VIEW_STYLE_LIST); - *value = MF_VIEW_STYLE_LIST; - mf_debug("ret %d", ret); - } else { - if (*value < MF_VIEW_STYLE_LIST || *value > MF_VIEW_STYLE_THUMBNAIL) { - mf_warning("invaild list by type[%d], set it default", *value); - ret = preference_set_int(MF_VIEW_STYLE, MF_VIEW_STYLE_LIST); - *value = MF_VIEW_STYLE_LIST; - mf_debug("ret %d", ret); - } - } - break; - - case PREF_TYPE_EXTENSION_STATE: - ret = preference_get_int(MF_EXTENSION_STATE, value); - if (ret < 0) { - mf_warning("fail to get list_by value, set it default"); - ret = preference_set_int(MF_EXTENSION_STATE, MF_EXTENSION_SHOW); - *value = MF_EXTENSION_SHOW; - mf_debug("ret : %d", ret); - } else { - if (*value < MF_EXTENSION_SHOW || *value > MF_EXTENSION_HIDE) - { - mf_warning("invaild list by type[%d], set it default", *value); - ret = preference_set_int(MF_EXTENSION_STATE, MF_EXTENSION_SHOW); - *value = MF_EXTENSION_SHOW; - mf_debug("ret : %d", ret); - } - } - break; - case PREF_TYPE_HIDEN_STATE: - ret = preference_get_int(MF_HIDDEN_STATE, value); - if (ret < 0) { - mf_warning("fail to get list_by value, set it default"); - ret = preference_set_int(MF_HIDDEN_STATE, MF_HIDEN_HIDE); - *value = MF_HIDEN_HIDE; - mf_debug("ret : %d", ret); - } else { - if (*value < MF_HIDEN_SHOW|| *value > MF_HIDEN_HIDE) { - mf_warning("invaild list by type[%d], set it default", *value); - ret = preference_set_int(MF_HIDDEN_STATE, MF_HIDEN_HIDE); - *value = MF_HIDEN_HIDE; - mf_debug("ret : %d", ret); - } - } - break; - - default: - mf_debug("No case"); - break; - } - - if (ret != MYFILE_ERR_NONE) { - ret = MYFILE_ERR_STORAGE_GET_FAILED; - mf_warning("MYFILE_ERR_STORAGE_GET_FAILED"); - } - - return ret; + int ret = MYFILE_ERR_NONE; + switch (type) { + case PREF_TYPE_SORT_TYPE: { + ret = preference_get_int(MF_LIST_BY, value); + if (ret < 0) { + mf_warning("fail to get list_by value, set it default"); + ret = preference_set_int(MF_LIST_BY, MYFILE_SORT_BY_DATE_R2O); + *value = MYFILE_SORT_BY_DATE_R2O; + mf_debug("set int : %d", ret); + } else { + if (*value <= MYFILE_SORT_BY_NONE || *value >= MYFILE_SORT_BY_MAX) { + mf_warning("invaild list by type[%d], set it default", *value); + ret = preference_set_int(MF_LIST_BY, MYFILE_SORT_BY_DATE_R2O); + mf_debug("set int : %d", ret); + *value = MYFILE_SORT_BY_DATE_R2O; + } + } + return MYFILE_ERR_NONE; + } + break; + + case PREF_TYPE_VIEW_STYLE: + ret = preference_get_int(MF_VIEW_STYLE, value); + if (ret < 0) { + mf_warning("fail to get list_by value, set it default"); + ret = preference_set_int(MF_VIEW_STYLE, MF_VIEW_STYLE_LIST); + *value = MF_VIEW_STYLE_LIST; + mf_debug("ret %d", ret); + } else { + if (*value < MF_VIEW_STYLE_LIST || *value > MF_VIEW_STYLE_THUMBNAIL) { + mf_warning("invaild list by type[%d], set it default", *value); + ret = preference_set_int(MF_VIEW_STYLE, MF_VIEW_STYLE_LIST); + *value = MF_VIEW_STYLE_LIST; + mf_debug("ret %d", ret); + } + } + break; + + case PREF_TYPE_EXTENSION_STATE: + ret = preference_get_int(MF_EXTENSION_STATE, value); + if (ret < 0) { + mf_warning("fail to get list_by value, set it default"); + ret = preference_set_int(MF_EXTENSION_STATE, MF_EXTENSION_SHOW); + *value = MF_EXTENSION_SHOW; + mf_debug("ret : %d", ret); + } else { + if (*value < MF_EXTENSION_SHOW || *value > MF_EXTENSION_HIDE) { + mf_warning("invaild list by type[%d], set it default", *value); + ret = preference_set_int(MF_EXTENSION_STATE, MF_EXTENSION_SHOW); + *value = MF_EXTENSION_SHOW; + mf_debug("ret : %d", ret); + } + } + break; + case PREF_TYPE_HIDEN_STATE: + ret = preference_get_int(MF_HIDDEN_STATE, value); + if (ret < 0) { + mf_warning("fail to get list_by value, set it default"); + ret = preference_set_int(MF_HIDDEN_STATE, MF_HIDEN_HIDE); + *value = MF_HIDEN_HIDE; + mf_debug("ret : %d", ret); + } else { + if (*value < MF_HIDEN_SHOW || *value > MF_HIDEN_HIDE) { + mf_warning("invaild list by type[%d], set it default", *value); + ret = preference_set_int(MF_HIDDEN_STATE, MF_HIDEN_HIDE); + *value = MF_HIDEN_HIDE; + mf_debug("ret : %d", ret); + } + } + break; + + default: + mf_debug("No case"); + break; + } + + if (ret != MYFILE_ERR_NONE) { + ret = MYFILE_ERR_STORAGE_GET_FAILED; + mf_warning("MYFILE_ERR_STORAGE_GET_FAILED"); + } + + return ret; } void mf_util_set_sort_type(int value) { - int ret = -1; - - if (value <= MYFILE_SORT_BY_NONE || value >= MYFILE_SORT_BY_MAX) - { - ret = preference_set_int(MF_LIST_BY, MYFILE_SORT_BY_DATE_R2O); - mf_warning("invaild list by type[%d], set it default, %d", value, ret); - } else { - ret = preference_set_int(MF_LIST_BY, value); - mf_debug("value is [%d], [%d]", value, ret); - } - - return; + int ret = -1; + + if (value <= MYFILE_SORT_BY_NONE || value >= MYFILE_SORT_BY_MAX) { + ret = preference_set_int(MF_LIST_BY, MYFILE_SORT_BY_DATE_R2O); + mf_warning("invaild list by type[%d], set it default, %d", value, ret); + } else { + ret = preference_set_int(MF_LIST_BY, value); + mf_debug("value is [%d], [%d]", value, ret); + } + + return; } void mf_util_set_extension_state(int value) { - int ret = -1; + int ret = -1; - if (value <= MF_EXTENSION_NONE || value >= MF_EXTENSION_MAX) { - ret = preference_set_int(MF_EXTENSION_STATE, MF_EXTENSION_SHOW); - mf_warning("invaild list by type[%d], set it default : %d", value, ret); - } else { - ret = preference_set_int(MF_EXTENSION_STATE, value); - mf_debug("value is [%d], [%d]", value, ret); - } + if (value <= MF_EXTENSION_NONE || value >= MF_EXTENSION_MAX) { + ret = preference_set_int(MF_EXTENSION_STATE, MF_EXTENSION_SHOW); + mf_warning("invaild list by type[%d], set it default : %d", value, ret); + } else { + ret = preference_set_int(MF_EXTENSION_STATE, value); + mf_debug("value is [%d], [%d]", value, ret); + } - return; + return; } void mf_util_set_hiden_state(int value) { - int ret = -1; + int ret = -1; - if (value <= MF_HIDEN_NONE || value >= MF_HIDEN_MAX) { - ret = preference_set_int(MF_HIDDEN_STATE, MF_HIDEN_HIDE); - mf_warning("invaild hiden by type[%d], set it default : %d", value, ret); - } else { - ret = preference_set_int(MF_HIDDEN_STATE, value); - mf_debug("value is [%d] [%d]", value, ret); - } + if (value <= MF_HIDEN_NONE || value >= MF_HIDEN_MAX) { + ret = preference_set_int(MF_HIDDEN_STATE, MF_HIDEN_HIDE); + mf_warning("invaild hiden by type[%d], set it default : %d", value, ret); + } else { + ret = preference_set_int(MF_HIDDEN_STATE, value); + mf_debug("value is [%d] [%d]", value, ret); + } - return; + return; } void mf_util_set_view_style(int value) { - int ret = -1; + int ret = -1; - if (value < MF_VIEW_STYLE_LIST || value > MF_VIEW_STYLE_THUMBNAIL) { - ret = preference_set_int(MF_VIEW_STYLE, MF_VIEW_STYLE_LIST); - mf_warning("invaild list by type[%d], set it default : %d", value, ret); - } else { - ret = preference_set_int(MF_VIEW_STYLE, value); - mf_debug("value is [%d], [%d]", value, ret); - } + if (value < MF_VIEW_STYLE_LIST || value > MF_VIEW_STYLE_THUMBNAIL) { + ret = preference_set_int(MF_VIEW_STYLE, MF_VIEW_STYLE_LIST); + mf_warning("invaild list by type[%d], set it default : %d", value, ret); + } else { + ret = preference_set_int(MF_VIEW_STYLE, value); + mf_debug("value is [%d], [%d]", value, ret); + } - return; + return; } void mf_util_set_recent_file(char *path) { - if (path == NULL) { - mf_debug("path NULL"); - return; - } + if (path == NULL) { + mf_debug("path NULL"); + return; + } - int ret = -1; - ret = preference_set_string(MF_RECENT_FILE, path); - mf_debug("ret is [%d]", ret); + int ret = -1; + ret = preference_set_string(MF_RECENT_FILE, path); + mf_debug("ret is [%d]", ret); - return; + return; } bool mf_util_db_get_recent_files_cb(MFRitem *Ritem, void *user_data) { struct appdata *ap = (struct appdata *)user_data; if (Ritem && Ritem->path) { - SECURE_ERROR("Ritem->path is [%s]mf_file_exists is [%d] access(dst_dir, R_OK | W_OK) is [%d] ",Ritem->path, mf_file_exists(Ritem->path), access(Ritem->path, R_OK | W_OK)); + SECURE_ERROR("Ritem->path is [%s]mf_file_exists is [%d] access(dst_dir, R_OK | W_OK) is [%d] ", Ritem->path, mf_file_exists(Ritem->path), access(Ritem->path, R_OK | W_OK)); if (mf_file_exists(Ritem->path)) { mf_util_generate_list_prepend(&ap->mf_FileOperation.recent_list, g_strdup(Ritem->path), FILE_TYPE_ETC, mf_list_recent_files); } else { @@ -1184,12 +1188,12 @@ void mf_util_exception_func(void *data) case MORE_DATA_COPYING: ap->mf_Status.more = MORE_INTERNAL_COPY; ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT, NULL, - MF_MSG_COPY_FAILED2, NULL, NULL, NULL, (Evas_Smart_Cb)mf_callback_exception_popup_cb, ap); + MF_MSG_COPY_FAILED2, NULL, NULL, NULL, (Evas_Smart_Cb)mf_callback_exception_popup_cb, ap); break; case MORE_DATA_MOVING: ap->mf_Status.more = MORE_INTERNAL_MOVE; ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT, NULL, - MF_MSG_MOVE_FAILED3, NULL, NULL, NULL, (Evas_Smart_Cb)mf_callback_exception_popup_cb, ap); + MF_MSG_MOVE_FAILED3, NULL, NULL, NULL, (Evas_Smart_Cb)mf_callback_exception_popup_cb, ap); break; case MORE_DELETE: ap->mf_Status.more = MORE_DEFAULT; @@ -1238,31 +1242,32 @@ EXIT: void mf_util_set_pm_lock(void *data, Eina_Bool isLock) { - MF_TRACE_BEGIN; - mf_retm_if(data == NULL, "data is NULL"); - - int ret = -1; - struct appdata *ap = (struct appdata *)data; - - if (ap->mf_Status.flagLCDLock != isLock) { - if (ap->mf_Status.flagLCDLock == EINA_TRUE) { - ap->mf_Status.flagLCDLock = EINA_FALSE; - } else { - ap->mf_Status.flagLCDLock = EINA_TRUE; - } - - if (ap->mf_Status.flagLCDLock) { - mf_debug("lock the LCD_OFF"); - ret = device_power_request_lock(POWER_LOCK_CPU, 0); - } else { - mf_debug("unlock the LCD_OFF"); - ret = device_power_release_lock(POWER_LOCK_CPU); - } - - if (ret != 0) - mf_debug("fail to lock(unlock)"); - } - MF_TRACE_END; + MF_TRACE_BEGIN; + mf_retm_if(data == NULL, "data is NULL"); + + int ret = -1; + struct appdata *ap = (struct appdata *)data; + + if (ap->mf_Status.flagLCDLock != isLock) { + if (ap->mf_Status.flagLCDLock == EINA_TRUE) { + ap->mf_Status.flagLCDLock = EINA_FALSE; + } else { + ap->mf_Status.flagLCDLock = EINA_TRUE; + } + + if (ap->mf_Status.flagLCDLock) { + mf_debug("lock the LCD_OFF"); + ret = device_power_request_lock(POWER_LOCK_CPU, 0); + } else { + mf_debug("unlock the LCD_OFF"); + ret = device_power_release_lock(POWER_LOCK_CPU); + } + + if (ret != 0) { + mf_debug("fail to lock(unlock)"); + } + } + MF_TRACE_END; } long mf_util_character_count_get(const char *original) @@ -1270,13 +1275,13 @@ long mf_util_character_count_get(const char *original) mf_retvm_if(original == NULL, 0, "input string is NULL"); long count = 0; char *utf8_form = g_locale_to_utf8(original, -1, NULL, NULL, NULL); - if (utf8_form == NULL) + if (utf8_form == NULL) { + return count; + } else { + count = g_utf8_strlen(utf8_form, -1); + free(utf8_form); + mf_debug("utf8 count is %ld", count); return count; - else { - count = g_utf8_strlen(utf8_form, -1); - free(utf8_form); - mf_debug("utf8 count is %ld", count); - return count; } } @@ -1296,7 +1301,7 @@ gboolean mf_util_is_file_selected(Eina_List **source, GString *path) mf_debug("source_path is [%s] path is [%s]", source_path->str, path->str); if (g_strcmp0(source_path->str, path->str) == 0) { flag = TRUE; - mf_debug("flag is [%d]source_path is [%s] path is [%s]",flag, source_path->str, path->str); + mf_debug("flag is [%d]source_path is [%s] path is [%s]", flag, source_path->str, path->str); *source = eina_list_remove(*source, source_path); g_string_free(source_path, TRUE); source_path = NULL; @@ -1314,7 +1319,7 @@ gboolean mf_util_is_file_selected(Eina_List **source, GString *path) return flag; } -int mf_util_generate_list_data(const char *path, Eina_List **dir_list ,Eina_List ** file_list) +int mf_util_generate_list_data(const char *path, Eina_List **dir_list , Eina_List ** file_list) { MF_TRACE_BEGIN; mf_retvm_if(path == NULL, 0, "input path is NULL"); @@ -1344,8 +1349,8 @@ int mf_util_generate_file_list(void *data) Eina_List *dir_list = NULL; int error_code = 0; - mf_retvm_if (ap->mf_Status.path == NULL, MYFILE_ERR_INVALID_ARG, "ap->mf_Status.path is NULL"); - mf_retvm_if (ap->mf_Status.path->str == NULL, MYFILE_ERR_INVALID_ARG, "ap->mf_Status.path->str is NULL"); + mf_retvm_if(ap->mf_Status.path == NULL, MYFILE_ERR_INVALID_ARG, "ap->mf_Status.path is NULL"); + mf_retvm_if(ap->mf_Status.path->str == NULL, MYFILE_ERR_INVALID_ARG, "ap->mf_Status.path->str is NULL"); error_code = mf_util_generate_list_data(ap->mf_Status.path->str, &dir_list, &file_list); if (error_code != MYFILE_ERR_NONE) { @@ -1377,8 +1382,9 @@ int mf_util_generate_root_view_file_list(void *data, Eina_List **list, int stora mf_retvm_if(data == NULL, 0, "data is null"); pNode = (fsNodeInfo *) malloc(sizeof(fsNodeInfo)); - if (pNode == NULL) + if (pNode == NULL) { return 0; + } /*set path */ memset(pNode, 0, sizeof(fsNodeInfo)); @@ -1428,7 +1434,7 @@ void mf_util_sort_the_file_list(void *data) /*need to sort folder items only By Name and Date*/ if (iSortTypeValue == MYFILE_SORT_BY_NAME_A2Z || iSortTypeValue == MYFILE_SORT_BY_NAME_Z2A || iSortTypeValue == MYFILE_SORT_BY_DATE_R2O - || iSortTypeValue == MYFILE_SORT_BY_DATE_O2R) { + || iSortTypeValue == MYFILE_SORT_BY_DATE_O2R) { mf_fs_oper_sort_list(&ap->mf_FileOperation.folder_list, iSortTypeValue); } else { mf_fs_oper_sort_list(&ap->mf_FileOperation.folder_list, MYFILE_SORT_BY_NAME_A2Z); @@ -1468,8 +1474,8 @@ const char *mf_util_search_markup_keyword(const char *string, char *searchword, int i = 0; bool found = false; gchar *markup_text_start = NULL; - gchar *markup_text_end= NULL; - gchar *markup_text= NULL; + gchar *markup_text_end = NULL; + gchar *markup_text = NULL; int r = 222; int g = 111; @@ -1481,7 +1487,7 @@ const char *mf_util_search_markup_keyword(const char *string, char *searchword, mf_retvm_if(result == NULL, NULL, "result is NULL"); char *translate_keyword = elm_entry_markup_to_utf8(searchword); - if (g_utf8_validate(string,-1,NULL)) { + if (g_utf8_validate(string, -1, NULL)) { strncpy(pstr, string, DEF_BUF_LEN); word_len = strlen(pstr); @@ -1518,12 +1524,12 @@ const char *mf_util_search_markup_keyword(const char *string, char *searchword, } *result = found; - memset(return_string, 0x00, DEF_BUF_LEN+1); + memset(return_string, 0x00, DEF_BUF_LEN + 1); bool is_valid_length = ((i + search_len) <= word_len);//Fixed P131112-02074 if (found && is_valid_length) { if (i == 0) { markup_text = g_markup_escape_text(&pstr[0], search_len); - markup_text_end = g_markup_escape_text(&pstr[search_len], word_len-search_len); + markup_text_end = g_markup_escape_text(&pstr[search_len], word_len - search_len); mf_retvm_if(markup_text == NULL, NULL, "markup_text is NULL"); mf_retvm_if(markup_text_end == NULL, NULL, "markup_text_end is NULL"); @@ -1534,7 +1540,7 @@ const char *mf_util_search_markup_keyword(const char *string, char *searchword, markup_text_start = g_markup_escape_text(&pstr[0], i); markup_text = g_markup_escape_text(&pstr[i], search_len); - markup_text_end = g_markup_escape_text(&pstr[i+search_len], word_len-(i+search_len)); + markup_text_end = g_markup_escape_text(&pstr[i + search_len], word_len - (i + search_len)); mf_retvm_if(markup_text_start == NULL, NULL, "markup_text_start is NULL"); mf_retvm_if(markup_text == NULL, NULL, "markup_text is NULL"); mf_retvm_if(markup_text_end == NULL, NULL, "markup_text_end is NULL"); @@ -1562,10 +1568,11 @@ char *mf_util_get_text(const char *ID) MF_CHECK_NULL(ID); char *str; - if (strstr(ID, "IDS_COM")) + if (strstr(ID, "IDS_COM")) { str = dgettext("sys_string", ID); - else + } else { str = gettext(ID); + } return str; } @@ -1744,8 +1751,7 @@ bool mf_util_is_rotation_lock(void) void mf_util_free_data(void **data, int type) { switch (type) { - case MYFILE_TYPE_FSNODE: - { + case MYFILE_TYPE_FSNODE: { if (*data != NULL) { SAFE_FREE_CHAR(((fsNodeInfo *)(*data))->path); SAFE_FREE_CHAR(((fsNodeInfo *)(*data))->name); @@ -1755,9 +1761,8 @@ void mf_util_free_data(void **data, int type) *data = NULL; } } - break; - case MYFILE_TYPE_ITEM_DATA: - { + break; + case MYFILE_TYPE_ITEM_DATA: { if (*data != NULL) { SAFE_FREE_GSTRING(((mfItemData_s *)(*data))->m_ItemName); SAFE_FREE_CHAR(((mfItemData_s *)(*data))->size); @@ -1773,7 +1778,7 @@ void mf_util_free_data(void **data, int type) *data = NULL; } } - break; + break; default: break; } diff --git a/src/media-db/mf-media-db.c b/src/media-db/mf-media-db.c index 9886caf..adade1e 100755 --- a/src/media-db/mf-media-db.c +++ b/src/media-db/mf-media-db.c @@ -44,43 +44,43 @@ static sqlite3_callback sqlite3_func = NULL; static void *func_params = NULL; typedef enum { - MF_TABLE_NONE = -1, - MF_TABLE_RECENT_FILES, - MF_TABLE_NUM, + MF_TABLE_NONE = -1, + MF_TABLE_RECENT_FILES, + MF_TABLE_NUM, } mf_tbl_name_e; typedef enum { - MF_FIELD_RECENT_FILES_NONE = -1, - MF_FIELD_RECENT_FILES_PATH, - MF_FIELD_RECENT_FILES_NAME, - MF_FIELD_RECENT_FILES_STORAGE_TYPE, - MF_FIELD_RECENT_FILES_THUMBNAIL, - MF_FIELD_RECENT_FILES_NUM, + MF_FIELD_RECENT_FILES_NONE = -1, + MF_FIELD_RECENT_FILES_PATH, + MF_FIELD_RECENT_FILES_NAME, + MF_FIELD_RECENT_FILES_STORAGE_TYPE, + MF_FIELD_RECENT_FILES_THUMBNAIL, + MF_FIELD_RECENT_FILES_NUM, } mf_field_recent_files_e; typedef struct { - char *field_name; - char *field_type; + char *field_name; + char *field_type; } mf_tbl_field_s; typedef struct { char *table_name; - mf_tbl_field_s mf_tbl_field[MF_FIELD_RECENT_FILES_NUM+1]; + mf_tbl_field_s mf_tbl_field[MF_FIELD_RECENT_FILES_NUM + 1]; } mf_tbl_s; -mf_tbl_s mf_tbl[MF_TABLE_NUM] = -{ - {"recent_files", - { - {"path", ""} /* PK */ - , - {"name", ""} - , - {"storage_type", ""} - , - {"thumbnail_path", ""} - } - } +mf_tbl_s mf_tbl[MF_TABLE_NUM] = { + { + "recent_files", + { + {"path", ""} /* PK */ + , + {"name", ""} + , + {"storage_type", ""} + , + {"thumbnail_path", ""} + } + } }; static int __mf_busy_handler(void *pData, int count) @@ -93,10 +93,10 @@ static int __mf_busy_handler(void *pData, int count) } int mf_sqlite3_exec(sqlite3 *p_db, /* An open database */ - const char *sql, /* SQL to be evaluated */ - int (*callback)(void*,int,char**,char**), /* Callback function */ - void * params, /* 1st argument to callback */ - char **errmsg) /* Error msg written here */ + const char *sql, /* SQL to be evaluated */ + int (*callback)(void*, int, char**, char**), /* Callback function */ + void * params, /* 1st argument to callback */ + char **errmsg) /* Error msg written here */ { mf_debug("mf_sqlite3_exec enter\n"); sqlite3_stmt* p_statement = NULL; @@ -132,13 +132,14 @@ static int __mf_sqlite3_commit_trans(MFDHandle *mfd_handle) if (SQLITE_OK != mf_sqlite3_exec(handle, "COMMIT;", sqlite3_func, func_params, &err_msg)) { if (err_msg) { mf_debug("Error:failed to end transaction: error=%s\n", - err_msg); + err_msg); sqlite3_free(err_msg); } return MFD_ERROR_DB_INTERNAL; } - if (err_msg) + if (err_msg) { sqlite3_free(err_msg); + } mf_debug("gm_sqlite3_commit_trans leave\n"); return 0; } @@ -148,10 +149,11 @@ static int __mf_query_bind_text(sqlite3_stmt *stmt, int pos, const char *str) { assert(NULL != stmt); - if (str) + if (str) { return sqlite3_bind_text(stmt, pos, (const char*)str, strlen(str), SQLITE_STATIC); - else + } else { return sqlite3_bind_null(stmt, pos); + } } static int __mf_query_bind_int(sqlite3_stmt *stmt, int pos, int num) @@ -178,7 +180,7 @@ static int __mf_query_table_column_int(sqlite3_stmt *stmt, int pos) static void __mf_data_to_text(char *textbuf, char **output) { - if (textbuf && strlen(textbuf)>0) { + if (textbuf && strlen(textbuf) > 0) { if (*output) { free(*output); *output = NULL; @@ -211,8 +213,9 @@ static int __mf_query_sql(MFDHandle *mfd_handle, char *query_str) return MFD_ERROR_DB_INTERNAL; } - if (err_msg) + if (err_msg) { sqlite3_free(err_msg); + } mf_debug("query success\n"); return err; @@ -230,16 +233,17 @@ static int __mf_sqlite3_begin_trans(MFDHandle *mfd_handle) mf_debug("gm_sqlite3_begin_trans enter\n"); if (SQLITE_OK != - mf_sqlite3_exec(handle, "BEGIN IMMEDIATE;", NULL, NULL, &err_msg)) { - if (err_msg) { + mf_sqlite3_exec(handle, "BEGIN IMMEDIATE;", NULL, NULL, &err_msg)) { + if (err_msg) { mf_debug("Error:failed to begin transaction: error=%s\n", - err_msg); + err_msg); sqlite3_free(err_msg); - } + } return MFD_ERROR_DB_INTERNAL; } - if (err_msg) + if (err_msg) { sqlite3_free(err_msg); + } mf_debug("gm_sqlite3_begin_trans leave\n"); return 0; } @@ -256,16 +260,17 @@ static int __mf_sqlite3_rollback_trans(MFDHandle *mfd_handle) mf_debug("gm_sqlite3_rollback_trans enter\n"); if (SQLITE_OK != - mf_sqlite3_exec(handle, "ROLLBACK;", NULL, NULL, &err_msg)) { - if (err_msg) { + mf_sqlite3_exec(handle, "ROLLBACK;", NULL, NULL, &err_msg)) { + if (err_msg) { mf_debug("Error:failed to rollback transaction: error=%s\n", - err_msg); + err_msg); sqlite3_free(err_msg); - } + } return MFD_ERROR_DB_INTERNAL; } - if (err_msg) + if (err_msg) { sqlite3_free(err_msg); + } mf_debug("gm_sqlite3_rollback_trans leave\n"); return 0; } @@ -296,8 +301,9 @@ static void __mf_foreach_recent_files_ritem_cb(mf_recent_files_item_cb callback, MFRitem *ritem = NULL; ritem = (MFRitem *)iter->data; - if (callback(ritem, user_data) == FALSE) + if (callback(ritem, user_data) == FALSE) { break; + } } } @@ -306,7 +312,8 @@ static void __mf_free_recent_files_list(void *data) mf_destroy_recent_files_item(data); } -static void __mf_media_db_eina_list_free_full(Eina_List **list, void (*func)(void *data)) { +static void __mf_media_db_eina_list_free_full(Eina_List **list, void (*func)(void *data)) +{ mf_retm_if(*list == NULL, "list is NULL"); void *pNode = NULL; @@ -376,11 +383,11 @@ int mf_disconnect_db_with_handle(sqlite3 *db_handle) return MFD_ERROR_NONE; } -int mf_insert_recent_file(MFDHandle *mfd_handle, const char *path, const char *name, int storage_type, +int mf_insert_recent_file(MFDHandle *mfd_handle, const char *path, const char *name, int storage_type, const char *thumbnail_path) { mf_debug(""); - mf_retvm_if (path == NULL, MFD_ERROR_INVALID_PARAMETER, "path is NULL"); + mf_retvm_if(path == NULL, MFD_ERROR_INVALID_PARAMETER, "path is NULL"); //mf_retvm_if (thumbnail_path == NULL, MFD_ERROR_INVALID_PARAMETER, "path is NULL"); sqlite3_stmt *stmt = NULL; @@ -393,11 +400,11 @@ int mf_insert_recent_file(MFDHandle *mfd_handle, const char *path, const char *n mf_tbl_field = mf_tbl[field_seq].mf_tbl_field; snprintf(query_string, sizeof(query_string), MF_INSERT_INTO_RECENT_FILES_TABLE, - mf_tbl[field_seq].table_name, - mf_tbl_field[MF_FIELD_RECENT_FILES_PATH].field_name, - mf_tbl_field[MF_FIELD_RECENT_FILES_NAME].field_name, - mf_tbl_field[MF_FIELD_RECENT_FILES_STORAGE_TYPE].field_name, - mf_tbl_field[MF_FIELD_RECENT_FILES_THUMBNAIL].field_name); + mf_tbl[field_seq].table_name, + mf_tbl_field[MF_FIELD_RECENT_FILES_PATH].field_name, + mf_tbl_field[MF_FIELD_RECENT_FILES_NAME].field_name, + mf_tbl_field[MF_FIELD_RECENT_FILES_STORAGE_TYPE].field_name, + mf_tbl_field[MF_FIELD_RECENT_FILES_THUMBNAIL].field_name); err = sqlite3_prepare_v2(mfd_handle, query_string, strlen(query_string), &stmt, NULL); if (err != SQLITE_OK) { @@ -445,9 +452,9 @@ int mf_delete_recent_files(MFDHandle *mfd_handle, const char *path) query_string = sqlite3_mprintf(MF_DELETE_FROM_RECENT_FILES_TABLE, - mf_tbl[field_seq].table_name, - mf_tbl_field[MF_FIELD_RECENT_FILES_PATH].field_name, - path); + mf_tbl[field_seq].table_name, + mf_tbl_field[MF_FIELD_RECENT_FILES_PATH].field_name, + path); mf_debug("Query : %s", query_string); @@ -488,9 +495,9 @@ int mf_delete_recent_files_by_type(MFDHandle *mfd_handle, int storage_type) query_string = sqlite3_mprintf(MF_DELETE_BY_TYPE_FROM_RECENT_FILES_TABLE, - mf_tbl[field_seq].table_name, - mf_tbl_field[MF_FIELD_RECENT_FILES_STORAGE_TYPE].field_name, - storage_type); + mf_tbl[field_seq].table_name, + mf_tbl_field[MF_FIELD_RECENT_FILES_STORAGE_TYPE].field_name, + storage_type); mf_debug("Query : %s", query_string); @@ -541,11 +548,11 @@ int mf_update_recent_files_thumbnail(MFDHandle *mfd_handle, const char *thumbnai query_string = sqlite3_mprintf(MF_UPDATE_SET_RECENT_FILES_TABLE, - mf_tbl[field_seq].table_name, - mf_tbl_field[MF_FIELD_RECENT_FILES_THUMBNAIL].field_name, - new_thumbnail, - mf_tbl_field[MF_FIELD_RECENT_FILES_THUMBNAIL].field_name, - thumbnail); + mf_tbl[field_seq].table_name, + mf_tbl_field[MF_FIELD_RECENT_FILES_THUMBNAIL].field_name, + new_thumbnail, + mf_tbl_field[MF_FIELD_RECENT_FILES_THUMBNAIL].field_name, + thumbnail); mf_debug("Query : %s", query_string); @@ -562,7 +569,7 @@ int mf_update_recent_files_thumbnail(MFDHandle *mfd_handle, const char *thumbnai } -int mf_update_recent_files_name(MFDHandle *mfd_handle,const char *new_name, char *old_name) +int mf_update_recent_files_name(MFDHandle *mfd_handle, const char *new_name, char *old_name) { if (new_name == NULL) { mf_debug("device_id is null"); @@ -578,11 +585,11 @@ int mf_update_recent_files_name(MFDHandle *mfd_handle,const char *new_name, char query_string = sqlite3_mprintf(MF_UPDATE_SET_RECENT_FILES_TABLE, - mf_tbl[field_seq].table_name, - mf_tbl_field[MF_FIELD_RECENT_FILES_PATH].field_name, - new_name, - mf_tbl_field[MF_FIELD_RECENT_FILES_PATH].field_name, - old_name); + mf_tbl[field_seq].table_name, + mf_tbl_field[MF_FIELD_RECENT_FILES_PATH].field_name, + new_name, + mf_tbl_field[MF_FIELD_RECENT_FILES_PATH].field_name, + old_name); mf_error("Query : %s", query_string); @@ -630,7 +637,7 @@ int mf_foreach_recent_files_list(MFDHandle *mfd_handle, mf_recent_files_item_cb } Eina_List *recent_files_list = NULL; - MFRitem *ritem= NULL; + MFRitem *ritem = NULL; while (SQLITE_ROW == rc) { ritem = (MFRitem *)calloc(1, sizeof(MFRitem)); @@ -717,9 +724,9 @@ int mf_find_recent_file(MFDHandle *mfd_handle, const char *path) int rc = 0; int find = 0; query_string = sqlite3_mprintf(MF_SELECT_FROM_RECENT_FILE_TABLE, - mf_tbl[field_seq].table_name, - mf_tbl_field[MF_FIELD_RECENT_FILES_PATH].field_name, - path); + mf_tbl[field_seq].table_name, + mf_tbl_field[MF_FIELD_RECENT_FILES_PATH].field_name, + path); mf_error("Query : %s", query_string); diff --git a/src/media-db/mf-media.c b/src/media-db/mf-media.c index 9a0b645..b9bbdb5 100755 --- a/src/media-db/mf-media.c +++ b/src/media-db/mf-media.c @@ -59,7 +59,7 @@ int mf_media_add_recent_files(MFDHandle *mfd_handle, const char *path, const cha } ret = mf_insert_recent_file(mfd_handle, path, name, storage_type, thumbnail_path); - if (ret != MFD_ERROR_NONE) { + if (ret != MFD_ERROR_NONE) { mf_debug("insert content info into folder table failed"); return ret; } @@ -77,7 +77,7 @@ int mf_media_delete_recent_files(MFDHandle *mfd_handle, const char *path) } ret = mf_delete_recent_files(mfd_handle, path); - if (ret != MFD_ERROR_NONE) { + if (ret != MFD_ERROR_NONE) { mf_debug("delete device info into devices table failed"); return ret; } @@ -95,7 +95,7 @@ int mf_media_delete_recent_files_by_type(MFDHandle *mfd_handle, int storage_type } ret = mf_delete_recent_files_by_type(mfd_handle, storage_type); - if (ret != MFD_ERROR_NONE) { + if (ret != MFD_ERROR_NONE) { mf_debug("delete device info into devices table failed"); return ret; } @@ -113,9 +113,9 @@ int mf_media_update_recent_files_thumbnail(MFDHandle *mfd_handle, const char *th } ret = mf_update_recent_files_thumbnail(mfd_handle, thumbnail, new_thumbnail); - if (ret != MFD_ERROR_NONE) { + if (ret != MFD_ERROR_NONE) { mf_debug - ("update device icon failed"); + ("update device icon failed"); return ret; } @@ -133,7 +133,7 @@ int mf_media_foreach_recent_files_list(MFDHandle *mfd_handle, mf_recent_files_it } ret = mf_foreach_recent_files_list(mfd_handle, callback, user_data); - if (ret != MFD_ERROR_NONE && ret != MFD_ERROR_DB_NO_RECORD) { + if (ret != MFD_ERROR_NONE && ret != MFD_ERROR_DB_NO_RECORD) { mf_debug("foreach content list fail"); return ret; } @@ -151,9 +151,9 @@ int mf_media_get_recent_files_count(MFDHandle *mfd_handle, int *count) } ret = mf_get_recent_files_count(mfd_handle, count); - if (ret != MFD_ERROR_NONE && ret != MFD_ERROR_DB_NO_RECORD) { + if (ret != MFD_ERROR_NONE && ret != MFD_ERROR_DB_NO_RECORD) { mf_debug - ("foreach content list fail"); + ("foreach content list fail"); return ret; } diff --git a/src/mf-main.c b/src/mf-main.c index 32f17ae..a12244f 100755 --- a/src/mf-main.c +++ b/src/mf-main.c @@ -308,13 +308,13 @@ __mf_main_app_init_idler_cb(void *data) SAFE_FREE_ECORE_EVENT(ap->mf_MainWindow.event); ap->mf_MainWindow.event = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, - (Ecore_Event_Handler_Cb)mf_context_popup_mousedown_cb, ap); + (Ecore_Event_Handler_Cb)mf_context_popup_mousedown_cb, ap); mf_callback_set_mmc_state_cb(ap); ap->mf_Status.app_init_idler = NULL; //mf_callback_imf_state_callback_register(ap); -/*** Add the media-db update callback ***********/ + /*** Add the media-db update callback ***********/ media_content_set_db_updated_cb(mf_category_list_update_cb, ap); mf_file_recursive_rm(TEMP_FOLDER_FOR_COPY_PHONE); mf_file_recursive_rm(TEMP_FOLDER_FOR_COPY_MMC); @@ -343,7 +343,7 @@ static int __mf_main_remake_app(app_control_h app_control, void *data) RAISE_WIN: -/**************pre-condition test to launch myfile app******************/ + /**************pre-condition test to launch myfile app******************/ MF_TRACE_END; t_end; @@ -387,8 +387,7 @@ void __mf_main_rotation_list_register(Evas_Object *win) { MF_TRACE_BEGIN; mf_retm_if(win == NULL, "win is NULL"); - if (elm_win_wm_rotation_supported_get(win)) - { + if (elm_win_wm_rotation_supported_get(win)) { const int rots[4] = { 0, 90, 180, 270 }; elm_win_wm_rotation_available_rotations_set(win, rots, 4); } @@ -430,10 +429,10 @@ static void run_extra(void *data) pthread_t thread_extra; pthread_attr_t attr; pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); if (initialization_done_extra != 1) { - pthread_create(&thread_extra,&attr,initialization_extra,data); - initialization_done_extra=1; + pthread_create(&thread_extra, &attr, initialization_extra, data); + initialization_done_extra = 1; } } @@ -534,7 +533,7 @@ bool __mf_main_create_app(void *data) elm_object_content_set(ap->mf_MainWindow.pConformant, ap->mf_MainWindow.pMainLayout); elm_win_conformant_set(ap->mf_MainWindow.pWindow, EINA_TRUE); - //recover indicator mode and type when your view disappeared. + //recover indicator mode and type when your view disappeared. elm_win_indicator_mode_set(ap->mf_MainWindow.pWindow, ELM_WIN_INDICATOR_SHOW); elm_win_indicator_opacity_set(ap->mf_MainWindow.pWindow, ELM_WIN_INDICATOR_TRANSPARENT); elm_object_signal_emit(ap->mf_MainWindow.pConformant, "elm,state,indicator,overlap", ""); @@ -574,10 +573,10 @@ static void __mf_main_bundle_parse(app_control_h service, void *data) struct appdata *ap = (struct appdata *)data; - app_control_get_extra_data (service, "path", &ap->mf_Bundle.path); - app_control_get_extra_data (service, "select_type", &ap->mf_Bundle.select_type); - app_control_get_extra_data (service, "file_type", &ap->mf_Bundle.file_type); - app_control_get_extra_data (service, "marked_mode", &ap->mf_Bundle.marked_mode); + app_control_get_extra_data(service, "path", &ap->mf_Bundle.path); + app_control_get_extra_data(service, "select_type", &ap->mf_Bundle.select_type); + app_control_get_extra_data(service, "file_type", &ap->mf_Bundle.file_type); + app_control_get_extra_data(service, "marked_mode", &ap->mf_Bundle.marked_mode); MF_TRACE_END; t_end; } @@ -606,7 +605,7 @@ static void __mf_main_reset_app(app_control_h app_control, void *data) char *tmp = NULL; mf_error(); char *operation = NULL; - + app_control_get_operation(app_control, &operation); mf_error("operation is [%s]", operation); if (g_strcmp0(operation, APP_CONTROL_OPERATION_PICK) == 0) { @@ -644,8 +643,7 @@ static void __mf_main_reset_app(app_control_h app_control, void *data) SAFE_DEL_NAVI_ITEM(&ap->mf_Status.pPreNaviItem); //run_extra(data); } else { - if (ap->mf_MainWindow.pWindow != NULL && ap->mf_Status.b_run_background) - { + if (ap->mf_MainWindow.pWindow != NULL && ap->mf_Status.b_run_background) { if (mf_util_is_rotation_lock() == 0) { mf_debug("rotation is locked"); if (ap->mf_Status.rotation_type == MF_ROTATE_PORTRAIT) { @@ -680,8 +678,7 @@ static void __mf_main_reset_app(app_control_h app_control, void *data) run_extra(data); SAFE_FREE_CHAR(uri); } else { - if (ap->mf_MainWindow.pWindow != NULL && ap->mf_Status.b_run_background) - { + if (ap->mf_MainWindow.pWindow != NULL && ap->mf_Status.b_run_background) { if (mf_util_is_rotation_lock() == 0) { mf_debug("rotation is locked"); if (ap->mf_Status.rotation_type == MF_ROTATE_PORTRAIT) { @@ -714,7 +711,7 @@ static void __mf_main_reset_app(app_control_h app_control, void *data) run_extra(data); } } - SAFE_FREE_CHAR(tmp); + SAFE_FREE_CHAR(tmp); } if (ap->mf_MainWindow.pWindow) { evas_object_show(ap->mf_MainWindow.pWindow); @@ -770,15 +767,16 @@ void __mf_main_terminate_app(void *data) if (mf_view_is_operating(ap)) { mf_callback_progress_bar_cancel_cb(ap, NULL, NULL); } - + mf_media_content_disconnect(); SAFE_FREE_OBJ(ap->mf_MainWindow.pProgressPopup); media_content_unset_db_updated_cb(); mf_category_list_destory(); mf_callback_unregister_mmc_state_cb(); - if (ap->mf_Status.search_handler) + if (ap->mf_Status.search_handler) { mf_search_finalize(&ap->mf_Status.search_handler); + } mf_edit_folder_list_clear(); mf_edit_file_list_clear(); @@ -815,8 +813,9 @@ void __mf_main_terminate_app(void *data) mf_log_finalize(); #endif - if (ap->mf_Status.flagIcuInit == TRUE) + if (ap->mf_Status.flagIcuInit == TRUE) { mf_util_icu_finalize(ap); + } if (ap->mf_FileOperation.sync_pipe) { ecore_pipe_del(ap->mf_FileOperation.sync_pipe); @@ -833,7 +832,7 @@ void __mf_main_terminate_app(void *data) mf_util_set_pm_lock(ap, EINA_FALSE); - elm_theme_extension_del(NULL, EDJ_NAME); + elm_theme_extension_del(NULL, EDJ_NAME); t_end; MF_TRACE_END; @@ -898,7 +897,7 @@ static void __mf_language_changed_cb(app_event_info_h event_info, void *user_dat int retcode = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale); if (retcode != SYSTEM_SETTINGS_ERROR_NONE) { - mf_error("[ERR] failed to get the language"); + mf_error("[ERR] failed to get the language"); } if (locale) { @@ -911,15 +910,15 @@ static void __mf_language_changed_cb(app_event_info_h event_info, void *user_dat ap->mf_MainWindow.pLongpressPopup = NULL; } if (ap->mf_Status.more == MORE_EDIT - || ap->mf_Status.more == MORE_SHARE_EDIT - || ap->mf_Status.more == MORE_COMPRESS - || ap->mf_Status.more == MORE_EDIT_COPY - || ap->mf_Status.more == MORE_EDIT_MOVE - || ap->mf_Status.more == MORE_EDIT_DELETE - || ap->mf_Status.more == MORE_EDIT_DELETE_RECENT - || ap->mf_Status.more == MORE_EDIT_UNINSTALL - - || (mf_view_get_pre_state(ap) == MORE_EDIT && ap->mf_Status.more == MORE_RENAME)) { + || ap->mf_Status.more == MORE_SHARE_EDIT + || ap->mf_Status.more == MORE_COMPRESS + || ap->mf_Status.more == MORE_EDIT_COPY + || ap->mf_Status.more == MORE_EDIT_MOVE + || ap->mf_Status.more == MORE_EDIT_DELETE + || ap->mf_Status.more == MORE_EDIT_DELETE_RECENT + || ap->mf_Status.more == MORE_EDIT_UNINSTALL + + || (mf_view_get_pre_state(ap) == MORE_EDIT && ap->mf_Status.more == MORE_RENAME)) { char *label = NULL; int count = mf_edit_file_count_get(); @@ -968,8 +967,9 @@ EXPORT_API int main(int argc, char *argv[]) #ifdef MYFILE_CRITICAL_LOG ret = mf_log_init(); - if (ret != MYFILE_ERR_NONE) + if (ret != MYFILE_ERR_NONE) { mf_debug("initialize critical log failed"); + } #endif memset(&ops, 0x0, sizeof(ui_app_lifecycle_callback_s)); memset(&ad, 0x0, sizeof(struct appdata)); diff --git a/src/thumbnail/mf-thumb-gen.c b/src/thumbnail/mf-thumb-gen.c index 2f906fb..93ec478 100755 --- a/src/thumbnail/mf-thumb-gen.c +++ b/src/thumbnail/mf-thumb-gen.c @@ -39,21 +39,20 @@ static mf_thumb_gen_h g_thumb_gen = NULL; #define MF_THUMBNAIL_DEBUG mf_debug char *thumb_request_id = NULL; -typedef struct _ThumbGen -{ - char *szMediaURL; - bool bIsRealize; +typedef struct _ThumbGen { + char *szMediaURL; + bool bIsRealize; - char *szSaveDir; - bool bIsStart; - bool bIscancel; - void *pUserData; + char *szSaveDir; + bool bIsStart; + bool bIscancel; + void *pUserData; - mf_thumb_gen_progress_cb progress_cb; - mf_thumb_gen_complete_cb complete_cb; - mf_thumb_gen_cancel_cb cancel_cb; + mf_thumb_gen_progress_cb progress_cb; + mf_thumb_gen_complete_cb complete_cb; + mf_thumb_gen_cancel_cb cancel_cb; - Eina_List * file_list; + Eina_List * file_list; } ThumbGen; @@ -72,115 +71,112 @@ static void _mf_thumb_gen_unlock() static int myfile_thumb_update_filelist(ThumbGen *pThumbGen) { - if (pThumbGen == NULL) { - return 0; - } - - _mf_thumb_gen_lock(); - if (pThumbGen->bIsRealize == FALSE) { - mf_debug(" == pThumbGen->bIsRealize is Fail =="); - _mf_thumb_gen_unlock(); - return 0; - } - - _mf_thumb_gen_unlock(); - mf_retvm_if(pThumbGen->file_list == NULL, MYFILE_ERR_INVALID_ARG, "pThumbGen->file_list is null"); - - fsNodeInfo *pNode = NULL; - Eina_List *l = NULL; - int i = 0; - char *path = pThumbGen->szMediaURL; - Eina_List *file_list = pThumbGen->file_list; - Eina_List *list_tmp = file_list; - int file_count = eina_list_count(file_list) ; - - thumbnail_h thumb_handle; - while (true) - { - list_tmp = file_list->prev; - MF_THUMBNAIL_DEBUG("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>list_tmp = %p", list_tmp); - if (list_tmp == NULL) - break; - else - file_list = file_list->prev; - } - - MF_THUMBNAIL_DEBUG("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>path = %s", path); - MF_THUMBNAIL_DEBUG("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>file_list = %x", pThumbGen->file_list); - MF_THUMBNAIL_DEBUG("\nfile count is [%d]", file_count); - - EINA_LIST_FOREACH(file_list, l, pNode) { - if (pNode) { - //Make thumbnail begining............................ - if (pThumbGen->bIscancel == true) { - goto EXIT; - } - - if (pNode != NULL && pNode->name != NULL && pNode->path != NULL) - { - MF_THUMBNAIL_DEBUG("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>pNode->path = %s, pNode->name=%s", pNode->path, pNode->name); - - switch (pNode->type) - { - case FILE_TYPE_IMAGE: - case FILE_TYPE_VIDEO: - { - if (mf_util_is_low_memory(PHONE_FOLDER, MF_STORAGE_SIZE_MIN)) { - goto EXIT; - } - - pNode->thumbnail_path = calloc(1, sizeof(char) * MF_FILE_NAME_MAX_LENGTH); - if (pNode->thumbnail_path != NULL) { - MF_THUMBNAIL_DEBUG("\n>>>>>1"); - snprintf(pNode->thumbnail_path, MF_FILE_NAME_MAX_LENGTH - 1, MF_THUMB_FILE_NAME_STR, pNode->name); - MF_THUMBNAIL_DEBUG("\n>>>>>2"); - char tmp_path[MF_FILE_NAME_MAX_LENGTH + 1] = {0}; - MF_THUMBNAIL_DEBUG("\n>>>>>3"); - snprintf(tmp_path, MF_FILE_NAME_MAX_LENGTH - 1, "%s/%s", pNode->path, pNode->name); - MF_THUMBNAIL_DEBUG("\n>>>>>4"); - MF_THUMBNAIL_DEBUG("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>pNode->thumbnail_path1 = %s", pNode->thumbnail_path); - thumbnail_util_create(&thumb_handle); - if (thumb_handle) { - thumbnail_util_set_path(thumb_handle, tmp_path); - int ret = thumbnail_util_extract(thumb_handle, _mf_thumbnail_completed_cb, pNode, &thumb_request_id); - //int ret = thumbnail_request_save_to_file(tmp_path, pNode->thumbnail_path); - if (ret == THUMBNAIL_UTIL_ERROR_NONE) { - mf_thumb_gen_progress_cb func = pThumbGen->progress_cb; - if (func && pThumbGen->bIscancel == false) { - func(true, i, pNode); - } else { - goto EXIT; - } + if (pThumbGen == NULL) { + return 0; + } + + _mf_thumb_gen_lock(); + if (pThumbGen->bIsRealize == FALSE) { + mf_debug(" == pThumbGen->bIsRealize is Fail =="); + _mf_thumb_gen_unlock(); + return 0; + } + + _mf_thumb_gen_unlock(); + mf_retvm_if(pThumbGen->file_list == NULL, MYFILE_ERR_INVALID_ARG, "pThumbGen->file_list is null"); + + fsNodeInfo *pNode = NULL; + Eina_List *l = NULL; + int i = 0; + char *path = pThumbGen->szMediaURL; + Eina_List *file_list = pThumbGen->file_list; + Eina_List *list_tmp = file_list; + int file_count = eina_list_count(file_list) ; + + thumbnail_h thumb_handle; + while (true) { + list_tmp = file_list->prev; + MF_THUMBNAIL_DEBUG("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>list_tmp = %p", list_tmp); + if (list_tmp == NULL) { + break; + } else { + file_list = file_list->prev; + } + } + + MF_THUMBNAIL_DEBUG("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>path = %s", path); + MF_THUMBNAIL_DEBUG("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>file_list = %x", pThumbGen->file_list); + MF_THUMBNAIL_DEBUG("\nfile count is [%d]", file_count); + + EINA_LIST_FOREACH(file_list, l, pNode) { + if (pNode) { + //Make thumbnail begining............................ + if (pThumbGen->bIscancel == true) { + goto EXIT; + } + + if (pNode != NULL && pNode->name != NULL && pNode->path != NULL) { + MF_THUMBNAIL_DEBUG("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>pNode->path = %s, pNode->name=%s", pNode->path, pNode->name); + + switch (pNode->type) { + case FILE_TYPE_IMAGE: + case FILE_TYPE_VIDEO: { + if (mf_util_is_low_memory(PHONE_FOLDER, MF_STORAGE_SIZE_MIN)) { + goto EXIT; + } + + pNode->thumbnail_path = calloc(1, sizeof(char) * MF_FILE_NAME_MAX_LENGTH); + if (pNode->thumbnail_path != NULL) { + MF_THUMBNAIL_DEBUG("\n>>>>>1"); + snprintf(pNode->thumbnail_path, MF_FILE_NAME_MAX_LENGTH - 1, MF_THUMB_FILE_NAME_STR, pNode->name); + MF_THUMBNAIL_DEBUG("\n>>>>>2"); + char tmp_path[MF_FILE_NAME_MAX_LENGTH + 1] = {0}; + MF_THUMBNAIL_DEBUG("\n>>>>>3"); + snprintf(tmp_path, MF_FILE_NAME_MAX_LENGTH - 1, "%s/%s", pNode->path, pNode->name); + MF_THUMBNAIL_DEBUG("\n>>>>>4"); + MF_THUMBNAIL_DEBUG("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>pNode->thumbnail_path1 = %s", pNode->thumbnail_path); + thumbnail_util_create(&thumb_handle); + if (thumb_handle) { + thumbnail_util_set_path(thumb_handle, tmp_path); + int ret = thumbnail_util_extract(thumb_handle, _mf_thumbnail_completed_cb, pNode, &thumb_request_id); + //int ret = thumbnail_request_save_to_file(tmp_path, pNode->thumbnail_path); + if (ret == THUMBNAIL_UTIL_ERROR_NONE) { + mf_thumb_gen_progress_cb func = pThumbGen->progress_cb; + if (func && pThumbGen->bIscancel == false) { + func(true, i, pNode); + } else { + goto EXIT; } - thumbnail_util_destroy(thumb_handle); - } - } - if (pThumbGen->bIscancel == true) { - goto EXIT; - } - MF_THUMBNAIL_DEBUG("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>pNode->thumbnail_path2 = %s", pNode->thumbnail_path); - break; - } - default: - break; - } - } - i++; - //End........................................................ - } - } - - pThumbGen->bIsStart = FALSE; - mf_thumb_gen_complete_cb func = pThumbGen->complete_cb; - - if (func && pThumbGen->bIscancel == false) { - // func(file_count, pThumbGen->pUserData); - } + } + thumbnail_util_destroy(thumb_handle); + } + } + if (pThumbGen->bIscancel == true) { + goto EXIT; + } + MF_THUMBNAIL_DEBUG("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>pNode->thumbnail_path2 = %s", pNode->thumbnail_path); + break; + } + default: + break; + } + } + i++; + //End........................................................ + } + } + + pThumbGen->bIsStart = FALSE; + mf_thumb_gen_complete_cb func = pThumbGen->complete_cb; + + if (func && pThumbGen->bIscancel == false) { + // func(file_count, pThumbGen->pUserData); + } EXIT: - pthread_exit(0); - thumbnail_util_destroy(thumb_handle); - return MYFILE_ERR_NONE; + pthread_exit(0); + thumbnail_util_destroy(thumb_handle); + return MYFILE_ERR_NONE; } @@ -529,8 +525,7 @@ static Eina_Bool __mf_make_thumbnail_done(void *data) if (view_style != MF_VIEW_STYLE_THUMBNAIL && ap->mf_MainWindow.pNaviGenlist != NULL) { elm_genlist_realized_items_update(ap->mf_MainWindow.pNaviGenlist); - } - else if (view_style == MF_VIEW_STYLE_THUMBNAIL && ap->mf_MainWindow.pNaviGengrid != NULL) { + } else if (view_style == MF_VIEW_STYLE_THUMBNAIL && ap->mf_MainWindow.pNaviGengrid != NULL) { elm_gengrid_realized_items_update(ap->mf_MainWindow.pNaviGengrid); } @@ -555,7 +550,7 @@ static Eina_Bool __mf_make_thumbnail_progress(void *data) //elm_genlist_realized_items_update(ap->mf_MainWindow.pNaviGenlist); fsNodeInfo *pNode = data; elm_genlist_item_fields_update(pNode->item, "elm.icon.1", ELM_GENLIST_ITEM_FIELD_CONTENT); - }else if (view_style == MF_VIEW_STYLE_THUMBNAIL && ap->mf_MainWindow.pNaviGengrid != NULL) { + } else if (view_style == MF_VIEW_STYLE_THUMBNAIL && ap->mf_MainWindow.pNaviGengrid != NULL) { //elm_genlist_realized_items_update(ap->mf_MainWindow.pNaviGenlist); fsNodeInfo *pNode = data; elm_gengrid_item_update(pNode->item); @@ -565,10 +560,10 @@ static Eina_Bool __mf_make_thumbnail_progress(void *data) Ecore_Pipe *g_mf_thumbnail_progress_pipe = NULL;//Fix the bug, when clicking the image again and again quickly, there will be problem. -typedef enum{ - THUMBNAIL_UPDATE_PROGRESS, - THUMBNAIL_UPDATE_COMPLETE, -}thumbnail_progress_state_e; +typedef enum { + THUMBNAIL_UPDATE_PROGRESS, + THUMBNAIL_UPDATE_COMPLETE, +} thumbnail_progress_state_e; typedef struct { int download_id; @@ -649,8 +644,9 @@ void mf_view_refresh_thumbnail_for_other_memory(void *data, Eina_List *file_list MF_THUMBNAIL_DEBUG("\n>>>>>>>>>>>> is_at_otg is [%d]", is_at_otg); if (is_at_otg) {//Only for otg, we will update the thumbnail MF_THUMBNAIL_DEBUG(">>>>>>>>>>>> path is [%s]", ap->mf_Status.path->str); - if (g_mf_thumbnail_progress_pipe == NULL) + if (g_mf_thumbnail_progress_pipe == NULL) { g_mf_thumbnail_progress_pipe = ecore_pipe_add(__mf_thumbnail_progress_pipe_handler, data); + } mf_thumb_gen_h thumb_gen = mf_thumb_gen_create(ap->mf_Status.path->str); g_thumb_gen = thumb_gen; diff --git a/src/widget/mf-category-view.c b/src/widget/mf-category-view.c index a9ca74d..17c06cc 100755 --- a/src/widget/mf-category-view.c +++ b/src/widget/mf-category-view.c @@ -75,15 +75,16 @@ static void __mf_category_item_sel(void *data, Evas_Object * obj, void *event_in elm_genlist_item_selected_set(item, FALSE); } //when longpressed, selected is called too ,so now if longpress popup exists,selected callbackwill return directly - if (ap->mf_MainWindow.pLongpressPopup != NULL) + if (ap->mf_MainWindow.pLongpressPopup != NULL) { return; + } if (ap->mf_Status.more == MORE_EDIT - || ap->mf_Status.more == MORE_SHARE_EDIT - || ap->mf_Status.more == MORE_EDIT_COPY - || ap->mf_Status.more == MORE_EDIT_MOVE - || ap->mf_Status.more == MORE_EDIT_DETAIL - || ap->mf_Status.more == MORE_EDIT_DELETE - ) { + || ap->mf_Status.more == MORE_SHARE_EDIT + || ap->mf_Status.more == MORE_EDIT_COPY + || ap->mf_Status.more == MORE_EDIT_MOVE + || ap->mf_Status.more == MORE_EDIT_DETAIL + || ap->mf_Status.more == MORE_EDIT_DELETE + ) { MF_TRACE_END; return; } @@ -105,7 +106,7 @@ static Eina_Bool __mf_launch_service_idler_cb(void *data) mf_debug("ret is %d\n", ret); if (ret) { ap->mf_MainWindow.pNormalPopup = - mf_popup_create_popup(ap, POPMODE_TEXT, NULL, MF_LABEL_UNSUPPORT_FILE_TYPE, NULL, NULL, NULL, NULL, NULL); + mf_popup_create_popup(ap, POPMODE_TEXT, NULL, MF_LABEL_UNSUPPORT_FILE_TYPE, NULL, NULL, NULL, NULL, NULL); } return ECORE_CALLBACK_CANCEL; } @@ -242,7 +243,7 @@ mfItemData_s *mf_category_media_data_generate(media_data_s *media_data) item_data->thumb_path = g_strdup(MF_ICON_SOUND); item_data->thumbnail_type = MF_THUMBNAIL_DEFAULT; item_data->real_thumb_flag = TRUE; - } else if (media_data->thumbnail_path && mf_file_exists(media_data->thumbnail_path) && strcmp(media_data->thumbnail_path,MF_MUSIC_DEFAULT_THUMBNAIL_FROM_DB)) { + } else if (media_data->thumbnail_path && mf_file_exists(media_data->thumbnail_path) && strcmp(media_data->thumbnail_path, MF_MUSIC_DEFAULT_THUMBNAIL_FROM_DB)) { item_data->thumb_path = g_strdup(media_data->thumbnail_path); item_data->thumbnail_type = MF_THUMBNAIL_THUMB; item_data->real_thumb_flag = TRUE; @@ -408,16 +409,17 @@ void mf_view_refresh_edit_status_for_category_list(Eina_List *category_list) mfItemData_s *item_data_tmp = NULL; Eina_List *l = NULL; EINA_LIST_FOREACH(category_list, l, item_data_tmp) { - if (item_data_tmp) { - if (g_strcmp0(itemData->m_ItemName->str, item_data_tmp->m_ItemName->str) == 0) { - if (itemData->m_checked == true) - item_data_tmp->m_checked = true; - //mf_debug("itemData->m_ItemName->str1111 is [%s]", itemData->m_ItemName->str); - //mf_debug("item_data_tmp->m_checked is [%d]", item_data_tmp->m_checked); - break; + if (item_data_tmp) { + if (g_strcmp0(itemData->m_ItemName->str, item_data_tmp->m_ItemName->str) == 0) { + if (itemData->m_checked == true) { + item_data_tmp->m_checked = true; } + //mf_debug("itemData->m_ItemName->str1111 is [%s]", itemData->m_ItemName->str); + //mf_debug("item_data_tmp->m_checked is [%d]", item_data_tmp->m_checked); + break; } } + } if (view_type == MF_VIEW_STYLE_THUMBNAIL) { it = elm_gengrid_item_next_get(it); } else { @@ -532,223 +534,209 @@ void mf_category_search_item_update(void *data, char *path, media_content_db_upd } } -void mf_category_list_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 *user_data) +void mf_category_list_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 *user_data) { - int pre_more = MORE_DEFAULT; - Evas_Object *newContent = NULL; - struct appdata *ap = (struct appdata *)mf_get_appdata(); - - mf_debug("update_item : [%d] update_type : [%d] media_type : [%d]", - update_item, update_type, media_type); - - if (ap->mf_Status.view_type == mf_view_recent) { - if(mf_view_is_item_exists_by_name(ap, path)) { - mf_recent_view_create(ap); - return; - } - } - if (ap->mf_Status.more == MORE_SEARCH || mf_view_get_pre_state(ap) == MORE_SEARCH) - { - mf_category_search_item_update(user_data, path, update_item, update_type, uuid); - return; - } - - switch (update_type) - { - case MEDIA_CONTENT_INSERT://go through. - { - mf_debug("MEDIA_CONTENT_INSERT"); - /* TODO : need to add lists, not to update whole lists */ - //break;//go through. - } - case MEDIA_CONTENT_UPDATE: - { - mf_debug("MEDIA_CONTENT_UPDATE"); - - if ((ap->mf_Status.more == MORE_SEARCH || mf_view_get_pre_state(ap) == MORE_SEARCH) && - (ap->mf_Status.search_filter!=NULL)) - { - if (!ap->mf_Status.b_run_background) { - mf_category_view_refresh_space_size_set(true); - mf_category_size_update(ap); - return; - } - - if (mf_is_dir(path)) { - mf_category_view_refresh_space_size_set(true); - mf_category_size_update(ap); - return; - } - - if (mf_util_NFD_strstr(mf_file_get(path), ap->mf_Status.search_filter)) - { - media_info_h handle = NULL; - int ret = media_info_get_media_from_db(uuid, &handle); - - if (ret == MEDIA_CONTENT_ERROR_NONE) - { - media_data_s *media_data = mf_media_data_get_by_media_handle(handle); - if (media_data) { - mf_view_item_popup_check(ap, path); - if (!mf_util_NFD_strstr(media_data->display_name, ap->mf_Status.search_filter)) { - mf_view_item_delete_by_name(ap, path); - } else { - mf_view_search_item_update(ap, path, media_data->fullpath); - } - mf_media_data_item_free(&media_data); - } - } - - if (handle) { - media_info_destroy(handle); - handle = NULL; - } - } - } - else - { - if (ap->mf_Status.view_type == mf_view_root_category && - mf_view_get_pre_state(ap) != MORE_SEARCH && - (ap->mf_Status.more == MORE_DEFAULT || ap->mf_Status.more == MORE_EDIT || - ap->mf_Status.more == MORE_SHARE_EDIT || ap->mf_Status.more == MORE_EDIT_COPY || - ap->mf_Status.more == MORE_EDIT_MOVE || ap->mf_Status.more == MORE_EDIT_DELETE || - ap->mf_Status.more == MORE_EDIT_DETAIL)) - { /* if it is rename state, don't refresh list */ - if (mf_callback_monitor_media_db_update_flag_get()) { - mf_callback_monitor_media_db_update_flag_set(EINA_FALSE); - mf_category_view_refresh_space_size_set(true); - return; - } - - Eina_List *file_list = NULL; - int pre_more = ap->mf_Status.more; - - if (ap->mf_Status.more == MORE_THUMBNAIL_RENAME) { - mf_view_state_reset_state_with_pre(ap); - } - - if (ap->mf_MainWindow.pNewFolderPopup) { - SAFE_FREE_OBJ(ap->mf_MainWindow.pNewFolderPopup); - } - - if (pre_more == MORE_EDIT || - pre_more == MORE_SHARE_EDIT || - pre_more == MORE_EDIT_COPY || - pre_more == MORE_EDIT_MOVE || - pre_more == MORE_EDIT_DELETE || - pre_more == MORE_EDIT_DETAIL) - { - ap->mf_Status.more = MORE_DEFAULT; - file_list = mf_edit_get_selected_file_list(); - } - - elm_box_clear(ap->mf_MainWindow.pNaviBox); - newContent = mf_category_get_from_media_db(ap, ap->mf_Status.category_type, true); - elm_box_pack_end(ap->mf_MainWindow.pNaviBox, newContent); - evas_object_show(newContent); - //mf_navi_bar_layout_content_set(ap->mf_MainWindow.pNaviLayout, newContent); - - if (pre_more == MORE_EDIT || - pre_more == MORE_EDIT_COPY || - pre_more == MORE_EDIT_MOVE || - pre_more == MORE_EDIT_DELETE || - pre_more == MORE_EDIT_DETAIL) - { - if (!ap->mf_Status.flagNoContent) { - ap->mf_Status.more = pre_more; - mf_edit_view_refresh(ap, &file_list, NULL); - } else { - mf_naviframe_title_button_delete(ap->mf_MainWindow.pNaviItem); - mf_navi_bar_title_content_set(ap, ap->mf_Status.categorytitle); - } - } else if (pre_more == MORE_SHARE_EDIT) { - if (!ap->mf_Status.flagNoContent) { - ap->mf_Status.more = pre_more; - mf_edit_view_refresh(ap, &file_list, NULL); - } else { - mf_naviframe_title_button_delete(ap->mf_MainWindow.pNaviItem); - mf_navi_bar_title_content_set(ap, ap->mf_Status.categorytitle); - } - } - } - } - - mf_category_view_refresh_space_size_set(true); - mf_category_size_update(ap); - //mf_storage_refresh(ap); - } - break; - - case MEDIA_CONTENT_DELETE: - { - if (ap->mf_MainWindow.pDeleteConfirmPopup) { - SAFE_FREE_OBJ(ap->mf_MainWindow.pDeleteConfirmPopup); - ap->mf_FileOperation.idle_delete_item = NULL; - } - mf_category_list_item_remove(path, media_type); - mf_category_view_refresh_space_size_set(true); - if (ap->mf_Status.more == MORE_IDLE_DELETE) { - return; - } - if (ap->mf_Status.view_type == mf_view_root_category && mf_view_get_pre_state(ap) != MORE_SEARCH - && (ap->mf_Status.more == MORE_DEFAULT || - ap->mf_Status.more == MORE_EDIT || - ap->mf_Status.more == MORE_SHARE_EDIT || - ap->mf_Status.more == MORE_THUMBNAIL_RENAME || - ap->mf_Status.more == MORE_EDIT_COPY || - ap->mf_Status.more == MORE_EDIT_MOVE || - ap->mf_Status.more == MORE_EDIT_DETAIL || - ap->mf_Status.more == MORE_EDIT_DELETE)) - { - Eina_List *file_list = NULL; - if (mf_callback_monitor_media_db_update_flag_get()) { - return; - } - - if (ap->mf_Status.more == MORE_EDIT || - ap->mf_Status.more == MORE_SHARE_EDIT || - ap->mf_Status.more == MORE_EDIT_COPY || - ap->mf_Status.more == MORE_EDIT_MOVE || - ap->mf_Status.more == MORE_EDIT_DELETE || - ap->mf_Status.more == MORE_EDIT_DETAIL - ) - { - pre_more = ap->mf_Status.more; - ap->mf_Status.more = MORE_DEFAULT; - file_list = mf_edit_get_selected_file_list(); - } - - mf_object_box_clear(ap->mf_MainWindow.pNaviBox); - newContent = mf_category_get_from_media_db(ap, ap->mf_Status.category_type, true); - elm_box_pack_end(ap->mf_MainWindow.pNaviBox, newContent); - //mf_navi_bar_layout_content_set(ap->mf_MainWindow.pNaviLayout, newContent); - - if (pre_more == MORE_EDIT || pre_more == MORE_SHARE_EDIT - || pre_more == MORE_EDIT_COPY - || pre_more == MORE_EDIT_MOVE - || pre_more == MORE_EDIT_DELETE - || pre_more == MORE_EDIT_DETAIL - ) { - if (!ap->mf_Status.flagNoContent) { - ap->mf_Status.more = pre_more; - mf_edit_view_refresh(ap, &file_list, NULL); - } else { - mf_naviframe_title_button_delete(ap->mf_MainWindow.pNaviItem); - mf_navi_bar_title_content_set(ap, ap->mf_Status.categorytitle); - } - } - } - //mf_storage_refresh(ap); - } - break; - - default: - mf_debug("Invalid Case : %d", update_type); - break; - } + int pre_more = MORE_DEFAULT; + Evas_Object *newContent = NULL; + struct appdata *ap = (struct appdata *)mf_get_appdata(); + + mf_debug("update_item : [%d] update_type : [%d] media_type : [%d]", + update_item, update_type, media_type); + + if (ap->mf_Status.view_type == mf_view_recent) { + if (mf_view_is_item_exists_by_name(ap, path)) { + mf_recent_view_create(ap); + return; + } + } + if (ap->mf_Status.more == MORE_SEARCH || mf_view_get_pre_state(ap) == MORE_SEARCH) { + mf_category_search_item_update(user_data, path, update_item, update_type, uuid); + return; + } + + switch (update_type) { + case MEDIA_CONTENT_INSERT: { //go through. + mf_debug("MEDIA_CONTENT_INSERT"); + /* TODO : need to add lists, not to update whole lists */ + //break;//go through. + } + case MEDIA_CONTENT_UPDATE: { + mf_debug("MEDIA_CONTENT_UPDATE"); + + if ((ap->mf_Status.more == MORE_SEARCH || mf_view_get_pre_state(ap) == MORE_SEARCH) && + (ap->mf_Status.search_filter != NULL)) { + if (!ap->mf_Status.b_run_background) { + mf_category_view_refresh_space_size_set(true); + mf_category_size_update(ap); + return; + } + + if (mf_is_dir(path)) { + mf_category_view_refresh_space_size_set(true); + mf_category_size_update(ap); + return; + } + + if (mf_util_NFD_strstr(mf_file_get(path), ap->mf_Status.search_filter)) { + media_info_h handle = NULL; + int ret = media_info_get_media_from_db(uuid, &handle); + + if (ret == MEDIA_CONTENT_ERROR_NONE) { + media_data_s *media_data = mf_media_data_get_by_media_handle(handle); + if (media_data) { + mf_view_item_popup_check(ap, path); + if (!mf_util_NFD_strstr(media_data->display_name, ap->mf_Status.search_filter)) { + mf_view_item_delete_by_name(ap, path); + } else { + mf_view_search_item_update(ap, path, media_data->fullpath); + } + mf_media_data_item_free(&media_data); + } + } + + if (handle) { + media_info_destroy(handle); + handle = NULL; + } + } + } else { + if (ap->mf_Status.view_type == mf_view_root_category && + mf_view_get_pre_state(ap) != MORE_SEARCH && + (ap->mf_Status.more == MORE_DEFAULT || ap->mf_Status.more == MORE_EDIT || + ap->mf_Status.more == MORE_SHARE_EDIT || ap->mf_Status.more == MORE_EDIT_COPY || + ap->mf_Status.more == MORE_EDIT_MOVE || ap->mf_Status.more == MORE_EDIT_DELETE || + ap->mf_Status.more == MORE_EDIT_DETAIL)) { + /* if it is rename state, don't refresh list */ + if (mf_callback_monitor_media_db_update_flag_get()) { + mf_callback_monitor_media_db_update_flag_set(EINA_FALSE); + mf_category_view_refresh_space_size_set(true); + return; + } + + Eina_List *file_list = NULL; + int pre_more = ap->mf_Status.more; + + if (ap->mf_Status.more == MORE_THUMBNAIL_RENAME) { + mf_view_state_reset_state_with_pre(ap); + } + + if (ap->mf_MainWindow.pNewFolderPopup) { + SAFE_FREE_OBJ(ap->mf_MainWindow.pNewFolderPopup); + } + + if (pre_more == MORE_EDIT || + pre_more == MORE_SHARE_EDIT || + pre_more == MORE_EDIT_COPY || + pre_more == MORE_EDIT_MOVE || + pre_more == MORE_EDIT_DELETE || + pre_more == MORE_EDIT_DETAIL) { + ap->mf_Status.more = MORE_DEFAULT; + file_list = mf_edit_get_selected_file_list(); + } + + elm_box_clear(ap->mf_MainWindow.pNaviBox); + newContent = mf_category_get_from_media_db(ap, ap->mf_Status.category_type, true); + elm_box_pack_end(ap->mf_MainWindow.pNaviBox, newContent); + evas_object_show(newContent); + //mf_navi_bar_layout_content_set(ap->mf_MainWindow.pNaviLayout, newContent); + + if (pre_more == MORE_EDIT || + pre_more == MORE_EDIT_COPY || + pre_more == MORE_EDIT_MOVE || + pre_more == MORE_EDIT_DELETE || + pre_more == MORE_EDIT_DETAIL) { + if (!ap->mf_Status.flagNoContent) { + ap->mf_Status.more = pre_more; + mf_edit_view_refresh(ap, &file_list, NULL); + } else { + mf_naviframe_title_button_delete(ap->mf_MainWindow.pNaviItem); + mf_navi_bar_title_content_set(ap, ap->mf_Status.categorytitle); + } + } else if (pre_more == MORE_SHARE_EDIT) { + if (!ap->mf_Status.flagNoContent) { + ap->mf_Status.more = pre_more; + mf_edit_view_refresh(ap, &file_list, NULL); + } else { + mf_naviframe_title_button_delete(ap->mf_MainWindow.pNaviItem); + mf_navi_bar_title_content_set(ap, ap->mf_Status.categorytitle); + } + } + } + } + + mf_category_view_refresh_space_size_set(true); + mf_category_size_update(ap); + //mf_storage_refresh(ap); + } + break; + + case MEDIA_CONTENT_DELETE: { + if (ap->mf_MainWindow.pDeleteConfirmPopup) { + SAFE_FREE_OBJ(ap->mf_MainWindow.pDeleteConfirmPopup); + ap->mf_FileOperation.idle_delete_item = NULL; + } + mf_category_list_item_remove(path, media_type); + mf_category_view_refresh_space_size_set(true); + if (ap->mf_Status.more == MORE_IDLE_DELETE) { + return; + } + if (ap->mf_Status.view_type == mf_view_root_category && mf_view_get_pre_state(ap) != MORE_SEARCH + && (ap->mf_Status.more == MORE_DEFAULT || + ap->mf_Status.more == MORE_EDIT || + ap->mf_Status.more == MORE_SHARE_EDIT || + ap->mf_Status.more == MORE_THUMBNAIL_RENAME || + ap->mf_Status.more == MORE_EDIT_COPY || + ap->mf_Status.more == MORE_EDIT_MOVE || + ap->mf_Status.more == MORE_EDIT_DETAIL || + ap->mf_Status.more == MORE_EDIT_DELETE)) { + Eina_List *file_list = NULL; + if (mf_callback_monitor_media_db_update_flag_get()) { + return; + } + + if (ap->mf_Status.more == MORE_EDIT || + ap->mf_Status.more == MORE_SHARE_EDIT || + ap->mf_Status.more == MORE_EDIT_COPY || + ap->mf_Status.more == MORE_EDIT_MOVE || + ap->mf_Status.more == MORE_EDIT_DELETE || + ap->mf_Status.more == MORE_EDIT_DETAIL + ) { + pre_more = ap->mf_Status.more; + ap->mf_Status.more = MORE_DEFAULT; + file_list = mf_edit_get_selected_file_list(); + } + + mf_object_box_clear(ap->mf_MainWindow.pNaviBox); + newContent = mf_category_get_from_media_db(ap, ap->mf_Status.category_type, true); + elm_box_pack_end(ap->mf_MainWindow.pNaviBox, newContent); + //mf_navi_bar_layout_content_set(ap->mf_MainWindow.pNaviLayout, newContent); + + if (pre_more == MORE_EDIT || pre_more == MORE_SHARE_EDIT + || pre_more == MORE_EDIT_COPY + || pre_more == MORE_EDIT_MOVE + || pre_more == MORE_EDIT_DELETE + || pre_more == MORE_EDIT_DETAIL + ) { + if (!ap->mf_Status.flagNoContent) { + ap->mf_Status.more = pre_more; + mf_edit_view_refresh(ap, &file_list, NULL); + } else { + mf_naviframe_title_button_delete(ap->mf_MainWindow.pNaviItem); + mf_navi_bar_title_content_set(ap, ap->mf_Status.categorytitle); + } + } + } + //mf_storage_refresh(ap); + } + break; + + default: + mf_debug("Invalid Case : %d", update_type); + break; + } } void mf_category_list_destory() @@ -778,8 +766,8 @@ static Evas_Object *__mf_category_media_content_create(Eina_List *category_list, ap->mf_MainWindow.pNaviGengrid = mf_gengrid_create_grid(ap->mf_MainWindow.pNaviBar); mf_category_gen_style_set(); parent = ap->mf_MainWindow.pNaviGengrid; - evas_object_smart_callback_add(ap->mf_MainWindow.pNaviGengrid, "language,changed", mf_gengrid_gl_lang_changed, ap); - //evas_object_smart_callback_add(ap->mf_MainWindow.pNaviGengrid, "longpressed", mf_gengrid_thumbs_longpressed, ap); + evas_object_smart_callback_add(ap->mf_MainWindow.pNaviGengrid, "language,changed", mf_gengrid_gl_lang_changed, ap); + //evas_object_smart_callback_add(ap->mf_MainWindow.pNaviGengrid, "longpressed", mf_gengrid_thumbs_longpressed, ap); evas_object_smart_callback_add(ap->mf_MainWindow.pNaviGengrid, "selected", __mf_category_item_sel, ap); evas_object_smart_callback_add(ap->mf_MainWindow.pNaviGengrid, "realized", mf_gengrid_realized, ap); @@ -861,14 +849,14 @@ Eina_List *mf_category_list_generate(Eina_List *file_list) Eina_List *category_list = NULL; EINA_LIST_FOREACH(file_list, l, media_data) { - if (media_data) { - mfItemData_s *item_data = NULL; - item_data = mf_category_media_data_generate(media_data); - if (item_data) { - mf_debug("============= name is [%s]", item_data->m_ItemName->str); - category_list = eina_list_append(category_list, item_data); - } - } + if (media_data) { + mfItemData_s *item_data = NULL; + item_data = mf_category_media_data_generate(media_data); + if (item_data) { + mf_debug("============= name is [%s]", item_data->m_ItemName->str); + category_list = eina_list_append(category_list, item_data); + } + } } return category_list; } @@ -881,15 +869,15 @@ Evas_Object *mf_category_get_from_media_db(void *data, int category, bool is_use mf_retvm_if(ap == NULL, NULL, "input data error"); Eina_List *media_list = NULL; Eina_List *category_list = NULL; - + mf_media_data_list_free(&mf_category_file_list); mf_media_category_list_get(category, &media_list); - + int sort_type = 0; mf_util_get_pref_value(PREF_TYPE_SORT_TYPE, &sort_type); mf_media_data_sort_list(&media_list, sort_type); mf_category_file_list = media_list; - category_list = mf_category_list_generate(media_list); + category_list = mf_category_list_generate(media_list); if (is_use_previous_state) { mf_view_refresh_edit_status_for_category_list(category_list); @@ -986,9 +974,9 @@ static int mf_category_view_content_create(void *data) struct appdata *ap = (struct appdata *)data; Evas_Object *newContent = mf_category_get_from_media_db(ap, ap->mf_Status.category_type, false); elm_box_pack_end(ap->mf_MainWindow.pNaviBox, newContent); - //mf_navi_bar_layout_content_set(ap->mf_MainWindow.pNaviLayout, newContent); - SAFE_FREE_OBJ(mf_category_view_popup); - mf_category_view_idler = NULL; + //mf_navi_bar_layout_content_set(ap->mf_MainWindow.pNaviLayout, newContent); + SAFE_FREE_OBJ(mf_category_view_popup); + mf_category_view_idler = NULL; return ECORE_CALLBACK_CANCEL; } @@ -999,7 +987,7 @@ void mf_category_view_create_vew_as(void *data, bool flag_show) t_start; struct appdata *ap = (struct appdata *)data; - mf_retm_if (ap->mf_MainWindow.pNaviBar == NULL, "ap->mf_MainWindow.pNaviBar is NULL"); + mf_retm_if(ap->mf_MainWindow.pNaviBar == NULL, "ap->mf_MainWindow.pNaviBar is NULL"); Evas_Object *newContent = NULL; //Evas_Object *pathinfo = NULL; ap->mf_Status.view_type = mf_view_root_category; @@ -1045,7 +1033,7 @@ void mf_category_view_create(void *data, bool flag_show) return; } - mf_retm_if (ap->mf_MainWindow.pNaviBar == NULL, "ap->mf_MainWindow.pNaviBar is NULL"); + mf_retm_if(ap->mf_MainWindow.pNaviBar == NULL, "ap->mf_MainWindow.pNaviBar is NULL"); Evas_Object *newContent = NULL; ap->mf_Status.view_type = mf_view_root_category; //int view_style = mf_view_style_get(ap); @@ -1105,7 +1093,7 @@ void mf_category_view_create(void *data, bool flag_show) } //Evas_Object *pathinfo = mf_genlist_create_path_info(ap->mf_MainWindow.pNaviLayout, ap->mf_Status.categorytitle, EINA_FALSE); - + //elm_object_part_content_set(ap->mf_MainWindow.pNaviLayout, "pathinfo", pathinfo); //elm_naviframe_item_title_enabled_set(ap->mf_MainWindow.pNaviItem, EINA_FALSE, EINA_FALSE); mf_navi_bar_title_content_set(ap, LABEL_MYFILE_CHAP); diff --git a/src/widget/mf-context-popup.c b/src/widget/mf-context-popup.c index dca5971..45fa21d 100755 --- a/src/widget/mf-context-popup.c +++ b/src/widget/mf-context-popup.c @@ -41,10 +41,10 @@ static Evas_Object *searchfilter_ctxpopup = NULL; #define MF_CTXPOPUP_STYLE_MORE "more/default" enum __context_popup_type { - CONTEXT_POPUP_TYPE_NONE, - CONTEXT_POPUP_TYPE_MORE, - CONTEXT_POPUP_TYPE_SEARCH_FILTER, - CONTEXT_POPUP_TYPE_MAX + CONTEXT_POPUP_TYPE_NONE, + CONTEXT_POPUP_TYPE_MORE, + CONTEXT_POPUP_TYPE_SEARCH_FILTER, + CONTEXT_POPUP_TYPE_MAX }; static void _move_ctxpopup_all(void *data, Evas_Object *parent, Evas_Object *ctxpopup) @@ -64,32 +64,32 @@ static void _move_ctxpopup_all(void *data, Evas_Object *parent, Evas_Object *ctx int changed_angle = elm_win_rotation_get(ap->mf_MainWindow.pWindow); mf_error("changed_angle is [%d]", changed_angle); switch (changed_angle) { - case APP_DEVICE_ORIENTATION_270: - case APP_DEVICE_ORIENTATION_90: - {//landscape - x= x + (w /2)+7; - y= y + (h /2); - mf_error("x is [%d] y is [%d]", x, y); - break; - } - case APP_DEVICE_ORIENTATION_180: - case APP_DEVICE_ORIENTATION_0 : - {//portrait - - x= x + (w /2); - //y= y + h - 4; - y = y+h+12; - mf_error("x is [%d] y is [%d]", x, y); - break; - } - default: - break; + case APP_DEVICE_ORIENTATION_270: + case APP_DEVICE_ORIENTATION_90: { + //landscape + x = x + (w / 2) + 7; + y = y + (h / 2); + mf_error("x is [%d] y is [%d]", x, y); + break; + } + case APP_DEVICE_ORIENTATION_180: + case APP_DEVICE_ORIENTATION_0 : { + //portrait + + x = x + (w / 2); + //y= y + h - 4; + y = y + h + 12; + mf_error("x is [%d] y is [%d]", x, y); + break; + } + default: + break; } evas_object_move(ctxpopup, x , y); elm_ctxpopup_direction_priority_set(ctxpopup, ELM_CTXPOPUP_DIRECTION_DOWN, - ELM_CTXPOPUP_DIRECTION_LEFT, - ELM_CTXPOPUP_DIRECTION_RIGHT, - ELM_CTXPOPUP_DIRECTION_UP); + ELM_CTXPOPUP_DIRECTION_LEFT, + ELM_CTXPOPUP_DIRECTION_RIGHT, + ELM_CTXPOPUP_DIRECTION_UP); //end*/ } else { evas_object_move(ctxpopup, touch_x, touch_y); @@ -107,18 +107,18 @@ static void _move_more_ctxpopup(void *data, Evas_Object *win, Evas_Object *ctxpo elm_win_screen_size_get(win, NULL, NULL, &w, &h); pos = elm_win_rotation_get(win); switch (pos) { - case 0: - case 180: - x = w / 2; - y = h; + case 0: + case 180: + x = w / 2; + y = h; break; - case 90: - x = h / 2; - y = w; - break; - case 270: - x = h / 2; - y = w; + case 90: + x = h / 2; + y = w; + break; + case 270: + x = h / 2; + y = w; break; } //elm_win_screen_size_get(win, NULL, NULL, &w, &h); @@ -162,7 +162,7 @@ void mf_context_popup_get_position(Evas_Object *obj, const char *label, int *x, if (g_strcmp0(button_label, label) == 0) { Evas_Object *icon = elm_toolbar_item_object_get(pItem); evas_object_geometry_get(icon, &x_position, &y_position, &w, NULL); - *x = x_position+w/2; + *x = x_position + w / 2; *y = y_position; return; } @@ -220,7 +220,7 @@ static void __mf_context_popup_item_append(Evas_Object *parent, void *data, mf_c case mf_context_popup_item_view_by: item = elm_ctxpopup_item_append(ctxpopup, LABEL_VIEW_AS, image, mf_callback_view_as_cb, data); mf_object_item_translate_set(item, LABEL_VIEW_AS); - break; + break; case mf_context_popup_item_sort_by: item = elm_ctxpopup_item_append(ctxpopup, LABEL_SORT_BY, image, mf_callback_list_by_view_cb, data); mf_object_item_translate_set(item, LABEL_SORT_BY); @@ -286,12 +286,12 @@ static void __mf_context_popup_item_append(Evas_Object *parent, void *data, mf_c //Added by jian12.li, for fixing the context popup is rotated problem, when rotate context popup, press the back key, it will be show again. static void __mf_ctxpopup_parent_resize_cb(void *data, Evas *e, - Evas_Object *obj, void *ei) + Evas_Object *obj, void *ei) { MF_TRACE_BEGIN; mf_retm_if(!data, "data is NULL"); evas_object_data_set((Evas_Object *)data, MF_CTXPOPUP_OBJ_ROTATE_KEY, - (void*)true); + (void*)true); } static void __mf_ctxpopup_search_filter_rotate_cb(void *data, Evas_Object *obj, void *ei) @@ -314,7 +314,7 @@ static void __mf_ctxpopup_search_filter_hide_cb(void *data, Evas_Object *obj, vo struct appdata *ap = (struct appdata *)data; bool ct_rotate = (bool)evas_object_data_get(obj, - MF_CTXPOPUP_OBJ_ROTATE_KEY); + MF_CTXPOPUP_OBJ_ROTATE_KEY); if (!ct_rotate) { mf_debug("ctxpopup is dismissed"); evas_object_del(obj); @@ -325,7 +325,7 @@ static void __mf_ctxpopup_search_filter_hide_cb(void *data, Evas_Object *obj, vo /* when "dismissed" cb is called next time, * ctxpopup should be dismissed if device is not rotated. */ evas_object_data_set(obj, MF_CTXPOPUP_OBJ_ROTATE_KEY, - (void*)false); + (void*)false); /* If ctxpopup is not dismissed, then it must be shown again. * Otherwise "dismissed" cb will be called one more time. */ if (searchfilter_ctxpopup) { @@ -343,7 +343,7 @@ static void __mf_ctxpopup_hide_cb(void *data, Evas_Object *obj, void *ei) struct appdata *ap = (struct appdata *)data; bool ct_rotate = (bool)evas_object_data_get(obj, - MF_CTXPOPUP_OBJ_ROTATE_KEY); + MF_CTXPOPUP_OBJ_ROTATE_KEY); if (!ct_rotate) { mf_debug("ctxpopup is dismissed"); @@ -354,7 +354,7 @@ static void __mf_ctxpopup_hide_cb(void *data, Evas_Object *obj, void *ei) /* when "dismissed" cb is called next time, * ctxpopup should be dismissed if device is not rotated. */ evas_object_data_set(obj, MF_CTXPOPUP_OBJ_ROTATE_KEY, - (void*)false); + (void*)false); /* If ctxpopup is not dismissed, then it must be shown again. * Otherwise "dismissed" cb will be called one more time. */ if (ap->mf_MainWindow.pContextPopup) { @@ -392,16 +392,16 @@ static void __mf_ctxpopup_del_cb(void *data, Evas *e, Evas_Object *obj, void *ei evas_object_data_del(ctxpopup, MF_CTXPOPUP_OBJ_MORE_BTN_KEY); evas_object_data_del(ctxpopup, MF_CTXPOPUP_OBJ_ROTATE_KEY); evas_object_smart_callback_del(ctxpopup, "dismissed", - __mf_ctxpopup_hide_cb); + __mf_ctxpopup_hide_cb); evas_object_event_callback_del(ap->mf_MainWindow.pWindow, - EVAS_CALLBACK_RESIZE, - __mf_ctxpopup_parent_resize_cb); + EVAS_CALLBACK_RESIZE, + __mf_ctxpopup_parent_resize_cb); evas_object_smart_callback_del(elm_object_top_widget_get(ctxpopup), - "rotation,changed", - __mf_ctxpopup_rotate_cb); + "rotation,changed", + __mf_ctxpopup_rotate_cb); evas_object_event_callback_del(ctxpopup, EVAS_CALLBACK_DEL, - __mf_ctxpopup_del_cb); + __mf_ctxpopup_del_cb); /*evas_object_smart_callback_del(ap->maininfo.naviframe, "ctxpopup,items,update", __mf_ctxpopup_items_update_cb);*/ @@ -419,16 +419,16 @@ static int __mf_ctxpopup_add_callbacks(void *data, Evas_Object *ctxpopup) //evas_object_event_callback_del(ap->mf_MainWindow.pWindow, EVAS_CALLBACK_RESIZE, mf_ug_resize_more_ctxpopup_cb); //evas_object_event_callback_add(ap->mf_MainWindow.pWindow, EVAS_CALLBACK_RESIZE, (Evas_Object_Event_Cb)mf_ug_resize_more_ctxpopup_cb, ap); evas_object_smart_callback_add(ctxpopup, "dismissed", - __mf_ctxpopup_hide_cb, data); + __mf_ctxpopup_hide_cb, data); evas_object_smart_callback_add(elm_object_top_widget_get(ctxpopup), - "rotation,changed", - __mf_ctxpopup_rotate_cb, data); + "rotation,changed", + __mf_ctxpopup_rotate_cb, data); evas_object_event_callback_add(ap->mf_MainWindow.pWindow, - EVAS_CALLBACK_RESIZE, - __mf_ctxpopup_parent_resize_cb, - ctxpopup); + EVAS_CALLBACK_RESIZE, + __mf_ctxpopup_parent_resize_cb, + ctxpopup); evas_object_event_callback_add(ctxpopup, EVAS_CALLBACK_DEL, - __mf_ctxpopup_del_cb, data); + __mf_ctxpopup_del_cb, data); /*evas_object_smart_callback_add(ap->mf_MainWindow.pWindow, "ctxpopup,items,update", __mf_ctxpopup_items_update_cb, ctxpopup);*/ @@ -451,9 +451,9 @@ void mf_context_popup_create_more(void *data, Evas_Object *parent) elm_object_style_set(ctxpopup, "more/default"); elm_ctxpopup_direction_priority_set(ctxpopup, ELM_CTXPOPUP_DIRECTION_UP, - ELM_CTXPOPUP_DIRECTION_UNKNOWN, - ELM_CTXPOPUP_DIRECTION_UNKNOWN, - ELM_CTXPOPUP_DIRECTION_UNKNOWN); + ELM_CTXPOPUP_DIRECTION_UNKNOWN, + ELM_CTXPOPUP_DIRECTION_UNKNOWN, + ELM_CTXPOPUP_DIRECTION_UNKNOWN); ap->mf_MainWindow.pContextPopup = ctxpopup; if (ap->mf_Status.more == MORE_DEFAULT) { @@ -475,22 +475,22 @@ void mf_context_popup_create_more(void *data, Evas_Object *parent) //1 Setting __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_setting); } else if (ap->mf_Status.view_type == mf_view_root_category) { - //1 Search - __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_search); + //1 Search + __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_search); if (ap->mf_Status.flagNoContent == EINA_FALSE) { - //1 Share - __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_share); - - //1 Delete - __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_delete); - //1 Move - __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_move); - //1 Copy - __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_copy); - //1 Rename - __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_rename); - //1 Edit - __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_edit); + //1 Share + __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_share); + + //1 Delete + __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_delete); + //1 Move + __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_move); + //1 Copy + __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_copy); + //1 Rename + __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_rename); + //1 Edit + __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_edit); } //1 View by __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_view_by); @@ -514,7 +514,7 @@ void mf_context_popup_create_more(void *data, Evas_Object *parent) ap->mf_Status.flagNoContent = EINA_TRUE; } //1 Search - __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_search); + __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_search); if (ap->mf_Status.flagNoContent == EINA_FALSE) { //1 Share @@ -548,21 +548,21 @@ void mf_context_popup_create_more(void *data, Evas_Object *parent) //1 Share __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_share); } - //1 Delete - __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_delete); - //1 Move - __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_move); - //1 Copy - __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_copy); + //1 Delete + __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_delete); + //1 Move + __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_move); + //1 Copy + __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_copy); } if (ap->mf_Status.flagNoContent == EINA_FALSE) { //1 Create - __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_new_folder); - //1 Rename - __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_rename); - //1 Edit - //__mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_edit); + __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_new_folder); + //1 Rename + __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_rename); + //1 Edit + //__mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_edit); //1 View by __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_view_by); @@ -571,9 +571,9 @@ void mf_context_popup_create_more(void *data, Evas_Object *parent) //1 Details __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_details); - }else{ + } else { //1 View by - __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_view_by); + __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_view_by); //1 Sort by __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_sort_by); } @@ -583,13 +583,13 @@ void mf_context_popup_create_more(void *data, Evas_Object *parent) //__mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_setting); } - } else if (ap->mf_Status.more == MORE_SEARCH){ + } else if (ap->mf_Status.more == MORE_SEARCH) { if (ap->mf_Status.flagNoContent == EINA_FALSE) { //delete __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_delete); //1 Share if (!(ap->mf_FileOperation.search_result_file_list == NULL || - eina_list_count(ap->mf_FileOperation.search_result_file_list) == 0)) { + eina_list_count(ap->mf_FileOperation.search_result_file_list) == 0)) { __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_share); } //1 Move @@ -605,7 +605,7 @@ void mf_context_popup_create_more(void *data, Evas_Object *parent) } } else if (ap->mf_Status.more == MORE_EDIT) { - return; + return; //1 Copy //__mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_copy); //fix P130916-02998 by ray @@ -614,14 +614,13 @@ void mf_context_popup_create_more(void *data, Evas_Object *parent) //__mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_move); // fix P130916-02998 by ray } else if (ap->mf_Status.more == MORE_INTERNAL_MOVE || - ap->mf_Status.more == MORE_INTERNAL_COPY || - ap->mf_Status.more == MORE_INTERNAL_DECOMPRESS) { + ap->mf_Status.more == MORE_INTERNAL_COPY || + ap->mf_Status.more == MORE_INTERNAL_DECOMPRESS) { //1 Create __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_new_folder); } - if (ctxpopup) - { + if (ctxpopup) { __mf_ctxpopup_add_callbacks(ap, ctxpopup); } _move_more_ctxpopup(ap, ap->mf_MainWindow.pWindow, ctxpopup); @@ -743,14 +742,14 @@ Evas_Object *mf_context_popup_search_filter(Evas_Object *parent, void *user_data evas_object_show(ctxpopup); evas_object_smart_callback_add(ctxpopup, "dismissed", - __mf_ctxpopup_search_filter_hide_cb, user_data); + __mf_ctxpopup_search_filter_hide_cb, user_data); evas_object_smart_callback_add(elm_object_top_widget_get(ctxpopup), - "rotation,changed", - __mf_ctxpopup_search_filter_rotate_cb, ap); + "rotation,changed", + __mf_ctxpopup_search_filter_rotate_cb, ap); evas_object_event_callback_add(ap->mf_MainWindow.pWindow, - EVAS_CALLBACK_RESIZE, - __mf_ctxpopup_parent_resize_cb, - ctxpopup); + EVAS_CALLBACK_RESIZE, + __mf_ctxpopup_parent_resize_cb, + ctxpopup); return ctxpopup; } diff --git a/src/widget/mf-detail-view.c b/src/widget/mf-detail-view.c index ea3784e..4f4bcd2 100755 --- a/src/widget/mf-detail-view.c +++ b/src/widget/mf-detail-view.c @@ -55,7 +55,7 @@ mf_detail_view_back_cb(void *data, Evas_Object *obj, void *event_info) mf_detail_data_destroy(ap); - mf_retm_if(ap->mf_MainWindow.pNaviBar == NULL,"ap->mf_MainWindow.pNaviBar is NULL"); + mf_retm_if(ap->mf_MainWindow.pNaviBar == NULL, "ap->mf_MainWindow.pNaviBar is NULL"); if (ap->mf_Status.more == MORE_DEFAULT) { ap->mf_Status.view_type = ap->mf_Status.preViewType; mf_view_update(ap); @@ -82,7 +82,7 @@ mf_detail_view_content_create(void *data) ap->mf_MainWindow.pNaviGenlist = NULL; } else { Evas_Object *genlist = mf_ug_detail_view_create_genlist(ap->mf_MainWindow.pNaviLayout, - ap->mf_Status.detail); + ap->mf_Status.detail); mf_ug_detail_view_process_genlist(ap->mf_Status.detail, genlist); evas_object_show(genlist); @@ -122,15 +122,15 @@ void mf_detail_view_create(void *data) MF_TA_ACUM_ITEM_BEGIN("123456 push naviframe item", 0); if (ap->mf_Status.pPreNaviItem) { ap->mf_MainWindow.pNaviItem = elm_naviframe_item_insert_after(ap->mf_MainWindow.pNaviBar, - ap->mf_Status.pPreNaviItem, - "", NULL, NULL, - ap->mf_MainWindow.pNaviLayout, - MF_NAVI_STYLE_ENABLE); + ap->mf_Status.pPreNaviItem, + "", NULL, NULL, + ap->mf_MainWindow.pNaviLayout, + MF_NAVI_STYLE_ENABLE); } else { ap->mf_MainWindow.pNaviItem = elm_naviframe_item_push(ap->mf_MainWindow.pNaviBar, - NULL, NULL, NULL, - ap->mf_MainWindow.pNaviLayout, - MF_NAVI_STYLE_ENABLE); + NULL, NULL, NULL, + ap->mf_MainWindow.pNaviLayout, + MF_NAVI_STYLE_ENABLE); } // Evas_Object *pImage = elm_image_add(ap->mf_MainWindow.pNaviBar); diff --git a/src/widget/mf-edit-view.c b/src/widget/mf-edit-view.c index eb27228..0e418ea 100755 --- a/src/widget/mf-edit-view.c +++ b/src/widget/mf-edit-view.c @@ -61,8 +61,9 @@ void mf_edit_select_all_check_set(Eina_Bool state) void mf_edit_folder_list_append(void *data) { if (edit_folder_list) { - if (eina_list_data_find(edit_folder_list, data) == NULL) + if (eina_list_data_find(edit_folder_list, data) == NULL) { edit_folder_list = eina_list_append(edit_folder_list, data); + } } else { edit_folder_list = eina_list_append(edit_folder_list, data); } @@ -101,8 +102,9 @@ Eina_List * mf_edit_folder_list_get() void mf_edit_file_list_append(void *data) { if (edit_file_list) { - if (eina_list_data_find(edit_file_list, data) == NULL) + if (eina_list_data_find(edit_file_list, data) == NULL) { edit_file_list = eina_list_append(edit_file_list, data); + } } else { edit_file_list = eina_list_append(edit_file_list, data); } @@ -229,7 +231,7 @@ void mf_edit_list_item_reset(void *data) struct appdata *ap = (struct appdata *)data; mf_retm_if(ap == NULL, "ap is NULL"); - + Evas_Object *genlist = NULL; Elm_Object_Item *it = NULL; mf_list_data_t *item_data = NULL; @@ -240,7 +242,7 @@ void mf_edit_list_item_reset(void *data) mf_edit_select_all_set(EINA_FALSE); mf_edit_count_set(0); - + edit_count = elm_genlist_items_count(genlist); selected_all = EINA_FALSE; it = elm_genlist_first_item_get(genlist); @@ -281,7 +283,7 @@ void mf_edit_view_select_info_create(void *data) label = g_strdup(MF_LABEL_SELECT_ITEMS); } mf_object_item_text_set(ap->mf_MainWindow.pNaviItem, label, "elm.text.title"); - SAFE_FREE_CHAR(label); + SAFE_FREE_CHAR(label); } @@ -291,8 +293,7 @@ static void mf_edit_item_sel_all_press_cb(void *data, Evas_Object *obj, void *ev Eina_Bool state = elm_check_state_get(pSelectAllCheckBox); if (state) { elm_object_signal_emit(pSelectAllCheckBox, "elm,activate,check,off", "elm"); - } - else { + } else { elm_object_signal_emit(pSelectAllCheckBox, "elm,activate,check,on", "elm"); } @@ -339,7 +340,7 @@ void mf_edit_item_sel_all_cb(void *data, Evas_Object * obj, void *event_info) } elm_check_state_set(it_data->pCheckBox, it_data->m_checked); } - // elm_genlist_item_update(it); + // elm_genlist_item_update(it); it = elm_genlist_item_next_get(it); } //elm_genlist_realized_items_update(ap->mf_MainWindow.pNaviGenlist); @@ -404,18 +405,18 @@ void mf_edit_gengrid_item_sel_cb(void *data, Evas_Object * obj, void *event_info struct appdata *ap = (struct appdata *)selected->ap; mf_retm_if(ap == NULL, "input parameter data error"); int view_style = mf_view_style_get(ap); - if (ap->mf_Status.more != MORE_EDIT - && ap->mf_Status.more != MORE_SHARE_EDIT - && ap->mf_Status.more != MORE_EDIT_COPY - && ap->mf_Status.more != MORE_EDIT_MOVE - && ap->mf_Status.more != MORE_EDIT_DELETE - && ap->mf_Status.more != MORE_EDIT_DELETE_RECENT - && ap->mf_Status.more != MORE_EDIT_UNINSTALL - && ap->mf_Status.more != MORE_EDIT_DETAIL - ) { + if (ap->mf_Status.more != MORE_EDIT + && ap->mf_Status.more != MORE_SHARE_EDIT + && ap->mf_Status.more != MORE_EDIT_COPY + && ap->mf_Status.more != MORE_EDIT_MOVE + && ap->mf_Status.more != MORE_EDIT_DELETE + && ap->mf_Status.more != MORE_EDIT_DELETE_RECENT + && ap->mf_Status.more != MORE_EDIT_UNINSTALL + && ap->mf_Status.more != MORE_EDIT_DETAIL + ) { MF_TRACE_END; - return; - } + return; + } if (selected->file_type == FILE_TYPE_DIR) { if (mf_edit_folder_list_item_exists(item)) { selected->m_checked = false; @@ -470,20 +471,22 @@ void mf_edit_list_item_sel_by_list_data(mf_list_data_t *selected, Evas_Object * int view_style = mf_view_style_get(ap); if (ap->mf_Status.more != MORE_EDIT - && ap->mf_Status.more != MORE_SHARE_EDIT - && ap->mf_Status.more != MORE_EDIT_COPY - && ap->mf_Status.more != MORE_EDIT_MOVE - && ap->mf_Status.more != MORE_EDIT_DELETE - && ap->mf_Status.more != MORE_EDIT_DELETE_RECENT - && ap->mf_Status.more != MORE_EDIT_UNINSTALL - && ap->mf_Status.more != MORE_EDIT_DETAIL - ) { + && ap->mf_Status.more != MORE_SHARE_EDIT + && ap->mf_Status.more != MORE_EDIT_COPY + && ap->mf_Status.more != MORE_EDIT_MOVE + && ap->mf_Status.more != MORE_EDIT_DELETE + && ap->mf_Status.more != MORE_EDIT_DELETE_RECENT + && ap->mf_Status.more != MORE_EDIT_UNINSTALL + && ap->mf_Status.more != MORE_EDIT_DETAIL + ) { return; } if (obj) { Evas_Object *popup = evas_object_data_get(obj, "popup"); // Get popup - if (popup) return; // If popup exists, do nothing + if (popup) { + return; // If popup exists, do nothing + } } if (selected->file_type == FILE_TYPE_DIR) { @@ -620,10 +623,10 @@ void mf_edit_view_list_update(void *data) if (itemData->file_type == FILE_TYPE_DIR) { it = elm_gengrid_item_next_get(it); elm_object_item_del(itemData->item); - }else { + } else { it = elm_gengrid_item_next_get(it); } - }else { + } else { it = elm_gengrid_item_next_get(it); } } @@ -766,9 +769,9 @@ void mf_edit_view_title_button_set(void *data) } else if (ap->mf_Status.more == MORE_EDIT_DELETE_RECENT) { mf_naviframe_right_save_button_create(ap->mf_MainWindow.pNaviBar, ap->mf_MainWindow.pNaviItem, mf_callback_delete_recent_files_confirm_cb, ap); } else if (ap->mf_Status.more == MORE_EDIT_UNINSTALL) { - #ifdef MYFILE_DOWNLOAD_APP_FEATURE +#ifdef MYFILE_DOWNLOAD_APP_FEATURE mf_naviframe_right_save_button_create(ap->mf_MainWindow.pNaviBar, ap->mf_MainWindow.pNaviItem, mf_download_app_uninstall_cb, ap); - #endif +#endif } else if (ap->mf_Status.more == MORE_EDIT_DETAIL) { mf_debug("detail callback"); mf_naviframe_right_save_button_create(ap->mf_MainWindow.pNaviBar, ap->mf_MainWindow.pNaviItem, mf_callback_details_cb, ap); @@ -895,7 +898,7 @@ void mf_edit_view_refresh(void *data, Eina_List **file_list, Eina_List **folder_ } edit_count = elm_gengrid_items_count(ap->mf_MainWindow.pNaviGengrid); } - + if (view_style != MF_VIEW_STYLE_THUMBNAIL) { elm_genlist_realized_items_update(ap->mf_MainWindow.pNaviGenlist); } else { @@ -917,10 +920,11 @@ void mf_edit_view_refresh(void *data, Eina_List **file_list, Eina_List **folder_ } mf_edit_view_select_all_layout_prepend(ap); - if (count == edit_count) + if (count == edit_count) { mf_edit_select_all_check_set(EINA_TRUE); - else + } else { mf_edit_select_all_check_set(EINA_FALSE); + } mf_edit_view_title_button_set(ap); @@ -939,15 +943,15 @@ void mf_edit_view_create(void *data) mf_edit_select_all_set(EINA_FALSE); mf_edit_count_set(0); char *title = NULL; - + elm_naviframe_item_title_enabled_set(ap->mf_MainWindow.pNaviItem, EINA_TRUE, EINA_FALSE); mf_edit_select_all_callback_set(mf_edit_item_sel_all_cb); mf_edit_select_info_func_set(mf_edit_view_select_info_create); - if(ap->mf_Status.extra != MORE_SEARCH) { + if (ap->mf_Status.extra != MORE_SEARCH) { mf_edit_view_select_all_layout_prepend(ap); title = g_strdup_printf(mf_util_get_text(MF_LABEL_SELECTED), 0); } else { - title =mf_util_get_text(MF_LABEL_SELECT_ITEMS); + title = mf_util_get_text(MF_LABEL_SELECT_ITEMS); } mf_edit_view_list_update(ap); mf_navi_bar_title_content_set(ap, title); diff --git a/src/widget/mf-focus-ui.c b/src/widget/mf-focus-ui.c index ed4a93a..a4867ec 100755 --- a/src/widget/mf-focus-ui.c +++ b/src/widget/mf-focus-ui.c @@ -24,7 +24,7 @@ int _mf_focus_ui_set_dual_focus_order(Evas_Object *curr, Evas_Object *next, mf_f mf_retvm_if(next == NULL, 0, "next is NULL"); if (elm_object_focus_allow_get(curr) != EINA_TRUE || - elm_object_focus_allow_get(next) != EINA_TRUE) { + elm_object_focus_allow_get(next) != EINA_TRUE) { mf_debug("Input elm object is not focusable!"); return -1; } diff --git a/src/widget/mf-gengrid.c b/src/widget/mf-gengrid.c index 95fc7d6..b943825 100755 --- a/src/widget/mf-gengrid.c +++ b/src/widget/mf-gengrid.c @@ -46,8 +46,9 @@ static void __mf_gengrid_icon_clicked(void *data, Evas_Object *obj, void *event_ elm_gengrid_item_selected_set(item, EINA_FALSE); } - if (ap->mf_MainWindow.pLongpressPopup != NULL) + if (ap->mf_MainWindow.pLongpressPopup != NULL) { return; + } if (item != NULL) { mfItemData_s *selected = (mfItemData_s *) elm_object_item_data_get(item); @@ -55,14 +56,14 @@ static void __mf_gengrid_icon_clicked(void *data, Evas_Object *obj, void *event_ mf_retm_if(selected->m_ItemName == NULL, "selected->m_ItemName is NULL"); mf_retm_if(selected->m_ItemName->str == NULL, "selected->m_ItemName->str is NULL"); - if (ap->mf_Status.more == MORE_EDIT - || ap->mf_Status.more == MORE_SHARE_EDIT - || ap->mf_Status.more == MORE_EDIT_COPY - || ap->mf_Status.more == MORE_EDIT_MOVE - || ap->mf_Status.more == MORE_EDIT_DELETE - || ap->mf_Status.more == MORE_EDIT_UNINSTALL - || ap->mf_Status.more == MORE_EDIT_DETAIL - ) { + if (ap->mf_Status.more == MORE_EDIT + || ap->mf_Status.more == MORE_SHARE_EDIT + || ap->mf_Status.more == MORE_EDIT_COPY + || ap->mf_Status.more == MORE_EDIT_MOVE + || ap->mf_Status.more == MORE_EDIT_DELETE + || ap->mf_Status.more == MORE_EDIT_UNINSTALL + || ap->mf_Status.more == MORE_EDIT_DETAIL + ) { return; } @@ -78,18 +79,18 @@ static void __mf_gengrid_icon_clicked(void *data, Evas_Object *obj, void *event_ void mf_gengrid_realized(void *data, Evas_Object *obj, void *event_info) { - + mf_retm_if(data == NULL, "data is NULL"); struct appdata *ap = (struct appdata*)data; - + if (ap->mf_Status.more == MORE_EDIT - || ap->mf_Status.more == MORE_SHARE_EDIT - || ap->mf_Status.more == MORE_EDIT_COPY - || ap->mf_Status.more == MORE_EDIT_MOVE - || ap->mf_Status.more == MORE_EDIT_DELETE - || ap->mf_Status.more == MORE_EDIT_UNINSTALL - || ap->mf_Status.more == MORE_EDIT_DETAIL - ) { + || ap->mf_Status.more == MORE_SHARE_EDIT + || ap->mf_Status.more == MORE_EDIT_COPY + || ap->mf_Status.more == MORE_EDIT_MOVE + || ap->mf_Status.more == MORE_EDIT_DELETE + || ap->mf_Status.more == MORE_EDIT_UNINSTALL + || ap->mf_Status.more == MORE_EDIT_DETAIL + ) { mf_list_data_t *list_data = (mf_list_data_t *)elm_object_item_data_get(event_info); elm_object_item_signal_emit(event_info, "check,state,show", ""); if (list_data->m_checked) { @@ -123,8 +124,9 @@ void mf_gengrid_create_grid_items(void *data, Evas_Object *grid, Eina_List *file char *real_name = NULL; fsNodeInfo *pNode = (fsNodeInfo *)pData; - if (pNode == NULL) + if (pNode == NULL) { continue; + } real_name = g_strconcat(pNode->path, "/", pNode->name, NULL); if (real_name == NULL) { @@ -152,7 +154,7 @@ void mf_gengrid_create_grid_items(void *data, Evas_Object *grid, Eina_List *file m_TempItem->list_type = pNode->list_type; m_TempItem->ap = ap; if (ap->mf_Status.more == MORE_INTERNAL_COPY_MOVE || ap->mf_Status.more == MORE_INTERNAL_COPY || ap->mf_Status.more == MORE_INTERNAL_DECOMPRESS - || ap->mf_Status.more == MORE_INTERNAL_MOVE || ap->mf_Status.more == MORE_DATA_COPYING || ap->mf_Status.more == MORE_DATA_MOVING) { + || ap->mf_Status.more == MORE_INTERNAL_MOVE || ap->mf_Status.more == MORE_DATA_COPYING || ap->mf_Status.more == MORE_DATA_MOVING) { mf_debug(); it = elm_gengrid_item_append(grid, &gic, m_TempItem, NULL, NULL); } else { @@ -208,11 +210,11 @@ Evas_Object *mf_gengrid_item_icon_get(void *data, Evas_Object *obj, const char * if (!strcmp(part, "elm.swallow.icon")) { Evas_Object *thumb = NULL; - if (!(params->real_thumb_flag && params->thumb_path)) { - mf_genlist_get_thumbnail(params); - } + if (!(params->real_thumb_flag && params->thumb_path)) { + mf_genlist_get_thumbnail(params); + } if (params->file_type == FILE_TYPE_MUSIC || params->file_type == FILE_TYPE_SOUND) { - if (params->thumb_path && mf_file_exists(params->thumb_path) && strcmp(params->thumb_path,MF_MUSIC_DEFAULT_THUMBNAIL_FROM_DB) == 0) { + if (params->thumb_path && mf_file_exists(params->thumb_path) && strcmp(params->thumb_path, MF_MUSIC_DEFAULT_THUMBNAIL_FROM_DB) == 0) { SAFE_FREE_CHAR(params->thumb_path); params->thumb_path = g_strdup(MF_ICON_MUSIC_THUMBNAIL); params->thumbnail_type = MF_THUMBNAIL_TYPE_DEFAULT; @@ -233,12 +235,13 @@ Evas_Object *mf_gengrid_item_icon_get(void *data, Evas_Object *obj, const char * int isOriginalImage = (params->m_ItemName->str && params->thumb_path && strcmp(params->thumb_path, params->m_ItemName->str) == 0); if (isOriginalImage == 0) { mf_file_attr_get_file_size(params->thumb_path, &size); - if (size < 4*1024*1024) + if (size < 4 * 1024 * 1024) { elm_image_file_set(thumb, params->thumb_path, NULL); - }else{ - if (g_is_refresh_at_grid == false) + } + } else { + if (g_is_refresh_at_grid == false) { mf_view_refresh_thumbnail_for_other_memory(ap, ap->mf_FileOperation.file_list); - else{ + } else { if (params->pNode && params->pNode->thumbnail_path) {//For supporting the otg thumbnail mf_debug("params->pNode->thumbnail_path=%s", params->pNode->thumbnail_path); thumb = elm_image_add(obj); @@ -246,65 +249,68 @@ Evas_Object *mf_gengrid_item_icon_get(void *data, Evas_Object *obj, const char * elm_image_fill_outside_set(thumb, EINA_TRUE); elm_image_smooth_set(thumb, EINA_FALSE); elm_image_file_set(thumb, params->pNode->thumbnail_path, NULL); - }else if (params->thumb_path) { + } else if (params->thumb_path) { thumb = elm_image_add(obj); elm_image_prescale_set(thumb, MF_ICON_SIZE); elm_image_fill_outside_set(thumb, EINA_TRUE); elm_image_smooth_set(thumb, EINA_FALSE); - if (params->file_type == FILE_TYPE_IMAGE) + if (params->file_type == FILE_TYPE_IMAGE) { elm_image_file_set(thumb, EDJ_IMAGE, MF_ICON_IMAGE); - else if (params->file_type == FILE_TYPE_VIDEO) + } else if (params->file_type == FILE_TYPE_VIDEO) { elm_image_file_set(thumb, EDJ_IMAGE, MF_ICON_VIDEO); - else + } else { elm_image_file_set(thumb, params->thumb_path, NULL); - }else{ + } + } else { return NULL; } } g_is_refresh_at_grid = true; } } else { - thumb = elm_image_add(obj); - elm_image_prescale_set(thumb, MF_ICON_SIZE); - elm_image_fill_outside_set(thumb, EINA_TRUE); - elm_image_smooth_set(thumb, EINA_FALSE); - //Checking file size, if more than 4M, don't display it, it will be very slow. - off_t size = 0;//Comment it, for P140606-04570, some times at efl, it will crash at png file. - int isOriginalImage = (params->m_ItemName->str && params->thumb_path && strcmp(params->thumb_path, params->m_ItemName->str) == 0); - if (isOriginalImage == 0) { - mf_file_attr_get_file_size(params->thumb_path, &size); - if (size < 4*1024*1024) - elm_image_file_set(thumb, params->thumb_path, NULL); - }else{ - if (g_is_refresh_at_grid == false) - mf_view_refresh_thumbnail_for_other_memory(ap, ap->mf_FileOperation.file_list); - else{ - if (params->pNode && params->pNode->thumbnail_path) {//For supporting the otg thumbnail - mf_debug("params->pNode->thumbnail_path=%s", params->pNode->thumbnail_path); - thumb = elm_image_add(obj); - elm_image_prescale_set(thumb, MF_ICON_SIZE); - elm_image_fill_outside_set(thumb, EINA_TRUE); - elm_image_smooth_set(thumb, EINA_FALSE); - elm_image_file_set(thumb, params->pNode->thumbnail_path, NULL); - }else if (params->thumb_path) { - thumb = elm_image_add(obj); - elm_image_prescale_set(thumb, MF_ICON_SIZE); - elm_image_fill_outside_set(thumb, EINA_TRUE); - elm_image_smooth_set(thumb, EINA_FALSE); - - if (params->file_type == FILE_TYPE_IMAGE) - elm_image_file_set(thumb, EDJ_IMAGE, MF_ICON_IMAGE); - else if (params->file_type == FILE_TYPE_VIDEO) - elm_image_file_set(thumb, EDJ_IMAGE, MF_ICON_VIDEO); - else - elm_image_file_set(thumb, params->thumb_path, NULL); - }else{ - return NULL; + thumb = elm_image_add(obj); + elm_image_prescale_set(thumb, MF_ICON_SIZE); + elm_image_fill_outside_set(thumb, EINA_TRUE); + elm_image_smooth_set(thumb, EINA_FALSE); + //Checking file size, if more than 4M, don't display it, it will be very slow. + off_t size = 0;//Comment it, for P140606-04570, some times at efl, it will crash at png file. + int isOriginalImage = (params->m_ItemName->str && params->thumb_path && strcmp(params->thumb_path, params->m_ItemName->str) == 0); + if (isOriginalImage == 0) { + mf_file_attr_get_file_size(params->thumb_path, &size); + if (size < 4 * 1024 * 1024) { + elm_image_file_set(thumb, params->thumb_path, NULL); + } + } else { + if (g_is_refresh_at_grid == false) { + mf_view_refresh_thumbnail_for_other_memory(ap, ap->mf_FileOperation.file_list); + } else { + if (params->pNode && params->pNode->thumbnail_path) {//For supporting the otg thumbnail + mf_debug("params->pNode->thumbnail_path=%s", params->pNode->thumbnail_path); + thumb = elm_image_add(obj); + elm_image_prescale_set(thumb, MF_ICON_SIZE); + elm_image_fill_outside_set(thumb, EINA_TRUE); + elm_image_smooth_set(thumb, EINA_FALSE); + elm_image_file_set(thumb, params->pNode->thumbnail_path, NULL); + } else if (params->thumb_path) { + thumb = elm_image_add(obj); + elm_image_prescale_set(thumb, MF_ICON_SIZE); + elm_image_fill_outside_set(thumb, EINA_TRUE); + elm_image_smooth_set(thumb, EINA_FALSE); + + if (params->file_type == FILE_TYPE_IMAGE) { + elm_image_file_set(thumb, EDJ_IMAGE, MF_ICON_IMAGE); + } else if (params->file_type == FILE_TYPE_VIDEO) { + elm_image_file_set(thumb, EDJ_IMAGE, MF_ICON_VIDEO); + } else { + elm_image_file_set(thumb, params->thumb_path, NULL); } + } else { + return NULL; } - g_is_refresh_at_grid = true; } + g_is_refresh_at_grid = true; + } } @@ -337,7 +343,7 @@ Evas_Object *mf_gengrid_item_icon_get(void *data, Evas_Object *obj, const char * elm_image_smooth_set(thumb, EINA_FALSE); elm_image_preload_disabled_set(thumb, EINA_FALSE); } else { - return NULL; + return NULL; } if (params->file_type != FILE_TYPE_DIR) { @@ -352,7 +358,7 @@ Evas_Object *mf_gengrid_item_icon_get(void *data, Evas_Object *obj, const char * evas_object_show(thumb); return thumb; } - return NULL; + return NULL; } char *mf_gengrid_item_label_get(void *data, Evas_Object * obj, const char *part) @@ -365,13 +371,13 @@ char *mf_gengrid_item_label_get(void *data, Evas_Object * obj, const char *part) mf_error("===================== label get entry"); if (ap->mf_Status.view_type == mf_view_root_category) { - if (ap->mf_Status.more != MORE_SEARCH && mf_view_get_pre_state(ap) != MORE_SEARCH) { - if (ap->mf_Status.category_type == mf_tray_item_category_image - || ap->mf_Status.category_type == mf_tray_item_category_video) { - if (params->thumbnail_type != MF_THUMBNAIL_DEFAULT) { - is_apply_filename = false; - } + if (ap->mf_Status.more != MORE_SEARCH && mf_view_get_pre_state(ap) != MORE_SEARCH) { + if (ap->mf_Status.category_type == mf_tray_item_category_image + || ap->mf_Status.category_type == mf_tray_item_category_video) { + if (params->thumbnail_type != MF_THUMBNAIL_DEFAULT) { + is_apply_filename = false; } + } } } if (is_apply_filename && strcmp(part, "elm.text") == 0) { @@ -390,8 +396,7 @@ char *mf_gengrid_item_label_get(void *data, Evas_Object * obj, const char *part) MF_TRACE_END; file_name = g_strdup(markup_name); } - } - else if (params->ap->mf_Status.iExtensionState == MF_EXTENSION_HIDE && !mf_file_attr_is_dir(params->m_ItemName->str)) { + } else if (params->ap->mf_Status.iExtensionState == MF_EXTENSION_HIDE && !mf_file_attr_is_dir(params->m_ItemName->str)) { file_name = mf_fm_svc_get_file_name(params->m_ItemName); } else { file_name = g_strdup(mf_file_get(params->m_ItemName->str)); @@ -416,7 +421,7 @@ char *mf_gengrid_item_label_get(void *data, Evas_Object * obj, const char *part) } } return file_name_tmp; - }else{ + } else { if (file_name) { char *translate_label = elm_entry_utf8_to_markup(file_name); if (translate_label) { @@ -427,7 +432,7 @@ char *mf_gengrid_item_label_get(void *data, Evas_Object * obj, const char *part) } return file_name; } - }else{ + } else { return strdup(_("")); } } @@ -491,13 +496,13 @@ Evas_Object *mf_gengrid_create(Evas_Object *parent, void *data) Evas_Object *grid = NULL; grid = mf_gengrid_create_grid(parent); int gengrid_len = eina_list_count(ap->mf_FileOperation.file_list) + eina_list_count(ap->mf_FileOperation.folder_list); - mf_error("gengrid length = %d",gengrid_len); + mf_error("gengrid length = %d", gengrid_len); mf_gengrid_align_set(grid, gengrid_len); mf_gengrid_gen_style_set(); return grid; } -Evas_Object *mf_gengrid_create_grid (Evas_Object *parent) +Evas_Object *mf_gengrid_create_grid(Evas_Object *parent) { MF_TRACE_BEGIN; mf_retvm_if(parent == NULL, NULL, "parent is NULL"); @@ -509,17 +514,17 @@ Evas_Object *mf_gengrid_create_grid (Evas_Object *parent) //elm_object_focus_set(grid, EINA_FALSE); elm_object_focus_allow_set(grid, EINA_TRUE); - elm_gengrid_horizontal_set(grid, EINA_FALSE); + elm_gengrid_horizontal_set(grid, EINA_FALSE); elm_scroller_bounce_set(grid, EINA_FALSE, EINA_TRUE); elm_scroller_policy_set(grid, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); - elm_gengrid_multi_select_set(grid, EINA_TRUE); + elm_gengrid_multi_select_set(grid, EINA_TRUE); evas_object_show(grid); g_is_refresh_at_grid = false; return grid; } void mf_gengrid_create_list_default_style(Evas_Object *pGengrid, void *data, Eina_List *dir_list, - Eina_List *file_list) + Eina_List *file_list) { MF_TRACE_BEGIN; @@ -532,26 +537,26 @@ void mf_gengrid_create_list_default_style(Evas_Object *pGengrid, void *data, Ein Eina_List *l = NULL; EINA_LIST_FOREACH(dir_list, l, pNode) { - if (pNode) { - it = mf_view_item_append(pGengrid, pNode, ap); - mf_error(); - if (ap->mf_Status.ToTop) { - elm_genlist_item_show(it, ELM_GENLIST_ITEM_SCROLLTO_TOP); - ap->mf_Status.ToTop = false ; - } - } + if (pNode) { + it = mf_view_item_append(pGengrid, pNode, ap); + mf_error(); + if (ap->mf_Status.ToTop) { + elm_genlist_item_show(it, ELM_GENLIST_ITEM_SCROLLTO_TOP); + ap->mf_Status.ToTop = false ; + } + } } /* add file items into the genlist */ EINA_LIST_FOREACH(file_list, l, pNode) { - if (pNode) { - mf_view_item_append(pGengrid, pNode, ap); - } + if (pNode) { + mf_view_item_append(pGengrid, pNode, ap); + } } } void mf_gengrid_thumbs_longpressed(void *data, Evas_Object *obj, - void *event_info) + void *event_info) { struct appdata *ap = (struct appdata *)data; mf_retm_if(ap == NULL, "ap is NULL"); @@ -592,7 +597,7 @@ Evas_Object *mf_gengrid_create_list(void *data, Evas_Object *parent) dir_list = ap->mf_FileOperation.folder_list; } - gengrid = mf_gengrid_create(parent,ap); + gengrid = mf_gengrid_create(parent, ap); evas_object_smart_callback_add(gengrid, "language,changed", mf_gengrid_gl_lang_changed, ap); diff --git a/src/widget/mf-genlist.c b/src/widget/mf-genlist.c index 40973c8..06cd167 100755 --- a/src/widget/mf-genlist.c +++ b/src/widget/mf-genlist.c @@ -56,8 +56,7 @@ #define DEF_LABEL_BUF_LEN (512) #define MF_LIST_THUMBNAIL_SIZE 46 -typedef struct -{ +typedef struct { void *ap_data; Evas_Object *layout; Evas_Object *navi_layout; @@ -67,7 +66,7 @@ typedef struct Eina_List *file_list; Evas_Object *navi_item; Eina_Bool is_root; -}cloud_view_data; +} cloud_view_data; /**** Global definition ****/ static bool g_is_refresh_at_glist = false; @@ -193,7 +192,7 @@ void mf_genlist_get_thumbnail(mfItemData_s *params) } int thumbnail_type = mf_file_attr_get_file_icon(params->m_ItemName->str, &error_code, - MF_ROTATE_PORTRAIT, &icon_path, ¶ms->media); + MF_ROTATE_PORTRAIT, &icon_path, ¶ms->media); if (icon_path && thumbnail_type == MF_THUMBNAIL_TYPE_THUMBNAIL) { if (mf_file_exists(icon_path)) { @@ -249,7 +248,7 @@ static char *__mf_genlist_gl_label_get_lite(void *data, Evas_Object *obj, const } else if (g_strcmp0(params->m_ItemName->str, MEMORY_FOLDER) == 0) { return g_strdup(mf_util_get_text(MF_LABEL_SD_CARD)); } else { - if (params->ap->mf_Status.more == MORE_SEARCH &¶ms->ap->mf_Status.search_filter) { + if (params->ap->mf_Status.more == MORE_SEARCH && params->ap->mf_Status.search_filter) { char *markup_name = NULL; bool res = false; markup_name = (char *)mf_util_search_markup_keyword(mf_file_get(params->m_ItemName->str), params->ap->mf_Status.search_filter, &res); @@ -266,19 +265,19 @@ static char *__mf_genlist_gl_label_get_lite(void *data, Evas_Object *obj, const } } /* - } else if (strcmp(part, "elm.uptitle.text") == 0) { - return g_strdup(params->m_ItemName->str); - } else if (strcmp(part, "elm.slide_base.text") == 0) { - return g_strdup(mf_file_get(params->m_ItemName->str)); - } else if (strcmp(part, "elm.slide.text.1") == 0) { - return g_strdup(mf_file_get(params->m_ItemName->str)); + } else if (strcmp(part, "elm.uptitle.text") == 0) { + return g_strdup(params->m_ItemName->str); + } else if (strcmp(part, "elm.slide_base.text") == 0) { + return g_strdup(mf_file_get(params->m_ItemName->str)); + } else if (strcmp(part, "elm.slide.text.1") == 0) { + return g_strdup(mf_file_get(params->m_ItemName->str)); */ } else if (strcmp(part, "elm.text.main.left.top") == 0) { if (g_strcmp0(params->m_ItemName->str, PHONE_FOLDER) == 0) { return g_strdup(mf_util_get_text(MF_LABEL_DEVICE_MEMORY)); } else if (g_strcmp0(params->m_ItemName->str, MEMORY_FOLDER) == 0) { return g_strdup(mf_util_get_text(MF_LABEL_SD_CARD)); - } else if (params->ap->mf_Status.more == MORE_SEARCH &¶ms->ap->mf_Status.search_filter) { + } else if (params->ap->mf_Status.more == MORE_SEARCH && params->ap->mf_Status.search_filter) { char *markup_name = NULL; bool res = false; markup_name = (char *)mf_util_search_markup_keyword(mf_file_get(params->m_ItemName->str), params->ap->mf_Status.search_filter, &res); @@ -295,7 +294,7 @@ static char *__mf_genlist_gl_label_get_lite(void *data, Evas_Object *obj, const } else if (strcmp(part, "elm.text.sub.left.bottom") == 0) { if ((params->ap->mf_Status.more == MORE_SEARCH && params->ap->mf_Status.search_filter) - || params->ap->mf_Status.view_type == mf_view_root) { + || params->ap->mf_Status.view_type == mf_view_root) { int root_len = 0; char *new_path = NULL; GString *parent_path = NULL; @@ -332,7 +331,7 @@ static char *__mf_genlist_gl_label_get_lite(void *data, Evas_Object *obj, const } else { if (params->create_date) { if (params->list_type == mf_list_normal - || params->list_type == mf_list_recent_files) { + || params->list_type == mf_list_recent_files) { if (params->modify_time) { char *tempdate = mf_util_icu_translate(params->ap, params->modify_time, false); SAFE_FREE_CHAR(params->create_date); @@ -359,7 +358,7 @@ static char *__mf_genlist_gl_label_get_lite(void *data, Evas_Object *obj, const if (count == 0 || count == 1) { return g_strdup_printf(mf_util_get_text(MF_LABEL_ITEM), count); } else { - return g_strdup_printf("%d %s", count ,mf_util_get_text(MF_LABEL_ITEMS)); + return g_strdup_printf("%d %s", count , mf_util_get_text(MF_LABEL_ITEMS)); } } else { return g_strdup(_("")); @@ -456,13 +455,12 @@ static Evas_Object *__mf_genlist_gl_default_icon_get_lite(void *data, Evas_Objec } } else if (!strcmp(part, "elm.icon.2")) { if (ap->mf_Status.more == MORE_SHARE_EDIT - || ap->mf_Status.more == MORE_EDIT_DELETE - || ap->mf_Status.more == MORE_EDIT_COPY - || ap->mf_Status.more == MORE_EDIT_MOVE - || ap->mf_Status.more == MORE_EDIT_DELETE_RECENT - || ap->mf_Status.more == MORE_EDIT_UNINSTALL - || ap->mf_Status.more == MORE_EDIT_DETAIL) - { + || ap->mf_Status.more == MORE_EDIT_DELETE + || ap->mf_Status.more == MORE_EDIT_COPY + || ap->mf_Status.more == MORE_EDIT_MOVE + || ap->mf_Status.more == MORE_EDIT_DELETE_RECENT + || ap->mf_Status.more == MORE_EDIT_UNINSTALL + || ap->mf_Status.more == MORE_EDIT_DETAIL) { if (ap->mf_Status.extra != MORE_SEARCH) { Evas_Object *content = elm_layout_add(obj); elm_layout_theme_set(content, "layout", "list/C/type.2", "default"); @@ -498,19 +496,21 @@ static Evas_Object *__mf_genlist_gl_default_icon_get_lite(void *data, Evas_Objec if (params->file_type == FILE_TYPE_MUSIC || params->file_type == FILE_TYPE_SOUND) { if (params->thumb_path && mf_file_exists(params->thumb_path) && - strcmp(params->thumb_path, MF_MUSIC_DEFAULT_THUMBNAIL_FROM_DB) == 0) { + strcmp(params->thumb_path, MF_MUSIC_DEFAULT_THUMBNAIL_FROM_DB) == 0) { SAFE_FREE_CHAR(params->thumb_path); - if (params->file_type == FILE_TYPE_MUSIC) + if (params->file_type == FILE_TYPE_MUSIC) { params->thumb_path = g_strdup(MF_ICON_MUSIC_THUMBNAIL); - else + } else { params->thumb_path = g_strdup(MF_ICON_SOUND); + } params->thumbnail_type = MF_THUMBNAIL_TYPE_DEFAULT; } else { - if (params->file_type == FILE_TYPE_MUSIC) + if (params->file_type == FILE_TYPE_MUSIC) { params->thumb_path = g_strdup(MF_ICON_MUSIC_THUMBNAIL); - else + } else { params->thumb_path = g_strdup(MF_ICON_SOUND); + } params->thumbnail_type = MF_THUMBNAIL_TYPE_DEFAULT; } @@ -532,8 +532,8 @@ static Evas_Object *__mf_genlist_gl_default_icon_get_lite(void *data, Evas_Objec bool is_phone_or_mmc = (params->storage_type == MYFILE_PHONE || params->storage_type == MYFILE_MMC); bool is_using_original_image_at_phone_or_mmc = - (params->thumbnail_type == MF_THUMBNAIL_DEFAULT && params->file_type == FILE_TYPE_IMAGE && - is_phone_or_mmc && params->m_ItemName->str); + (params->thumbnail_type == MF_THUMBNAIL_DEFAULT && params->file_type == FILE_TYPE_IMAGE && + is_phone_or_mmc && params->m_ItemName->str); if (params->thumbnail_type == MF_THUMBNAIL_DEFAULT && (is_using_original_image_at_phone_or_mmc == false)) { mf_debug("1"); @@ -545,11 +545,11 @@ static Evas_Object *__mf_genlist_gl_default_icon_get_lite(void *data, Evas_Objec off_t size = 0; int isOriginalImage = (params->m_ItemName->str && params->thumb_path && - strcmp(params->thumb_path, params->m_ItemName->str) == 0); + strcmp(params->thumb_path, params->m_ItemName->str) == 0); if (isOriginalImage == 0) { mf_file_attr_get_file_size(params->thumb_path, &size); - if (size < 4*1024*1024) { + if (size < 4 * 1024 * 1024) { elm_image_file_set(thumb, EDJ_IMAGE, params->thumb_path); //elm_object_part_content_set(layout, "default_thumbnail", thumb); //elm_layout_content_set(layout, "elm.swallow.content", thumb); @@ -570,12 +570,13 @@ static Evas_Object *__mf_genlist_gl_default_icon_get_lite(void *data, Evas_Objec mf_debug("22"); thumb = elm_image_add(obj); elm_image_fill_outside_set(thumb, EINA_TRUE); - if (params->file_type == FILE_TYPE_IMAGE) + if (params->file_type == FILE_TYPE_IMAGE) { elm_image_file_set(thumb, EDJ_IMAGE, MF_ICON_IMAGE); - else if (params->file_type == FILE_TYPE_VIDEO) + } else if (params->file_type == FILE_TYPE_VIDEO) { elm_image_file_set(thumb, EDJ_IMAGE, MF_ICON_VIDEO); - else if (params->thumbnail_type == MF_THUMBNAIL_DEFAULT) + } else if (params->thumbnail_type == MF_THUMBNAIL_DEFAULT) { elm_image_file_set(thumb, EDJ_IMAGE, params->thumb_path); + } elm_image_smooth_set(thumb, EINA_FALSE); elm_image_preload_disabled_set(thumb, EINA_FALSE); //elm_object_part_content_set(layout, "default_thumbnail", thumb); @@ -594,12 +595,12 @@ static Evas_Object *__mf_genlist_gl_default_icon_get_lite(void *data, Evas_Objec mf_debug("51"); //Checking file size, if more than 4M, don't display it, it will be very slow. /*off_t size = 0;//Comment it, for P140606-04570, some times at efl, it will crash at png file. - mf_file_attr_get_file_size(params->m_ItemName->str, &size); - if (size < 4*1024*1024) - elm_image_file_set(thumb, params->m_ItemName->str, NULL);*/ - if (g_is_refresh_at_glist == false) + mf_file_attr_get_file_size(params->m_ItemName->str, &size); + if (size < 4*1024*1024) + elm_image_file_set(thumb, params->m_ItemName->str, NULL);*/ + if (g_is_refresh_at_glist == false) { mf_view_refresh_thumbnail_for_other_memory(ap, ap->mf_FileOperation.file_list); - else { + } else { mf_debug("52"); if (params->pNode && params->pNode->thumbnail_path) {//For supporting the otg thumbnail mf_debug("53"); @@ -611,12 +612,13 @@ static Evas_Object *__mf_genlist_gl_default_icon_get_lite(void *data, Evas_Objec mf_debug("54"); thumb = elm_image_add(obj); elm_image_fill_outside_set(thumb, EINA_TRUE); - if (params->file_type == FILE_TYPE_IMAGE) + if (params->file_type == FILE_TYPE_IMAGE) { elm_image_file_set(thumb, EDJ_IMAGE, MF_ICON_IMAGE); - else if (params->file_type == FILE_TYPE_VIDEO) + } else if (params->file_type == FILE_TYPE_VIDEO) { elm_image_file_set(thumb, EDJ_IMAGE, MF_ICON_VIDEO); - else if (params->thumbnail_type == MF_THUMBNAIL_DEFAULT) + } else if (params->thumbnail_type == MF_THUMBNAIL_DEFAULT) { elm_image_file_set(thumb, EDJ_IMAGE, params->thumb_path); + } elm_image_smooth_set(thumb, EINA_FALSE); elm_image_preload_disabled_set(thumb, EINA_FALSE); //elm_layout_content_set(layout, "elm.swallow.content", thumb); @@ -636,12 +638,13 @@ static Evas_Object *__mf_genlist_gl_default_icon_get_lite(void *data, Evas_Objec Evas_Object *thumb = elm_image_add(obj); elm_image_fill_outside_set(thumb, EINA_TRUE); elm_image_smooth_set(thumb, EINA_FALSE); - if (params->file_type == FILE_TYPE_MUSIC || params->file_type == FILE_TYPE_SOUND) + if (params->file_type == FILE_TYPE_MUSIC || params->file_type == FILE_TYPE_SOUND) { elm_image_file_set(thumb, EDJ_IMAGE, params->thumb_path); - else if (params->thumbnail_type == MF_THUMBNAIL_DEFAULT) + } else if (params->thumbnail_type == MF_THUMBNAIL_DEFAULT) { elm_image_file_set(thumb, EDJ_IMAGE, params->thumb_path); - else + } else { elm_image_file_set(thumb, params->thumb_path, NULL); + } evas_object_show(thumb); return thumb; } @@ -659,13 +662,14 @@ static Evas_Object *__mf_genlist_gl_default_icon_get_lite(void *data, Evas_Objec return layout; } - if(strstr(params->m_ItemName->str, "/.") != NULL) { - if (params->file_type == FILE_TYPE_IMAGE) + if (strstr(params->m_ItemName->str, "/.") != NULL) { + if (params->file_type == FILE_TYPE_IMAGE) { elm_image_file_set(thumb, EDJ_IMAGE, MF_ICON_IMAGE); - else if (params->file_type == FILE_TYPE_VIDEO) + } else if (params->file_type == FILE_TYPE_VIDEO) { elm_image_file_set(thumb, EDJ_IMAGE, MF_ICON_VIDEO); - else if (params->thumbnail_type == MF_THUMBNAIL_DEFAULT) + } else if (params->thumbnail_type == MF_THUMBNAIL_DEFAULT) { elm_image_file_set(thumb, EDJ_IMAGE, params->thumb_path); + } elm_image_smooth_set(thumb, EINA_FALSE); } @@ -678,12 +682,12 @@ static Evas_Object *__mf_genlist_gl_default_icon_get_lite(void *data, Evas_Objec return edit_field; } else if (!strcmp(part, "elm.flip.eraser")) { layout = mf_object_create_button(obj, "editfield_clear", NULL, NULL, - (Evas_Smart_Cb)__genlist_rename_eraser_clicked_cb, params, EINA_FALSE); + (Evas_Smart_Cb)__genlist_rename_eraser_clicked_cb, params, EINA_FALSE); return layout; } else if (!strcmp(part, "elm.flip.icon")) { Evas_Object *cancel_btn = mf_object_create_button(obj, NULL, LABEL_CANCEL, NULL, - (Evas_Smart_Cb)mf_callback_cancel_cb, params->ap, EINA_FALSE); + (Evas_Smart_Cb)mf_callback_cancel_cb, params->ap, EINA_FALSE); evas_object_size_hint_min_set(cancel_btn, ELM_SCALE_SIZE(140), 0); evas_object_show(cancel_btn); evas_object_propagate_events_set(cancel_btn, EINA_FALSE); @@ -717,8 +721,9 @@ void mf_genlist_gl_selected(void *data, Evas_Object *obj, void *event_info) struct appdata *ap = (struct appdata *)data; mf_retm_if(ap == NULL, "ap is NULL"); Elm_Object_Item *item = (Elm_Object_Item *) event_info; - if (item) + if (item) { elm_genlist_item_selected_set(item, FALSE); + } Evas_Object *popup = evas_object_data_get(obj, "popup"); if (popup) { @@ -731,24 +736,25 @@ void mf_genlist_gl_selected(void *data, Evas_Object *obj, void *event_info) elm_genlist_item_selected_set(item, FALSE); if (ap->mf_Status.more == MORE_EDIT_RENAME) { - if (ap->mf_Status.view_type == mf_view_root) + if (ap->mf_Status.view_type == mf_view_root) { return; + } ap->mf_FileOperation.rename_item = item; mf_callback_idle_rename(selected); } else if (ap->mf_Status.more == MORE_RENAME) { mf_callback_rename_save_cb(ap, NULL, NULL); return; - } else if (ap->mf_Status.more != MORE_EDIT - && ap->mf_Status.more != MORE_SHARE_EDIT - && ap->mf_Status.more != MORE_EDIT_COPY - && ap->mf_Status.more != MORE_EDIT_MOVE - && ap->mf_Status.more != MORE_EDIT_DETAIL - && ap->mf_Status.more != MORE_EDIT_DELETE - && ap->mf_Status.more != MORE_EDIT_DELETE_RECENT - ) { + } else if (ap->mf_Status.more != MORE_EDIT + && ap->mf_Status.more != MORE_SHARE_EDIT + && ap->mf_Status.more != MORE_EDIT_COPY + && ap->mf_Status.more != MORE_EDIT_MOVE + && ap->mf_Status.more != MORE_EDIT_DETAIL + && ap->mf_Status.more != MORE_EDIT_DELETE + && ap->mf_Status.more != MORE_EDIT_DELETE_RECENT + ) { if (selected->storage_type == MYFILE_PHONE - || selected->storage_type == MYFILE_MMC - ) { + || selected->storage_type == MYFILE_MMC + ) { if (!mf_file_exists(selected->m_ItemName->str)) { mf_popup_indicator_popup(NULL, mf_util_get_text(MF_LABEL_FILE_NOT_EXIST)); elm_object_item_del(selected->item); @@ -800,7 +806,7 @@ static char *__mf_genlist_widget_storage_label_get(void *data, Evas_Object *obj, mf_retv_if(pStorage == NULL, NULL); if (!strcmp(part, "elm.text.main.left")) { - mf_debug("%s ",pStorage->root_name); + mf_debug("%s ", pStorage->root_name); return elm_entry_utf8_to_markup(pStorage->root_name); } else if (!strcmp(part, "elm.text.sub")) { char storage_size[256]; @@ -820,16 +826,15 @@ void mf_genlist_cloud_content_set(void *data, Evas_Object *genlist, Eina_List *f mf_retm_if(genlist == NULL, "genlist is NULL"); mf_retm_if(file_list == NULL, "file_list is NULL"); - EINA_LIST_FOREACH(file_list, list, item) - { + EINA_LIST_FOREACH(file_list, list, item) { Elm_Object_Item *node_item = NULL; Elm_Genlist_Item_Class *itc_cloud = NULL; itc_cloud = elm_genlist_item_class_new(); if (itc_cloud != NULL) { - itc_cloud->item_style= "1line"; + itc_cloud->item_style = "1line"; itc_cloud->func.text_get = __mf_genlist_widget_storage_label_get; itc_cloud->func.content_get = __mf_genlist_widget_storage_content_get; - node_item = elm_genlist_item_append(genlist, itc_cloud, item, NULL,ELM_GENLIST_ITEM_NONE, __mf_genlist_widget_storage_selected_cb, ap); + node_item = elm_genlist_item_append(genlist, itc_cloud, item, NULL, ELM_GENLIST_ITEM_NONE, __mf_genlist_widget_storage_selected_cb, ap); elm_object_item_data_set(node_item, item); } } @@ -843,8 +848,9 @@ void mf_genlist_create_itc_style(Elm_Genlist_Item_Class **itc, int itc_type) if (*itc == NULL) { mf_error("new item class ==================== itc_type is [%d]", itc_type); *itc = elm_genlist_item_class_new(); - if (*itc == NULL) + if (*itc == NULL) { return; + } } int view_style = mf_view_style_get(ap); mf_debug("itc type : %d, view style : %d", itc_type, view_style); @@ -859,7 +865,7 @@ void mf_genlist_create_itc_style(Elm_Genlist_Item_Class **itc, int itc_type) case mf_item_itc_type_recent: if (view_style == MF_VIEW_SYTLE_LIST_DETAIL) { (*itc)->item_style = "myfile_2line.top.3"; - }else{ + } else { (*itc)->item_style = "myfile_1line"; } (*itc)->func.text_get = __mf_genlist_gl_label_get_lite; @@ -936,7 +942,7 @@ void mf_genlist_set_folder_edit_style(void *data) } void mf_genlist_create_list_default_style(Evas_Object *pGenlist, void *data, Eina_List *dir_list, - Eina_List *file_list) + Eina_List *file_list) { MF_TRACE_BEGIN; /*0. variable definition and parameter check*/ @@ -1011,7 +1017,7 @@ void mf_genlist_gl_lang_changed(void *data, Evas_Object *obj, void *event_info) elm_genlist_realized_items_update(obj); } -Evas_Object *mf_genlist_create_list(void *data,Evas_Object *parent) +Evas_Object *mf_genlist_create_list(void *data, Evas_Object *parent) { MF_TRACE_BEGIN; t_start; @@ -1117,8 +1123,9 @@ void mf_genlist_clear(Evas_Object *genlist) static void _index_clicked(void *data, Evas_Object *obj, const char *em, const char *src) { - if (!obj) + if (!obj) { return; + } mf_error(" >>>>>>>>>>>>>> obj is [%p]", obj); elm_object_signal_emit(obj, "elm,state,slide,start", ""); } @@ -1127,10 +1134,9 @@ void mf_genlist_path_item_cb(void *data, Evas_Object * obj, void *event_info) { struct appdata *ap = mf_get_appdata(); if (!(ap->mf_Status.more == MORE_DEFAULT - || ap->mf_Status.more == MORE_INTERNAL_COPY - || ap->mf_Status.more == MORE_INTERNAL_MOVE - )) - { + || ap->mf_Status.more == MORE_INTERNAL_COPY + || ap->mf_Status.more == MORE_INTERNAL_MOVE + )) { return; } char *fullpath = (char *)data; @@ -1145,8 +1151,7 @@ void mf_genlist_path_item_cb(void *data, Evas_Object * obj, void *event_info) if (g_strcmp0(ap->mf_Status.path->str, fullpath) == 0) { mf_error("The same folder selected"); return; - } - else { + } else { if (!mf_file_exists(fullpath)) { SAFE_FREE_GSTRING(ap->mf_Status.path); ap->mf_Status.path = g_string_new(PHONE_FOLDER); @@ -1183,9 +1188,9 @@ Evas_Object *mf_genlist_create_path_tab(Evas_Object *parent, char *info, void *d if (ap->mf_Status.view_type == mf_view_storage) { label = MF_LABEL_LOCAL_STORAGE; } else if (ap->mf_Status.view_type == mf_view_recent && ap->mf_Status.more == MORE_DEFAULT) { - label = MF_LABEL_RECTENT_FILES; + label = MF_LABEL_RECTENT_FILES; } else if (ap->mf_Status.view_type == mf_view_root_category && ap->mf_Status.categorytitle && ap->mf_Status.more == MORE_DEFAULT) { - label = ap->mf_Status.categorytitle; + label = ap->mf_Status.categorytitle; } else { switch (location) { case MYFILE_PHONE: @@ -1302,13 +1307,13 @@ static int __mf_model_utils_read_dir(const char *dir_path, Eina_List **dir_list, struct dirent *ent = NULL; while ((readdir_r(pDir, &ent_struct, &ent) == 0) && ent) { int skip = ((strncmp(ent->d_name, ".", 1) == 0) || - (strncmp(ent->d_name, "..", 2) == 0)); + (strncmp(ent->d_name, "..", 2) == 0)); skip = skip || ((ent->d_type != DT_DIR) && (ent->d_type != DT_REG)); skip = skip || ((ent->d_type == DT_DIR) && - (strcmp(dir_path, PHONE_FOLDER) == 0) && - (strcmp(ent->d_name, DEBUG_FOLDER) == 0)); + (strcmp(dir_path, PHONE_FOLDER) == 0) && + (strcmp(ent->d_name, DEBUG_FOLDER) == 0)); node_info *const pNode = skip ? NULL : calloc(1, sizeof(node_info)); if (pNode) { @@ -1384,8 +1389,7 @@ storage_type __mf_genlist_cloud_is_root_path(const char *fullpath, Eina_List *st Eina_List *list = NULL; void *item = NULL; - EINA_LIST_FOREACH(storage_list, list, item) - { + EINA_LIST_FOREACH(storage_list, list, item) { storage_info *info = item; if ((info->type != STORAGE_TYPE_LABEL) && (!strcmp(info->root_path, fullpath))) { return info->type; @@ -1438,15 +1442,15 @@ static void __mf_genlist_widget_storage_selected_cb(void *data, Evas_Object *obj char *title = __mf_genlist_cloud_title_get(cloud_data->curr_path, ap->storage_list); if (ap->mf_Status.pPreNaviItem) { ap->mf_MainWindow.pNaviItem = elm_naviframe_item_insert_after(ap->mf_MainWindow.pNaviBar, - ap->mf_Status.pPreNaviItem, - "", NULL, NULL, - cloud_data->navi_layout, - MF_NAVI_STYLE_ENABLE); + ap->mf_Status.pPreNaviItem, + "", NULL, NULL, + cloud_data->navi_layout, + MF_NAVI_STYLE_ENABLE); } else { ap->mf_MainWindow.pNaviItem = elm_naviframe_item_push(ap->mf_MainWindow.pNaviBar, - title, NULL, NULL, - cloud_data->navi_layout, - MF_NAVI_STYLE_ENABLE); + title, NULL, NULL, + cloud_data->navi_layout, + MF_NAVI_STYLE_ENABLE); } mf_navi_add_back_button(ap, mf_callback_navi_backbutton_clicked_cb); free(title); @@ -1457,7 +1461,7 @@ static char *__mf_genlist_widget_cloud_item_label_get(void *data, Evas_Object *o node_info *pNode = (node_info *)data; if (!strcmp(part, "elm.text.main.left")) { - mf_debug("%s ",pNode->name); + mf_debug("%s ", pNode->name); return elm_entry_utf8_to_markup(pNode->name); } else { return NULL; @@ -1469,16 +1473,15 @@ void mf_genlist_cloud_item_content_set(void *data, Evas_Object *genlist, Eina_Li const Eina_List *list = NULL; void *item = NULL; - EINA_LIST_FOREACH(file_list, list, item) - { + EINA_LIST_FOREACH(file_list, list, item) { Elm_Object_Item *node_item; Elm_Genlist_Item_Class *itc_cloud; itc_cloud = elm_genlist_item_class_new(); if (itc_cloud != NULL) { - itc_cloud->item_style= "1line"; + itc_cloud->item_style = "1line"; itc_cloud->func.text_get = __mf_genlist_widget_cloud_item_label_get; itc_cloud->func.content_get = __mf_genlist_widget_cloud_item_content_get; - node_item = elm_genlist_item_append(genlist, itc_cloud, item, NULL,ELM_GENLIST_ITEM_NONE, NULL, NULL); + node_item = elm_genlist_item_append(genlist, itc_cloud, item, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); elm_object_item_data_set(node_item, item); } } diff --git a/src/widget/mf-navi-bar.c b/src/widget/mf-navi-bar.c index 778df5c..a683c22 100755 --- a/src/widget/mf-navi-bar.c +++ b/src/widget/mf-navi-bar.c @@ -195,8 +195,8 @@ Evas_Object *mf_navi_bar_create_view_content(void *data) _mf_navi_bar_create_content_set_focus(ap, pContent); if (ap->mf_Status.more == MORE_DEFAULT - || ap->mf_Status.more == MORE_INTERNAL_COPY - || ap->mf_Status.more == MORE_INTERNAL_MOVE) { + || ap->mf_Status.more == MORE_INTERNAL_COPY + || ap->mf_Status.more == MORE_INTERNAL_MOVE) { mf_fs_monitor_add_dir_watch(ap->mf_Status.path->str, ap); } t_end; @@ -251,7 +251,7 @@ void mf_navi_bar_set_content(void *data, Evas_Object *pLayout, Evas_Object *Navi struct appdata *ap = (struct appdata *)data; mf_navi_bar_clean_content(data, pLayout); - + ap->mf_MainWindow.pNaviBox = mf_object_create_box(ap->mf_MainWindow.pNaviLayout); mf_navi_bar_layout_content_set(ap->mf_MainWindow.pNaviLayout, ap->mf_MainWindow.pNaviBox); @@ -281,12 +281,12 @@ Evas_Object *mf_navi_bar_home_button_create(Evas_Object *parent, Evas_Smart_Cb f evas_object_show(home_ic); Evas_Object *home_btn = mf_object_create_button(parent, - "naviframe/title_icon", - NULL, - home_ic, - func, - user_data, - EINA_FALSE); + "naviframe/title_icon", + NULL, + home_ic, + func, + user_data, + EINA_FALSE); return home_btn; } @@ -297,14 +297,14 @@ Evas_Object *mf_navi_bar_search_button_create(Evas_Object *parent, Evas_Smart_Cb elm_image_file_set(image, EDJ_IMAGE, MF_TITLE_ICON_SEARCH); elm_image_resizable_set(image, EINA_TRUE, EINA_TRUE); evas_object_show(image); - + Evas_Object *up_btn = mf_object_create_button(parent, - "naviframe/title_icon", - NULL, - image, - func, - user_data, - EINA_FALSE); + "naviframe/title_icon", + NULL, + image, + func, + user_data, + EINA_FALSE); return up_btn; } @@ -317,12 +317,12 @@ Evas_Object *mf_navi_bar_upper_button_create(Evas_Object *parent, Evas_Smart_Cb evas_object_show(up_ic); Evas_Object *up_btn = mf_object_create_button(parent, - "naviframe/title_icon", - NULL, - up_ic, - func, - user_data, - EINA_FALSE); + "naviframe/title_icon", + NULL, + up_ic, + func, + user_data, + EINA_FALSE); return up_btn; } @@ -334,12 +334,12 @@ Evas_Object *mf_navi_bar_select_all_button_create(Evas_Object *parent, Evas_Smar evas_object_show(select_ic); Evas_Object *select_btn = mf_object_create_button(parent, - "naviframe/title_icon", - NULL, - select_ic, - func, - user_data, - EINA_FALSE); + "naviframe/title_icon", + NULL, + select_ic, + func, + user_data, + EINA_FALSE); return select_btn; } @@ -372,13 +372,13 @@ void mf_navi_bar_title_set(void *data) char *title = NULL; if (ap->mf_Status.more == MORE_SEARCH - || ap->mf_Status.more == MORE_EDIT - || ap->mf_Status.more == MORE_SHARE_EDIT - || ap->mf_Status.more == MORE_EDIT_DETAIL - || ap->mf_Status.more == MORE_EDIT_COPY - || ap->mf_Status.more == MORE_EDIT_MOVE - || ap->mf_Status.more == MORE_EDIT_DELETE - || ap->mf_Status.more == MORE_EDIT_DELETE_RECENT + || ap->mf_Status.more == MORE_EDIT + || ap->mf_Status.more == MORE_SHARE_EDIT + || ap->mf_Status.more == MORE_EDIT_DETAIL + || ap->mf_Status.more == MORE_EDIT_COPY + || ap->mf_Status.more == MORE_EDIT_MOVE + || ap->mf_Status.more == MORE_EDIT_DELETE + || ap->mf_Status.more == MORE_EDIT_DELETE_RECENT ) { if (more == MORE_EDIT) { title = MF_LABEL_SELECT_ITEMS; @@ -414,13 +414,13 @@ void mf_navi_bar_title_set(void *data) elm_object_item_part_content_set(navi_it, TITLE_RIGHT_BTN, search_btn); } } else if (ap->mf_Status.view_type == mf_view_root && more == MORE_DEFAULT) { - Evas_Object *search_btn = mf_navi_bar_search_button_create(pNavi, mf_search_bar_enter_search_routine, ap); - unset = elm_object_item_part_content_unset(navi_it, TITLE_RIGHT_BTN); - SAFE_FREE_OBJ(unset); - elm_object_item_part_content_set(navi_it, TITLE_RIGHT_BTN, search_btn); + Evas_Object *search_btn = mf_navi_bar_search_button_create(pNavi, mf_search_bar_enter_search_routine, ap); + unset = elm_object_item_part_content_unset(navi_it, TITLE_RIGHT_BTN); + SAFE_FREE_OBJ(unset); + elm_object_item_part_content_set(navi_it, TITLE_RIGHT_BTN, search_btn); } if ((ap->mf_Status.view_type == mf_view_root_category) && (ap->mf_Status.categorytitle != NULL)) { - mf_error("ap->mf_Status.categorytitle = %s",ap->mf_Status.categorytitle); + mf_error("ap->mf_Status.categorytitle = %s", ap->mf_Status.categorytitle); title = ap->mf_Status.categorytitle ; Evas_Object *search_btn = mf_navi_bar_search_button_create(pNavi, mf_search_bar_enter_search_routine, ap); unset = elm_object_item_part_content_unset(navi_it, TITLE_RIGHT_BTN); @@ -467,7 +467,7 @@ Evas_Object *__mf_navi_bar_backbutton_create(Evas_Object *parent, Evas_Object *w return btn; } -void mf_navi_add_back_button(void *data, Eina_Bool (*func)(void *data, Elm_Object_Item *it)) +void mf_navi_add_back_button(void *data, Eina_Bool(*func)(void *data, Elm_Object_Item *it)) { MF_TRACE_BEGIN; mf_retm_if(data == NULL, "data is NULL"); @@ -533,7 +533,7 @@ void mf_navi_bar_set_ctrlbar(void *data) //toolbar = mf_object_toolbar_create(ap->mf_MainWindow.pNaviBar); //mf_object_item_tabbar_item_append(toolbar, NULL, LABEL_CANCEL, mf_callback_cancel_cb, ap); //mf_object_item_tabbar_item_append(toolbar, NULL, LABEL_SHARE, mf_callback_share_cb, ap); - break; + break; case MORE_INTERNAL_DECOMPRESS: if (ap->mf_Status.view_type != mf_view_root) { @@ -542,7 +542,7 @@ void mf_navi_bar_set_ctrlbar(void *data) //mf_object_item_tabbar_item_append(toolbar, NULL, LABEL_CANCEL, mf_callback_cancel_cb, ap); //mf_object_item_tabbar_item_append(toolbar, NULL, MF_LABEL_DECOMPRESS_HERE, mf_callback_decompress_here_cb, ap); } - break; + break; default: break; } @@ -551,12 +551,12 @@ void mf_navi_bar_set_ctrlbar(void *data) evas_object_event_callback_add(more_bt, EVAS_CALLBACK_KEY_DOWN, mf_callback_more_keydown_cb, ap); } //Prevent issue fix -/* if (toolbar) { - ap->mf_MainWindow.pNaviCtrlBar = toolbar; - elm_object_item_part_content_set(navi_it, NAVI_CTRL_PART, toolbar); - - elm_object_focus_allow_set(ap->mf_MainWindow.pNaviCtrlBar, EINA_TRUE); - }*/ + /* if (toolbar) { + ap->mf_MainWindow.pNaviCtrlBar = toolbar; + elm_object_item_part_content_set(navi_it, NAVI_CTRL_PART, toolbar); + + elm_object_focus_allow_set(ap->mf_MainWindow.pNaviCtrlBar, EINA_TRUE); + }*/ elm_object_item_signal_callback_add(navi_it, "elm,action,more_event", "", mf_callback_hardkey_more_cb, ap); t_end; MF_TRACE_END; @@ -727,7 +727,8 @@ void mf_navi_bar_reset(void *data) void my_elm_object_item_disabled_set(Evas_Object *ctrlbar, Elm_Object_Item *it, Eina_Bool disabled) -{//Fixed P131025-04748 by jian12.li. +{ + //Fixed P131025-04748 by jian12.li. MF_TRACE_BEGIN; const char *button_label = elm_object_item_part_text_get(it, NAVI_CTRL_TEXT_PART); mf_error("my_elm_object_item_disabled_set button_label is [%s]", button_label); @@ -736,7 +737,7 @@ my_elm_object_item_disabled_set(Evas_Object *ctrlbar, Elm_Object_Item *it, Eina_ elm_object_focus_allow_set(ctrlbar, false); //elm_object_focus_allow_set(it, false); } - MF_TRACE_END; + MF_TRACE_END; } void mf_navi_bar_set_ctrlbar_item_disable(Elm_Object_Item *navi_it, int disable_item, bool disable) @@ -876,8 +877,8 @@ Evas_Object *mf_navi_bar_content_create(void *data) } } if (ap->mf_Status.more == MORE_DEFAULT - || ap->mf_Status.more == MORE_INTERNAL_COPY - || ap->mf_Status.more == MORE_INTERNAL_MOVE) { + || ap->mf_Status.more == MORE_INTERNAL_COPY + || ap->mf_Status.more == MORE_INTERNAL_MOVE) { mf_fs_monitor_add_dir_watch(ap->mf_Status.path->str, ap); } t_end; @@ -887,7 +888,7 @@ Evas_Object *mf_navi_bar_content_create(void *data) } Evas_Object *mf_naviframe_left_cancel_button_create(Evas_Object *pParent, Elm_Object_Item *pNaviItem, - Evas_Smart_Cb pFunc, void *pUserData) + Evas_Smart_Cb pFunc, void *pUserData) { Evas_Object *btn = elm_button_add(pParent); elm_object_style_set(btn, "naviframe/title_left"); @@ -901,7 +902,7 @@ Evas_Object *mf_naviframe_left_cancel_button_create(Evas_Object *pParent, Elm_Ob } Evas_Object *mf_naviframe_right_save_button_create(Evas_Object *pParent, Elm_Object_Item *pNaviItem, - Evas_Smart_Cb pFunc, void *pUserData) + Evas_Smart_Cb pFunc, void *pUserData) { struct appdata *ap = (struct appdata *)pUserData; Evas_Object *btn = elm_button_add(pParent); diff --git a/src/widget/mf-normal-view.c b/src/widget/mf-normal-view.c index ec8eaa5..ac83417 100755 --- a/src/widget/mf-normal-view.c +++ b/src/widget/mf-normal-view.c @@ -172,9 +172,8 @@ void mf_normal_view_create(void *data) } else if (ap->mf_Status.more == MORE_EDIT_RENAME) { elm_naviframe_item_title_enabled_set(ap->mf_MainWindow.pNaviItem, EINA_TRUE, EINA_FALSE); mf_navi_bar_title_content_set(ap, LABEL_RENAME); - } - else { - mf_navi_bar_title_content_set(ap,ap->mf_MainWindow.naviframe_title); + } else { + mf_navi_bar_title_content_set(ap, ap->mf_MainWindow.naviframe_title); elm_naviframe_item_title_enabled_set(ap->mf_MainWindow.pNaviItem, EINA_TRUE, EINA_TRUE); } //mf_navi_bar_title_set(ap); diff --git a/src/widget/mf-object-item.c b/src/widget/mf-object-item.c index 5328537..38ab239 100755 --- a/src/widget/mf-object-item.c +++ b/src/widget/mf-object-item.c @@ -33,10 +33,11 @@ void mf_object_item_text_set(Elm_Object_Item *item, const char *ID, const char * mf_retm_if(item == NULL, "item is NULL"); const char *domain; - if (strstr(ID, "IDS_COM")) + if (strstr(ID, "IDS_COM")) { domain = PKGNAME_SYSTEM; - else - domain = NULL;//PKGNAME_MYFILE; + } else { + domain = NULL; //PKGNAME_MYFILE; + } elm_object_item_domain_translatable_part_text_set(item, part, domain, ID); MF_TRACE_END; } @@ -47,20 +48,21 @@ void mf_object_item_translate_set(Elm_Object_Item *item, const char *ID) mf_retm_if(item == NULL, "item is NULL"); const char *domain; - if (strstr(ID, "IDS_COM")) + if (strstr(ID, "IDS_COM")) { domain = PKGNAME_SYSTEM; - else + } else { domain = NULL; + } SECURE_DEBUG(">>>>>>>>>>>>>>> ID is [%s] domain is [%s]", ID, domain); elm_object_item_domain_text_translatable_set(item, domain, EINA_TRUE); } Elm_Object_Item *mf_object_item_tabbar_item_append(Evas_Object *obj, - const char *icon, - const char *label, - Evas_Smart_Cb func, - const void *data) + const char *icon, + const char *label, + Evas_Smart_Cb func, + const void *data) { Elm_Object_Item *item = elm_toolbar_item_append(obj, icon, label, func, data); @@ -79,8 +81,9 @@ void mf_object_item_tabbar_item_set_disable(Evas_Object *obj, const char *label, while (item) { button_label = elm_object_item_part_text_get(item, NAVI_CTRL_TEXT_PART); if (g_strcmp0(button_label, mf_util_get_text(label)) == 0 - || g_strcmp0(button_label, (label)) == 0) + || g_strcmp0(button_label, (label)) == 0) { elm_object_item_disabled_set(item, disable); + } button_label = NULL; item = elm_toolbar_item_next_get(item); } @@ -138,10 +141,10 @@ mfItemData_s *mf_object_item_normal_data_get(const char *fullpath, void *user_da } Elm_Object_Item *mf_object_list_item_append(Evas_Object *parent, - void *obj_data, - void (*func)(void *data, Evas_Object * obj, void *event_info), - void *func_data, - void *user_data) + void *obj_data, + void (*func)(void *data, Evas_Object * obj, void *event_info), + void *func_data, + void *user_data) { MF_TRACE_BEGIN; mf_retvm_if(parent == NULL, NULL, "parent error"); @@ -171,12 +174,12 @@ Elm_Object_Item *mf_object_list_item_append(Evas_Object *parent, } else { Elm_Gengrid_Item_Class *gitc = NULL; //Prevent issue fix - gitc = &gic; - /* if (ap->mf_Status.view_type == mf_view_root_category) { - gitc = &gic; - } else { - gitc = &gic; - }*/ + gitc = &gic; + /* if (ap->mf_Status.view_type == mf_view_root_category) { + gitc = &gic; + } else { + gitc = &gic; + }*/ it = elm_genlist_item_append(parent, gitc, obj_data, NULL, ELM_GENLIST_ITEM_NONE, func, func_data); } @@ -189,7 +192,7 @@ Elm_Object_Item *mf_object_item_genlist_x_y_item_get(Evas_Object *genlist, int x if (genlist) { int posret = 0; - it =elm_genlist_at_xy_item_get(genlist, x, y, &posret); + it = elm_genlist_at_xy_item_get(genlist, x, y, &posret); } return it; } diff --git a/src/widget/mf-object.c b/src/widget/mf-object.c index 9d9fd8d..36d0a5d 100755 --- a/src/widget/mf-object.c +++ b/src/widget/mf-object.c @@ -302,13 +302,14 @@ Evas_Object *mf_object_unset_part_content(Evas_Object *parent, const char *part) } Evas_Object *mf_object_create_button(Evas_Object *parent, const char *style, - const char *caption, Evas_Object *icon, - Evas_Smart_Cb func, - void *data, - Eina_Bool flag_propagate) + const char *caption, Evas_Object *icon, + Evas_Smart_Cb func, + void *data, + Eina_Bool flag_propagate) { - if (!parent) + if (!parent) { return NULL; + } Evas_Object *btn; @@ -322,8 +323,9 @@ Evas_Object *mf_object_create_button(Evas_Object *parent, const char *style, mf_object_text_set(btn, caption, NULL); } - if (icon) + if (icon) { elm_object_content_set(btn, icon); + } evas_object_propagate_events_set(btn, flag_propagate); @@ -399,16 +401,17 @@ void mf_object_text_set(Evas_Object *obj, const char *ID, const char *part) mf_retm_if(obj == NULL, "obj is NULL"); const char *domain; - if (strstr(ID, "IDS_COM")) + if (strstr(ID, "IDS_COM")) { domain = PKGNAME_SYSTEM; - else - domain = NULL;//PKGNAME_MYFILE; + } else { + domain = NULL; //PKGNAME_MYFILE; + } elm_object_domain_translatable_part_text_set(obj, part, domain, ID); //elm_object_domain_part_text_translatable_set(obj, part, domain, EINA_TRUE); } -Evas_Object *mf_object_create_select_all_btn(Evas_Object *parent,void *data) +Evas_Object *mf_object_create_select_all_btn(Evas_Object *parent, void *data) { mf_retvm_if(parent == NULL, NULL, "parent is NULL"); @@ -457,7 +460,7 @@ Evas_Object *mf_object_create_box(Evas_Object *parent) } void mf_object_create_select_all_layout(Evas_Object *pParent, Evas_Smart_Cb pChangeFunc, - Evas_Object_Event_Cb pMouseDownFunc, void *pUserData, Evas_Object **pCheckBox, Evas_Object **pSelectLayout) + Evas_Object_Event_Cb pMouseDownFunc, void *pUserData, Evas_Object **pCheckBox, Evas_Object **pSelectLayout) { Evas_Object *pSelectAllLayout = elm_layout_add(pParent); //elm_layout_theme_set(pSelectAllLayout, "genlist", "item", "select_all/default"); diff --git a/src/widget/mf-popup.c b/src/widget/mf-popup.c index 959a4ce..f6e4cc7 100755 --- a/src/widget/mf-popup.c +++ b/src/widget/mf-popup.c @@ -110,8 +110,9 @@ void mf_popup_ok_button_set(Evas_Object *obj) void mf_popup_entry_string_set(char *string) { SAFE_FREE_CHAR(entry_string); - if (string) + if (string) { entry_string = g_strdup(string); + } } char *mf_popup_entry_string_get() @@ -206,14 +207,15 @@ static char *__mf_popup_view_as_genlist_label_get(void *data, Evas_Object * obj, } static void __gl_popup_viewby_radio_smart_cb(void *data, - Evas_Object *obj, - void *vi) + Evas_Object *obj, + void *vi) { MF_TRACE_BEGIN; mf_debug("radio show has finished by smart callback."); ListByData_s *params = (ListByData_s *) data; - if (params == NULL) + if (params == NULL) { return; + } __mf_popup_view_as_genlist_change(params); MF_TRACE_END; } @@ -223,8 +225,9 @@ static void __gl_popup_viewby_radio_signal_cb(void *data, Evas_Object *obj, cons MF_TRACE_BEGIN; mf_debug("radio show has finished by signal callback."); ListByData_s *params = (ListByData_s *) data; - if (params == NULL) + if (params == NULL) { return; + } __mf_popup_view_as_genlist_change(params); MF_TRACE_END; } @@ -250,7 +253,7 @@ static Evas_Object *__mf_popup_view_as_genlist_icon_get(void *data, Evas_Object evas_object_smart_callback_add(radio, "changed", __gl_popup_viewby_radio_smart_cb, params); elm_object_signal_callback_add(radio, "elm,action,radio,toggle", "", - __gl_popup_viewby_radio_signal_cb, params); + __gl_popup_viewby_radio_signal_cb, params); evas_object_show(radio); return radio; } @@ -421,10 +424,10 @@ static void __mf_popup_progress_del_cb(void *data, Evas *e, Evas_Object *obj, vo struct appdata *ap = (struct appdata *)data; if (ap->mf_Status.more == MORE_SEARCH || - (ap->mf_Status.view_type == mf_view_root_category && ap->mf_Status.more != MORE_SEARCH)) { - if (ap->mf_Status.flagSearchStart) { + (ap->mf_Status.view_type == mf_view_root_category && ap->mf_Status.more != MORE_SEARCH)) { + if (ap->mf_Status.flagSearchStart) { //mf_search_bar_stop(ap); - } + } } if (mf_progress_bar_timer != NULL) { ecore_timer_del(mf_progress_bar_timer); @@ -457,7 +460,7 @@ static void __mf_popup_normal_del_cb(void *data, Evas *e, Evas_Object *obj, void SAFE_FREE_OBJ(ap->mf_MainWindow.pNormalPopup); } if (ap->mf_MainWindow.pPopupBox) { - SAFE_FREE_OBJ(ap->mf_MainWindow.pPopupBox); + SAFE_FREE_OBJ(ap->mf_MainWindow.pPopupBox); } if (ap->mf_MainWindow.pDeleteConfirmPopup) { SAFE_FREE_OBJ(ap->mf_MainWindow.pDeleteConfirmPopup); @@ -631,13 +634,13 @@ Evas_Object *mf_popup_entry_create(Evas_Object *parent) eext_entry_selection_back_event_allow_set(en, EINA_TRUE); elm_entry_scrollable_set(en, EINA_TRUE); elm_scroller_policy_set(en, ELM_SCROLLER_POLICY_OFF, - ELM_SCROLLER_POLICY_AUTO); + ELM_SCROLLER_POLICY_AUTO); elm_object_signal_emit(en, "elm,action,hide,search_icon", ""); elm_object_part_text_set(en, "elm.guide", ""); elm_entry_single_line_set(en, EINA_TRUE); evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); + EVAS_HINT_EXPAND); evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_entry_prediction_allow_set(en, EINA_FALSE); evas_object_show(en); @@ -814,20 +817,20 @@ Evas_Object *mf_popup_create_rename_popup(void *data, char *context) elm_object_signal_emit(en, "elm,action,hide,search_icon", ""); Evas_Object *btn1 = mf_object_create_button(popup, - NULL, //"popup_button/default", - LABEL_CANCEL, - NULL, - (Evas_Smart_Cb)rename_cancel_cb, - rename_cancel_params, - EINA_FALSE); + NULL, //"popup_button/default", + LABEL_CANCEL, + NULL, + (Evas_Smart_Cb)rename_cancel_cb, + rename_cancel_params, + EINA_FALSE); Evas_Object *btn2 = mf_object_create_button(popup, - NULL, //"popup_button/default", - LABEL_RENAME,//Change MF_LABEL_DONE to MF_BUTTON_LABEL_OK for fixing(P131029-02752). - NULL, - (Evas_Smart_Cb)mf_callback_rename_save_cb, - rename_save_params, - EINA_FALSE); + NULL, //"popup_button/default", + LABEL_RENAME,//Change MF_LABEL_DONE to MF_BUTTON_LABEL_OK for fixing(P131029-02752). + NULL, + (Evas_Smart_Cb)mf_callback_rename_save_cb, + rename_save_params, + EINA_FALSE); ok_button = btn2; elm_object_part_content_set(popup, "button1", btn1); @@ -856,8 +859,8 @@ Evas_Object *mf_popup_create_new_folder_popup(void *data, char *context) popup = elm_popup_add(ap->mf_MainWindow.pMainLayout); elm_object_signal_emit(popup, "elm,action,center_popup,entry", ""); - Evas_Object *layout = mf_popup_entry_layout_create(popup); - elm_object_content_set(popup, layout); + Evas_Object *layout = mf_popup_entry_layout_create(popup); + elm_object_content_set(popup, layout); Evas_Object *en = NULL; en = mf_popup_entry_create(layout); @@ -878,26 +881,26 @@ Evas_Object *mf_popup_create_new_folder_popup(void *data, char *context) elm_entry_input_panel_return_key_type_set(en, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE); Evas_Object *btn1 = mf_object_create_button(popup, - NULL, //"popup_button/default", - LABEL_CANCEL, - NULL, - (Evas_Smart_Cb)__mf_popup_new_folder_cancel_cb, - ap, - EINA_FALSE); + NULL, //"popup_button/default", + LABEL_CANCEL, + NULL, + (Evas_Smart_Cb)__mf_popup_new_folder_cancel_cb, + ap, + EINA_FALSE); Evas_Object *btn2 = mf_object_create_button(popup, - NULL, //"popup_button/default", - MF_LABEL_CREATE,//Change MF_LABEL_DONE to MF_BUTTON_LABEL_OK for fixing(P131029-02752). - NULL, - (Evas_Smart_Cb)mf_callback_new_folder_save_cb, - ap, - EINA_FALSE); + NULL, //"popup_button/default", + MF_LABEL_CREATE,//Change MF_LABEL_DONE to MF_BUTTON_LABEL_OK for fixing(P131029-02752). + NULL, + (Evas_Smart_Cb)mf_callback_new_folder_save_cb, + ap, + EINA_FALSE); ok_button = btn2; elm_object_part_content_set(popup, "button1", btn1); elm_object_part_content_set(popup, "button2", btn2); mf_object_text_set(popup, context, "title,text"); - elm_object_part_content_set(layout,"elm.swallow.content", en); + elm_object_part_content_set(layout, "elm.swallow.content", en); evas_object_show(popup); evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, mf_popup_new_folder_del_cb, ap); @@ -931,11 +934,11 @@ progressbar_timer_cb(void *data) }*/ Evas_Object *mf_popup_center_processing(void *data, - const char *context, - const char *first_btn_text, - Evas_Smart_Cb func, - void *param, - Eina_Bool flag_backwork) + const char *context, + const char *first_btn_text, + Evas_Smart_Cb func, + void *param, + Eina_Bool flag_backwork) { mf_error("=================================="); Evas_Object *popup; @@ -1011,64 +1014,64 @@ Evas_Object *mf_popup_center_processing(void *data, } Evas_Object *mf_popup_text(void *data, - const char *context, Evas_Object_Event_Cb func, - void *param) -{ - mf_error("=================================="); - Evas_Object *popup; - struct appdata *ap; - - ap = (struct appdata *) data; - popup = elm_popup_add(ap->mf_MainWindow.pMainLayout); - - Evas_Object *box = elm_box_add(popup); - elm_box_horizontal_set(box, EINA_TRUE); - evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_box_align_set(box, 0.5, 0.5); - elm_box_padding_set(box, 16, 0); - - // [UI] progress icon - Evas_Object *progressbar = elm_progressbar_add(popup); - elm_object_style_set(progressbar, "process_large");/* "toolbar_process" or "pending_list" or "list_prosess" */ - //evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.5); - //evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_progressbar_pulse(progressbar, EINA_TRUE); - evas_object_show(progressbar); - elm_box_pack_end(box, progressbar); - - // [UI] text - Evas_Object *label = elm_label_add(popup); - //elm_object_text_set(label, context);/* "Loading..." */ - mf_object_text_set(label, context, NULL); - evas_object_show(label); - elm_box_pack_end(box, label); - - - // [UI] add table - Evas_Object *table = elm_table_add(popup); - evas_object_show(table); - elm_table_homogeneous_set(table, EINA_FALSE); - - Evas_Object *rect_up;// rect as a padding - rect_up = evas_object_rectangle_add(evas_object_evas_get(popup)); - evas_object_size_hint_min_set(rect_up, ELM_SCALE_SIZE(100), ELM_SCALE_SIZE(20)); - - Evas_Object *rect_down;// rect as a padding - rect_down = evas_object_rectangle_add(evas_object_evas_get(popup)); - evas_object_size_hint_min_set(rect_down, ELM_SCALE_SIZE(100), ELM_SCALE_SIZE(20)); - - // box - elm_table_pack(table, rect_up, 0, 0, 2, 1);// rect as a padding - elm_table_pack(table, box, 0, 1, 2, 1); - elm_table_pack(table, rect_down, 0, 2, 2, 1);// rect as a padding - evas_object_show(box); - elm_object_content_set(popup, table); - eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, eext_popup_back_cb, NULL); + const char *context, Evas_Object_Event_Cb func, + void *param) +{ + mf_error("=================================="); + Evas_Object *popup; + struct appdata *ap; + + ap = (struct appdata *) data; + popup = elm_popup_add(ap->mf_MainWindow.pMainLayout); - evas_object_show(popup); - evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, (Evas_Object_Event_Cb)func, param); - return popup; + Evas_Object *box = elm_box_add(popup); + elm_box_horizontal_set(box, EINA_TRUE); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_align_set(box, 0.5, 0.5); + elm_box_padding_set(box, 16, 0); + + // [UI] progress icon + Evas_Object *progressbar = elm_progressbar_add(popup); + elm_object_style_set(progressbar, "process_large");/* "toolbar_process" or "pending_list" or "list_prosess" */ + //evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.5); + //evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_progressbar_pulse(progressbar, EINA_TRUE); + evas_object_show(progressbar); + elm_box_pack_end(box, progressbar); + + // [UI] text + Evas_Object *label = elm_label_add(popup); + //elm_object_text_set(label, context);/* "Loading..." */ + mf_object_text_set(label, context, NULL); + evas_object_show(label); + elm_box_pack_end(box, label); + + + // [UI] add table + Evas_Object *table = elm_table_add(popup); + evas_object_show(table); + elm_table_homogeneous_set(table, EINA_FALSE); + + Evas_Object *rect_up;// rect as a padding + rect_up = evas_object_rectangle_add(evas_object_evas_get(popup)); + evas_object_size_hint_min_set(rect_up, ELM_SCALE_SIZE(100), ELM_SCALE_SIZE(20)); + + Evas_Object *rect_down;// rect as a padding + rect_down = evas_object_rectangle_add(evas_object_evas_get(popup)); + evas_object_size_hint_min_set(rect_down, ELM_SCALE_SIZE(100), ELM_SCALE_SIZE(20)); + + // box + elm_table_pack(table, rect_up, 0, 0, 2, 1);// rect as a padding + elm_table_pack(table, box, 0, 1, 2, 1); + elm_table_pack(table, rect_down, 0, 2, 2, 1);// rect as a padding + evas_object_show(box); + elm_object_content_set(popup, table); + eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, eext_popup_back_cb, NULL); + + evas_object_show(popup); + evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, (Evas_Object_Event_Cb)func, param); + return popup; } /****************************** @@ -1107,10 +1110,11 @@ static Evas_Object *__mf_popup_sort_by_box_set(Evas_Object *parent, Evas_Object //pos = elm_win_rotation_get(mf_get_appdata()->mf_MainWindow.pWindow); int max_item_num = item_cnt; - if (max_item_num > ITEM_MAX_COUNT) + if (max_item_num > ITEM_MAX_COUNT) { max_item_num = ITEM_MAX_COUNT; + } evas_object_size_hint_min_set(box, -1, - ELM_SCALE_SIZE(MF_POPUP_MENUSTYLE_HEIGHT(max_item_num))); + ELM_SCALE_SIZE(MF_POPUP_MENUSTYLE_HEIGHT(max_item_num))); evas_object_show(content); elm_box_pack_end(box, content); @@ -1126,10 +1130,11 @@ static Evas_Object *__mf_popup_box_set(Evas_Object *parent, Evas_Object *content evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); int max_item_num = item_cnt; - if (max_item_num > ITEM_MAX_COUNT) + if (max_item_num > ITEM_MAX_COUNT) { max_item_num = ITEM_MAX_COUNT; + } evas_object_size_hint_min_set(box, ELM_SCALE_SIZE(MF_POPUP_MENUSTYLE_WIDTH), - ELM_SCALE_SIZE(MF_POPUP_MENUSTYLE_HEIGHT(max_item_num))); + ELM_SCALE_SIZE(MF_POPUP_MENUSTYLE_HEIGHT(max_item_num))); evas_object_show(content); elm_box_pack_end(box, content); @@ -1141,10 +1146,10 @@ int g_popup_item_index = 0; void mf_elm_popup_item_append(Evas_Object *obj, - const char *label, - Evas_Object *icon, - Evas_Smart_Cb func, - const void *data) + const char *label, + Evas_Object *icon, + Evas_Smart_Cb func, + const void *data) { struct appdata * ap = (struct appdata *) mf_get_appdata(); Elm_Object_Item *it = NULL; @@ -1155,7 +1160,7 @@ mf_elm_popup_item_append(Evas_Object *obj, item_data->ap = ap; item_data->title = g_strdup(label); it = elm_genlist_item_append(obj, ap->mf_gl_style.popup_itc, (void *)item_data, NULL, - ELM_GENLIST_ITEM_NONE, func, data); + ELM_GENLIST_ITEM_NONE, func, data); item_data->item = it; @@ -1211,46 +1216,46 @@ static void __mf_popup_operation_items_generate(void *data, Evas_Object *genlist if (ap->mf_Status.more == MORE_SEARCH) { { - if (item_data->file_type == FILE_TYPE_DIR) { - //1 Delete - __mf_popup_operation_item_create(genlist, data, mf_operation_item_delete); + if (item_data->file_type == FILE_TYPE_DIR) { + //1 Delete + __mf_popup_operation_item_create(genlist, data, mf_operation_item_delete); - //1 Rename - __mf_popup_operation_item_create(genlist, data, mf_operation_item_rename); + //1 Rename + __mf_popup_operation_item_create(genlist, data, mf_operation_item_rename); - //1 Move - __mf_popup_operation_item_create(genlist, data, mf_operation_item_move); + //1 Move + __mf_popup_operation_item_create(genlist, data, mf_operation_item_move); - //1 Copy - __mf_popup_operation_item_create(genlist, data, mf_operation_item_copy); + //1 Copy + __mf_popup_operation_item_create(genlist, data, mf_operation_item_copy); - //1 Details - __mf_popup_operation_item_create(genlist, data, mf_operation_item_details); - }else { - //1 Go to folder - __mf_popup_operation_item_create(genlist, data, mf_operation_item_goto_folder); + //1 Details + __mf_popup_operation_item_create(genlist, data, mf_operation_item_details); + } else { + //1 Go to folder + __mf_popup_operation_item_create(genlist, data, mf_operation_item_goto_folder); - //1 Share - { - __mf_popup_operation_item_create(genlist, data, mf_operation_item_share); - } + //1 Share + { + __mf_popup_operation_item_create(genlist, data, mf_operation_item_share); + } - //1 Delete - __mf_popup_operation_item_create(genlist, data, mf_operation_item_delete); + //1 Delete + __mf_popup_operation_item_create(genlist, data, mf_operation_item_delete); - //1 Rename - __mf_popup_operation_item_create(genlist, data, mf_operation_item_rename); + //1 Rename + __mf_popup_operation_item_create(genlist, data, mf_operation_item_rename); - //1 Move - __mf_popup_operation_item_create(genlist, data, mf_operation_item_move); + //1 Move + __mf_popup_operation_item_create(genlist, data, mf_operation_item_move); - //1 Copy - __mf_popup_operation_item_create(genlist, data, mf_operation_item_copy); + //1 Copy + __mf_popup_operation_item_create(genlist, data, mf_operation_item_copy); - //1 Details - __mf_popup_operation_item_create(genlist, data, mf_operation_item_details); - } + //1 Details + __mf_popup_operation_item_create(genlist, data, mf_operation_item_details); + } } } else if (ap->mf_Status.view_type == mf_view_root) { switch (type) { @@ -1305,47 +1310,47 @@ static void __mf_popup_operation_items_generate(void *data, Evas_Object *genlist } } else { - if (item_data->file_type == FILE_TYPE_DIR) { + if (item_data->file_type == FILE_TYPE_DIR) { - //1 Delete - __mf_popup_operation_item_create(genlist, data, mf_operation_item_delete); + //1 Delete + __mf_popup_operation_item_create(genlist, data, mf_operation_item_delete); - //1 Rename - __mf_popup_operation_item_create(genlist, data, mf_operation_item_rename); + //1 Rename + __mf_popup_operation_item_create(genlist, data, mf_operation_item_rename); - //1 Move - __mf_popup_operation_item_create(genlist, data, mf_operation_item_move); + //1 Move + __mf_popup_operation_item_create(genlist, data, mf_operation_item_move); - //1 Copy - __mf_popup_operation_item_create(genlist, data, mf_operation_item_copy); + //1 Copy + __mf_popup_operation_item_create(genlist, data, mf_operation_item_copy); - //1 Compress - __mf_popup_operation_item_create(genlist, data, mf_operation_item_compress); + //1 Compress + __mf_popup_operation_item_create(genlist, data, mf_operation_item_compress); - //1 Details - __mf_popup_operation_item_create(genlist, data, mf_operation_item_details); - } else { - //1 Share - { - __mf_popup_operation_item_create(genlist, data, mf_operation_item_share); - } + //1 Details + __mf_popup_operation_item_create(genlist, data, mf_operation_item_details); + } else { + //1 Share + { + __mf_popup_operation_item_create(genlist, data, mf_operation_item_share); + } - //1 Delete - __mf_popup_operation_item_create(genlist, data, mf_operation_item_delete); + //1 Delete + __mf_popup_operation_item_create(genlist, data, mf_operation_item_delete); - //1 Rename - __mf_popup_operation_item_create(genlist, data, mf_operation_item_rename); + //1 Rename + __mf_popup_operation_item_create(genlist, data, mf_operation_item_rename); - //1 Move - __mf_popup_operation_item_create(genlist, data, mf_operation_item_move); + //1 Move + __mf_popup_operation_item_create(genlist, data, mf_operation_item_move); - //1 Copy - __mf_popup_operation_item_create(genlist, data, mf_operation_item_copy); + //1 Copy + __mf_popup_operation_item_create(genlist, data, mf_operation_item_copy); - //1 Details - __mf_popup_operation_item_create(genlist, data, mf_operation_item_details); - } + //1 Details + __mf_popup_operation_item_create(genlist, data, mf_operation_item_details); + } } MF_TRACE_END; } @@ -1395,7 +1400,7 @@ static Evas_Object *__mf_popup_genlist_icon_get(void *data, Evas_Object * obj, c elm_radio_value_set(radio, ap->mf_Status.iRadioValue); /* elm_object_signal_callback_add(radio, "elm,action,show,finished", "elm", */ - /* __gl_popup_viewby_radio_cb, params); */ + /* __gl_popup_viewby_radio_cb, params); */ evas_object_show(radio); return radio; @@ -1416,10 +1421,10 @@ Evas_Object *mf_popup_create_operation_item_pop(void *data) char *title = NULL; if (item_data->list_type == mf_list_normal - || item_data->list_type == mf_list_recent_files) { + || item_data->list_type == mf_list_recent_files) { if (item_data->storage_type == MYFILE_PHONE - || item_data->storage_type == MYFILE_MMC - ) { + || item_data->storage_type == MYFILE_MMC + ) { if (!mf_file_exists(((mfItemData_s *)item_data)->m_ItemName->str)) { mf_popup_indicator_popup(NULL, mf_util_get_text(MF_LABEL_FILE_NOT_EXIST)); elm_object_item_del(item_data->item); @@ -1450,18 +1455,18 @@ Evas_Object *mf_popup_create_operation_item_pop(void *data) return NULL; } - elm_object_style_set(popup,"indicator_norepeatevent"); + elm_object_style_set(popup, "indicator_norepeatevent"); elm_object_focus_set(popup, EINA_FALSE); evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); if (title) { - mf_object_text_set(popup, title, "title,text");//Fixed P140321-05456 by jian12.li - /*char *temp_utf8 = elm_entry_utf8_to_markup(title); - if (temp_utf8) { - elm_object_part_text_set(popup, "title,text", temp_utf8); - free(temp_utf8); - }*/ - SAFE_FREE_CHAR(title); + mf_object_text_set(popup, title, "title,text");//Fixed P140321-05456 by jian12.li + /*char *temp_utf8 = elm_entry_utf8_to_markup(title); + if (temp_utf8) { + elm_object_part_text_set(popup, "title,text", temp_utf8); + free(temp_utf8); + }*/ + SAFE_FREE_CHAR(title); } //elm_object_style_set(popup,"content_no_vhpad"); @@ -1522,7 +1527,7 @@ Evas_Object *mf_popup_create_operation_item_pop(void *data) return popup; } #endif -Evas_Object *mf_popup_share_as_video_or_image(void *func_for_video,void *func_for_image, void *data) +Evas_Object *mf_popup_share_as_video_or_image(void *func_for_video, void *func_for_image, void *data) { MF_TRACE_BEGIN mfItemData_s *item_data = (mfItemData_s *)data; @@ -1533,13 +1538,13 @@ Evas_Object *mf_popup_share_as_video_or_image(void *func_for_video,void *func_fo Evas_Object *popup = NULL; popup = elm_popup_add(ap->mf_MainWindow.pWindow); mf_retvm_if(popup == NULL, NULL, "popup is NULL"); - elm_object_style_set(popup,"indicator_norepeatevent"); + elm_object_style_set(popup, "indicator_norepeatevent"); elm_object_focus_set(popup, EINA_FALSE); evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_object_part_text_set(popup, "title,text", mf_util_get_text(MF_LABEL_SHARE_SOUND_AND_SHOT_PICS)); - elm_popup_item_append(popup,mf_util_get_text(MF_LABEL_SHARE_AS_VIDEO_FILES), NULL, func_for_video, data); - elm_popup_item_append(popup,mf_util_get_text(MF_LABEL_SHARE_AS_IMAGE_FILES) , NULL, func_for_image, data); + elm_popup_item_append(popup, mf_util_get_text(MF_LABEL_SHARE_AS_VIDEO_FILES), NULL, func_for_video, data); + elm_popup_item_append(popup, mf_util_get_text(MF_LABEL_SHARE_AS_IMAGE_FILES) , NULL, func_for_image, data); evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, (Evas_Object_Event_Cb)__mf_popup_longpress_del_cb, ap); evas_object_smart_callback_add(popup, "block,clicked", (Evas_Smart_Cb)__mf_popup_block_clicked_cb, NULL); eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, eext_popup_back_cb, NULL); @@ -1642,7 +1647,7 @@ void mf_popup_del_by_timeout(void *data, Evas_Object *obj, void *event_info) }*/ Evas_Object *mf_popup_create_popup(void *data, ePopMode popupMode, char *title, const char *context, const char *first_btn_text, const char *second_btn_text, - const char *third_btn_text, Evas_Smart_Cb func, void *param) + const char *third_btn_text, Evas_Smart_Cb func, void *param) { MF_TRACE_BEGIN; Evas_Object *popup = NULL; @@ -1653,7 +1658,7 @@ Evas_Object *mf_popup_create_popup(void *data, ePopMode popupMode, char *title, Evas_Object *btn1 = NULL; Evas_Object *btn2 = NULL; int index = 0; - int listby_selected= 0; + int listby_selected = 0; ap = (struct appdata *)data; mf_retvm_if(ap == NULL, NULL, "ap is NULL"); @@ -1678,7 +1683,7 @@ Evas_Object *mf_popup_create_popup(void *data, ePopMode popupMode, char *title, elm_popup_timeout_set(popup, 3); if (func != NULL) { evas_object_smart_callback_add(popup, "timeout", (Evas_Smart_Cb)func, param); - }else{ + } else { evas_object_smart_callback_add(popup, "timeout", (Evas_Smart_Cb)mf_popup_del_by_timeout, ap); } break; @@ -1691,19 +1696,19 @@ Evas_Object *mf_popup_create_popup(void *data, ePopMode popupMode, char *title, case POPMODE_TEXT_TWO_BTN: case POPMODE_TITLE_TEXT_TWO_BTN: btn1 = mf_object_create_button(popup, - NULL, //"popup_button/default", - first_btn_text, - NULL, - (Evas_Smart_Cb)func, - param, - EINA_FALSE); + NULL, //"popup_button/default", + first_btn_text, + NULL, + (Evas_Smart_Cb)func, + param, + EINA_FALSE); btn2 = mf_object_create_button(popup, - NULL, //"popup_button/default", - second_btn_text, - NULL, - (Evas_Smart_Cb)func, - param, - EINA_FALSE); + NULL, //"popup_button/default", + second_btn_text, + NULL, + (Evas_Smart_Cb)func, + param, + EINA_FALSE); elm_object_part_content_set(popup, "button1", btn1); elm_object_part_content_set(popup, "button2", btn2); break; @@ -1711,12 +1716,12 @@ Evas_Object *mf_popup_create_popup(void *data, ePopMode popupMode, char *title, case POPMODE_TEXT_BTN: case POPMODE_TITLE_TEXT_BTN: btn1 = mf_object_create_button(popup, - NULL, //"popup_button/default", - first_btn_text, - NULL, - (Evas_Smart_Cb)func, - param, - EINA_FALSE); + NULL, //"popup_button/default", + first_btn_text, + NULL, + (Evas_Smart_Cb)func, + param, + EINA_FALSE); elm_object_focus_set(btn1, EINA_TRUE); elm_object_part_content_set(popup, "button1", btn1); break; @@ -1751,13 +1756,14 @@ Evas_Object *mf_popup_create_popup(void *data, ePopMode popupMode, char *title, for (index = 0; index < 2; index++) { Elm_Object_Item *it = NULL; ListByData_s *item_data = calloc(sizeof(ListByData_s), sizeof(char)); - if (item_data == NULL) + if (item_data == NULL) { continue; + } memset(item_data, 0x00, sizeof(ListByData_s)); item_data->index = index; item_data->ap = ap; it = elm_genlist_item_append(genlist, ap->mf_gl_style.listby_itc, (void *)item_data, NULL, - ELM_GENLIST_ITEM_NONE, __mf_popup_view_as_genlist_select, popup); + ELM_GENLIST_ITEM_NONE, __mf_popup_view_as_genlist_select, popup); item_data->item = it; evas_object_smart_callback_add(genlist, "language,changed", mf_genlist_gl_lang_changed, item_data); } @@ -1814,19 +1820,19 @@ Evas_Object *mf_popup_create_delete_confirm_popup(void *data, char *title, const } btn1 = mf_object_create_button(popup, - NULL, //"popup_button/default", - first_btn_text, - NULL, - (Evas_Smart_Cb)func, - param, - EINA_FALSE); + NULL, //"popup_button/default", + first_btn_text, + NULL, + (Evas_Smart_Cb)func, + param, + EINA_FALSE); btn2 = mf_object_create_button(popup, - NULL, //"popup_button/default", - second_btn_text, - NULL, - (Evas_Smart_Cb)func, - param, - EINA_FALSE); + NULL, //"popup_button/default", + second_btn_text, + NULL, + (Evas_Smart_Cb)func, + param, + EINA_FALSE); elm_object_part_content_set(popup, "button1", btn1); elm_object_part_content_set(popup, "button2", btn2); evas_object_show(popup); @@ -1864,12 +1870,12 @@ Evas_Object *mf_popup_warning_popup_create(void *data, Evas_Object *parent, char } btn1 = mf_object_create_button(second_popup, - NULL, //"popup_button/default", - btn_text, - NULL, - (Evas_Smart_Cb)func, - param, - EINA_FALSE); + NULL, //"popup_button/default", + btn_text, + NULL, + (Evas_Smart_Cb)func, + param, + EINA_FALSE); elm_object_part_content_set(second_popup, "button1", btn1); evas_object_show(second_popup); evas_object_event_callback_add(second_popup, EVAS_CALLBACK_DEL, __mf_popup_second_popup_del_cb, ap); @@ -1905,12 +1911,12 @@ Evas_Object *mf_popup_second_popup_create(void *data, Evas_Object *parent, const } btn1 = mf_object_create_button(second_popup, - NULL, //"popup_button/default", - btn_text, - NULL, - (Evas_Smart_Cb)func, - param, - EINA_FALSE); + NULL, //"popup_button/default", + btn_text, + NULL, + (Evas_Smart_Cb)func, + param, + EINA_FALSE); elm_object_focus_set(btn1, EINA_TRUE); elm_object_part_content_set(second_popup, "button1", btn1); evas_object_show(second_popup); @@ -1931,8 +1937,9 @@ void mf_popup_indicator_popup(void *data, const char *text) mf_retm_if(text == NULL, "text is NULL"); char *notification = mf_util_get_text(text); int ret = notification_status_message_post(notification); - if (notification != NULL) + if (notification != NULL) { mf_debug("indicator popup message : %s", notification); + } mf_debug("notification_status_message_post()... [0x%x]!", ret); if (ret != 0) { @@ -1958,8 +1965,7 @@ static void _go_check_clicked_cb(void *data, Evas_Object *obj, void *event_info) Eina_Bool state = elm_check_state_get(obj); if (state) { elm_object_signal_emit(obj, "elm,activate,check,off", "elm"); - } - else { + } else { elm_object_signal_emit(obj, "elm,activate,check,on", "elm"); } @@ -1967,13 +1973,13 @@ static void _go_check_clicked_cb(void *data, Evas_Object *obj, void *event_info) } Evas_Object *mf_popup_check_view_popup(void *data, - const char *title, - const char *text, - const char *check_text, - const char *first_btn_text, - const char *second_btn_text, - Evas_Smart_Cb func, - void *param) + const char *title, + const char *text, + const char *check_text, + const char *first_btn_text, + const char *second_btn_text, + Evas_Smart_Cb func, + void *param) { Evas_Object *popup; Evas_Object *layout; @@ -1991,7 +1997,7 @@ Evas_Object *mf_popup_check_view_popup(void *data, eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, eext_popup_back_cb, NULL); evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); if (title) { - mf_object_text_set(popup, title, "title,text"); + mf_object_text_set(popup, title, "title,text"); } /* layout */ layout = elm_layout_add(popup); @@ -2037,22 +2043,22 @@ Evas_Object *mf_popup_check_view_popup(void *data, evas_object_show(popup); if (first_btn_text && func) { btn1 = mf_object_create_button(popup, - "popup_button/default", - first_btn_text, - NULL, - (Evas_Smart_Cb)func, - param, - EINA_FALSE); + "popup_button/default", + first_btn_text, + NULL, + (Evas_Smart_Cb)func, + param, + EINA_FALSE); elm_object_part_content_set(popup, "button1", btn1); } if (second_btn_text && func) { btn2 = mf_object_create_button(popup, - "popup_button/default", - second_btn_text, - NULL, - (Evas_Smart_Cb)func, - param, - EINA_FALSE); + "popup_button/default", + second_btn_text, + NULL, + (Evas_Smart_Cb)func, + param, + EINA_FALSE); elm_object_part_content_set(popup, "button2", btn2); } evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, __mf_popup_normal_del_cb, ap); @@ -2064,8 +2070,9 @@ Evas_Object *mf_popup_check_view_popup(void *data, void __mf_popup_view_as_genlist_change(ListByData_s *params) { - if (params == NULL) + if (params == NULL) { return; + } elm_radio_value_set(params->ap->mf_Status.pRadioGroup, params->index); int iViewAsType = __mf_popup_get_view_as_type(params->index); @@ -2200,9 +2207,9 @@ static Evas_Object *__mf_sort_by_gl_icon(void *data, Evas_Object * obj, const ch //evas_object_propagate_events_set(radio, EINA_FALSE); elm_object_signal_emit(radio, "elm,event,pass,enabled", "elm"); evas_object_size_hint_align_set(radio, - EVAS_HINT_FILL, EVAS_HINT_FILL); + EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_weight_set(radio, - EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_layout_content_set(layout, "elm.swallow.content", radio); evas_object_show(radio); @@ -2347,9 +2354,9 @@ static void __mf_check_clicked_cb(void *data, Evas_Object *obj, void *event_info struct appdata *ap = mf_get_appdata(); if (elm_check_state_get(obj)) { - ap->mf_Status.check=1; + ap->mf_Status.check = 1; } else { - ap->mf_Status.check=0; + ap->mf_Status.check = 0; } MF_TRACE_END; @@ -2371,7 +2378,7 @@ Evas_Object *mf_popup_replace_create(char *title, char *label_text, Evas_Smart_C Evas_Object *popup = elm_popup_add(ap->mf_MainWindow.pWindow); mf_retvm_if(popup == NULL, NULL, "POPUP is NULL"); elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0); - ap->mf_Status.check=0; + ap->mf_Status.check = 0; evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); mf_object_text_set(popup, title, "title,text"); /* layout */ @@ -2405,26 +2412,26 @@ Evas_Object *mf_popup_replace_create(char *title, char *label_text, Evas_Smart_C Evas_Object *btn2 = NULL; Evas_Object *btn3 = NULL; btn1 = mf_object_create_button(popup, - NULL, - MF_POPUP_BUTTON_CANCEL, - NULL, - (Evas_Smart_Cb)func1, - ap, - EINA_FALSE); + NULL, + MF_POPUP_BUTTON_CANCEL, + NULL, + (Evas_Smart_Cb)func1, + ap, + EINA_FALSE); btn2 = mf_object_create_button(popup, - NULL, - MF_LABEL_REPLACE, - NULL, - (Evas_Smart_Cb)func2, - param, - EINA_FALSE); + NULL, + MF_LABEL_REPLACE, + NULL, + (Evas_Smart_Cb)func2, + param, + EINA_FALSE); btn3 = mf_object_create_button(popup, - NULL, - LABEL_RENAME, - NULL, - (Evas_Smart_Cb)func3, - param, - EINA_FALSE); + NULL, + LABEL_RENAME, + NULL, + (Evas_Smart_Cb)func3, + param, + EINA_FALSE); elm_object_part_content_set(popup, "button1", btn1); elm_object_part_content_set(popup, "button2", btn2); elm_object_part_content_set(popup, "button3", btn3); @@ -2487,15 +2494,15 @@ Evas_Object *mf_popup_sort_by_create(char *title, Evas_Smart_Cb func, void *para //Elm_Object_Item *it = NULL; for (index = 0; index < 4; index++) { elm_genlist_item_append(genlist, ap->mf_gl_style.listby_itc, (void *)index, NULL, - ELM_GENLIST_ITEM_NONE, __mf_sort_by_gl_select, (void *)index); + ELM_GENLIST_ITEM_NONE, __mf_sort_by_gl_select, (void *)index); } elm_genlist_item_append(genlist, ap->mf_gl_style.order_itc, NULL, NULL, - ELM_GENLIST_ITEM_NONE, NULL, NULL); + ELM_GENLIST_ITEM_NONE, NULL, NULL); for (index = 4; index < 6; index++) { elm_genlist_item_append(genlist, ap->mf_gl_style.listby_itc, (void *)index, NULL, - ELM_GENLIST_ITEM_NONE, __mf_sort_by_gl_select, (void *)index); + ELM_GENLIST_ITEM_NONE, __mf_sort_by_gl_select, (void *)index); } box = __mf_popup_sort_by_box_set(popup, genlist, 6); ap->mf_MainWindow.pPopupBox = box; @@ -2506,19 +2513,19 @@ Evas_Object *mf_popup_sort_by_create(char *title, Evas_Smart_Cb func, void *para Evas_Object *btn1 = NULL; Evas_Object *btn2 = NULL; btn1 = mf_object_create_button(popup, - "popup", - LABEL_CANCEL, - NULL, - (Evas_Smart_Cb)__mf_sort_by_button_cb, - ap, - EINA_FALSE); + "popup", + LABEL_CANCEL, + NULL, + (Evas_Smart_Cb)__mf_sort_by_button_cb, + ap, + EINA_FALSE); btn2 = mf_object_create_button(popup, - "popup", - MF_BUTTON_LABEL_OK, - NULL, - (Evas_Smart_Cb)__mf_sort_by_button_cb, - ap, - EINA_FALSE); + "popup", + MF_BUTTON_LABEL_OK, + NULL, + (Evas_Smart_Cb)__mf_sort_by_button_cb, + ap, + EINA_FALSE); elm_object_part_content_set(popup, "button1", btn1); elm_object_part_content_set(popup, "button2", btn2); diff --git a/src/widget/mf-recent-view.c b/src/widget/mf-recent-view.c index d24fa1b..0511d78 100755 --- a/src/widget/mf-recent-view.c +++ b/src/widget/mf-recent-view.c @@ -69,14 +69,13 @@ Evas_Object *mf_recent_view_content_create(void *data) mf_util_free_eina_list_with_data(&(ap->mf_FileOperation.recent_list), MYFILE_TYPE_FSNODE); mf_util_generate_saved_files_list(ap, mf_list_recent_files); - if (eina_list_count(ap->mf_FileOperation.recent_list) == 0) - { + if (eina_list_count(ap->mf_FileOperation.recent_list) == 0) { mf_debug("No recent lists"); content = mf_object_create_multi_no_content(ap->mf_MainWindow.pNaviLayout); mf_object_text_set(content, MF_LABEL_NO_FILES, "elm.text"); ap->mf_MainWindow.pNaviGengrid = NULL; - ap->mf_MainWindow.pNaviGenlist= NULL; + ap->mf_MainWindow.pNaviGenlist = NULL; ap->mf_Status.flagNoContent = EINA_TRUE; } else { int iSortTypeValue = 0; @@ -150,11 +149,11 @@ void mf_recent_view_create(void *data) MF_TA_ACUM_ITEM_BEGIN("123456 push naviframe item", 0); if (ap->mf_Status.pPreNaviItem) { ap->mf_MainWindow.pNaviItem = elm_naviframe_item_insert_after(ap->mf_MainWindow.pNaviBar, - ap->mf_Status.pPreNaviItem, "", NULL, NULL, ap->mf_MainWindow.pNaviLayout, - MF_NAVI_STYLE_ENABLE); + ap->mf_Status.pPreNaviItem, "", NULL, NULL, ap->mf_MainWindow.pNaviLayout, + MF_NAVI_STYLE_ENABLE); } else { ap->mf_MainWindow.pNaviItem = elm_naviframe_item_push(ap->mf_MainWindow.pNaviBar, NULL, NULL, NULL, - ap->mf_MainWindow.pNaviLayout, MF_NAVI_STYLE_ENABLE); + ap->mf_MainWindow.pNaviLayout, MF_NAVI_STYLE_ENABLE); } MF_TA_ACUM_ITEM_END("123456 push naviframe item", 0); diff --git a/src/widget/mf-root-view.c b/src/widget/mf-root-view.c index ad09b70..627bf67 100755 --- a/src/widget/mf-root-view.c +++ b/src/widget/mf-root-view.c @@ -97,7 +97,7 @@ Elm_Object_Item *mf_mw_root_category_item_prepend(void *data) /*if (first_index_item) { it = elm_genlist_item_insert_before(genlist, &root_category_itc, ap, NULL, first_index_item, ELM_GENLIST_ITEM_NONE, NULL, NULL); } else {*/ - it = elm_genlist_item_prepend(genlist, &root_category_itc, ap, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); + it = elm_genlist_item_prepend(genlist, &root_category_itc, ap, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); //} elm_genlist_item_show(it, ELM_GENLIST_ITEM_SCROLLTO_TOP); MF_TRACE_END; @@ -132,12 +132,14 @@ void mf_mw_root_category_refresh(void *data) if (category) { if (changed_angle == APP_DEVICE_ORIENTATION_90 || changed_angle == APP_DEVICE_ORIENTATION_270) { - if (box_root_category) + if (box_root_category) { evas_object_size_hint_min_set(box_root_category, ELM_SCALE_SIZE(1280), -1); + } edje_object_signal_emit(_EDJ(category), "landscape", "category_frame"); } else { - if (box_root_category) + if (box_root_category) { evas_object_size_hint_min_set(box_root_category, ELM_SCALE_SIZE(720), -1); + } edje_object_signal_emit(_EDJ(category), "portrait", "category_frame"); } } @@ -149,7 +151,7 @@ static Evas_Object *__mf_mw_category_content_get(void *data, Evas_Object * obj, MF_TRACE_BEGIN; mf_retvm_if(data == NULL, NULL, "data is NULL"); struct appdata *ap = (struct appdata *)data; - /*create detail layout*/ + /*create detail layout*/ Evas_Object *category = mf_category_create(ap); /* @@ -413,7 +415,7 @@ void mf_root_view_append_mmc_item_after_phone(Evas_Object *parent, fsNodeInfo *p mf_retm_if(pNode->path == NULL, "pNode->path is NULL"); mf_retm_if(pNode->name == NULL, "pNode->name is NULL"); mf_retm_if(data == NULL, "data is NULL"); - + char *real_name = NULL; mfItemData_s *m_TempItem = NULL; struct appdata *ap = (struct appdata *)data; @@ -552,7 +554,7 @@ void mf_root_view_create(void *data) MF_TA_ACUM_ITEM_BEGIN("123456 mf_navi_bar_set_ctrlbar", 0); mf_navi_bar_set_ctrlbar(data); MF_TA_ACUM_ITEM_END("123456 mf_navi_bar_set_ctrlbar", 0); - mf_navi_bar_title_content_set(ap,ap->mf_MainWindow.naviframe_title); + mf_navi_bar_title_content_set(ap, ap->mf_MainWindow.naviframe_title); elm_naviframe_item_title_enabled_set(ap->mf_MainWindow.pNaviItem, EINA_TRUE, EINA_TRUE); MF_TA_ACUM_ITEM_END("12345 mf_root_view_create", 0); diff --git a/src/widget/mf-search-bar.c b/src/widget/mf-search-bar.c index 0805ee7..f39f8f1 100755 --- a/src/widget/mf-search-bar.c +++ b/src/widget/mf-search-bar.c @@ -50,7 +50,7 @@ extern pthread_mutex_t gLockSearchMsg; extern pthread_cond_t gCondSearchMsg; static Eina_Bool search_all_flag = EINA_FALSE; static Eina_Bool do_search_all = EINA_FALSE; -static Ecore_Idler *entry_focus_allow_idler =NULL; +static Ecore_Idler *entry_focus_allow_idler = NULL; typedef struct { char *size; @@ -84,12 +84,12 @@ static Evas_Object *_gl_search_all_content_get(void *data, Evas_Object * obj, co if (!strcmp(part, "elm.icon")) { Evas_Object *btn = mf_object_create_button(obj, - NULL, - MF_LABEL_SEARCH_ALL, - NULL, - __mf_search_bar_sel_search_all, - data, - EINA_FALSE); + NULL, + MF_LABEL_SEARCH_ALL, + NULL, + __mf_search_bar_sel_search_all, + data, + EINA_FALSE); return btn; } @@ -112,7 +112,7 @@ void mf_search_bar_search_all_item_append(void *data) itc->func.state_get = NULL; itc->func.del = NULL; elm_genlist_item_append(ap->mf_MainWindow.pNaviGenlist, itc, ap, NULL, - ELM_GENLIST_ITEM_NONE, NULL, NULL); + ELM_GENLIST_ITEM_NONE, NULL, NULL); } } } @@ -172,7 +172,7 @@ static void __mf_search_bar_click_item(void *data) mf_debug("ret is %d\n", ret); if (ret) { ap->mf_MainWindow.pNormalPopup = - mf_popup_create_popup(ap, POPMODE_TEXT, NULL, MF_LABEL_UNSUPPORT_FILE_TYPE, NULL, NULL, NULL, NULL, NULL); + mf_popup_create_popup(ap, POPMODE_TEXT, NULL, MF_LABEL_UNSUPPORT_FILE_TYPE, NULL, NULL, NULL, NULL, NULL); } } MF_TRACE_END; @@ -189,7 +189,7 @@ static void __mf_search_bar_item_sel(void *data, Evas_Object * obj, void *event_ struct appdata *ap = (struct appdata *)selected->ap; //fix P131209-00523 by wangyan,search -> longpress searched file-> back, highlight should be released elm_genlist_item_selected_set(item, FALSE); - if (ap->mf_MainWindow.pLongpressPopup!=NULL) { + if (ap->mf_MainWindow.pLongpressPopup != NULL) { return; } if (ap->mf_Status.more == MORE_EDIT_RENAME) { @@ -199,9 +199,9 @@ static void __mf_search_bar_item_sel(void *data, Evas_Object * obj, void *event_ mf_callback_rename_save_cb(ap, NULL, NULL); return; } else if (ap->mf_Status.more == MORE_EDIT || ap->mf_Status.more == MORE_SHARE_EDIT || - ap->mf_Status.more == MORE_EDIT_COPY || ap->mf_Status.more == MORE_EDIT_MOVE || - ap->mf_Status.more == MORE_EDIT_DETAIL || ap->mf_Status.more == MORE_EDIT_DELETE - || ap->mf_Status.more == MORE_SHARE_EDIT) { + ap->mf_Status.more == MORE_EDIT_COPY || ap->mf_Status.more == MORE_EDIT_MOVE || + ap->mf_Status.more == MORE_EDIT_DETAIL || ap->mf_Status.more == MORE_EDIT_DELETE + || ap->mf_Status.more == MORE_SHARE_EDIT) { if (selected->file_type == FILE_TYPE_DIR) { mf_info("select type is DIR"); if (mf_edit_folder_list_item_exists(selected->item)) { @@ -224,14 +224,14 @@ static void __mf_search_bar_item_sel(void *data, Evas_Object * obj, void *event_ } } if (ap->mf_Status.more == MORE_EDIT_COPY || ap->mf_Status.more == MORE_EDIT_MOVE) { - mf_callback_copy_move_cb(ap,NULL,NULL); + mf_callback_copy_move_cb(ap, NULL, NULL); } else if (ap->mf_Status.more == MORE_EDIT_DELETE) { - mf_callback_delete_cb(ap,NULL,NULL); + mf_callback_delete_cb(ap, NULL, NULL); } else if (ap->mf_Status.more == MORE_SHARE_EDIT) { - mf_callback_share_cb(ap,NULL,NULL); + mf_callback_share_cb(ap, NULL, NULL); } else if (ap->mf_Status.more == MORE_EDIT_DETAIL) { mf_debug("detail callback"); - mf_callback_details_cb(ap,NULL,NULL); + mf_callback_details_cb(ap, NULL, NULL); } } else { __mf_search_bar_click_item(selected); @@ -317,18 +317,16 @@ static void __mf_search_bar_item_append(void *data, mfItemData_s *item_data) Elm_Object_Item *git = NULL; git = elm_gengrid_item_append(ap->mf_MainWindow.pNaviGengrid, &search_gic, item_data, __mf_search_bar_grid_item_sel, ap); item_data->item = git; - } - else - { + } else { Elm_Object_Item *it = NULL; it = elm_genlist_item_append(ap->mf_MainWindow.pNaviGenlist, ap->mf_gl_style.search_itc, item_data, NULL, - ELM_GENLIST_ITEM_NONE, __mf_search_bar_item_sel, ap); + ELM_GENLIST_ITEM_NONE, __mf_search_bar_item_sel, ap); item_data->item = it; } #else Elm_Object_Item *it = NULL; it = elm_genlist_item_append(ap->mf_MainWindow.pNaviGenlist, ap->mf_gl_style.search_itc, m_TempItem, NULL, - ELM_GENLIST_ITEM_NONE, __mf_search_bar_item_sel, ap); + ELM_GENLIST_ITEM_NONE, __mf_search_bar_item_sel, ap); m_TempItem->item = it; #endif } @@ -390,7 +388,7 @@ void mf_search_bar_set_content(void *data, Evas_Object *pLayout, Evas_Object *Na mf_retm_if(data == NULL, "data is NULL"); mf_retm_if(pLayout == NULL, "pConform is NULL"); mf_retm_if(NaviContent == NULL, "NaviContent is NULL"); - + elm_box_clear(pLayout); elm_box_pack_end(pLayout, NaviContent); MF_TRACE_END; @@ -444,7 +442,7 @@ void mf_search_set_ctrl_button(void *data) Evas_Object *more_bt = NULL; ap->mf_Status.extra = MORE_SEARCH; more_bt = mf_object_create_button(ap->mf_MainWindow.pNaviBar, NAVI_BUTTON_EDIT, MF_LABEL_MORE, - NULL, (Evas_Smart_Cb)mf_callback_more_button_cb, ap, EINA_FALSE); + NULL, (Evas_Smart_Cb)mf_callback_more_button_cb, ap, EINA_FALSE); if (more_bt) { Evas_Object *unset = elm_object_item_part_content_unset(navi_it, NAVI_MORE_BUTTON_PART); @@ -473,7 +471,7 @@ void mf_search_bar_content_create(mf_search_result_t *result, void *user_data) if (result->file_list != NULL) { g_list_foreach(result->file_list, mf_search_bar_file_item_append, ap); } - if(ap->mf_Status.count == 0) { + if (ap->mf_Status.count == 0) { ap->mf_Status.flagNoContent = true; Evas_Object *parent = NULL; parent = ap->mf_MainWindow.pNaviBar; @@ -507,37 +505,37 @@ void mf_search_bar_view_update(void *data) if (view_style != MF_VIEW_STYLE_THUMBNAIL) { elm_genlist_clear(ap->mf_MainWindow.pNaviGenlist); EINA_LIST_FOREACH(ap->mf_FileOperation.search_result_folder_list, l, item_data) { - if (item_data && item_data->m_ItemName && item_data->m_ItemName->str) { - if (!mf_file_exists(item_data->m_ItemName->str)) { - ap->mf_FileOperation.search_result_folder_list = eina_list_remove(ap->mf_FileOperation.search_result_folder_list, item_data); - mf_util_normal_item_data_free(&item_data); - continue; - } - if (ap->mf_Status.search_category == mf_tray_item_category_none) { - __mf_search_bar_item_append(ap, item_data); - } - } - } - EINA_LIST_FOREACH(ap->mf_FileOperation.search_result_file_list, l, item_data) { - if (item_data) { - if (!mf_file_exists(item_data->m_ItemName->str)) { - ap->mf_FileOperation.search_result_file_list = eina_list_remove(ap->mf_FileOperation.search_result_file_list, item_data); - mf_util_normal_item_data_free(&item_data); - continue; - } - if (ap->mf_Status.search_category != mf_tray_item_category_none) { - int type = 0; - type = mf_tray_item_category_type_get_by_file_type(item_data->file_type); - if (type != ap->mf_Status.search_category) { - continue; - } else { - __mf_search_bar_item_append(ap, item_data); - } - } else { - __mf_search_bar_item_append(ap, item_data); - } - } - } + if (item_data && item_data->m_ItemName && item_data->m_ItemName->str) { + if (!mf_file_exists(item_data->m_ItemName->str)) { + ap->mf_FileOperation.search_result_folder_list = eina_list_remove(ap->mf_FileOperation.search_result_folder_list, item_data); + mf_util_normal_item_data_free(&item_data); + continue; + } + if (ap->mf_Status.search_category == mf_tray_item_category_none) { + __mf_search_bar_item_append(ap, item_data); + } + } + } + EINA_LIST_FOREACH(ap->mf_FileOperation.search_result_file_list, l, item_data) { + if (item_data) { + if (!mf_file_exists(item_data->m_ItemName->str)) { + ap->mf_FileOperation.search_result_file_list = eina_list_remove(ap->mf_FileOperation.search_result_file_list, item_data); + mf_util_normal_item_data_free(&item_data); + continue; + } + if (ap->mf_Status.search_category != mf_tray_item_category_none) { + int type = 0; + type = mf_tray_item_category_type_get_by_file_type(item_data->file_type); + if (type != ap->mf_Status.search_category) { + continue; + } else { + __mf_search_bar_item_append(ap, item_data); + } + } else { + __mf_search_bar_item_append(ap, item_data); + } + } + } if (elm_genlist_items_count(ap->mf_MainWindow.pNaviGenlist) == 0) { //Evas_Object *no_content = NULL; @@ -559,50 +557,50 @@ void mf_search_bar_view_update(void *data) } else { elm_gengrid_clear(ap->mf_MainWindow.pNaviGengrid); EINA_LIST_FOREACH(ap->mf_FileOperation.search_result_folder_list, l, item_data) { - if (item_data) { - if (!mf_file_exists(item_data->m_ItemName->str)) { - ap->mf_FileOperation.search_result_folder_list = eina_list_remove(ap->mf_FileOperation.search_result_folder_list, item_data); - mf_util_normal_item_data_free(&item_data); - continue; - } - if (ap->mf_Status.search_category == mf_tray_item_category_none) { - __mf_search_bar_item_append(ap, item_data); - } - } - } - EINA_LIST_FOREACH(ap->mf_FileOperation.search_result_file_list, l, item_data) { - if (item_data && item_data->m_ItemName && item_data->m_ItemName->str) { - if (!mf_file_exists(item_data->m_ItemName->str)) { - ap->mf_FileOperation.search_result_file_list = eina_list_remove(ap->mf_FileOperation.search_result_file_list, item_data); - mf_util_normal_item_data_free(&item_data); - continue; - } - if (ap->mf_Status.search_category != mf_tray_item_category_none) { - int type = 0; - type = mf_tray_item_category_type_get_by_file_type(item_data->file_type); - if (type != ap->mf_Status.search_category) { - continue; - } else { - __mf_search_bar_item_append(ap, item_data); - } - } else { - __mf_search_bar_item_append(ap, item_data); - } - } - } - if (elm_gengrid_items_count(ap->mf_MainWindow.pNaviGengrid) == 0) { - Evas_Object *parent = NULL; - parent = ap->mf_MainWindow.pNaviLayout; - Evas_Object *no_content = elm_layout_add(parent); - elm_layout_theme_set(no_content, "layout", "nocontents", "search"); - elm_object_focus_set(no_content, EINA_FALSE); - evas_object_size_hint_weight_set(no_content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(no_content, EVAS_HINT_FILL, EVAS_HINT_FILL); - //mf_object_disable_virtualkeypad(); - mf_object_text_set(no_content, MF_LABEL_NO_RESULT_FOUND, "elm.text"); - mf_search_bar_set_content(ap, ap->mf_MainWindow.pNaviBox, no_content,true); - evas_object_show(no_content); - ap->mf_MainWindow.pNaviGengrid = NULL; + if (item_data) { + if (!mf_file_exists(item_data->m_ItemName->str)) { + ap->mf_FileOperation.search_result_folder_list = eina_list_remove(ap->mf_FileOperation.search_result_folder_list, item_data); + mf_util_normal_item_data_free(&item_data); + continue; + } + if (ap->mf_Status.search_category == mf_tray_item_category_none) { + __mf_search_bar_item_append(ap, item_data); + } + } + } + EINA_LIST_FOREACH(ap->mf_FileOperation.search_result_file_list, l, item_data) { + if (item_data && item_data->m_ItemName && item_data->m_ItemName->str) { + if (!mf_file_exists(item_data->m_ItemName->str)) { + ap->mf_FileOperation.search_result_file_list = eina_list_remove(ap->mf_FileOperation.search_result_file_list, item_data); + mf_util_normal_item_data_free(&item_data); + continue; + } + if (ap->mf_Status.search_category != mf_tray_item_category_none) { + int type = 0; + type = mf_tray_item_category_type_get_by_file_type(item_data->file_type); + if (type != ap->mf_Status.search_category) { + continue; + } else { + __mf_search_bar_item_append(ap, item_data); + } + } else { + __mf_search_bar_item_append(ap, item_data); + } + } + } + if (elm_gengrid_items_count(ap->mf_MainWindow.pNaviGengrid) == 0) { + Evas_Object *parent = NULL; + parent = ap->mf_MainWindow.pNaviLayout; + Evas_Object *no_content = elm_layout_add(parent); + elm_layout_theme_set(no_content, "layout", "nocontents", "search"); + elm_object_focus_set(no_content, EINA_FALSE); + evas_object_size_hint_weight_set(no_content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(no_content, EVAS_HINT_FILL, EVAS_HINT_FILL); + //mf_object_disable_virtualkeypad(); + mf_object_text_set(no_content, MF_LABEL_NO_RESULT_FOUND, "elm.text"); + mf_search_bar_set_content(ap, ap->mf_MainWindow.pNaviBox, no_content, true); + evas_object_show(no_content); + ap->mf_MainWindow.pNaviGengrid = NULL; } } @@ -654,11 +652,11 @@ static void __mf_search_bar_result_update(mf_search_result_t *result, void *user } #endif Evas_Object *progressbar = elm_progressbar_add(ap->mf_MainWindow.pNaviBar); - elm_object_style_set(progressbar, "list_process"); - evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.5); - evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_show(progressbar); - elm_progressbar_pulse(progressbar, EINA_TRUE); + elm_object_style_set(progressbar, "list_process"); + evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(progressbar); + elm_progressbar_pulse(progressbar, EINA_TRUE); elm_object_item_part_content_set(ap->mf_MainWindow.pNaviItem, TITLE_RIGHT_BTN, progressbar); } if (msg_type == MF_SEARCH_PIPE_MSG_DOING) { @@ -696,7 +694,7 @@ static void __mf_search_bar_result_update(mf_search_result_t *result, void *user } else { mf_search_bar_content_create(result, ap); } - }else { + } else { mf_search_bar_content_create(result, ap); } } @@ -742,7 +740,7 @@ static void __mf_search_bar_result_update(mf_search_result_t *result, void *user //mf_object_disable_virtualkeypad(); mf_object_text_set(no_content, MF_LABEL_NO_RESULT_FOUND, "elm.text"); evas_object_show(no_content); - mf_search_bar_set_content(ap, ap->mf_MainWindow.pNaviBox, no_content,true); + mf_search_bar_set_content(ap, ap->mf_MainWindow.pNaviBox, no_content, true); //mf_navi_bar_layout_content_set(parent, pSearchBarLabel); } @@ -762,7 +760,7 @@ static void __mf_search_bar_result_update(mf_search_result_t *result, void *user //mf_object_disable_virtualkeypad(); mf_object_text_set(no_content, MF_LABEL_NO_RESULT_FOUND, "elm.text"); evas_object_show(no_content); - mf_search_bar_set_content(ap, ap->mf_MainWindow.pNaviBox, no_content,true); + mf_search_bar_set_content(ap, ap->mf_MainWindow.pNaviBox, no_content, true); //mf_navi_bar_layout_content_set(parent, pSearchBarLabel); } else { @@ -911,9 +909,9 @@ static bool __mf_search_bar_idle_search_start(void *data) } if (ap->mf_Status.view_type == mf_view_root - || ap->mf_Status.view_type == mf_view_root_category - || ap->mf_Status.view_type == mf_view_storage - || ap->mf_Status.view_type == mf_view_recent) { + || ap->mf_Status.view_type == mf_view_root_category + || ap->mf_Status.view_type == mf_view_storage + || ap->mf_Status.view_type == mf_view_recent) { SearchRoot[0] = PHONE_FOLDER; root_num++; if (ap->mf_Status.iStorageState & MYFILE_MMC) { @@ -928,8 +926,7 @@ static bool __mf_search_bar_idle_search_start(void *data) root_num++; } do_search_all = EINA_FALSE; - } - else { + } else { SearchRoot[0] = ap->mf_Status.path->str; root_num++; } @@ -937,7 +934,7 @@ static bool __mf_search_bar_idle_search_start(void *data) char *new_desc = NULL; /*Start Search routine*/ if (!mf_search_start(ap->mf_Status.search_handler, SearchRoot, root_num, \ - ((text) ? text : NULL), MF_SEARCH_OPTION_DEF, (void *)ap, NULL, mf_tray_item_category_none, MF_CATEGOR_SEARCH_ITEM_COUNT)) { + ((text) ? text : NULL), MF_SEARCH_OPTION_DEF, (void *)ap, NULL, mf_tray_item_category_none, MF_CATEGOR_SEARCH_ITEM_COUNT)) { /*generate the popup used to show search path **it's sure that new_desc is not NULL even if original path is NULL*/ new_desc = mf_fm_svc_wrapper_translate_path(ap->mf_Status.path->str, MF_TRANS_OPTION_POPUP); @@ -1022,8 +1019,9 @@ void mf_search_bar_search_started_callback(void *data, Evas_Object * obj, void * return; } - if (ap->mf_Status.search_handler > 0) + if (ap->mf_Status.search_handler > 0) { mf_search_finalize(&ap->mf_Status.search_handler); + } int ret = mf_search_init(&ap->mf_Status.search_handler); mf_retm_if(ret < 0, "Fail to mf_search_init()"); diff --git a/src/widget/mf-search-view.c b/src/widget/mf-search-view.c index c0d5b28..2e569f4 100755 --- a/src/widget/mf-search-view.c +++ b/src/widget/mf-search-view.c @@ -286,7 +286,7 @@ void mf_search_view_create(void *data) //mf_navi_bar_title_content_set(ap, LABEL_MYFILE); } // - + elm_naviframe_item_title_enabled_set(ap->mf_MainWindow.pNaviItem, EINA_FALSE, EINA_FALSE); evas_object_show(ap->mf_MainWindow.pSearchEntry); diff --git a/src/widget/mf-setting-view.c b/src/widget/mf-setting-view.c index f6091e5..f78e94a 100755 --- a/src/widget/mf-setting-view.c +++ b/src/widget/mf-setting-view.c @@ -145,7 +145,7 @@ Evas_Object *mf_setting_view_content_create(void *data, Evas_Object *parent) Evas_Object *scroller = elm_scroller_add(parent); elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_TRUE); - elm_scroller_policy_set(scroller,ELM_SCROLLER_POLICY_OFF,ELM_SCROLLER_POLICY_AUTO); + elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); evas_object_show(scroller); elm_object_style_set(scroller, "dialogue"); @@ -179,8 +179,8 @@ Evas_Object *mf_setting_view_content_create(void *data, Evas_Object *parent) Evas_Object *content = elm_layout_add(extension); elm_layout_theme_set(content, "layout", - "list/C/type.2", "default"); - + "list/C/type.2", "default"); + check_extension = elm_check_add(extension); //evas_object_resize(check_extension, -1, 46); evas_object_propagate_events_set(check_extension, EINA_FALSE); @@ -220,7 +220,7 @@ Evas_Object *mf_setting_view_content_create(void *data, Evas_Object *parent) content = elm_layout_add(extension); elm_layout_theme_set(content, "layout", - "list/C/type.2", "default"); + "list/C/type.2", "default"); check_hiden = elm_check_add(hiden); //evas_object_resize(check_hiden, -1, 46); @@ -294,54 +294,54 @@ void mf_setting_view_create(void *data) void update_lang(void) { - char *lang = NULL; - char *baselang = NULL; - char *r = NULL; + char *lang = NULL; + char *baselang = NULL; + char *r = NULL; int retcode = -1; retcode = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &lang); if (retcode != SYSTEM_SETTINGS_ERROR_NONE) { - mf_error("[ERR] failed to get the language"); + mf_error("[ERR] failed to get the language"); + } + if (lang) { + setenv("LANG", lang, 1); + setenv("LC_MESSAGES", lang, 1); + r = setlocale(LC_ALL, ""); + if (r == NULL) { + retcode = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &baselang); + if (retcode != SYSTEM_SETTINGS_ERROR_NONE) { + mf_error("[ERR] failed to get the language"); + } + if (baselang) { + setlocale(LC_ALL, baselang); + free(baselang); + } + } + free(lang); } - if (lang) { - setenv("LANG", lang, 1); - setenv("LC_MESSAGES", lang, 1); - r = setlocale(LC_ALL, ""); - if (r == NULL) { - retcode = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &baselang); - if (retcode != SYSTEM_SETTINGS_ERROR_NONE) { - mf_error("[ERR] failed to get the language"); - } - if (baselang) { - setlocale(LC_ALL, baselang); - free(baselang); - } - } - free(lang); - } } void update_region(void) { - char *region = NULL; - int retcode = -1; - retcode = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY, ®ion); + char *region = NULL; + int retcode = -1; + retcode = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY, ®ion); if (retcode != SYSTEM_SETTINGS_ERROR_NONE) { - mf_error("[ERR] failed to get the region"); + mf_error("[ERR] failed to get the region"); + } + if (region) { + setenv("LC_CTYPE", region, 1); + setenv("LC_NUMERIC", region, 1); + setenv("LC_TIME", region, 1); + setenv("LC_COLLATE", region, 1); + setenv("LC_MONETARY", region, 1); + setenv("LC_PAPER", region, 1); + setenv("LC_NAME", region, 1); + setenv("LC_ADDRESS", region, 1); + setenv("LC_TELEPHONE", region, 1); + setenv("LC_MEASUREMENT", region, 1); + setenv("LC_IDENTIFICATION", region, 1); + free(region); } - if (region) { - setenv("LC_CTYPE", region, 1); - setenv("LC_NUMERIC", region, 1); - setenv("LC_TIME", region, 1); - setenv("LC_COLLATE", region, 1); - setenv("LC_MONETARY", region, 1); - setenv("LC_PAPER", region, 1); - setenv("LC_NAME", region, 1); - setenv("LC_ADDRESS", region, 1); - setenv("LC_TELEPHONE", region, 1); - setenv("LC_MEASUREMENT", region, 1); - setenv("LC_IDENTIFICATION", region, 1); - free(region); - } } static int __set_i18n(const char *domain, const char *dir) @@ -356,15 +356,15 @@ static int __set_i18n(const char *domain, const char *dir) r = setlocale(LC_ALL, ""); /* if locale is not set properly, try again to set as language base */ if (r == NULL) { - char *lang = NULL; - int retcode = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &lang); - if (retcode != SYSTEM_SETTINGS_ERROR_NONE) { - mf_error("[ERR] failed to get the language"); - } - if (lang) { - setlocale(LC_ALL, lang); - free(lang); - } + char *lang = NULL; + int retcode = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &lang); + if (retcode != SYSTEM_SETTINGS_ERROR_NONE) { + mf_error("[ERR] failed to get the language"); + } + if (lang) { + setlocale(LC_ALL, lang); + free(lang); + } } bindtextdomain(domain, dir); textdomain(domain); @@ -374,9 +374,9 @@ static int __set_i18n(const char *domain, const char *dir) int mf_setting_set_i18n(char *pkgname, char *localedir) { mf_error("==============================="); - //update_lang(); - // update_region(); + //update_lang(); + // update_region(); - return __set_i18n(pkgname, localedir); + return __set_i18n(pkgname, localedir); } diff --git a/src/widget/mf-tray-item.c b/src/widget/mf-tray-item.c index 76a81fd..1fd2b6a 100755 --- a/src/widget/mf-tray-item.c +++ b/src/widget/mf-tray-item.c @@ -43,8 +43,7 @@ #define MF_CATEGORY_LAYOUT_EDJ EDJ_PATH"/myfile_category.edj" #define MF_CATEGORY_LAYOUT_GROUP "category_frame" -typedef struct __mf_category_layout -{ +typedef struct __mf_category_layout { Evas_Object *category_text; Evas_Object *category_frame; Evas_Object *category_image; @@ -226,7 +225,7 @@ void mf_tray_item_search(void *data, int type) ap->mf_Status.categorytitle = name ; if (ap->mf_MainWindow.pNaviGengrid == NULL) { - ap->mf_MainWindow.pNaviGengrid = mf_gengrid_create(ap->mf_MainWindow.pNaviBar,ap); + ap->mf_MainWindow.pNaviGengrid = mf_gengrid_create(ap->mf_MainWindow.pNaviBar, ap); } ap->mf_Status.category_type = type; mf_category_view_create(ap, false); @@ -262,19 +261,24 @@ void mf_category_refresh(void *data) void mf_category_item_title_refresh(Evas_Object *parent) { MF_TRACE_BEGIN; - if (g_mf_category_layout.category_image) - elm_object_part_text_set((g_mf_category_layout.category_image),"category_image_title",mf_util_get_text(MF_LABEL_IMAGES)); - if (g_mf_category_layout.category_video) - elm_object_part_text_set((g_mf_category_layout.category_video),"category_video_title",mf_util_get_text(MF_LABEL_VIDEOS)); - if (g_mf_category_layout.category_sound) - elm_object_part_text_set((g_mf_category_layout.category_sound),"category_sound_title",mf_util_get_text(MF_LABEL_TITLE_AUDIOS)); - if (g_mf_category_layout.category_document) - elm_object_part_text_set((g_mf_category_layout.category_document),"category_document_title",mf_util_get_text(MF_LABLE_SHORTCUT_DOCUMENTS)); - if (g_mf_category_layout.category_text) - elm_object_part_text_set((g_mf_category_layout.category_text),"category_text_title", mf_util_get_text(MF_LABEL_CATEGORY)); + if (g_mf_category_layout.category_image) { + elm_object_part_text_set((g_mf_category_layout.category_image), "category_image_title", mf_util_get_text(MF_LABEL_IMAGES)); + } + if (g_mf_category_layout.category_video) { + elm_object_part_text_set((g_mf_category_layout.category_video), "category_video_title", mf_util_get_text(MF_LABEL_VIDEOS)); + } + if (g_mf_category_layout.category_sound) { + elm_object_part_text_set((g_mf_category_layout.category_sound), "category_sound_title", mf_util_get_text(MF_LABEL_TITLE_AUDIOS)); + } + if (g_mf_category_layout.category_document) { + elm_object_part_text_set((g_mf_category_layout.category_document), "category_document_title", mf_util_get_text(MF_LABLE_SHORTCUT_DOCUMENTS)); + } + if (g_mf_category_layout.category_text) { + elm_object_part_text_set((g_mf_category_layout.category_text), "category_text_title", mf_util_get_text(MF_LABEL_CATEGORY)); + } if (g_mf_category_layout.category_recent) { - elm_object_part_text_set((g_mf_category_layout.category_recent),"category_recent_title",mf_util_get_text(MF_LABEL_RECTENT_FILES)); - elm_object_part_text_set((g_mf_category_layout.category_recent),"category_recent_size","0.0 Byte"); + elm_object_part_text_set((g_mf_category_layout.category_recent), "category_recent_title", mf_util_get_text(MF_LABEL_RECTENT_FILES)); + elm_object_part_text_set((g_mf_category_layout.category_recent), "category_recent_size", "0.0 Byte"); } } @@ -288,46 +292,46 @@ void mf_category_storage_size_reset(mf_tray_item_category category) //fix P1311 { MF_TRACE_BEGIN; switch (category) { - case mf_tray_item_category_none:{ - if (g_mf_category_layout.category_image) { - elm_object_part_text_set((g_mf_category_layout.category_image),"category_image_size", ""); - } - if (g_mf_category_layout.category_video) { - elm_object_part_text_set((g_mf_category_layout.category_video),"category_video_size", ""); - } - if (g_mf_category_layout.category_sound) { - elm_object_part_text_set((g_mf_category_layout.category_sound),"category_sound_size", ""); - } - if (g_mf_category_layout.category_document) { - elm_object_part_text_set((g_mf_category_layout.category_document),"category_document_size", ""); - } - if (g_mf_category_layout.category_recent) { - elm_object_part_text_set((g_mf_category_layout.category_recent),"category_recent_size", ""); - } - break; + case mf_tray_item_category_none: { + if (g_mf_category_layout.category_image) { + elm_object_part_text_set((g_mf_category_layout.category_image), "category_image_size", ""); } - case mf_tray_item_category_image:{ - elm_object_part_text_set((g_mf_category_layout.category_image),"category_image_size", ""); - break; + if (g_mf_category_layout.category_video) { + elm_object_part_text_set((g_mf_category_layout.category_video), "category_video_size", ""); } - case mf_tray_item_category_video:{ - elm_object_part_text_set((g_mf_category_layout.category_video),"category_video_size", ""); - break; + if (g_mf_category_layout.category_sound) { + elm_object_part_text_set((g_mf_category_layout.category_sound), "category_sound_size", ""); } - case mf_tray_item_category_sounds:{ - elm_object_part_text_set((g_mf_category_layout.category_sound),"category_sound_size", ""); - break; - } - case mf_tray_item_category_document:{ - elm_object_part_text_set((g_mf_category_layout.category_document),"category_document_size", ""); - break; + if (g_mf_category_layout.category_document) { + elm_object_part_text_set((g_mf_category_layout.category_document), "category_document_size", ""); } - case mf_tray_item_category_recent:{ - elm_object_part_text_set((g_mf_category_layout.category_recent),"category_recent_size", ""); - break; + if (g_mf_category_layout.category_recent) { + elm_object_part_text_set((g_mf_category_layout.category_recent), "category_recent_size", ""); } - default: - break; + break; + } + case mf_tray_item_category_image: { + elm_object_part_text_set((g_mf_category_layout.category_image), "category_image_size", ""); + break; + } + case mf_tray_item_category_video: { + elm_object_part_text_set((g_mf_category_layout.category_video), "category_video_size", ""); + break; + } + case mf_tray_item_category_sounds: { + elm_object_part_text_set((g_mf_category_layout.category_sound), "category_sound_size", ""); + break; + } + case mf_tray_item_category_document: { + elm_object_part_text_set((g_mf_category_layout.category_document), "category_document_size", ""); + break; + } + case mf_tray_item_category_recent: { + elm_object_part_text_set((g_mf_category_layout.category_recent), "category_recent_size", ""); + break; + } + default: + break; } } @@ -335,87 +339,87 @@ void mf_category_storage_size_refresh(mf_tray_item_category category, Update_Inf { MF_TRACE_BEGIN; switch (category) { - case mf_tray_item_category_none:{ - mfStorageStatus* storage_status = (mfStorageStatus*) mf_storage_get_status(pUserData); - if (g_mf_category_layout.category_image) { - if (storage_status->image_size_info.total_size >= 0.0) { - char *size = mf_launch_item_size_calculate((double)storage_status->image_size_info.total_size); - elm_object_part_text_set((g_mf_category_layout.category_image),"category_image_size", size); - SAFE_FREE_CHAR(size); - } - } - if (g_mf_category_layout.category_video) { - if (storage_status->video_size_info.total_size >= 0.0) { - char *size = mf_launch_item_size_calculate((double)storage_status->video_size_info.total_size); - elm_object_part_text_set((g_mf_category_layout.category_video),"category_video_size", size); - SAFE_FREE_CHAR(size); - } - } - if (g_mf_category_layout.category_sound) { - if (storage_status->sound_size_info.total_size >= 0.0) { - char *size = mf_launch_item_size_calculate((double)storage_status->sound_size_info.total_size); - elm_object_part_text_set((g_mf_category_layout.category_sound),"category_sound_size", size); - SAFE_FREE_CHAR(size); - } - } - if (g_mf_category_layout.category_document) { - if (storage_status->document_size_info.total_size >= 0.0) { - char *size = mf_launch_item_size_calculate((double)storage_status->document_size_info.total_size); - elm_object_part_text_set((g_mf_category_layout.category_document),"category_document_size", size); - SAFE_FREE_CHAR(size); - } - } - if (g_mf_category_layout.category_recent) { - if (storage_status->recent_size_info.total_size >= 0.0) { - char *size = mf_launch_item_size_calculate((double)storage_status->recent_size_info.total_size); - elm_object_part_text_set((g_mf_category_layout.category_recent),"category_recent_size", size); - SAFE_FREE_CHAR(size); - } - } - break; - } - case mf_tray_item_category_image:{ - if (update_info) { - char *size = mf_launch_item_size_calculate((double)update_info->total_size); - elm_object_part_text_set((g_mf_category_layout.category_image),"category_image_size", size); + case mf_tray_item_category_none: { + mfStorageStatus* storage_status = (mfStorageStatus*) mf_storage_get_status(pUserData); + if (g_mf_category_layout.category_image) { + if (storage_status->image_size_info.total_size >= 0.0) { + char *size = mf_launch_item_size_calculate((double)storage_status->image_size_info.total_size); + elm_object_part_text_set((g_mf_category_layout.category_image), "category_image_size", size); SAFE_FREE_CHAR(size); } - break; } - case mf_tray_item_category_video:{ - if (update_info) { - char *size = mf_launch_item_size_calculate((double)update_info->total_size); - elm_object_part_text_set((g_mf_category_layout.category_video),"category_video_size", size); + if (g_mf_category_layout.category_video) { + if (storage_status->video_size_info.total_size >= 0.0) { + char *size = mf_launch_item_size_calculate((double)storage_status->video_size_info.total_size); + elm_object_part_text_set((g_mf_category_layout.category_video), "category_video_size", size); SAFE_FREE_CHAR(size); } - break; } - case mf_tray_item_category_sounds:{ - if (update_info) { - char *size = mf_launch_item_size_calculate((double)update_info->total_size); - elm_object_part_text_set((g_mf_category_layout.category_sound),"category_sound_size", size); + if (g_mf_category_layout.category_sound) { + if (storage_status->sound_size_info.total_size >= 0.0) { + char *size = mf_launch_item_size_calculate((double)storage_status->sound_size_info.total_size); + elm_object_part_text_set((g_mf_category_layout.category_sound), "category_sound_size", size); SAFE_FREE_CHAR(size); } - break; } - case mf_tray_item_category_document:{ - if (update_info) { - char *size = mf_launch_item_size_calculate((double)update_info->total_size); - elm_object_part_text_set((g_mf_category_layout.category_document),"category_document_size", size); + if (g_mf_category_layout.category_document) { + if (storage_status->document_size_info.total_size >= 0.0) { + char *size = mf_launch_item_size_calculate((double)storage_status->document_size_info.total_size); + elm_object_part_text_set((g_mf_category_layout.category_document), "category_document_size", size); SAFE_FREE_CHAR(size); } - break; } - case mf_tray_item_category_recent:{ - if (update_info) { - char *size = mf_launch_item_size_calculate((double)update_info->total_size); - elm_object_part_text_set((g_mf_category_layout.category_recent),"category_recent_size", size); + if (g_mf_category_layout.category_recent) { + if (storage_status->recent_size_info.total_size >= 0.0) { + char *size = mf_launch_item_size_calculate((double)storage_status->recent_size_info.total_size); + elm_object_part_text_set((g_mf_category_layout.category_recent), "category_recent_size", size); SAFE_FREE_CHAR(size); } - break; } - default: - break; + break; + } + case mf_tray_item_category_image: { + if (update_info) { + char *size = mf_launch_item_size_calculate((double)update_info->total_size); + elm_object_part_text_set((g_mf_category_layout.category_image), "category_image_size", size); + SAFE_FREE_CHAR(size); + } + break; + } + case mf_tray_item_category_video: { + if (update_info) { + char *size = mf_launch_item_size_calculate((double)update_info->total_size); + elm_object_part_text_set((g_mf_category_layout.category_video), "category_video_size", size); + SAFE_FREE_CHAR(size); + } + break; + } + case mf_tray_item_category_sounds: { + if (update_info) { + char *size = mf_launch_item_size_calculate((double)update_info->total_size); + elm_object_part_text_set((g_mf_category_layout.category_sound), "category_sound_size", size); + SAFE_FREE_CHAR(size); + } + break; + } + case mf_tray_item_category_document: { + if (update_info) { + char *size = mf_launch_item_size_calculate((double)update_info->total_size); + elm_object_part_text_set((g_mf_category_layout.category_document), "category_document_size", size); + SAFE_FREE_CHAR(size); + } + break; + } + case mf_tray_item_category_recent: { + if (update_info) { + char *size = mf_launch_item_size_calculate((double)update_info->total_size); + elm_object_part_text_set((g_mf_category_layout.category_recent), "category_recent_size", size); + SAFE_FREE_CHAR(size); + } + break; + } + default: + break; } MF_TRACE_END; } @@ -425,17 +429,17 @@ static void __mf_category_item_key_down(void *data, Evas *evas, Evas_Object *obj { MF_TRACE_BEGIN; mf_retm_if(data == NULL, "data is NULL"); - struct appdata *ap = (struct appdata *)mf_get_appdata(); + struct appdata *ap = (struct appdata *)mf_get_appdata(); int category = (int) data; mf_debug("the category = %d", category); Evas_Event_Key_Down *ev = event_info; mf_retm_if(ev == NULL, "ev is NULL"); - if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) { return; + } - if ((!strcmp(ev->keyname, "Return")) || (!strcmp(ev->keyname, "KP_Enter")) || (!strcmp(ev->keyname, "space"))) - { + if ((!strcmp(ev->keyname, "Return")) || (!strcmp(ev->keyname, "KP_Enter")) || (!strcmp(ev->keyname, "space"))) { if (category != mf_tray_item_category_none) { mf_tray_item_search(ap, category); } @@ -519,7 +523,7 @@ Evas_Object *mf_category_widgets_create(void *data, Evas_Object *parent) g_mf_category_layout.category_recent = mf_object_create_layout(parent, MF_CATEGORY_LAYOUT_EDJ, "group_category_recent"); mf_retvm_if(g_mf_category_layout.category_recent == NULL, NULL, "category_recent_files is NULL"); //g_mf_category_layout.category_all = mf_object_create_layout(parent, MF_CATEGORY_LAYOUT_EDJ, "group_category_all_files"); - //mf_retvm_if(g_mf_category_layout.category_all == NULL, NULL, "category_all_files is NULL"); + //mf_retvm_if(g_mf_category_layout.category_all == NULL, NULL, "category_all_files is NULL"); g_mf_category_layout.category_image = mf_object_create_layout(parent, MF_CATEGORY_LAYOUT_EDJ, "group_category_image"); mf_retvm_if(g_mf_category_layout.category_image == NULL, NULL, "category_image is NULL"); g_mf_category_layout.category_video = mf_object_create_layout(parent, MF_CATEGORY_LAYOUT_EDJ, "group_category_video"); @@ -540,7 +544,7 @@ Evas_Object *mf_category_widgets_create(void *data, Evas_Object *parent) elm_object_part_content_set(g_mf_category_layout.category_frame, "category_text", g_mf_category_layout.category_text); evas_object_show(g_mf_category_layout.category_text); elm_object_part_content_set(g_mf_category_layout.category_frame, "1", g_mf_category_layout.category_recent); - evas_object_show(g_mf_category_layout.category_recent); + evas_object_show(g_mf_category_layout.category_recent); elm_object_part_content_set(g_mf_category_layout.category_frame, "2", g_mf_category_layout.category_image); evas_object_show(g_mf_category_layout.category_image); elm_object_part_content_set(g_mf_category_layout.category_frame, "3", g_mf_category_layout.category_video); @@ -612,60 +616,60 @@ void __mf_category_item_add_click_callback(void *data) { MF_TRACE_BEGIN; edje_object_signal_callback_add(_EDJ(g_mf_category_layout.category_image), - "category_image,clicked", "background_signal", __mf_category_item_clicked, (void *)mf_tray_item_category_image); + "category_image,clicked", "background_signal", __mf_category_item_clicked, (void *)mf_tray_item_category_image); edje_object_signal_callback_add(_EDJ(g_mf_category_layout.category_video), - "category_video,clicked", "background_signal", __mf_category_item_clicked, (void *)mf_tray_item_category_video); + "category_video,clicked", "background_signal", __mf_category_item_clicked, (void *)mf_tray_item_category_video); edje_object_signal_callback_add(_EDJ(g_mf_category_layout.category_sound), - "category_sound,clicked", "background_signal", __mf_category_item_clicked, (void *)mf_tray_item_category_sounds); + "category_sound,clicked", "background_signal", __mf_category_item_clicked, (void *)mf_tray_item_category_sounds); edje_object_signal_callback_add(_EDJ(g_mf_category_layout.category_document), - "category_document,clicked", "background_signal", __mf_category_item_clicked, (void *)mf_tray_item_category_document); + "category_document,clicked", "background_signal", __mf_category_item_clicked, (void *)mf_tray_item_category_document); edje_object_signal_callback_add(_EDJ(g_mf_category_layout.category_recent), - "category_recent,clicked", "background_signal", __mf_category_recent_item_clicked, NULL); + "category_recent,clicked", "background_signal", __mf_category_recent_item_clicked, NULL); } void __mf_category_item_del_click_callback(void *data) { MF_TRACE_BEGIN; edje_object_signal_callback_del(_EDJ(g_mf_category_layout.category_image), - "category_image,clicked", "background_signal", __mf_category_item_clicked); + "category_image,clicked", "background_signal", __mf_category_item_clicked); edje_object_signal_callback_del(_EDJ(g_mf_category_layout.category_video), - "category_video,clicked", "background_signal", __mf_category_item_clicked); + "category_video,clicked", "background_signal", __mf_category_item_clicked); edje_object_signal_callback_del(_EDJ(g_mf_category_layout.category_sound), - "category_sound,clicked", "background_signal", __mf_category_item_clicked); + "category_sound,clicked", "background_signal", __mf_category_item_clicked); edje_object_signal_callback_del(_EDJ(g_mf_category_layout.category_document), - "category_document,clicked", "background_signal", __mf_category_item_clicked); + "category_document,clicked", "background_signal", __mf_category_item_clicked); edje_object_signal_callback_del(_EDJ(g_mf_category_layout.category_recent), - "category_recent,clicked", "background_signal", __mf_category_recent_item_clicked); + "category_recent,clicked", "background_signal", __mf_category_recent_item_clicked); } void __mf_category_item_add_release_callback(void *data) { MF_TRACE_BEGIN; edje_object_signal_callback_add(_EDJ(g_mf_category_layout.category_image), - "category_image,released", "released_signal", __mf_category_item_released, NULL); + "category_image,released", "released_signal", __mf_category_item_released, NULL); edje_object_signal_callback_add(_EDJ(g_mf_category_layout.category_video), - "category_video,released", "released_signal", __mf_category_item_released, NULL); + "category_video,released", "released_signal", __mf_category_item_released, NULL); edje_object_signal_callback_add(_EDJ(g_mf_category_layout.category_sound), - "category_sound,released", "released_signal", __mf_category_item_released, NULL); + "category_sound,released", "released_signal", __mf_category_item_released, NULL); edje_object_signal_callback_add(_EDJ(g_mf_category_layout.category_document), - "category_document,released", "released_signal", __mf_category_item_released, NULL); + "category_document,released", "released_signal", __mf_category_item_released, NULL); edje_object_signal_callback_add(_EDJ(g_mf_category_layout.category_recent), - "category_recent,released", "released_signal", __mf_category_item_released, NULL); + "category_recent,released", "released_signal", __mf_category_item_released, NULL); } void __mf_category_item_del_release_callback(void *data) { MF_TRACE_BEGIN; edje_object_signal_callback_del(_EDJ(g_mf_category_layout.category_image), - "category_image,released", "released_signal", __mf_category_item_released); + "category_image,released", "released_signal", __mf_category_item_released); edje_object_signal_callback_del(_EDJ(g_mf_category_layout.category_video), - "category_video,released", "released_signal", __mf_category_item_released); + "category_video,released", "released_signal", __mf_category_item_released); edje_object_signal_callback_del(_EDJ(g_mf_category_layout.category_sound), - "category_sound,released", "released_signal", __mf_category_item_released); + "category_sound,released", "released_signal", __mf_category_item_released); edje_object_signal_callback_del(_EDJ(g_mf_category_layout.category_document), - "category_document,released", "released_signal", __mf_category_item_released); + "category_document,released", "released_signal", __mf_category_item_released); edje_object_signal_callback_del(_EDJ(g_mf_category_layout.category_recent), - "category_recent,released", "released_signal", __mf_category_item_released); + "category_recent,released", "released_signal", __mf_category_item_released); } diff --git a/src/widget/mf-view.c b/src/widget/mf-view.c index 03884bb..78a7ebd 100755 --- a/src/widget/mf-view.c +++ b/src/widget/mf-view.c @@ -167,11 +167,10 @@ Eina_Bool mf_view_is_operating(void *data) int more = ap->mf_Status.more; if (more == MORE_DATA_COPYING || - more == MORE_DATA_MOVING || - more == MORE_DATA_DECOMPRESSING || - more == MORE_DELETE || - more ==MORE_COMPRESS) - { + more == MORE_DATA_MOVING || + more == MORE_DATA_DECOMPRESSING || + more == MORE_DELETE || + more == MORE_COMPRESS) { return EINA_TRUE; } return EINA_FALSE; @@ -218,14 +217,14 @@ Eina_Bool mf_view_is_item_exists_by_name(void *data, char *name) if (ap->mf_MainWindow.pNaviGenlist) { it = elm_genlist_first_item_get(ap->mf_MainWindow.pNaviGenlist); while (it) { - mf_list_data_t *it_data = elm_object_item_data_get(it); - if (it_data->list_type != mf_list_normal && it_data->list_type != mf_list_recent_files) { - it = elm_genlist_item_next_get(it); - continue; - } + mf_list_data_t *it_data = elm_object_item_data_get(it); + if (it_data->list_type != mf_list_normal && it_data->list_type != mf_list_recent_files) { + it = elm_genlist_item_next_get(it); + continue; + } itemData = elm_object_item_data_get(it); if (itemData->m_ItemName == NULL || itemData->m_ItemName->str == NULL) { - it = elm_genlist_item_next_get(it); + it = elm_genlist_item_next_get(it); continue; } SECURE_DEBUG("itemData->m_ItemName->str is [%s]", itemData->m_ItemName->str); @@ -252,10 +251,10 @@ void mf_view_refresh(void *data) mf_view_refresh_thumbnail_destroy(); mf_error(); if (ap->mf_Status.more == MORE_DEFAULT || ap->mf_Status.more == MORE_INTERNAL_COPY_MOVE || - ap->mf_Status.more == MORE_INTERNAL_COPY || ap->mf_Status.more == MORE_INTERNAL_MOVE || - ap->mf_Status.more == MORE_DATA_COPYING || ap->mf_Status.more == MORE_DATA_MOVING || - ap->mf_Status.more == MORE_INTERNAL_DECOMPRESS - || ap->mf_Status.more == MORE_EDIT_RENAME) { + ap->mf_Status.more == MORE_INTERNAL_COPY || ap->mf_Status.more == MORE_INTERNAL_MOVE || + ap->mf_Status.more == MORE_DATA_COPYING || ap->mf_Status.more == MORE_DATA_MOVING || + ap->mf_Status.more == MORE_INTERNAL_DECOMPRESS + || ap->mf_Status.more == MORE_EDIT_RENAME) { mf_error(); if (ap->mf_Status.view_type == mf_view_root) { mf_root_view_create(ap); @@ -368,8 +367,8 @@ Elm_Object_Item *mf_view_item_append(Evas_Object *parent, fsNodeInfo *pNode, voi it = elm_genlist_item_append(parent, ap->mf_gl_style.itc, m_TempItem, NULL, ELM_GENLIST_ITEM_NONE, mf_genlist_gl_selected, ap); if (ap->mf_Status.EnterFrom) { if (!g_strcmp0(m_TempItem->m_ItemName->str, ap->mf_Status.EnterFrom)) { - ap->mf_Status.ToTop = true ; - SAFE_FREE_CHAR(ap->mf_Status.EnterFrom); + ap->mf_Status.ToTop = true ; + SAFE_FREE_CHAR(ap->mf_Status.EnterFrom); } } } @@ -387,7 +386,7 @@ Elm_Object_Item *mf_view_item_append(Evas_Object *parent, fsNodeInfo *pNode, voi return it; } -Elm_Object_Item *mf_view_item_append_with_data(Evas_Object *parent, mfItemData_s *item_data, void *data, void *itc, Evas_Smart_Cb func,void *user_data) +Elm_Object_Item *mf_view_item_append_with_data(Evas_Object *parent, mfItemData_s *item_data, void *data, void *itc, Evas_Smart_Cb func, void *user_data) { mf_retvm_if(parent == NULL, NULL, "pGenlist is NULL"); mf_retvm_if(data == NULL, NULL, "data is NULL"); @@ -585,7 +584,7 @@ Eina_Bool mf_view_is_search_view(void *data) { struct appdata *ap = (struct appdata *)data; if (ap->mf_Status.more == MORE_SEARCH || ap->mf_Status.more == MORE_ADVANCED_SEARCH || - mf_view_get_pre_state(ap) == MORE_SEARCH || mf_view_get_pre_state(ap) == MORE_ADVANCED_SEARCH) { + mf_view_get_pre_state(ap) == MORE_SEARCH || mf_view_get_pre_state(ap) == MORE_ADVANCED_SEARCH) { return EINA_TRUE; } @@ -660,12 +659,12 @@ void mf_view_search_item_update(void *data, const char *path, char *new_path) /*owner should make the followed routine as common function*/ if (ap->mf_MainWindow.pNaviGengrid) { it = elm_gengrid_first_item_get(ap->mf_MainWindow.pNaviGengrid); - while (it) { - mf_list_data_t *it_data = elm_object_item_data_get(it); - if (it_data->list_type != mf_list_normal) { - it = elm_gengrid_item_next_get(it); - continue; - } + while (it) { + mf_list_data_t *it_data = elm_object_item_data_get(it); + if (it_data->list_type != mf_list_normal) { + it = elm_gengrid_item_next_get(it); + continue; + } itemData = elm_object_item_data_get(it); if (itemData->m_ItemName == NULL || itemData->m_ItemName->str == NULL) { continue; @@ -695,12 +694,12 @@ void mf_view_search_item_update(void *data, const char *path, char *new_path) /*owner should make the followed routine as common function*/ if (ap->mf_MainWindow.pNaviGenlist) { it = elm_genlist_first_item_get(ap->mf_MainWindow.pNaviGenlist); - while (it) { - mf_list_data_t *it_data = elm_object_item_data_get(it); - if (it_data->list_type != mf_list_normal) { - it = elm_genlist_item_next_get(it); - continue; - } + while (it) { + mf_list_data_t *it_data = elm_object_item_data_get(it); + if (it_data->list_type != mf_list_normal) { + it = elm_genlist_item_next_get(it); + continue; + } itemData = elm_object_item_data_get(it); if (itemData->m_ItemName == NULL || itemData->m_ItemName->str == NULL) { mf_debug(); @@ -747,12 +746,12 @@ void mf_view_item_delete_by_name(void *data, const char *name) /*owner should make the followed routine as common function*/ if (ap->mf_MainWindow.pNaviGengrid) { it = elm_gengrid_first_item_get(ap->mf_MainWindow.pNaviGengrid); - while (it) { - mf_list_data_t *it_data = elm_object_item_data_get(it); - if (it_data->list_type != mf_list_normal) { - it = elm_gengrid_item_next_get(it); - continue; - } + while (it) { + mf_list_data_t *it_data = elm_object_item_data_get(it); + if (it_data->list_type != mf_list_normal) { + it = elm_gengrid_item_next_get(it); + continue; + } itemData = elm_object_item_data_get(it); if (itemData->m_ItemName == NULL || itemData->m_ItemName->str == NULL) { continue; @@ -770,11 +769,11 @@ void mf_view_item_delete_by_name(void *data, const char *name) if (ap->mf_MainWindow.pNaviGenlist) { it = elm_genlist_first_item_get(ap->mf_MainWindow.pNaviGenlist); while (it) { - mf_list_data_t *it_data = elm_object_item_data_get(it); - if (it_data->list_type != mf_list_normal) { - it = elm_genlist_item_next_get(it); - continue; - } + mf_list_data_t *it_data = elm_object_item_data_get(it); + if (it_data->list_type != mf_list_normal) { + it = elm_genlist_item_next_get(it); + continue; + } itemData = elm_object_item_data_get(it); if (itemData->m_ItemName == NULL || itemData->m_ItemName->str == NULL) { mf_debug(); @@ -807,11 +806,11 @@ void mf_view_item_delete_by_exists(void *data) if (ap->mf_MainWindow.pNaviGengrid) { it = elm_gengrid_first_item_get(ap->mf_MainWindow.pNaviGengrid); while (it) { - mf_list_data_t *it_data = elm_object_item_data_get(it); - if (it_data->list_type != mf_list_normal) { - it = elm_gengrid_item_next_get(it); - continue; - } + mf_list_data_t *it_data = elm_object_item_data_get(it); + if (it_data->list_type != mf_list_normal) { + it = elm_gengrid_item_next_get(it); + continue; + } itemData = elm_object_item_data_get(it); if (itemData->m_ItemName == NULL || itemData->m_ItemName->str == NULL) { continue; @@ -829,12 +828,12 @@ void mf_view_item_delete_by_exists(void *data) /*owner should make the followed routine as common function*/ if (ap->mf_MainWindow.pNaviGenlist) { it = elm_genlist_first_item_get(ap->mf_MainWindow.pNaviGenlist); - while (it) { - mf_list_data_t *it_data = elm_object_item_data_get(it); - if (it_data->list_type != mf_list_normal) { - it = elm_genlist_item_next_get(it); - continue; - } + while (it) { + mf_list_data_t *it_data = elm_object_item_data_get(it); + if (it_data->list_type != mf_list_normal) { + it = elm_genlist_item_next_get(it); + continue; + } itemData = elm_object_item_data_get(it); if (itemData->m_ItemName == NULL || itemData->m_ItemName->str == NULL) { -- 2.7.4