2 * Copyright 2012 Samsung Electronics Co., Ltd
\r
4 * Licensed under the Flora License, Version 1.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://floralicense.org/license/
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
19 #include <Elementary.h>
\r
21 #include <vconf-keys.h>
\r
22 #include <pthread.h>
\r
25 #include "mf-ug-main.h"
\r
26 #include "mf-ug-util.h"
\r
27 #include "mf-ug-inotify-handle.h"
\r
28 #include "mf-ug-winset.h"
\r
29 #include "mf-ug-fs-util.h"
\r
30 #include "mf-ug-fm-svc-wrapper.h"
\r
31 #include "mf-ug-resource.h"
\r
32 #include "mf-ug-list-play.h"
\r
34 #define UG_MAX_LEN_VIB_DURATION 0.5
\r
36 /******************************
\r
37 ** Prototype : mf_ug_cb_back_button_cb
\r
39 ** Input : void *data
\r
48 ** 1.Date : 2010/12/10
\r
50 ** Modification : Created function
\r
52 ******************************/
\r
54 void mf_ug_cb_back_button_cb(void *data, Evas_Object *obj, void *event_info)
\r
57 ugData *ugd = (ugData *)data;
\r
58 ug_mf_retm_if(ugd == NULL, "ugData is NULL");
\r
60 if (ugd->ug_Status.ug_bCancelDisableFlag) {
\r
63 if (0 != ugd->ug_ListPlay.ug_Player) {
\r
64 mf_ug_list_play_destory_playing_file(ugd);
\r
65 UG_SAFE_FREE_CHAR(ugd->ug_ListPlay.ug_pPlayFilePath);
\r
67 if (ugd->ug_Status.ug_iMore == UG_MORE_SEARCH) {
\r
69 ugNaviBar *pNavi_s = mf_ug_navi_bar_get_in_use_navi(ugd);
\r
70 ug_mf_retm_if(pNavi_s == NULL, "get navi failed");
\r
71 Evas_Object *playout = ugd->ug_MainWindow.ug_pNaviLayout;
\r
72 ug_mf_retm_if(playout == NULL, "get conformant failed");
\r
73 Evas_Object *newContent = NULL;
\r
75 newContent = mf_ug_genlist_create_content_list_view(ugd);
\r
77 Evas_Object *unUsed = elm_object_part_content_unset(playout, "part1");
\r
78 evas_object_del(unUsed);
\r
80 elm_object_part_content_set(playout, "part1", newContent);
\r
81 ugd->ug_Status.ug_iMore = UG_MORE_DEFAULT;
\r
83 if (ugd->ug_Status.ug_bSettingEntry == true && ugd->ug_Status.ug_bInSettingView == false) {
\r
84 Eina_List *l = NULL;
\r
86 ugNaviBar *pNavi_s = NULL;
\r
87 ugNaviBar *pNavi_toshow = NULL;
\r
88 GString *title = NULL;
\r
90 if (ugd->ug_ListPlay.ug_iPlayState == PLAY_STATE_PLAYING || ugd->ug_ListPlay.ug_iPlayState == PLAY_STATE_PAUSED) {
\r
91 mf_ug_list_play_destory_playing_file(ugd);
\r
92 UG_SAFE_FREE_CHAR(ugd->ug_ListPlay.ug_pPlayFilePath);
\r
95 EINA_LIST_FOREACH(ugd->ug_MainWindow.ug_pNaviBarList, l, item) {
\r
96 pNavi_s = (ugNaviBar *)item;
\r
97 if (pNavi_s == NULL)
\r
99 if (g_strcmp0(pNavi_s->ug_pNaviLabel, MF_UG_LABEL_PHONE) == 0) {
\r
100 if (pNavi_s->ug_pCurrentPath != NULL) {
\r
101 free(pNavi_s->ug_pCurrentPath);
\r
102 pNavi_s->ug_pCurrentPath = NULL;
\r
104 pNavi_s->ug_pCurrentPath = strdup(ugd->ug_Status.ug_pEntryPath);
\r
105 pNavi_s->ug_bNaviFlagInUse = true;
\r
106 pNavi_toshow = pNavi_s;
\r
108 if (pNavi_s->ug_pCurrentPath != NULL) {
\r
109 free(pNavi_s->ug_pCurrentPath);
\r
110 pNavi_s->ug_pCurrentPath = NULL;
\r
112 pNavi_s->ug_pCurrentPath = strdup(MEMORY_FOLDER);
\r
113 pNavi_s->ug_bNaviFlagInUse = false;
\r
118 if (pNavi_toshow == NULL) {
\r
119 ug_debug("pNavi_toshow is NULL");
\r
123 if (ugd->ug_Status.ug_pPath) {
\r
124 g_string_free(ugd->ug_Status.ug_pPath, TRUE);
\r
125 ugd->ug_Status.ug_pPath = NULL;
\r
128 ugd->ug_Status.ug_bInSettingView = true;
\r
130 if (ugd->ug_Status.ug_pPath) {
\r
131 g_string_free(ugd->ug_Status.ug_pPath, TRUE);
\r
132 ugd->ug_Status.ug_pPath = NULL;
\r
135 pNavi_toshow->ug_pCurrentPath = strdup(ugd->ug_Status.ug_pEntryPath);
\r
136 ugd->ug_Status.ug_pPath = g_string_new(pNavi_toshow->ug_pCurrentPath);
\r
137 title = mf_ug_fm_svc_wapper_get_file_name(ugd->ug_Status.ug_pPath);
\r
139 if (title != NULL) {
\r
140 pNavi_toshow->ug_pNaviTitle = g_strdup(title->str);
\r
141 g_string_free(title, TRUE);
\r
144 ugd->ug_Status.ug_iViewType = mf_ug_view_normal;
\r
145 mf_ug_navi_bar_create_default_view(ugd);
\r
146 mf_ug_ctrl_bar_set_item_disable(ugd);
\r
148 elm_object_item_text_set(ugd->ug_MainWindow.ug_pNaviItem, pNavi_toshow->ug_pNaviTitle);
\r
149 elm_naviframe_item_title_visible_set(ugd->ug_MainWindow.ug_pNaviItem, EINA_TRUE);
\r
151 //mf_ug_player_vol_set(ugd->ug_Status.ug_pPath->str);
\r
153 ug_destroy_me(ugd->ug);
\r
161 /******************************
\r
162 ** Prototype : mf_ug_cb_add_button_cb
\r
164 ** Input : void *data
\r
165 ** Evas_Object *obj
\r
166 ** void *event_info
\r
173 ** 1.Date : 2010/12/10
\r
174 ** Author : Samsung
\r
175 ** Modification : Created function
\r
177 ******************************/
\r
179 void mf_ug_cb_add_button_cb(void *data, Evas_Object *obj, void *event_info)
\r
182 ugData *ugd = (ugData *)data;
\r
183 ug_mf_retm_if(ugd == NULL, "ugData is NULL");
\r
187 char *result = NULL;
\r
189 if (ugd->ug_Status.ug_b_NaviPushFlag) {
\r
194 if (ugd->ug_UiGadget.ug_iSelectMode == EXPORT_MODE || ugd->ug_UiGadget.ug_iSelectMode == SAVE_MODE) {
\r
195 result = g_strdup(ugd->ug_Status.ug_pPath->str);
\r
197 result = mf_ug_util_get_send_result(ugd);
\r
201 ret = service_create(&service);
\r
202 if (ret == SERVICE_ERROR_NONE) {
\r
203 service_add_extra_data(service, "result", result);
\r
204 ug_send_result(ugd->ug, service);
\r
205 service_destroy(service);
\r
207 ug_debug("result is [%s]", result);
\r
208 UG_SAFE_FREE_CHAR(result);
\r
211 if (0 != ugd->ug_ListPlay.ug_Player) {
\r
212 mf_ug_list_play_destory_playing_file(ugd);
\r
213 UG_SAFE_FREE_CHAR(ugd->ug_ListPlay.ug_pPlayFilePath);
\r
215 ug_destroy_me(ugd->ug);
\r
219 void mf_ug_cb_list_by_response_cb(void *data)
\r
221 ugData *ugd = (ugData *)data;
\r
224 ugNaviBar *pNavi_s = mf_ug_navi_bar_get_in_use_navi(ugd);
\r
225 ug_mf_retm_if(pNavi_s == NULL, "get navi failed");
\r
226 Evas_Object *playout = ugd->ug_MainWindow.ug_pNaviLayout;
\r
227 ug_mf_retm_if(playout == NULL, "get conformant failed");
\r
228 Evas_Object *newContent = NULL;
\r
230 newContent = mf_ug_genlist_create_content_list_view(ugd);
\r
232 Evas_Object *unUsed = elm_object_part_content_unset(playout, "part1");
\r
233 evas_object_del(unUsed);
\r
235 elm_object_part_content_set(playout, "part1", newContent);
\r
240 void mf_ug_cb_list_by_button_callback(void *data, Evas_Object * obj, void *event_info)
\r
244 ugData *ugd = (ugData *)data;
\r
246 Evas_Object *btn = (Evas_Object *)obj;
\r
247 const char *label = elm_object_text_get(btn);
\r
248 int iListBySortType = 0;
\r
250 if (g_strcmp0(label, MF_UG_LABEL_ASCENDING) == 0 ) {
\r
251 switch(ugd->ug_Status.ug_iSelectedSortType) {
\r
253 iListBySortType = MF_UG_SORT_BY_NAME_Z2A;
\r
256 iListBySortType = MF_UG_SORT_BY_DATE_R2O;
\r
260 iListBySortType = MF_UG_SORT_BY_SIZE_L2S;
\r
263 iListBySortType = MF_UG_SORT_BY_TYPE_Z2A;
\r
266 iListBySortType = MF_UG_SORT_BY_DATE_R2O;
\r
269 } else if(g_strcmp0(label, MF_UG_LABEL_DESCENDING) == 0 ) {
\r
270 switch(ugd->ug_Status.ug_iSelectedSortType) {
\r
272 iListBySortType = MF_UG_SORT_BY_NAME_A2Z;
\r
275 iListBySortType = MF_UG_SORT_BY_DATE_O2R;
\r
279 iListBySortType = MF_UG_SORT_BY_SIZE_S2L;
\r
282 iListBySortType = MF_UG_SORT_BY_TYPE_A2Z;
\r
285 iListBySortType = MF_UG_SORT_BY_DATE_O2R;
\r
290 ugd->ug_Status.ug_iSortType = iListBySortType;
\r
291 mf_ug_cb_list_by_response_cb(ugd);
\r
295 void mf_ug_cb_popup_deleted_cb(void *data, Evas_Object * obj, void *event_info)
\r
297 ugData *ugd = (ugData *)data;
\r
300 mf_ug_cb_list_by_button_callback(data, obj, event_info);
\r
302 if (ugd->ug_MainWindow.ug_pNormalPopup != NULL) {
\r
303 evas_object_del(ugd->ug_MainWindow.ug_pNormalPopup);
\r
305 ugd->ug_MainWindow.ug_pNormalPopup = NULL;
\r
309 void mf_ug_cb_sort_by_cb(void *data, Evas_Object *obj, void *event_info)
\r
312 ugData *ugd = (ugData *)data;
\r
313 ug_mf_retm_if(ugd == NULL, "ugData is NULL");
\r
315 if (ugd->ug_Status.ug_b_NaviPushFlag) {
\r
319 ugd->ug_MainWindow.ug_pNormalPopup = mf_ug_popup_create(ugd, UG_POPMODE_LIST_BY, MF_UG_LABEL_LIST_BY,
\r
320 NULL, NULL, NULL, NULL, mf_ug_cb_popup_deleted_cb, ugd);
\r
324 void mf_ug_cb_goto_myfile_button_cb(void *data, Evas_Object *obj, void *event_info)
\r
327 ugData *ugd = (ugData *)data;
\r
328 ug_mf_retm_if(ugd == NULL, "ugData is NULL");
\r
330 if (ugd->ug_Status.ug_bCancelDisableFlag) {
\r
331 ug_debug("ug_Status.ug_bCancelDisableFlag is true");
\r
334 ugNaviBar *item = NULL;
\r
335 Eina_List *l = NULL;
\r
337 ugNaviBar *pNavi_s = NULL;//ug_mf_navi_bar_get_navi_from_navilist(ugd->ug_MainWindow.ug_pNaviBarList, MF_UG_LABEL_PHONE);
\r
338 ugNaviBar *pNavi_toshow = NULL;
\r
340 EINA_LIST_FOREACH(ugd->ug_MainWindow.ug_pNaviBarList, l, item) {
\r
341 pNavi_s = (ugNaviBar *)item;
\r
342 if (pNavi_s == NULL)
\r
344 if (g_strcmp0(pNavi_s->ug_pNaviLabel, MF_UG_LABEL_PHONE) == 0) {
\r
345 if (pNavi_s->ug_pCurrentPath != NULL) {
\r
346 free(pNavi_s->ug_pCurrentPath);
\r
347 pNavi_s->ug_pCurrentPath = NULL;
\r
349 pNavi_s->ug_pCurrentPath = strdup(PHONE_FOLDER);
\r
350 pNavi_s->ug_bNaviFlagInUse = true;
\r
351 pNavi_toshow = pNavi_s;
\r
353 if (pNavi_s->ug_pCurrentPath != NULL) {
\r
354 free(pNavi_s->ug_pCurrentPath);
\r
355 pNavi_s->ug_pCurrentPath = NULL;
\r
357 pNavi_s->ug_pCurrentPath = strdup(MEMORY_FOLDER);
\r
358 pNavi_s->ug_bNaviFlagInUse = false;
\r
364 if (0 != ugd->ug_ListPlay.ug_Player) {
\r
365 mf_ug_list_play_destory_playing_file(ugd);
\r
366 UG_SAFE_FREE_CHAR(ugd->ug_ListPlay.ug_pPlayFilePath);
\r
369 if (ugd->ug_Status.ug_pPath) {
\r
370 g_string_free(ugd->ug_Status.ug_pPath, TRUE);
\r
371 ugd->ug_Status.ug_pPath = NULL;
\r
373 ugd->ug_Status.ug_pPath = g_string_new(SOUNDS_FOLDER);
\r
374 UG_SAFE_FREE_CHAR(pNavi_s->ug_pCurrentPath);
\r
375 pNavi_s->ug_pCurrentPath = strdup(ugd->ug_Status.ug_pPath->str);
\r
377 ugd->ug_Status.ug_bInSettingView = false;
\r
379 mf_ug_navi_bar_create_default_view(ugd);
\r
380 ugd->ug_Status.ug_bCancelDisableFlag = true;
\r
381 mf_ug_ctrl_bar_set_item_disable(ugd);
\r
382 //mf_ug_player_vol_set(ugd->ug_Status.ug_pPath->str);
\r
386 /******************************
\r
387 ** Prototype : _ug_popup_exit
\r
388 ** Description : Samsung
\r
389 ** Input : void *data
\r
396 ** 1.Date : 2010/12/10
\r
397 ** Author : Samsung
\r
398 ** Modification : Created function
\r
400 ******************************/
\r
402 void mf_ug_cb_mass_storage_popup_cb(void *data)
\r
405 ugData *ugd = (ugData *)data;
\r
406 ug_mf_retm_if(ugd == NULL, "ugData is NULL");
\r
408 mf_ug_cb_back_button_cb(ugd, NULL, NULL);
\r
410 if (ugd->ug_MainWindow.ug_pNormalPopup) {
\r
411 evas_object_del(ugd->ug_MainWindow.ug_pNormalPopup);
\r
412 ugd->ug_MainWindow.ug_pNormalPopup = NULL;
\r
417 void mf_ug_cb_upper_button_pressed_cb(void *data, Evas_Object * obj, void *event_info)
\r
420 ug_mf_retm_if(data == NULL, "data is NULL");
\r
422 Evas_Object *upper_ic = (Evas_Object *)data;
\r
423 elm_image_file_set(upper_ic, UG_TITLE_ICON_UPPER_PRESS, NULL);
\r
426 void mf_ug_cb_upper_button_unpressed_cb(void *data, Evas_Object * obj, void *event_info)
\r
429 ug_mf_retm_if(data == NULL, "data is NULL");
\r
431 Evas_Object *upper_ic = (Evas_Object *)data;
\r
432 elm_image_file_set(upper_ic, UG_TITLE_ICON_UPPER, NULL);
\r
436 /******************************
\r
437 ** Prototype : mf_ug_cb_upper_click_cb
\r
438 ** Description : Samsung
\r
439 ** Input : void *data
\r
440 ** Evas_Object * obj
\r
441 ** void *event_info
\r
448 ** 1.Date : 2010/12/10
\r
449 ** Author : Samsung
\r
450 ** Modification : Created function
\r
452 ******************************/
\r
453 void mf_ug_cb_upper_click_cb(void *data, Evas_Object * obj, void *event_info)
\r
456 ug_mf_retm_if(data == NULL, "data is NULL");
\r
457 ugData *ugd = (ugData *)data;
\r
458 ugNaviBar *pNavi_s = mf_ug_navi_bar_get_in_use_navi(ugd);
\r
459 ug_mf_retm_if(pNavi_s == NULL, "pNavi_s is NULL");
\r
461 if (ugd->ug_Status.ug_b_NaviPushFlag) {
\r
466 if (mf_ug_fm_svc_wapper_is_root_path(ugd->ug_Status.ug_pPath)) {
\r
467 ugd->ug_Status.ug_iViewType = mf_ug_view_root;
\r
470 if (ugd->ug_Status.ug_pPath != NULL && pNavi_s->ug_pCurrentPath != NULL) {
\r
471 if (g_strcmp0(pNavi_s->ug_pCurrentPath, MF_UG_LABEL_PHONE) == 0
\r
472 || g_strcmp0(pNavi_s->ug_pCurrentPath, MF_UG_LABEL_MMC) == 0) {
\r
473 mf_ug_navi_bar_create_default_view(ugd);
\r
476 GString *new_path = NULL;
\r
477 char *file_dir = ecore_file_dir_get(pNavi_s->ug_pCurrentPath);
\r
478 if (file_dir && ugd->ug_Status.ug_iViewType != mf_ug_view_root) {
\r
479 new_path = g_string_new(file_dir);
\r
480 UG_SAFE_FREE_GSTRING(ugd->ug_Status.ug_pPath);
\r
481 ugd->ug_Status.ug_pPath = new_path;
\r
482 UG_SAFE_FREE_CHAR(pNavi_s->ug_pCurrentPath);
\r
483 pNavi_s->ug_pCurrentPath = strdup(new_path->str);
\r
487 ug_debug("file_dir is NULL");
\r
490 ugd->ug_Status.ug_pPath = g_string_new(MF_UG_LABEL_PHONE);
\r
491 pNavi_s->ug_pCurrentPath = strdup(MF_UG_LABEL_PHONE);
\r
493 mf_ug_navi_bar_create_default_view(ugd);
\r
494 mf_ug_ctrl_bar_set_item_disable(ugd);
\r
498 void mf_ug_cb_home_button_pressed_cb(void *data, Evas_Object * obj, void *event_info)
\r
501 ug_mf_retm_if(data == NULL, "data is NULL");
\r
503 Evas_Object *home_ic = (Evas_Object *)data;
\r
504 elm_image_file_set(home_ic, UG_TITLE_ICON_HOME_PRESS, NULL);
\r
507 void mf_ug_cb_home_button_unpressed_cb(void *data, Evas_Object * obj, void *event_info)
\r
510 ug_mf_retm_if(data == NULL, "data is NULL");
\r
512 Evas_Object *home_ic = (Evas_Object *)data;
\r
513 elm_image_file_set(home_ic, UG_TITLE_ICON_HOME, NULL);
\r
516 void mf_ug_cb_home_button_cb(void *data, Evas_Object * obj, void *event_info)
\r
519 ug_mf_retm_if(data == NULL, "data is NULL");
\r
520 ugData *ugd = (ugData *)data;
\r
521 ugNaviBar *pNavi_s = mf_ug_navi_bar_get_in_use_navi(ugd);
\r
522 ug_mf_retm_if(pNavi_s == NULL, "pNavi_s is NULL");
\r
524 if (ugd->ug_Status.ug_b_NaviPushFlag) {
\r
529 int storage = MF_UG_PHONE;
\r
530 ugd->ug_Status.ug_iViewType = mf_ug_view_root;
\r
532 storage = mf_ug_fm_svc_wapper_get_location(ugd->ug_Status.ug_pPath->str);
\r
535 UG_SAFE_FREE_GSTRING(ugd->ug_Status.ug_pPath);
\r
536 ugd->ug_Status.ug_pPath = g_string_new(PHONE_FOLDER);
\r
537 UG_SAFE_FREE_CHAR(pNavi_s->ug_pCurrentPath);
\r
538 pNavi_s->ug_pCurrentPath = g_strdup(PHONE_FOLDER);
\r
539 mf_ug_util_set_current_state(ugd, STATE_PHONE);
\r
542 UG_SAFE_FREE_GSTRING(ugd->ug_Status.ug_pPath);
\r
543 ugd->ug_Status.ug_pPath = g_string_new(MEMORY_FOLDER);
\r
544 UG_SAFE_FREE_CHAR(pNavi_s->ug_pCurrentPath);
\r
545 pNavi_s->ug_pCurrentPath = g_strdup(MEMORY_FOLDER);
\r
546 mf_ug_util_set_current_state(ugd, STATE_MEMORY);
\r
552 mf_ug_navi_bar_create_default_view(ugd);
\r
553 mf_ug_ctrl_bar_set_item_disable(ugd);
\r
557 /******************************
\r
558 ** Prototype : tab_callback
\r
560 ** Input : void *data
\r
561 ** Evas_Object *obj
\r
562 ** void *event_info
\r
569 ** 1.Date : 2010/12/10
\r
570 ** Author : Samsung
\r
571 ** Modification : Created function
\r
573 ******************************/
\r
574 void mf_ug_cb_tab_bar_cb(void *data, const char *path)
\r
577 ugData *ugd = (ugData *)data;
\r
578 ug_mf_retm_if(ugd == NULL, "ugd is NULL");
\r
581 const char *label = NULL;
\r
582 Evas_Object *newContent = NULL;
\r
583 Evas_Object *pNaviBar = NULL;
\r
584 ugNaviBar *pNavi_s_toshow = NULL;
\r
585 ugNaviBar *pNavi_s_inuse = NULL;
\r
587 //mf_ug_navi_bar_del_item_directly(ugd);
\r
589 Elm_Object_Item *it = NULL;
\r
590 it = (Elm_Object_Item *)event_info;
\r
591 label = elm_object_item_text_get(it);
\r
593 if (ugd->ug_Status.ug_bSettingEntry == true && ugd->ug_Status.ug_bInSettingView == true) {
\r
597 int optStorage = 0;
\r
598 optStorage = mf_ug_fm_svc_wapper_get_location(path);
\r
599 switch (optStorage) {
\r
601 label = MF_UG_LABEL_PHONE;
\r
604 label = MF_UG_LABEL_MMC;
\r
611 if (label != NULL) {
\r
612 char *rootpath = NULL;
\r
614 /*0. set the previous navi to be out of use */
\r
615 pNavi_s_inuse = mf_ug_navi_bar_get_in_use_navi(ugd);
\r
617 if (pNavi_s_inuse == NULL || pNavi_s_inuse->ug_pNaviLabel == NULL) {
\r
622 pNavi_s_inuse->ug_bNaviFlagInUse = FALSE;
\r
624 if (0 != ugd->ug_ListPlay.ug_Player) {
\r
625 mf_ug_list_play_destory_playing_file(ugd);
\r
626 UG_SAFE_FREE_CHAR(ugd->ug_ListPlay.ug_pPlayFilePath);
\r
629 /*if the muisc is playing, destory the play */
\r
631 /*1. get navi bar pointer by the label */
\r
632 pNaviBar = ugd->ug_MainWindow.ug_pNaviBar;
\r
633 pNavi_s_toshow = ug_mf_navi_bar_get_navi_from_navilist(ugd->ug_MainWindow.ug_pNaviBarList, label);
\r
635 ug_debug("label is %s", label);
\r
636 /*2. create navi bar if not created, otherwise get it by pNaviBar */
\r
637 if (pNavi_s_toshow == NULL) {
\r
638 /*2.0 get root path by storage label */
\r
639 rootpath = mf_ug_fm_svc_wapper_get_root_path_by_tab_label(label);
\r
640 if (rootpath == NULL) {
\r
644 /*2.1 create the navi for the tab */
\r
645 pNavi_s_toshow = calloc(1, sizeof(ugNaviBar));
\r
646 if (pNavi_s_toshow == NULL) {
\r
647 ug_debug("pNavi_s_toshow is NULL");
\r
653 pNavi_s_toshow->ug_bNaviFlagInUse = TRUE;
\r
654 /*2.2 set path as root path of the storage */
\r
655 pNavi_s_toshow->ug_pCurrentPath = g_strdup(rootpath);
\r
656 pNavi_s_toshow->ug_pNaviLabel = strdup(label);
\r
659 /*2.3 insert phone navi into the navi_list */
\r
660 ugd->ug_MainWindow.ug_pNaviBarList = eina_list_append(ugd->ug_MainWindow.ug_pNaviBarList, pNavi_s_toshow);
\r
663 /*/2.1 get the navi of the tab */
\r
664 pNavi_s_toshow = mf_ug_navi_bar_get_navi_struct_by_label(ugd, label);
\r
666 pNavi_s_toshow->ug_bNaviFlagInUse = TRUE;
\r
668 /*/2.2 set related status value. */
\r
669 if (ugd->ug_Status.ug_pPath != NULL) {
\r
670 g_string_free(ugd->ug_Status.ug_pPath, TRUE);
\r
671 ugd->ug_Status.ug_pPath = NULL;
\r
673 ugd->ug_Status.ug_pPath = g_string_new(pNavi_s_toshow->ug_pCurrentPath);
\r
674 ugd->ug_Status.ug_iViewType = mf_ug_view_normal;
\r
675 mf_ug_navi_bar_create_default_view(ugd);
\r
677 mf_ug_ctrl_bar_set_item_disable(ugd);
\r
679 ug_debug("Invalid argument: label is NULL\n");
\r
685 void mf_ug_cb_ctrl_bar_button_cb(void *data, Evas_Object *obj, void *event_info)
\r
689 ugData *ugd = (ugData *)data;
\r
690 ug_mf_retm_if(ugd == NULL, "ugd is NULL");
\r
691 ug_mf_retm_if(event_info == NULL, "event_info is NULL");
\r
692 const char *label = NULL;
\r
694 if (ugd->ug_Status.ug_b_NaviPushFlag)
\r
696 label = elm_object_item_text_get((Elm_Object_Item *)event_info);
\r
697 ug_mf_retm_if(label == NULL, "label is NULL");
\r
699 ugNaviBar *pNavi_s = mf_ug_navi_bar_get_in_use_navi(ugd);
\r
700 if (g_strcmp0(label, MF_UG_LABEL_RINGTONES) == 0) {
\r
701 if (g_strcmp0(ugd->ug_Status.ug_pPath->str, UG_RINGTION_PATH) != 0) {
\r
702 UG_SAFE_FREE_GSTRING(ugd->ug_Status.ug_pPath);
\r
703 ugd->ug_Status.ug_pPath = g_string_new(UG_RINGTION_PATH);
\r
704 UG_SAFE_FREE_CHAR(pNavi_s->ug_pCurrentPath);
\r
705 pNavi_s->ug_pCurrentPath = g_strdup(UG_RINGTION_PATH);
\r
706 mf_ug_util_set_current_state(ugd, STATE_PHONE);
\r
707 ugd->ug_Status.ug_iCtrlBarType = CTRL_BAR_MUSIC;
\r
708 mf_ug_navi_bar_create_default_view(ugd);
\r
710 } else if (g_strcmp0(label, MF_UG_LABEL_OTHER_MUSIC) == 0) {
\r
711 if (g_strcmp0(ugd->ug_Status.ug_pPath->str, UG_MUSIC_PATH) != 0) {
\r
712 UG_SAFE_FREE_GSTRING(ugd->ug_Status.ug_pPath);
\r
713 ugd->ug_Status.ug_pPath = g_string_new(UG_MUSIC_PATH);
\r
714 UG_SAFE_FREE_CHAR(pNavi_s->ug_pCurrentPath);
\r
715 pNavi_s->ug_pCurrentPath = g_strdup(UG_MUSIC_PATH);
\r
716 mf_ug_util_set_current_state(ugd, STATE_PHONE);
\r
717 ugd->ug_Status.ug_iCtrlBarType = CTRL_BAR_RINGTONE;
\r
718 mf_ug_navi_bar_create_default_view(ugd);
\r
724 /******************************
\r
725 ** Prototype : mf_ug_cb_list_play_cb
\r
726 ** Description : Samsung
\r
727 ** Input : ugListItemData *data
\r
728 ** Evas_Object *obj
\r
729 ** void *event_info
\r
736 ** 1.Date : 2010/12/10
\r
737 ** Author : Samsung
\r
738 ** Modification : Created function
\r
740 ******************************/
\r
741 void mf_ug_cb_list_play_cb(ugListItemData *data, Evas_Object *obj, void *event_info)
\r
744 ugListItemData *itemData = data;
\r
745 ugData *ugd = NULL;
\r
746 ug_mf_retm_if(itemData == NULL, "itemData is NULL");
\r
747 ug_mf_retm_if(itemData->ug_pData == NULL, "ug_pData is NULL");
\r
749 ugd = itemData->ug_pData;
\r
751 if (itemData->ug_pData->ug_Status.ug_b_NaviPushFlag)
\r
754 mf_ug_list_play_play_music_item(itemData);
\r
759 /******************************
\r
760 ** Prototype : mf_ug_cb_select_info_show_cb
\r
761 ** Description : Samsung
\r
762 ** Input : void *data
\r
764 ** Evas_Object *obj
\r
765 ** void *event_info
\r
772 ** 1.Date : 2010/12/10
\r
773 ** Author : Samsung
\r
774 ** Modification : Created function
\r
776 ******************************/
\r
777 void mf_ug_cb_select_info_show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
\r
780 ugData *ugd = (ugData *)data;
\r
781 ug_mf_retm_if(ugd == NULL, "ugd is NULL");
\r
782 edje_object_signal_emit(_EDJ(ugd->ug_MainWindow.ug_pMainLayout), "elm,state,show,default", "elm");
\r
787 /******************************
\r
788 ** Prototype : mf_ug_cb_select_info_hide_cb
\r
789 ** Description : Samsung
\r
790 ** Input : void *data
\r
792 ** Evas_Object *obj
\r
793 ** void *event_info
\r
800 ** 1.Date : 2010/12/10
\r
801 ** Author : Samsung
\r
802 ** Modification : Created function
\r
804 ******************************/
\r
805 void mf_ug_cb_select_info_hide_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
\r
808 ugData *ugd = (ugData *)data;
\r
809 ug_mf_retm_if(ugd == NULL, "ugd is NULL");
\r
810 edje_object_signal_emit(_EDJ(ugd->ug_MainWindow.ug_pMainLayout), "elm,state,hide,default", "elm");
\r
815 /******************************
\r
816 ** Prototype : mf_ug_cb_select_info_timeout_cb
\r
817 ** Description : Samsung
\r
818 ** Input : void *data
\r
819 ** Evas_Object *obj
\r
820 ** void *event_info
\r
827 ** 1.Date : 2010/12/10
\r
828 ** Author : Samsung
\r
829 ** Modification : Created function
\r
831 ******************************/
\r
832 void mf_ug_cb_select_info_timeout_cb(void *data, Evas_Object *obj, void *event_info)
\r
835 ugData *ugd = (ugData *)data;
\r
836 ug_mf_retm_if(ugd == NULL, "ugd is NULL");
\r
837 edje_object_signal_emit(_EDJ(ugd->ug_MainWindow.ug_pMainLayout), "elm,state,hide,default", "elm");
\r
843 /******************************
\r
844 ** Prototype : mf_ug_cb_mmc_changed_cb
\r
845 ** Description : Samsung
\r
846 ** Input : keynode_t *key
\r
854 ** 1.Date : 2010/12/10
\r
855 ** Author : Samsung
\r
856 ** Modification : Created function
\r
858 ******************************/
\r
859 static void __mf_ug_cb_mmc_remove_view_operation(void *data)
\r
862 ugData *ugd = (ugData *)data;
\r
863 ug_mf_retm_if(ugd == NULL, "ugd is NULL");
\r
865 Evas_Object *parent = NULL;
\r
866 const char *labelStorage = NULL;
\r
867 parent = ugd->ug_MainWindow.ug_pNaviGenlist;
\r
868 labelStorage = MEMORY_FOLDER;
\r
870 mf_ug_genlist_item_remove(parent, labelStorage);
\r
874 void mf_ug_cb_mmc_changed_cb(keynode_t *key, void *data)
\r
877 ugData *ugd = (ugData *)data;
\r
878 ug_mf_retm_if(ugd == NULL, "ugd is NULL");
\r
879 ug_mf_retm_if(ugd->ug_Status.ug_pPath == NULL || ugd->ug_Status.ug_pPath->str == NULL, "ugd->ug_Status.ug_pPath is NULL");
\r
881 int optStorage = MF_UG_NONE;
\r
882 char *labelStorage = NULL;
\r
884 if (VCONF_TYPE_INT == vconf_keynode_get_type(key)
\r
885 && VCONFKEY_SYSMAN_MMC_MOUNTED == vconf_keynode_get_int(key)) {
\r
886 if (ugd->ug_Status.ug_bInSettingView && ugd->ug_Status.ug_bSettingEntry) {
\r
887 ugd->ug_Status.ug_iMmcFlag = MMC_ON;
\r
890 ugd->ug_Status.ug_iMmcFlag = MMC_ON;
\r
892 mf_ug_util_storage_insert_action(ugd, MF_UG_LABEL_MMC);
\r
894 ugNaviBar *pNaviInUseStruct = NULL;
\r
896 if (VCONFKEY_SYSMAN_MMC_REMOVED == vconf_keynode_get_int(key)
\r
897 || VCONFKEY_SYSMAN_MMC_INSERTED_NOT_MOUNTED == vconf_keynode_get_int(key)) {
\r
898 ug_debug("mmc removed");
\r
899 if (ugd->ug_Status.ug_bInSettingView && ugd->ug_Status.ug_bSettingEntry) {
\r
900 ugd->ug_Status.ug_iMmcFlag = MMC_OFF;
\r
903 optStorage = MF_UG_MMC;
\r
904 ugd->ug_Status.ug_iMmcFlag = MMC_OFF;
\r
907 if (optStorage == MF_UG_NONE) {
\r
908 ug_debug("get removed storage failed");
\r
912 labelStorage = MF_UG_LABEL_MMC;
\r
914 if (ugd->ug_Status.ug_iViewType == mf_ug_view_root) {
\r
915 if (mf_ug_fm_svc_wapper_get_location(ugd->ug_Status.ug_pPath->str) != optStorage) {
\r
916 mf_ug_navi_bar_remove_navi_list_item_by_label(ugd, labelStorage);
\r
917 __mf_ug_cb_mmc_remove_view_operation(ugd);
\r
919 if (0 != ugd->ug_ListPlay.ug_Player) {
\r
920 mf_ug_list_play_destory_playing_file(ugd);
\r
921 UG_SAFE_FREE_CHAR(ugd->ug_ListPlay.ug_pPlayFilePath);
\r
924 mf_ug_navi_bar_remove_navi_list_item_by_label(ugd, labelStorage);
\r
925 pNaviInUseStruct = mf_ug_navi_bar_get_in_use_navi(ugd);
\r
926 mf_ug_navi_bar_refresh_navibar_recovered_view(ugd, pNaviInUseStruct);
\r
930 if (mf_ug_fm_svc_wapper_get_location(ugd->ug_Status.ug_pPath->str) == optStorage) {
\r
931 if (0 != ugd->ug_ListPlay.ug_Player) {
\r
932 mf_ug_list_play_destory_playing_file(ugd);
\r
933 UG_SAFE_FREE_CHAR(ugd->ug_ListPlay.ug_pPlayFilePath);
\r
936 mf_ug_navi_bar_remove_navi_list_item_by_label(ugd, labelStorage);
\r
937 pNaviInUseStruct = mf_ug_navi_bar_get_in_use_navi(ugd);
\r
938 ug_debug("label is [%s]pNaviInUseStruct->ug_pCurrentPath is [%s]", pNaviInUseStruct->ug_pNaviLabel, pNaviInUseStruct->ug_pCurrentPath);
\r
939 mf_ug_navi_bar_refresh_navibar_recovered_view(ugd, pNaviInUseStruct);
\r
945 mf_ug_navi_bar_title_set(ugd);
\r
951 /******************************
\r
952 ** Prototype : mf_ug_cb_dir_update_cb
\r
953 ** Description : Samsung
\r
954 ** Input : mf_ug_inotify_event event
\r
963 ** 1.Date : 2010/12/10
\r
964 ** Author : Samsung
\r
965 ** Modification : Created function
\r
967 ******************************/
\r
968 void mf_ug_cb_dir_update_cb(mf_ug_inotify_event event, char *name, void *data)
\r
971 ugData *ugd = (ugData *)data;
\r
972 ug_mf_retm_if(ugd == NULL, "ugData is NULL");
\r
974 ug_debug("event : %d, name : %s", event, name);
\r
976 ug_dir_event_t buffer;
\r
978 buffer.event = event;
\r
979 buffer.name = strdup(name);
\r
981 ecore_pipe_write(ugd->ug_UiGadget.ug_pInotifyPipe, &buffer, sizeof(buffer));
\r
987 /******************************
\r
988 ** Prototype : mf_ug_cb_dir_pipe_cb
\r
989 ** Description : Samsung
\r
990 ** Input : void *data
\r
992 ** unsigned int nbyte
\r
999 ** 1.Date : 2010/12/10
\r
1000 ** Author : Samsung
\r
1001 ** Modification : Created function
\r
1003 ******************************/
\r
1004 static GString *__mf_ug_cb_dir_pipe_get_parent(GString *path)
\r
1007 ug_mf_retvm_if(path == NULL, NULL, "path is NULL");
\r
1008 ug_mf_retvm_if(path->str == NULL, NULL, "path->str is NULL");
\r
1010 if (ecore_file_exists(path->str)) {
\r
1012 } else if (mf_ug_fm_svc_wapper_is_root_path(path)) {
\r
1015 GString *parent = mf_ug_fm_svc_wrapper_get_file_parent_path(path);
\r
1016 UG_SAFE_FREE_GSTRING(path);
\r
1017 __mf_ug_cb_dir_pipe_get_parent(parent);
\r
1022 void mf_ug_cb_dir_pipe_cb(void *data, void *buffer, unsigned int nbyte)
\r
1025 ugData *ugd = (ugData *)data;
\r
1026 ug_mf_retm_if(ugd == NULL, "ugd is NULL");
\r
1029 if (ugd->ug_ListPlay.ug_iPlayState != PLAY_STATE_INIT) {
\r
1032 if (ugd->ug_Status.ug_iViewType == mf_ug_view_root) {
\r
1036 if (g_strcmp0(ugd->ug_Status.monitor_path, ugd->ug_Status.ug_pPath->str)) {
\r
1040 ug_dir_event_t *msg = (ug_dir_event_t *) buffer;
\r
1041 ug_debug("event : %d, name : %s", msg->event, msg->name);
\r
1043 Evas_Object *newContent = NULL;
\r
1044 ugListItemData *itemData = NULL;
\r
1045 Elm_Object_Item *it = NULL;
\r
1046 GString *parent = NULL;
\r
1047 char *path = NULL;
\r
1050 switch (msg->event) {
\r
1051 case UG_MF_INOTI_CREATE:
\r
1052 case UG_MF_INOTI_MOVE_IN:
\r
1053 /*/1 TODO: add new item to list */
\r
1055 path = g_strconcat(ugd->ug_Status.ug_pPath->str, "/", msg->name, NULL);
\r
1056 int file_type = 0;
\r
1057 if (mf_ug_file_attr_is_dir(path)) {
\r
1058 file_type = UG_FILE_TYPE_DIR;
\r
1060 file_type = UG_FILE_TYPE_FILE;
\r
1062 ugFsNodeInfo *pNode = mf_ug_util_generate_pnode(path, file_type);
\r
1063 if (ugd->ug_MainWindow.ug_pNaviGenlist == NULL) {
\r
1065 Evas_Object *genlist = NULL;
\r
1066 genlist = elm_genlist_add(ugd->ug_MainWindow.ug_pNaviBar);
\r
1067 evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
\r
1068 evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
\r
1070 ugd->ug_MainWindow.ug_pNaviGenlist = genlist;
\r
1071 evas_object_smart_callback_add(genlist, "selected", mf_ug_genlist_selected_gl, ugd);
\r
1073 evas_object_del(elm_object_part_content_unset(ugd->ug_MainWindow.ug_pNaviLayout, "part1"));
\r
1075 elm_object_part_content_set(ugd->ug_MainWindow.ug_pNaviLayout, "part1", newContent);
\r
1076 elm_object_part_content_set(ugd->ug_MainWindow.ug_pNaviLayout, "part1", genlist);
\r
1078 if (file_type == UG_FILE_TYPE_DIR) {
\r
1079 if (ugd->ug_UiGadget.ug_iSelectMode == MULTI_FILE_MODE ||
\r
1080 ugd->ug_UiGadget.ug_iSelectMode == SINGLE_FILE_MODE ||
\r
1081 ugd->ug_UiGadget.ug_iSelectMode == IMPORT_MODE ||
\r
1082 ugd->ug_UiGadget.ug_iSelectMode == EXPORT_MODE ||
\r
1083 ugd->ug_UiGadget.ug_iSelectMode == SAVE_MODE ||
\r
1084 ugd->ug_UiGadget.ug_iSelectMode == IMPORT_SINGLE) {
\r
1086 mf_ug_genlist_item_append(ugd->ug_MainWindow.ug_pNaviGenlist, pNode, ugd, 0, &ugd->ug_Status.ug_normalitc);
\r
1088 int groupValue = elm_genlist_items_count(ugd->ug_MainWindow.ug_pNaviGenlist);
\r
1089 mf_ug_genlist_item_append(ugd->ug_MainWindow.ug_pNaviGenlist, pNode, ugd, groupValue, &ugd->ug_Status.ug_itc);
\r
1092 if (ugd->ug_UiGadget.ug_iSelectMode == SINGLE_ALL_MODE || ugd->ug_UiGadget.ug_iSelectMode == SINGLE_FILE_MODE) {
\r
1093 int groupValue = elm_genlist_items_count(ugd->ug_MainWindow.ug_pNaviGenlist);
\r
1094 mf_ug_genlist_item_append(ugd->ug_MainWindow.ug_pNaviGenlist, pNode, ugd, groupValue, &ugd->ug_Status.ug_itc);
\r
1095 } else if (ugd->ug_UiGadget.ug_iSelectMode == EXPORT_MODE || ugd->ug_UiGadget.ug_iSelectMode == SAVE_MODE) {
\r
1096 mf_ug_genlist_item_append(ugd->ug_MainWindow.ug_pNaviGenlist, pNode, ugd, 0, &ugd->ug_Status.ug_normalitc);
\r
1098 mf_ug_genlist_item_append(ugd->ug_MainWindow.ug_pNaviGenlist, pNode, ugd, 0, &ugd->ug_Status.ug_itc);
\r
1103 if (pNode != NULL) {
\r
1104 UG_SAFE_FREE_CHAR(pNode->ext);
\r
1110 case UG_MF_INOTI_DELETE:
\r
1111 case UG_MF_INOTI_MOVE_OUT:
\r
1112 /*/1 TODO: remove item from list */
\r
1113 path = g_strconcat(ugd->ug_Status.ug_pPath->str, "/", msg->name, NULL);
\r
1114 it = elm_genlist_first_item_get(ugd->ug_MainWindow.ug_pNaviGenlist);
\r
1116 itemData = elm_object_item_data_get(it);
\r
1117 if (itemData->ug_pItemName == NULL || itemData->ug_pItemName->str == NULL) {
\r
1121 if (g_strcmp0(path, itemData->ug_pItemName->str) == 0) {
\r
1122 elm_object_item_del(it);
\r
1126 it = elm_genlist_item_next_get(it);
\r
1128 count = elm_genlist_items_count(ugd->ug_MainWindow.ug_pNaviGenlist);
\r
1129 ugd->ug_Status.ug_bNoContentFlag = !count;
\r
1132 case UG_MF_INOTI_MODIFY:
\r
1133 /*/1 TODO: update item in list */
\r
1134 ugd->ug_MainWindow.ug_pNaviGenlist = newContent = mf_ug_genlist_create_content_list_view(ugd);
\r
1135 mf_ug_navi_bar_set_new_content(ugd->ug_MainWindow.ug_pNaviLayout, newContent);
\r
1137 case UG_MF_INOTI_DELETE_SELF:
\r
1138 case UG_MF_INOTI_MOVE_SELF:
\r
1139 /*/1 TODO: watching directory is removed, change current directory. */
\r
1141 GString *current = NULL;
\r
1142 current = g_string_new(ugd->ug_Status.ug_pPath->str);
\r
1143 parent = __mf_ug_cb_dir_pipe_get_parent(current);
\r
1145 ugNaviBar *pNavi_s = mf_ug_navi_bar_get_in_use_navi(ugd);
\r
1148 g_string_free(ugd->ug_Status.ug_pPath, TRUE);
\r
1149 ugd->ug_Status.ug_pPath = NULL;
\r
1150 ugd->ug_Status.ug_pPath = parent;
\r
1152 if (pNavi_s->ug_pCurrentPath != NULL) {
\r
1153 free(pNavi_s->ug_pCurrentPath);
\r
1154 pNavi_s->ug_pCurrentPath = NULL;
\r
1156 pNavi_s->ug_pCurrentPath = g_strdup(parent->str);
\r
1160 mf_ug_navi_bar_create_default_view(ugd);
\r
1164 ug_mf_error("Unknown event");
\r
1167 mf_ug_ctrl_bar_set_item_disable(ugd);
\r
1177 #ifdef UG_THUMB_REAL_TIME_UPDATE
\r
1178 Eina_Bool mf_ug_cb_thumb_timer_cb(void *data)
\r
1180 ugListItemData *itemData = (ugListItemData *)data;
\r
1181 ug_mf_retvm_if(itemData == NULL, EINA_FALSE, "input params is NULL");
\r
1182 ugData *ugd = (ugData *)itemData->ug_pData;
\r
1183 ug_mf_retvm_if(ugd == NULL, EINA_FALSE, "ugd is NULL");
\r
1185 bool allright_flag = true;
\r
1186 Evas_Object *pContent = NULL;
\r
1188 if (ugd->ug_Status.ug_pThumbUpdateTimer == NULL) {
\r
1189 return EINA_FALSE;
\r
1192 /****read the realized part of the list****/
\r
1193 if (itemData->ug_pItem) {
\r
1194 pContent = elm_object_item_widget_get(itemData->ug_pItem);
\r
1195 if (pContent == NULL) {
\r
1196 ugd->ug_Status.ug_pThumbUpdateTimer = NULL;
\r
1197 return EINA_FALSE;
\r
1200 ugd->ug_Status.ug_pThumbUpdateTimer = NULL;
\r
1201 return EINA_FALSE;
\r
1203 Eina_List *realized_list = elm_genlist_realized_items_get(pContent);
\r
1204 Eina_List *list = NULL;
\r
1205 Elm_Object_Item *it;
\r
1206 ugListItemData *item_data = NULL;
\r
1208 if (realized_list == NULL) {
\r
1209 allright_flag = false;
\r
1212 EINA_LIST_FOREACH(realized_list, list, it) {
\r
1213 item_data = (ugListItemData *)elm_object_item_data_get(it);
\r
1214 if (item_data == NULL)
\r
1217 if (item_data->ug_bRealThumbFlag == false) {
\r
1218 ug_debug("Update item: %s", item_data->ug_pItemName->str);
\r
1219 if (ecore_file_is_dir(item_data->ug_pItemName->str) == true) {
\r
1220 item_data->ug_pThumbPath = strdup(UG_ICON_FOLDER);
\r
1221 item_data->ug_bRealThumbFlag = true;
\r
1222 elm_object_item_data_set(it, item_data);
\r
1223 elm_genlist_item_update(it);
\r
1225 } else if (ecore_file_exists(item_data->ug_pItemName->str)) {
\r
1226 char *new_thumb = NULL;
\r
1227 int thumbnail_type = 0;
\r
1228 thumbnail_type = mf_ug_file_attr_get_file_icon(item_data->ug_pItemName->str, NULL, &new_thumb);
\r
1230 if (thumbnail_type == MF_UG_THUMBNAIL_TYPE_DEFAULT) {
\r
1231 if (item_data->ug_pThumbPath && g_strcmp0(new_thumb, item_data->ug_pThumbPath) == 0) {
\r
1232 allright_flag = FALSE;
\r
1234 if (item_data->ug_pThumbPath) {
\r
1235 free(item_data->ug_pThumbPath);
\r
1236 item_data->ug_pThumbPath = NULL;
\r
1238 item_data->ug_pThumbPath = strdup(new_thumb);
\r
1239 item_data->ug_bRealThumbFlag = TRUE;
\r
1240 elm_object_item_data_set(it, item_data);
\r
1241 elm_genlist_item_update(it);
\r
1247 if (item_data->ug_pThumbPath) {
\r
1248 free(item_data->ug_pThumbPath);
\r
1249 item_data->ug_pThumbPath = NULL;
\r
1251 item_data->ug_pThumbPath = strdup(new_thumb);
\r
1252 item_data->ug_bRealThumbFlag = TRUE;
\r
1253 elm_object_item_data_set(it, item_data);
\r
1254 elm_genlist_item_update(it);
\r
1259 allright_flag = false;
\r
1265 if (allright_flag == false) {
\r
1268 ugd->ug_Status.ug_pThumbUpdateTimer = NULL;
\r
1269 return EINA_FALSE;
\r
1274 void mf_ug_cb_create_new_folder(void *data, Evas_Object * obj, void *event_info)
\r
1277 ug_mf_retm_if(data == NULL, "data is NULL");
\r
1279 ugData *ugd = (ugData *)data;
\r
1280 UG_SAFE_FREE_OBJ(ugd->ug_MainWindow.ug_pContextPopup);
\r
1282 if (ugd->ug_Status.ug_b_NaviPushFlag) {
\r
1287 if (ugd->ug_Status.ug_iMore == UG_MORE_CREATE_FOLDER)
\r
1291 ugd->ug_Status.ug_iMore = UG_MORE_CREATE_FOLDER;
\r
1293 ret = mf_ug_util_check_disk_space(ugd);
\r
1294 if (ret == MYFILE_ERR_NO_FREE_SPACE) {
\r
1295 ugd->ug_Status.ug_iMore = UG_MORE_DEFAULT;
\r
1298 #ifdef UG_THUMB_REAL_TIME_UPDATE
\r
1299 if (ugd->ug_Status.ug_pThumbUpdateTimer != NULL) {
\r
1300 ecore_timer_del(ugd->ug_Status.ug_pThumbUpdateTimer);
\r
1301 ugd->ug_Status.ug_pThumbUpdateTimer = NULL;
\r
1304 mf_ug_navi_bar_create_new_folder_view(ugd);
\r
1308 void mf_ug_cb_warning_popup_cb(void *data, Evas_Object * obj, void *event_info)
\r
1311 ug_mf_retm_if(data == NULL, "data is NULL");
\r
1312 ugData *ugd = (ugData *)data;
\r
1314 Evas_Object *btn = (Evas_Object *)obj;
\r
1315 const char *label = elm_object_text_get(btn);
\r
1317 if (g_strcmp0(label, MF_UG_LABEL_OK) == 0 ) {
\r
1318 evas_object_del(ugd->ug_MainWindow.ug_pNormalPopup);
\r
1319 ugd->ug_MainWindow.ug_pNormalPopup = NULL;
\r
1323 void mf_ug_cb_reach_max_len_cb(void *data, Evas_Object * obj, void *event_info)
\r
1326 ug_mf_retm_if(data == NULL, "data is NULL");
\r
1327 ugData *ugd = (ugData *)data;
\r
1328 mf_ug_popup_indicator_popup(MF_UG_LABEL_MAX_CHARACTER_REACHED);
\r
1333 void mf_ug_cb_eraser_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
\r
1335 elm_entry_entry_set(data, "");
\r
1338 void mf_ug_cb_cancel_new_folder_cb(void *data, Evas_Object * obj, void *event_info)
\r
1341 ug_mf_retm_if(data == NULL, "data is NULL");
\r
1342 ugData *ugd = (ugData *)data;
\r
1344 ugd->ug_Status.ug_iMore = UG_MORE_DEFAULT;
\r
1345 ecore_imf_context_input_panel_hide(elm_entry_imf_context_get(ugd->ug_MainWindow.ug_pEntry));
\r
1346 evas_object_del(ugd->ug_MainWindow.ug_pEntry);
\r
1348 Evas_Object *btn = NULL;
\r
1349 btn = elm_object_item_part_content_unset(ugd->ug_MainWindow.ug_pNaviItem, TITLE_RIGHT_BTN);
\r
1350 UG_SAFE_FREE_OBJ(btn);
\r
1351 btn = elm_object_item_part_content_unset(ugd->ug_MainWindow.ug_pNaviItem, TITLE_LEFT_BTN);
\r
1352 UG_SAFE_FREE_OBJ(btn);
\r
1354 mf_ug_navi_bar_create_default_view(ugd);
\r
1355 mf_ug_ctrl_bar_set_item_disable(ugd);
\r
1358 static int __mf_cb_imk_cancel_cb(void *data)
\r
1361 ug_mf_retvm_if(data == NULL, false, "data is NULL");
\r
1362 ugData *ugd = (ugData *)data;
\r
1364 mf_ug_cb_cancel_new_folder_cb(ugd, NULL, NULL);
\r
1365 ugd->ug_Status.popup_del_idler = NULL;
\r
1370 static void __mf_ug_cb_illegal_char_popup_cb(void *data, Evas_Object * obj, void *event_info)
\r
1373 ug_mf_retm_if(data == NULL, "data is NULL");
\r
1374 ugData *ugd = (ugData *)data;
\r
1376 Evas_Object *btn = (Evas_Object *)obj;
\r
1377 const char *label = elm_object_text_get(btn);
\r
1379 if (g_strcmp0(label, MF_UG_LABEL_YES) == 0 ) {
\r
1380 UG_SAFE_FREE_OBJ(ugd->ug_MainWindow.ug_pNormalPopup);
\r
1382 Evas_Object *entry = ugd->ug_MainWindow.ug_pEntry;
\r
1383 if (entry != NULL)
\r
1384 elm_object_focus_set(entry, EINA_TRUE);
\r
1386 } else if (g_strcmp0(label, MF_UG_LABEL_NO) == 0 ) {
\r
1387 UG_SAFE_FREE_OBJ(ugd->ug_MainWindow.ug_pNormalPopup);
\r
1388 ugd->ug_Status.popup_del_idler = ecore_idler_add((Ecore_Task_Cb) __mf_cb_imk_cancel_cb, ugd);
\r
1393 static int __mf_ug_cb_ime_mkdir_cb(void *data, char *fileName)
\r
1396 ugData *ugd = (ugData *)data;
\r
1398 ug_mf_retvm_if(ugd == NULL, MYFILE_ERR_SRC_ARG_INVALID, "ugd is NULL");
\r
1399 ug_mf_retvm_if(fileName == NULL, MYFILE_ERR_SRC_ARG_INVALID, "data is NULL");
\r
1400 ug_mf_retvm_if(ugd->ug_Status.ug_pPath == NULL, MYFILE_ERR_SRC_ARG_INVALID, "ugd is NULL");
\r
1401 ug_mf_retvm_if(ugd->ug_Status.ug_pPath->str == NULL, MYFILE_ERR_SRC_ARG_INVALID, "ugd is NULL");
\r
1405 const char *message = NULL;
\r
1406 const char *left_label = NULL;
\r
1407 const char *right_label = NULL;
\r
1409 left_label = MF_UG_LABEL_YES;
\r
1410 right_label = MF_UG_LABEL_NO;
\r
1411 if (strlen(fileName)) {
\r
1413 GString *fullpathdir = g_string_new(ugd->ug_Status.ug_pPath->str);
\r
1415 if (fullpathdir == NULL) {
\r
1416 mf_ug_util_operation_alloc_failed(ugd);
\r
1417 return MYFILE_ERR_ALLOCATE_MEMORY_FAIL;
\r
1419 GString *fullpathname = g_string_new(fileName);
\r
1421 if (fullpathname == NULL) {
\r
1422 g_string_free(fullpathdir, TRUE);
\r
1423 fullpathdir = NULL;
\r
1424 mf_ug_util_operation_alloc_failed(ugd);
\r
1425 return MYFILE_ERR_ALLOCATE_MEMORY_FAIL;
\r
1427 /*check the space */
\r
1428 gchar *test_space = g_strdup(fileName);
\r
1429 if (test_space == NULL) {
\r
1430 g_string_free(fullpathdir, TRUE);
\r
1431 fullpathdir = NULL;
\r
1432 g_string_free(fullpathname, TRUE);
\r
1433 fullpathname = NULL;
\r
1434 mf_ug_util_operation_alloc_failed(ugd);
\r
1435 return MYFILE_ERR_ALLOCATE_MEMORY_FAIL;
\r
1437 if (strlen(g_strchug(test_space)) == 0) {
\r
1438 message = MF_UG_LABEL_NAME_INVALID; /*TODO */
\r
1439 ugd->ug_MainWindow.ug_pNormalPopup = mf_ug_popup_create(ugd, UG_POPMODE_TEXT_TWO_BTN, NULL, message,
\r
1440 left_label, right_label, NULL,
\r
1441 __mf_ug_cb_illegal_char_popup_cb, ugd);
\r
1443 g_string_free(fullpathdir, TRUE);
\r
1444 fullpathdir = NULL;
\r
1445 g_string_free(fullpathname, TRUE);
\r
1446 fullpathname = NULL;
\r
1447 g_free(test_space);
\r
1448 test_space = NULL;
\r
1449 return MYFILE_ERR_DIR_CREATE_FAIL;
\r
1452 g_free(test_space);
\r
1453 test_space = NULL;
\r
1455 /*check if input name is valid */
\r
1456 if (mf_ug_file_attr_is_valid_name(fullpathname->str) == MYFILE_ERR_INVALID_FILE_NAME) {
\r
1458 message = MF_UG_LABEL_ILLEGAL_CHAR;
\r
1459 ugd->ug_MainWindow.ug_pNormalPopup = mf_ug_popup_create(ugd, UG_POPMODE_TEXT_TWO_BTN, NULL, message,
\r
1460 left_label, right_label, NULL,
\r
1461 __mf_ug_cb_illegal_char_popup_cb, ugd);
\r
1462 g_string_free(fullpathdir, TRUE);
\r
1463 fullpathdir = NULL;
\r
1464 g_string_free(fullpathname, TRUE);
\r
1465 fullpathname = NULL;
\r
1467 return MYFILE_ERR_DIR_CREATE_FAIL;
\r
1470 GString *fullpath = NULL;
\r
1471 char *temp_fullpath = g_strconcat(fullpathdir->str, "/", fullpathname->str, NULL);
\r
1472 if (temp_fullpath) {
\r
1473 fullpath = g_string_new(temp_fullpath);
\r
1475 free(temp_fullpath);
\r
1476 temp_fullpath = NULL;
\r
1477 if (fullpath == NULL) {
\r
1478 g_string_free(fullpathdir, TRUE);
\r
1479 fullpathdir = NULL;
\r
1480 g_string_free(fullpathname, TRUE);
\r
1481 fullpathname = NULL;
\r
1482 mf_ug_util_operation_alloc_failed(ugd);
\r
1483 return MYFILE_ERR_ALLOCATE_MEMORY_FAIL;
\r
1486 g_string_free(fullpathdir, TRUE);
\r
1487 fullpathdir = NULL;
\r
1488 g_string_free(fullpathname, TRUE);
\r
1489 fullpathname = NULL;
\r
1490 return MYFILE_ERR_ALLOCATE_MEMORY_FAIL;
\r
1493 /*check whether DIR name is override(DIR name has no extention) */
\r
1494 /*check whether path length is override */
\r
1495 if ((strlen(fullpathdir->str) + strlen(fullpathname->str)) > MYFILE_FILE_PATH_LEN_MAX) {
\r
1497 message = MF_UG_LABEL_PATH_REACH_MAX_LEN;
\r
1498 ugd->ug_MainWindow.ug_pNormalPopup = mf_ug_popup_create(ugd, UG_POPMODE_TEXT_TWO_BTN, NULL, message,
\r
1499 left_label, right_label, NULL,
\r
1500 __mf_ug_cb_illegal_char_popup_cb, ugd);
\r
1501 g_string_free(fullpathdir, TRUE);
\r
1502 fullpathdir = NULL;
\r
1503 g_string_free(fullpathname, TRUE);
\r
1504 fullpathname = NULL;
\r
1505 ret = MYFILE_ERR_DIR_CREATE_FAIL;
\r
1507 /*check if duplicated name */
\r
1508 else if (mf_ug_file_attr_is_duplicated_name(ugd->ug_Status.ug_pPath->str, fileName) == MYFILE_ERR_DUPLICATED_NAME) {
\r
1509 message = MF_UG_LABEL_DUP_NAME;
\r
1510 ugd->ug_MainWindow.ug_pNormalPopup = mf_ug_popup_create(ugd, UG_POPMODE_TEXT_TWO_BTN, NULL, message,
\r
1511 left_label, right_label, NULL,
\r
1512 __mf_ug_cb_illegal_char_popup_cb, ugd);
\r
1514 g_string_free(fullpathdir, TRUE);
\r
1515 fullpathdir = NULL;
\r
1516 g_string_free(fullpathname, TRUE);
\r
1517 fullpathname = NULL;
\r
1518 ret = MYFILE_ERR_DIR_CREATE_FAIL;
\r
1520 /*check if DIR name is all spaces */
\r
1522 ret = mf_ug_fm_svc_wrapper_create_service(ugd, fullpath);
\r
1523 /*check whether operate on read only area */
\r
1524 if (errno == EROFS) {
\r
1525 message = MF_UG_LABEL_OPER_READ_ONLY;
\r
1526 ugd->ug_MainWindow.ug_pNormalPopup = mf_ug_popup_create(ugd, UG_POPMODE_TEXT, NULL, message, NULL, NULL, NULL, NULL, NULL);
\r
1527 ret = MYFILE_ERR_DIR_CREATE_FAIL;
\r
1529 message = MF_UG_LABEL_CREATE_DIR_FAILED;
\r
1530 ugd->ug_MainWindow.ug_pNormalPopup = mf_ug_popup_create(ugd, UG_POPMODE_TEXT, NULL, message, NULL, NULL, NULL, NULL, NULL);
\r
1533 g_string_free(fullpathdir, TRUE);
\r
1534 fullpathdir = NULL;
\r
1535 g_string_free(fullpathname, TRUE);
\r
1536 fullpathname = NULL;
\r
1537 g_string_free(fullpath, TRUE);
\r
1542 message = MF_UG_LABEL_EMPTY_FOLDER_NAME;
\r
1544 ugd->ug_MainWindow.ug_pNormalPopup = mf_ug_popup_create(ugd, UG_POPMODE_TEXT_TWO_BTN, NULL, message,
\r
1545 left_label, right_label, NULL,
\r
1546 __mf_ug_cb_illegal_char_popup_cb, ugd);
\r
1547 ret = MYFILE_ERR_DIR_CREATE_FAIL;
\r
1553 void mf_ug_cb_save_cb(void *data, Evas_Object *obj, void *event_info)
\r
1556 ug_mf_retm_if(data == NULL, "data is NULL");
\r
1557 ugData *ugd = (ugData *)data;
\r
1559 if (ugd->ug_Status.ug_b_NaviPushFlag) {
\r
1565 const char *message = NULL;
\r
1566 const char *left_label = NULL;
\r
1567 const char *right_label = NULL;
\r
1569 if (ugd->ug_Status.ug_iMore == UG_MORE_CREATE_FOLDER) {
\r
1570 const char *entry_data = NULL;
\r
1571 char *name = NULL;
\r
1574 if (ugd->ug_MainWindow.ug_pEntry != NULL) {
\r
1575 Ecore_IMF_Context *imf_context = elm_entry_imf_context_get(ugd->ug_MainWindow.ug_pEntry);
\r
1576 if (imf_context != NULL)
\r
1577 ecore_imf_context_hide(imf_context);
\r
1580 entry_data = elm_entry_entry_get(ugd->ug_MainWindow.ug_pEntry);
\r
1583 name = elm_entry_markup_to_utf8(entry_data);
\r
1585 message = MF_UG_LABEL_GET_NAME_FAILED;
\r
1586 left_label = MF_UG_LABEL_YES;
\r
1587 right_label = MF_UG_LABEL_NO;
\r
1588 ugd->ug_MainWindow.ug_pNormalPopup = mf_ug_popup_create(ugd, UG_POPMODE_TEXT_TWO_BTN, NULL, message,
\r
1589 left_label, right_label, NULL,
\r
1590 __mf_ug_cb_illegal_char_popup_cb, ugd);
\r
1597 ret = __mf_ug_cb_ime_mkdir_cb(ugd, name);
\r
1599 ugd->ug_Status.ug_iMore = UG_MORE_DEFAULT;
\r
1600 ecore_imf_context_input_panel_hide(elm_entry_imf_context_get(ugd->ug_MainWindow.ug_pEntry));
\r
1601 evas_object_del(ugd->ug_MainWindow.ug_pEntry);
\r
1603 mf_ug_navi_bar_create_default_view(ugd);
\r
1606 if (name != NULL) {
\r
1613 void mf_ug_cb_lcd_state_changed_cb(power_state_e state, void *user_data)
\r
1617 ug_mf_retm_if(user_data == NULL, "user_data is NULL");
\r
1618 ugData *ugd = (ugData *)user_data;
\r
1620 if(state == POWER_STATE_SCREEN_OFF){
\r
1621 if (0 != ugd->ug_ListPlay.ug_Player) {
\r
1622 ug_debug("destory the playing file");
\r
1623 mf_ug_list_play_destory_playing_file(ugd);
\r
1624 mf_ug_list_disable_play_itc(ugd, true);
\r
1625 UG_SAFE_FREE_CHAR(ugd->ug_ListPlay.ug_pPlayFilePath);
\r
1632 Eina_Bool mf_ug_cb_popup_del_idler_cb(void *data)
\r
1635 ug_mf_retvm_if(data == NULL, ECORE_CALLBACK_CANCEL, "data is NULL");
\r
1636 ugData *ugd = (ugData *)data;
\r
1638 UG_SAFE_FREE_OBJ(ugd->ug_MainWindow.ug_pSearchPopup);
\r
1639 ugd->ug_Status.popup_del_idler = NULL;
\r
1641 return ECORE_CALLBACK_CANCEL;
\r
1644 void mf_ug_cb_entry_button_pressed_cb(void *data, Evas_Object * obj, void *event_info)
\r
1647 ug_mf_retm_if(data == NULL, "data is NULL");
\r
1649 Evas_Object *home_button_ic = (Evas_Object *)data;
\r
1650 elm_image_file_set(home_button_ic, UG_ICON_ENTRY_FOLDER_PRESS, NULL);
\r
1653 void mf_ug_cb_entry_button_unpressed_cb(void *data, Evas_Object * obj, void *event_info)
\r
1656 ug_mf_retm_if(data == NULL, "data is NULL");
\r
1658 Evas_Object *home_button_ic = (Evas_Object *)data;
\r
1659 elm_image_file_set(home_button_ic, UG_ICON_ENTRY_FOLDER, NULL);
\r
1662 void mf_ug_cb_play_button_pressed_cb(void *data, Evas_Object * obj, void *event_info)
\r
1665 ug_mf_retm_if(data == NULL, "data is NULL");
\r
1666 ugData *ugd = (ugData *)data;
\r
1668 const char *play_icon = NULL;
\r
1670 Evas_Object *music_icon = elm_object_part_content_get(obj, "icon");
\r
1671 if(ugd->ug_ListPlay.ug_iPlayState != PLAY_STATE_PLAYING) {
\r
1672 play_icon = UG_ICON_MUSIC_PLAY_WHITE_PRESS;
\r
1674 play_icon = UG_ICON_MUSIC_PAUSE_WHITE_PRESS;
\r
1677 elm_image_file_set(music_icon, play_icon, NULL);
\r
1680 void mf_ug_cb_play_button_unpressed_cb(void *data, Evas_Object * obj, void *event_info)
\r
1683 ug_mf_retm_if(data == NULL, "data is NULL");
\r
1684 ugData *ugd = (ugData *)data;
\r
1686 const char *play_icon = NULL;
\r
1688 Evas_Object *music_icon = elm_object_part_content_get(obj, "icon");
\r
1689 if(ugd->ug_ListPlay.ug_iPlayState != PLAY_STATE_PLAYING) {
\r
1690 play_icon = UG_ICON_MUSIC_PLAY_WHITE;
\r
1692 play_icon = UG_ICON_MUSIC_PAUSE_WHITE;
\r
1695 elm_image_file_set(music_icon, play_icon, NULL);
\r
1698 void mf_ug_cb_more_cb(void *data, Evas_Object * obj, void *event_info)
\r
1701 ug_mf_retm_if(data == NULL, "data is NULL");
\r
1702 ugData *ugd = (ugData *)data;
\r
1704 mf_ug_context_popup_create_more(ugd, obj);
\r