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) {
\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)) {
\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_pContent;
\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 void mf_ug_cb_dir_pipe_cb(void *data, void *buffer, unsigned int nbyte)
\r
1007 ugData *ugd = (ugData *)data;
\r
1008 ug_mf_retm_if(ugd == NULL, "ugd is NULL");
\r
1011 ugNaviBar *pNavi_s = mf_ug_navi_bar_get_in_use_navi(ugd);
\r
1012 ug_mf_retm_if(pNavi_s == NULL, "get navigation bar in use failed");
\r
1014 if (ugd->ug_ListPlay.ug_iPlayState != PLAY_STATE_INIT) {
\r
1018 ug_dir_event_t *msg = (ug_dir_event_t *) buffer;
\r
1019 ug_debug("event : %d, name : %s", msg->event, msg->name);
\r
1021 Evas_Object *newContent = NULL;
\r
1022 switch (msg->event) {
\r
1023 case UG_MF_INOTI_CREATE:
\r
1024 case UG_MF_INOTI_MOVE_IN:
\r
1025 /*/1 TODO: add new item to list */
\r
1027 case UG_MF_INOTI_DELETE:
\r
1028 case UG_MF_INOTI_MOVE_OUT:
\r
1029 /*/1 TODO: remove item from list */
\r
1031 case UG_MF_INOTI_MODIFY:
\r
1032 /*/1 TODO: update item in list */
\r
1034 case UG_MF_INOTI_DELETE_SELF:
\r
1035 case UG_MF_INOTI_MOVE_SELF:
\r
1036 /*/1 TODO: watching directory is removed, change current directory. */
\r
1039 ug_mf_error("Unknown event");
\r
1042 ugd->ug_MainWindow.ug_pContent = newContent = mf_ug_genlist_create_content_list_view(ugd);
\r
1043 mf_ug_navi_bar_set_new_content(ugd->ug_MainWindow.ug_pNaviLayout, newContent);
\r
1044 mf_ug_ctrl_bar_set_item_disable(ugd);
\r
1054 #ifdef UG_THUMB_REAL_TIME_UPDATE
\r
1055 Eina_Bool mf_ug_cb_thumb_timer_cb(void *data)
\r
1057 ugListItemData *itemData = (ugListItemData *)data;
\r
1058 ug_mf_retvm_if(itemData == NULL, EINA_FALSE, "input params is NULL");
\r
1059 ugData *ugd = (ugData *)itemData->ug_pData;
\r
1060 ug_mf_retvm_if(ugd == NULL, EINA_FALSE, "ugd is NULL");
\r
1062 bool allright_flag = true;
\r
1063 Evas_Object *pContent = NULL;
\r
1065 if (ugd->ug_Status.ug_pThumbUpdateTimer == NULL) {
\r
1066 return EINA_FALSE;
\r
1069 /****read the realized part of the list****/
\r
1070 if (itemData->ug_pItem) {
\r
1071 pContent = elm_object_item_widget_get(itemData->ug_pItem);
\r
1072 if (pContent == NULL) {
\r
1073 ugd->ug_Status.ug_pThumbUpdateTimer = NULL;
\r
1074 return EINA_FALSE;
\r
1077 ugd->ug_Status.ug_pThumbUpdateTimer = NULL;
\r
1078 return EINA_FALSE;
\r
1080 Eina_List *realized_list = elm_genlist_realized_items_get(pContent);
\r
1081 Eina_List *list = NULL;
\r
1082 Elm_Object_Item *it;
\r
1083 ugListItemData *item_data = NULL;
\r
1085 if (realized_list == NULL) {
\r
1086 allright_flag = false;
\r
1089 EINA_LIST_FOREACH(realized_list, list, it) {
\r
1090 item_data = (ugListItemData *)elm_object_item_data_get(it);
\r
1091 if (item_data == NULL)
\r
1094 if (item_data->ug_bRealThumbFlag == false) {
\r
1095 ug_debug("Update item: %s", item_data->ug_pItemName->str);
\r
1096 if (ecore_file_is_dir(item_data->ug_pItemName->str) == true) {
\r
1097 item_data->ug_pThumbPath = strdup(UG_ICON_FOLDER);
\r
1098 item_data->ug_bRealThumbFlag = true;
\r
1099 elm_object_item_data_set(it, item_data);
\r
1100 elm_genlist_item_update(it);
\r
1102 } else if (ecore_file_exists(item_data->ug_pItemName->str)) {
\r
1103 char *new_thumb = NULL;
\r
1104 int thumbnail_type = 0;
\r
1105 thumbnail_type = mf_ug_file_attr_get_file_icon(item_data->ug_pItemName->str, NULL, &new_thumb);
\r
1107 if (thumbnail_type == MF_UG_THUMBNAIL_TYPE_DEFAULT) {
\r
1108 if (item_data->ug_pThumbPath && g_strcmp0(new_thumb, item_data->ug_pThumbPath) == 0) {
\r
1109 allright_flag = FALSE;
\r
1111 if (item_data->ug_pThumbPath) {
\r
1112 free(item_data->ug_pThumbPath);
\r
1113 item_data->ug_pThumbPath = NULL;
\r
1115 item_data->ug_pThumbPath = strdup(new_thumb);
\r
1116 item_data->ug_bRealThumbFlag = TRUE;
\r
1117 elm_object_item_data_set(it, item_data);
\r
1118 elm_genlist_item_update(it);
\r
1124 if (item_data->ug_pThumbPath) {
\r
1125 free(item_data->ug_pThumbPath);
\r
1126 item_data->ug_pThumbPath = NULL;
\r
1128 item_data->ug_pThumbPath = strdup(new_thumb);
\r
1129 item_data->ug_bRealThumbFlag = TRUE;
\r
1130 elm_object_item_data_set(it, item_data);
\r
1131 elm_genlist_item_update(it);
\r
1136 allright_flag = false;
\r
1142 if (allright_flag == false) {
\r
1145 ugd->ug_Status.ug_pThumbUpdateTimer = NULL;
\r
1146 return EINA_FALSE;
\r
1151 void mf_ug_cb_create_new_folder(void *data, Evas_Object * obj, void *event_info)
\r
1154 ug_mf_retm_if(data == NULL, "data is NULL");
\r
1156 ugData *ugd = (ugData *)data;
\r
1157 UG_SAFE_FREE_OBJ(ugd->ug_MainWindow.ug_pContextPopup);
\r
1159 if (ugd->ug_Status.ug_b_NaviPushFlag) {
\r
1164 if (ugd->ug_Status.ug_iMore == UG_MORE_CREATE_FOLDER)
\r
1168 ugd->ug_Status.ug_iMore = UG_MORE_CREATE_FOLDER;
\r
1170 ret = mf_ug_util_check_disk_space(ugd);
\r
1171 if (ret == MYFILE_ERR_NO_FREE_SPACE) {
\r
1172 ugd->ug_Status.ug_iMore = UG_MORE_DEFAULT;
\r
1175 #ifdef UG_THUMB_REAL_TIME_UPDATE
\r
1176 if (ugd->ug_Status.ug_pThumbUpdateTimer != NULL) {
\r
1177 ecore_timer_del(ugd->ug_Status.ug_pThumbUpdateTimer);
\r
1178 ugd->ug_Status.ug_pThumbUpdateTimer = NULL;
\r
1181 mf_ug_navi_bar_create_new_folder_view(ugd);
\r
1185 void mf_ug_cb_warning_popup_cb(void *data, Evas_Object * obj, void *event_info)
\r
1188 ug_mf_retm_if(data == NULL, "data is NULL");
\r
1189 ugData *ugd = (ugData *)data;
\r
1191 Evas_Object *btn = (Evas_Object *)obj;
\r
1192 const char *label = elm_object_text_get(btn);
\r
1194 if (g_strcmp0(label, MF_UG_LABEL_OK) == 0 ) {
\r
1195 evas_object_del(ugd->ug_MainWindow.ug_pNormalPopup);
\r
1196 ugd->ug_MainWindow.ug_pNormalPopup = NULL;
\r
1200 void mf_ug_cb_reach_max_len_cb(void *data, Evas_Object * obj, void *event_info)
\r
1203 ug_mf_retm_if(data == NULL, "data is NULL");
\r
1204 ugData *ugd = (ugData *)data;
\r
1205 mf_ug_popup_indicator_popup(MF_UG_LABEL_MAX_CHARACTER_REACHED);
\r
1210 void mf_ug_cb_eraser_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
\r
1212 elm_entry_entry_set(data, "");
\r
1215 void mf_ug_cb_cancel_new_folder_cb(void *data, Evas_Object * obj, void *event_info)
\r
1218 ug_mf_retm_if(data == NULL, "data is NULL");
\r
1219 ugData *ugd = (ugData *)data;
\r
1221 ugd->ug_Status.ug_iMore = UG_MORE_DEFAULT;
\r
1222 ecore_imf_context_input_panel_hide(elm_entry_imf_context_get(ugd->ug_MainWindow.ug_pEntry));
\r
1223 evas_object_del(ugd->ug_MainWindow.ug_pEntry);
\r
1225 Evas_Object *btn = NULL;
\r
1226 btn = elm_object_item_part_content_unset(ugd->ug_MainWindow.ug_pNaviItem, TITLE_RIGHT_BTN);
\r
1227 UG_SAFE_FREE_OBJ(btn);
\r
1228 btn = elm_object_item_part_content_unset(ugd->ug_MainWindow.ug_pNaviItem, TITLE_LEFT_BTN);
\r
1229 UG_SAFE_FREE_OBJ(btn);
\r
1231 mf_ug_navi_bar_create_default_view(ugd);
\r
1232 mf_ug_ctrl_bar_set_item_disable(ugd);
\r
1235 static int __mf_cb_imk_cancel_cb(void *data)
\r
1238 ug_mf_retvm_if(data == NULL, false, "data is NULL");
\r
1239 ugData *ugd = (ugData *)data;
\r
1241 mf_ug_cb_cancel_new_folder_cb(ugd, NULL, NULL);
\r
1242 ugd->ug_Status.popup_del_idler = NULL;
\r
1247 static void __mf_ug_cb_illegal_char_popup_cb(void *data, Evas_Object * obj, void *event_info)
\r
1250 ug_mf_retm_if(data == NULL, "data is NULL");
\r
1251 ugData *ugd = (ugData *)data;
\r
1253 Evas_Object *btn = (Evas_Object *)obj;
\r
1254 const char *label = elm_object_text_get(btn);
\r
1256 if (g_strcmp0(label, MF_UG_LABEL_YES) == 0 ) {
\r
1257 UG_SAFE_FREE_OBJ(ugd->ug_MainWindow.ug_pNormalPopup);
\r
1259 Evas_Object *entry = ugd->ug_MainWindow.ug_pEntry;
\r
1260 if (entry != NULL)
\r
1261 elm_object_focus_set(entry, EINA_TRUE);
\r
1263 } else if (g_strcmp0(label, MF_UG_LABEL_NO) == 0 ) {
\r
1264 UG_SAFE_FREE_OBJ(ugd->ug_MainWindow.ug_pNormalPopup);
\r
1265 ugd->ug_Status.popup_del_idler = ecore_idler_add((Ecore_Task_Cb) __mf_cb_imk_cancel_cb, ugd);
\r
1270 static int __mf_ug_cb_ime_mkdir_cb(void *data, char *fileName)
\r
1273 ugData *ugd = (ugData *)data;
\r
1275 ug_mf_retvm_if(ugd == NULL, MYFILE_ERR_SRC_ARG_INVALID, "ugd is NULL");
\r
1276 ug_mf_retvm_if(fileName == NULL, MYFILE_ERR_SRC_ARG_INVALID, "data is NULL");
\r
1277 ug_mf_retvm_if(ugd->ug_Status.ug_pPath == NULL, MYFILE_ERR_SRC_ARG_INVALID, "ugd is NULL");
\r
1278 ug_mf_retvm_if(ugd->ug_Status.ug_pPath->str == NULL, MYFILE_ERR_SRC_ARG_INVALID, "ugd is NULL");
\r
1282 const char *message = NULL;
\r
1283 const char *left_label = NULL;
\r
1284 const char *right_label = NULL;
\r
1286 left_label = MF_UG_LABEL_YES;
\r
1287 right_label = MF_UG_LABEL_NO;
\r
1288 if (strlen(fileName)) {
\r
1290 GString *fullpathdir = g_string_new(ugd->ug_Status.ug_pPath->str);
\r
1292 if (fullpathdir == NULL) {
\r
1293 mf_ug_util_operation_alloc_failed(ugd);
\r
1294 return MYFILE_ERR_ALLOCATE_MEMORY_FAIL;
\r
1296 GString *fullpathname = g_string_new(fileName);
\r
1298 if (fullpathname == NULL) {
\r
1299 g_string_free(fullpathdir, TRUE);
\r
1300 fullpathdir = NULL;
\r
1301 mf_ug_util_operation_alloc_failed(ugd);
\r
1302 return MYFILE_ERR_ALLOCATE_MEMORY_FAIL;
\r
1304 /*check the space */
\r
1305 gchar *test_space = g_strdup(fileName);
\r
1306 if (test_space == NULL) {
\r
1307 g_string_free(fullpathdir, TRUE);
\r
1308 fullpathdir = NULL;
\r
1309 g_string_free(fullpathname, TRUE);
\r
1310 fullpathname = NULL;
\r
1311 mf_ug_util_operation_alloc_failed(ugd);
\r
1312 return MYFILE_ERR_ALLOCATE_MEMORY_FAIL;
\r
1314 if (strlen(g_strchug(test_space)) == 0) {
\r
1315 message = MF_UG_LABEL_NAME_INVALID; /*TODO */
\r
1316 ugd->ug_MainWindow.ug_pNormalPopup = mf_ug_popup_create(ugd, UG_POPMODE_TEXT_TWO_BTN, NULL, message,
\r
1317 left_label, right_label, NULL,
\r
1318 __mf_ug_cb_illegal_char_popup_cb, ugd);
\r
1320 g_string_free(fullpathdir, TRUE);
\r
1321 fullpathdir = NULL;
\r
1322 g_string_free(fullpathname, TRUE);
\r
1323 fullpathname = NULL;
\r
1324 g_free(test_space);
\r
1325 test_space = NULL;
\r
1326 return MYFILE_ERR_DIR_CREATE_FAIL;
\r
1329 g_free(test_space);
\r
1330 test_space = NULL;
\r
1332 /*check if input name is valid */
\r
1333 if (mf_ug_file_attr_is_valid_name(fullpathname->str) == MYFILE_ERR_INVALID_FILE_NAME) {
\r
1335 message = MF_UG_LABEL_ILLEGAL_CHAR;
\r
1336 ugd->ug_MainWindow.ug_pNormalPopup = mf_ug_popup_create(ugd, UG_POPMODE_TEXT_TWO_BTN, NULL, message,
\r
1337 left_label, right_label, NULL,
\r
1338 __mf_ug_cb_illegal_char_popup_cb, ugd);
\r
1339 g_string_free(fullpathdir, TRUE);
\r
1340 fullpathdir = NULL;
\r
1341 g_string_free(fullpathname, TRUE);
\r
1342 fullpathname = NULL;
\r
1344 return MYFILE_ERR_DIR_CREATE_FAIL;
\r
1347 GString *fullpath = NULL;
\r
1348 char *temp_fullpath = g_strconcat(fullpathdir->str, "/", fullpathname->str, NULL);
\r
1349 if (temp_fullpath) {
\r
1350 fullpath = g_string_new(temp_fullpath);
\r
1352 free(temp_fullpath);
\r
1353 temp_fullpath = NULL;
\r
1354 if (fullpath == NULL) {
\r
1355 g_string_free(fullpathdir, TRUE);
\r
1356 fullpathdir = NULL;
\r
1357 g_string_free(fullpathname, TRUE);
\r
1358 fullpathname = NULL;
\r
1359 mf_ug_util_operation_alloc_failed(ugd);
\r
1360 return MYFILE_ERR_ALLOCATE_MEMORY_FAIL;
\r
1363 g_string_free(fullpathdir, TRUE);
\r
1364 fullpathdir = NULL;
\r
1365 g_string_free(fullpathname, TRUE);
\r
1366 fullpathname = NULL;
\r
1367 return MYFILE_ERR_ALLOCATE_MEMORY_FAIL;
\r
1370 /*check whether DIR name is override(DIR name has no extention) */
\r
1371 /*check whether path length is override */
\r
1372 if ((strlen(fullpathdir->str) + strlen(fullpathname->str)) > MYFILE_FILE_PATH_LEN_MAX) {
\r
1374 message = MF_UG_LABEL_PATH_REACH_MAX_LEN;
\r
1375 ugd->ug_MainWindow.ug_pNormalPopup = mf_ug_popup_create(ugd, UG_POPMODE_TEXT_TWO_BTN, NULL, message,
\r
1376 left_label, right_label, NULL,
\r
1377 __mf_ug_cb_illegal_char_popup_cb, ugd);
\r
1378 g_string_free(fullpathdir, TRUE);
\r
1379 fullpathdir = NULL;
\r
1380 g_string_free(fullpathname, TRUE);
\r
1381 fullpathname = NULL;
\r
1382 ret = MYFILE_ERR_DIR_CREATE_FAIL;
\r
1384 /*check if duplicated name */
\r
1385 else if (mf_ug_file_attr_is_duplicated_name(ugd->ug_Status.ug_pPath->str, fileName) == MYFILE_ERR_DUPLICATED_NAME) {
\r
1386 message = MF_UG_LABEL_DUP_NAME;
\r
1387 ugd->ug_MainWindow.ug_pNormalPopup = mf_ug_popup_create(ugd, UG_POPMODE_TEXT_TWO_BTN, NULL, message,
\r
1388 left_label, right_label, NULL,
\r
1389 __mf_ug_cb_illegal_char_popup_cb, ugd);
\r
1391 g_string_free(fullpathdir, TRUE);
\r
1392 fullpathdir = NULL;
\r
1393 g_string_free(fullpathname, TRUE);
\r
1394 fullpathname = NULL;
\r
1395 ret = MYFILE_ERR_DIR_CREATE_FAIL;
\r
1397 /*check if DIR name is all spaces */
\r
1399 ret = mf_ug_fm_svc_wrapper_create_service(ugd, fullpath);
\r
1400 /*check whether operate on read only area */
\r
1401 if (errno == EROFS) {
\r
1402 message = MF_UG_LABEL_OPER_READ_ONLY;
\r
1403 ugd->ug_MainWindow.ug_pNormalPopup = mf_ug_popup_create(ugd, UG_POPMODE_TEXT, NULL, message, NULL, NULL, NULL, NULL, NULL);
\r
1404 ret = MYFILE_ERR_DIR_CREATE_FAIL;
\r
1406 message = MF_UG_LABEL_CREATE_DIR_FAILED;
\r
1407 ugd->ug_MainWindow.ug_pNormalPopup = mf_ug_popup_create(ugd, UG_POPMODE_TEXT, NULL, message, NULL, NULL, NULL, NULL, NULL);
\r
1410 g_string_free(fullpathdir, TRUE);
\r
1411 fullpathdir = NULL;
\r
1412 g_string_free(fullpathname, TRUE);
\r
1413 fullpathname = NULL;
\r
1414 g_string_free(fullpath, TRUE);
\r
1419 message = MF_UG_LABEL_EMPTY_FOLDER_NAME;
\r
1421 ugd->ug_MainWindow.ug_pNormalPopup = mf_ug_popup_create(ugd, UG_POPMODE_TEXT_TWO_BTN, NULL, message,
\r
1422 left_label, right_label, NULL,
\r
1423 __mf_ug_cb_illegal_char_popup_cb, ugd);
\r
1424 ret = MYFILE_ERR_DIR_CREATE_FAIL;
\r
1430 void mf_ug_cb_save_cb(void *data, Evas_Object *obj, void *event_info)
\r
1433 ug_mf_retm_if(data == NULL, "data is NULL");
\r
1434 ugData *ugd = (ugData *)data;
\r
1436 if (ugd->ug_Status.ug_b_NaviPushFlag) {
\r
1442 const char *message = NULL;
\r
1443 const char *left_label = NULL;
\r
1444 const char *right_label = NULL;
\r
1446 if (ugd->ug_Status.ug_iMore == UG_MORE_CREATE_FOLDER) {
\r
1447 const char *entry_data = NULL;
\r
1448 char *name = NULL;
\r
1451 if (ugd->ug_MainWindow.ug_pEntry != NULL) {
\r
1452 Ecore_IMF_Context *imf_context = elm_entry_imf_context_get(ugd->ug_MainWindow.ug_pEntry);
\r
1453 if (imf_context != NULL)
\r
1454 ecore_imf_context_hide(imf_context);
\r
1457 entry_data = elm_entry_entry_get(ugd->ug_MainWindow.ug_pEntry);
\r
1460 name = elm_entry_markup_to_utf8(entry_data);
\r
1462 message = MF_UG_LABEL_GET_NAME_FAILED;
\r
1463 left_label = MF_UG_LABEL_YES;
\r
1464 right_label = MF_UG_LABEL_NO;
\r
1465 ugd->ug_MainWindow.ug_pNormalPopup = mf_ug_popup_create(ugd, UG_POPMODE_TEXT_TWO_BTN, NULL, message,
\r
1466 left_label, right_label, NULL,
\r
1467 __mf_ug_cb_illegal_char_popup_cb, ugd);
\r
1474 ret = __mf_ug_cb_ime_mkdir_cb(ugd, name);
\r
1476 ugd->ug_Status.ug_iMore = UG_MORE_DEFAULT;
\r
1477 ecore_imf_context_input_panel_hide(elm_entry_imf_context_get(ugd->ug_MainWindow.ug_pEntry));
\r
1478 evas_object_del(ugd->ug_MainWindow.ug_pEntry);
\r
1480 mf_ug_navi_bar_create_default_view(ugd);
\r
1483 if (name != NULL) {
\r
1490 void mf_ug_cb_lcd_state_changed_cb(power_state_e state, void *user_data)
\r
1494 ug_mf_retm_if(user_data == NULL, "user_data is NULL");
\r
1495 ugData *ugd = (ugData *)user_data;
\r
1497 if(state == POWER_STATE_SCREEN_OFF){
\r
1498 if (0 != ugd->ug_ListPlay.ug_Player) {
\r
1499 ug_debug("destory the playing file");
\r
1500 mf_ug_list_play_destory_playing_file(ugd);
\r
1501 mf_ug_list_disable_play_itc(ugd, true);
\r
1502 UG_SAFE_FREE_CHAR(ugd->ug_ListPlay.ug_pPlayFilePath);
\r
1509 Eina_Bool mf_ug_cb_popup_del_idler_cb(void *data)
\r
1512 ug_mf_retvm_if(data == NULL, ECORE_CALLBACK_CANCEL, "data is NULL");
\r
1513 ugData *ugd = (ugData *)data;
\r
1515 UG_SAFE_FREE_OBJ(ugd->ug_MainWindow.ug_pSearchPopup);
\r
1516 ugd->ug_Status.popup_del_idler = NULL;
\r
1518 return ECORE_CALLBACK_CANCEL;
\r
1521 void mf_ug_cb_entry_button_pressed_cb(void *data, Evas_Object * obj, void *event_info)
\r
1524 ug_mf_retm_if(data == NULL, "data is NULL");
\r
1526 Evas_Object *home_button_ic = (Evas_Object *)data;
\r
1527 elm_image_file_set(home_button_ic, UG_ICON_ENTRY_FOLDER_PRESS, NULL);
\r
1530 void mf_ug_cb_entry_button_unpressed_cb(void *data, Evas_Object * obj, void *event_info)
\r
1533 ug_mf_retm_if(data == NULL, "data is NULL");
\r
1535 Evas_Object *home_button_ic = (Evas_Object *)data;
\r
1536 elm_image_file_set(home_button_ic, UG_ICON_ENTRY_FOLDER, NULL);
\r
1539 void mf_ug_cb_play_button_pressed_cb(void *data, Evas_Object * obj, void *event_info)
\r
1542 ug_mf_retm_if(data == NULL, "data is NULL");
\r
1543 ugData *ugd = (ugData *)data;
\r
1545 const char *play_icon = NULL;
\r
1547 Evas_Object *music_icon = elm_object_part_content_get(obj, "icon");
\r
1548 if(ugd->ug_ListPlay.ug_iPlayState != PLAY_STATE_PLAYING) {
\r
1549 play_icon = UG_ICON_MUSIC_PLAY_WHITE_PRESS;
\r
1551 play_icon = UG_ICON_MUSIC_PAUSE_WHITE_PRESS;
\r
1554 elm_image_file_set(music_icon, play_icon, NULL);
\r
1557 void mf_ug_cb_play_button_unpressed_cb(void *data, Evas_Object * obj, void *event_info)
\r
1560 ug_mf_retm_if(data == NULL, "data is NULL");
\r
1561 ugData *ugd = (ugData *)data;
\r
1563 const char *play_icon = NULL;
\r
1565 Evas_Object *music_icon = elm_object_part_content_get(obj, "icon");
\r
1566 if(ugd->ug_ListPlay.ug_iPlayState != PLAY_STATE_PLAYING) {
\r
1567 play_icon = UG_ICON_MUSIC_PLAY_WHITE;
\r
1569 play_icon = UG_ICON_MUSIC_PAUSE_WHITE;
\r
1572 elm_image_file_set(music_icon, play_icon, NULL);
\r
1575 void mf_ug_cb_more_cb(void *data, Evas_Object * obj, void *event_info)
\r
1578 ug_mf_retm_if(data == NULL, "data is NULL");
\r
1579 ugData *ugd = (ugData *)data;
\r
1581 mf_ug_context_popup_create_more(ugd, obj);
\r