2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "mp-view-manager.h"
18 #include "mp-edit-view.h"
19 #include "mp-playlist-view.h"
20 #include "mp-track-view.h"
21 #include "mp-common.h"
23 #include "mp-play-view.h"
24 #include "mp-ug-launch.h"
25 #include "mp-search.h"
26 #include "mp-widget.h"
27 #include "mp-library.h"
33 mp_view_content_t content_type;
35 Evas_Object *view_layout;
36 Evas_Object *controlbar;
37 Evas_Object *control_buttons[MP_NAVI_CONTROL_BUTTON_MAX];
39 Elm_Object_Item *navi_item;
43 mp_view_manager_set_back_button(Evas_Object * parent, Elm_Object_Item* navi_item, Evas_Smart_Cb cb, void *data)
48 Evas_Object *button = NULL;
51 button = mp_widget_create_button(parent, "naviframe/back_btn/default", NULL, NULL, cb, data);
52 elm_object_item_part_content_set(navi_item, ELM_NAVIFRAME_ITEM_PREV_BTN, button);
56 elm_object_item_part_content_set(navi_item, ELM_NAVIFRAME_ITEM_PREV_BTN, NULL);
61 mp_view_manager_push_view_content(view_data_t * view_data, Evas_Object * content, mp_view_content_t type)
64 mp_view_histroy_t *last_history;
65 Evas_Object *top_view = NULL;
69 MP_CHECK_NULL(view_data);
70 MP_CHECK_VIEW_DATA(view_data);
71 MP_CHECK_NULL(content);
72 MP_CHECK_NULL(view_data->navibar);
74 struct appdata *ad = view_data->ad;
77 Elm_Object_Item *navi_item = elm_naviframe_top_item_get(view_data->navibar);
80 top_view = elm_object_item_content_get(navi_item);
81 MP_CHECK_NULL(top_view);
83 mp_view_layout_progress_timer_freeze(top_view);
86 view_idx = mp_view_manager_count_view_content(view_data);
87 DEBUG_TRACE("view_idx: %d", view_idx);
88 last_history = calloc(sizeof(mp_view_histroy_t), 1);
90 last_history->content_type = type;
91 last_history->view_index = view_idx;
92 last_history->view_layout = content;
96 last_history->navi_item =
97 elm_naviframe_item_push(view_data->navibar, NULL, NULL, NULL, content, "tabbar");
98 elm_naviframe_item_title_visible_set(last_history->navi_item, EINA_FALSE);
100 else if(MP_VIEW_CONTENT_PLAY == type)
102 elm_naviframe_prev_btn_auto_pushed_set(view_data->navibar, EINA_FALSE);
103 last_history->navi_item =
104 elm_naviframe_item_push(view_data->navibar, NULL, NULL, NULL, content, "1line/music");
108 last_history->navi_item =
109 elm_naviframe_item_push(view_data->navibar, NULL, NULL, NULL, content, NULL);
112 mp_language_mgr_register_object_item(last_history->navi_item, NULL);
114 if(MP_VIEW_CONTENT_PLAY == type)
115 elm_naviframe_item_title_visible_set(last_history->navi_item, false);
117 evas_object_data_set(content, "navi_item", last_history->navi_item);
119 if (view_idx) //Do not set as true when first push. Effect finished callback not called in this case..
120 ad->navi_effect_in_progress = TRUE;
122 ad->view_history = g_list_append(ad->view_history, last_history);
126 return last_history->navi_item;
130 /* Musc call this api befor del navigationbar. it prevent destroying info ug layout*/
132 mp_view_manager_unswallow_info_ug_layout(struct appdata *ad)
137 edje_object_part_unswallow(ad->info_ug_base, ad->info_ug_layout);
138 evas_object_hide(ad->info_ug_layout);
139 mp_ug_send_message(ad, MP_UG_MESSAGE_DEL);
144 mp_view_manager_pop_view_content(view_data_t * view_data, bool pop_to_first, bool pop_content)
147 MP_CHECK_VIEW_DATA(view_data);
149 struct appdata *ad = view_data->ad;
152 GList *view_item = g_list_last(ad->view_history);
154 MP_CHECK(view_data->navibar);
156 mp_view_histroy_t *last_history = view_item->data;
158 mp_view_manager_unswallow_info_ug_layout(ad);
162 elm_naviframe_item_pop(view_data->navibar);
163 ad->navi_effect_in_progress = TRUE;
164 mp_language_mgr_unregister_object_item(last_history->navi_item);
165 SAFE_FREE(last_history);
167 g_list_delete_link(ad->view_history, view_item);
168 view_item = g_list_last(ad->view_history);
169 last_history = view_item->data;
173 if (last_history->view_index == 0)
178 elm_naviframe_item_pop_to(elm_naviframe_bottom_item_get(view_data->navibar));
179 while (last_history->view_index > 0)
181 mp_language_mgr_unregister_object_item(last_history->navi_item);
182 SAFE_FREE(last_history);
184 g_list_delete_link(ad->view_history, view_item);
185 view_item = g_list_last(ad->view_history);
187 last_history = view_item->data;
191 Elm_Object_Item *navi_item = elm_naviframe_top_item_get(view_data->navibar);
193 Evas_Object *top_view = elm_object_item_content_get(navi_item);
196 mp_view_layout_progress_timer_thaw(top_view);
201 mp_view_manager_pop_to_view_content(view_data_t * view_data, mp_view_content_t type)
204 MP_CHECK_VIEW_DATA(view_data);
206 struct appdata *ad = view_data->ad;
209 GList *view_item = g_list_last(ad->view_history);
211 MP_CHECK(view_data->navibar);
213 mp_view_histroy_t *last_history = view_item->data;
214 bool find_view = false;
216 mp_view_manager_unswallow_info_ug_layout(ad);
218 while (last_history->view_index > 0)
220 DEBUG_TRACE("Content type: %d", last_history->content_type);
221 if (last_history->content_type == type)
225 mp_language_mgr_unregister_object_item(last_history->navi_item);
226 SAFE_FREE(last_history);
228 g_list_delete_link(ad->view_history, view_item);
229 view_item = g_list_last(ad->view_history);
231 last_history = view_item->data;
235 elm_naviframe_item_pop_to(last_history->navi_item);
240 Elm_Object_Item *navi_item = elm_naviframe_top_item_get(view_data->navibar);
242 Evas_Object *top_view = elm_object_item_content_get(navi_item);
245 mp_view_layout_progress_timer_thaw(top_view);
250 mp_view_manager_count_view_content(view_data_t * view_data)
252 MP_CHECK_VAL(view_data, -1);
253 MP_CHECK_VIEW_DATA(view_data);
255 GList *histroy = view_data->ad->view_history;
256 mp_retvm_if(!histroy, 0, "last_item not exist");
258 return g_list_length(histroy);
262 mp_view_manager_get_last_view_layout(struct appdata * ad)
265 MP_CHECK_NULL(ad->naviframe);
267 Evas_Object *cur_view = ad->naviframe;
269 view_data_t *cur_view_data = evas_object_data_get(cur_view, "view_data");
270 MP_CHECK_NULL(cur_view_data);
271 MP_CHECK_VIEW_DATA(cur_view_data);
273 GList *last_item = g_list_last(ad->view_history);
274 MP_CHECK_NULL(last_item);
276 mp_view_histroy_t *last_history = last_item->data;
277 MP_CHECK_NULL(last_history);
279 return last_history->view_layout;
283 mp_view_manager_get_play_view_navi_item(struct appdata *ad)
287 MP_CHECK_NULL(ad->naviframe);
289 mp_view_histroy_t *history;
290 Evas_Object *cur_view = ad->naviframe;
292 view_data_t *cur_view_data = evas_object_data_get(cur_view, "view_data");
293 MP_CHECK_NULL(cur_view_data);
294 MP_CHECK_VIEW_DATA(cur_view_data);
296 GList *item = g_list_last(ad->view_history);
301 history = item->data;
302 if (history->content_type == MP_VIEW_CONTENT_PLAY)
304 return history->navi_item;
306 item = g_list_previous(item);
314 mp_view_manager_play_view_title_label_set(struct appdata *ad, const char *title)
317 Elm_Object_Item *navi_item;
320 navi_item = mp_view_manager_get_play_view_navi_item(ad);
322 elm_object_item_text_set(navi_item, title);
328 mp_view_manager_get_first_view_layout(struct appdata *ad)
332 Evas_Object *cur_view = ad->naviframe;
333 MP_CHECK_NULL(cur_view);
335 view_data_t *cur_view_data = evas_object_data_get(cur_view, "view_data");
336 MP_CHECK_NULL(cur_view_data);
337 MP_CHECK_VIEW_DATA(cur_view_data);
339 GList *first_item = g_list_first(ad->view_history);
340 MP_CHECK_NULL(first_item);
342 mp_view_histroy_t *last_history = first_item->data;
343 MP_CHECK_NULL(last_history);
345 return last_history->view_layout;
349 mp_view_manager_get_edit_view_layout(struct appdata * ad)
351 mp_view_histroy_t *history = NULL;
355 Evas_Object *cur_view = ad->naviframe;
356 MP_CHECK_NULL(cur_view);
358 view_data_t *cur_view_data = evas_object_data_get(cur_view, "view_data");
359 MP_CHECK_NULL(cur_view_data);
360 MP_CHECK_VIEW_DATA(cur_view_data);
362 GList *item = g_list_last(ad->view_history);
363 MP_CHECK_FALSE(item);
367 history = item->data;
368 if (history->content_type == MP_VIEW_CONTENT_EDIT)
370 return history->view_layout;
372 item = g_list_previous(item);
381 mp_view_manager_is_play_view(struct appdata * ad)
385 Evas_Object *cur_view = ad->naviframe;
386 MP_CHECK_FALSE(cur_view);
388 view_data_t *cur_view_data = evas_object_data_get(cur_view, "view_data");
389 MP_CHECK_FALSE(cur_view_data);
390 MP_CHECK_VIEW_DATA(cur_view_data);
392 GList *last_item = g_list_last(ad->view_history);
393 MP_CHECK_FALSE(last_item);
395 mp_view_histroy_t *last_history = last_item->data;
396 MP_CHECK_FALSE(last_history);
398 if (last_history->content_type == MP_VIEW_CONTENT_PLAY)
406 mp_view_manager_get_view_layout(struct appdata * ad, mp_view_content_t type)
408 mp_view_histroy_t *history = NULL;
412 Evas_Object *cur_view = ad->naviframe;
413 MP_CHECK_NULL(cur_view);
415 view_data_t *cur_view_data = evas_object_data_get(cur_view, "view_data");
416 MP_CHECK_NULL(cur_view_data);
417 MP_CHECK_VIEW_DATA(cur_view_data);
419 GList *item = g_list_last(ad->view_history);
420 MP_CHECK_FALSE(item);
424 history = item->data;
425 if (history->content_type == type)
427 return history->view_layout;
429 item = g_list_previous(item);
438 mp_view_manager_update_list_contents(view_data_t * view_data, bool update_edit_list)
441 MP_CHECK_VIEW_DATA(view_data);
443 mp_view_histroy_t *history = NULL;
444 struct appdata *ad = view_data->ad;
447 GList *item = g_list_last(ad->view_history);
451 history = item->data;
452 if (history->content_type == MP_VIEW_CONTENT_LIST)
454 mp_layout_data_t *layout_data = evas_object_data_get(history->view_layout, "layout_data");
457 if(layout_data->edit_mode && !update_edit_list)
459 DEBUG_TRACE("skip update edit view");
460 item = g_list_previous(item);
463 if(layout_data->album_delete_flag)
465 DEBUG_TRACE("skip update album view or artist view");
466 item = g_list_previous(item);
470 mp_view_layout_update(history->view_layout);
472 item = g_list_previous(item);
478 static void _mp_view_manager_more_btn_move_ctxpopup(Evas_Object *ctxpopup, Evas_Object *btn)
485 Evas_Coord x, y, w , h;
486 evas_object_geometry_get(btn, &x, &y, &w, &h);
487 evas_object_move(ctxpopup, x + w/2, y);
490 static void _mp_view_manager_more_btn_dismissed_cb(void *data, Evas_Object *obj, void *event_info)
494 struct appdata *ad = data;
497 mp_evas_object_del(ad->more_btn_popup);
500 static void _mp_view_manager_more_btn_cb(void *data, Evas_Object *obj, void *event_info)
503 view_data_t *view_data = (view_data_t *) data;
505 MP_CHECK_VIEW_DATA(view_data);
506 void *cb_data = NULL;
508 struct appdata *ad = view_data->ad;
511 cb_data = evas_object_data_get(obj, "cb_data");
513 mp_evas_object_del(ad->more_btn_popup);
515 ad->more_btn_popup = elm_ctxpopup_add(ad->naviframe);
516 evas_object_smart_callback_add(ad->more_btn_popup, "dismissed", _mp_view_manager_more_btn_dismissed_cb, ad);
518 mp_more_button_type_e btn_type = (int)evas_object_data_get(obj, "more_btn_type");
519 if (btn_type == MP_MORE_BUTTON_TYPE_TRACK_LIST)
520 elm_ctxpopup_item_append(ad->more_btn_popup,
521 GET_STR("IDS_MUSIC_BODY_ADD_TO_PLAYLIST"),
522 NULL, mp_edit_view_add_to_plst_cb, cb_data);
525 elm_ctxpopup_item_append(ad->more_btn_popup,
526 GET_STR("IDS_MUSIC_BODY_CREATE_PLAYLIST"),
527 NULL, mp_playlist_view_create_playlist_button_cb, cb_data);
530 elm_object_scroll_freeze_push(ad->more_btn_popup);
531 _mp_view_manager_more_btn_move_ctxpopup(ad->more_btn_popup, obj);
533 evas_object_show(ad->more_btn_popup);
537 mp_view_manager_set_title_and_buttons(view_data_t * view_data, char *text_ID, void *data)
540 struct appdata *ad = NULL;
541 GList *last_node = NULL;
542 mp_view_histroy_t *last_history = NULL;
543 Evas_Object *navibar = NULL;
544 Elm_Object_Item *navi_it = NULL;
545 Evas_Object *layout = NULL, *btn = NULL;
550 MP_CHECK_VIEW_DATA(view_data);
555 last_node = g_list_last(ad->view_history);
558 last_history = last_node->data;
559 MP_CHECK(last_history);
561 navibar = ad->naviframe;
564 navi_it = last_history->navi_item;
567 layout = last_history->view_layout;
570 if(text_ID && strstr(text_ID, "IDS_COM"))
571 title = GET_SYS_STR(text_ID);
573 title = GET_STR(text_ID);
577 DEBUG_TRACE("title: %s", title);
578 elm_object_item_text_set(navi_it, title);
579 mp_language_mgr_object_item_text_ID_set(navi_it, text_ID);
582 //delete all buttons...
583 for (i = 0; i < MP_NAVI_CONTROL_BUTTON_MAX; i++)
585 if (last_history->control_buttons[i])
587 evas_object_del(last_history->control_buttons[i]);
588 last_history->control_buttons[i] = NULL;
591 elm_object_item_part_content_set(navi_it, "toolbar_button1", NULL);
592 elm_object_item_part_content_set(navi_it, "toolbar_button2", NULL);
594 //destroy back button
595 mp_view_manager_set_back_button(last_history->view_layout, navi_it, NULL, NULL);
596 btn = elm_object_item_part_content_get(navi_it, "toolbar_more_btn");
599 evas_object_del(btn);
600 elm_object_item_part_content_set(navi_it, "toolbar_more_btn", NULL);
603 if (last_history->content_type == MP_VIEW_CONTENT_LIST)
605 mp_layout_data_t *layout_data = evas_object_data_get(last_history->view_layout, "layout_data");
606 MP_CHECK(layout_data);
607 DEBUG_TRACE("layout_data: 0x%x", layout_data);
608 MP_CHECK_LAYOUT_DATA(layout_data);
610 DEBUG_TRACE("MP_VIEW_CONTENT_LIST. category: %d, rename mode: %d, add tracks : %d ",
611 layout_data->category, layout_data->rename_mode, layout_data->ad->b_add_tracks);
612 DEBUG_TRACE("layout_data->playlist_id: %d", layout_data->playlist_id);
614 if (layout_data->edit_mode)
616 if (layout_data->ad->b_add_tracks)
620 btn = mp_widget_create_toolbar_btn(layout,
621 MP_TOOLBAR_BTN_DEFULTL, GET_STR("IDS_MUSIC_BODY_ADD_TO_PLAYLIST"), mp_track_view_add_to_playlist_cancel_cb, data);
622 elm_object_item_part_content_set(navi_it, "toolbar_button1", btn);
623 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_ADD_TO_PLAYLIST] = btn;
625 mp_view_manager_set_back_button(layout, navi_it, mp_track_view_add_to_playlist_cancel_cb, data);
630 if (layout_data->category == MP_LAYOUT_TRACK_LIST)
634 btn = mp_widget_create_toolbar_btn(layout,
635 MP_TOOLBAR_BTN_LEFT, GET_STR("IDS_MUSIC_OPT_DELETE"), mp_edit_view_delete_cb, data);
636 elm_object_item_part_content_set(navi_it, "toolbar_button1", btn);
637 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_DELETE] = btn;
639 btn = mp_widget_create_toolbar_btn(layout,
640 MP_TOOLBAR_BTN_RIGHT, GET_STR("IDS_MUSIC_SK_SHARE"), mp_edit_view_share_cb, data);
641 elm_object_item_part_content_set(navi_it, "toolbar_button2", btn);
642 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_SHARE] = btn;
644 btn = mp_widget_create_toolbar_btn(layout, MP_TOOLBAR_BTN_MORE, NULL, _mp_view_manager_more_btn_cb, view_data);
645 evas_object_data_set(btn, "more_btn_type", (void *)MP_MORE_BUTTON_TYPE_TRACK_LIST);
646 elm_object_item_part_content_set(navi_it, "toolbar_more_btn", btn);
647 evas_object_data_set(btn, "cb_data", data);
649 mp_view_manager_set_back_button(layout, navi_it, mp_edit_view_cencel_cb, data);
652 else if (layout_data->category == MP_LAYOUT_GROUP_LIST)
655 btn = mp_widget_create_toolbar_btn(layout,
656 MP_TOOLBAR_BTN_DEFULTL, GET_STR("IDS_MUSIC_BODY_ADD_TO_PLAYLIST"), mp_edit_view_add_to_plst_cb, data);
657 elm_object_item_part_content_set(navi_it, "toolbar_button1", btn);
658 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_ADD_TO_PLAYLIST] = btn;
660 mp_view_manager_set_back_button(layout, navi_it, mp_edit_view_cencel_cb, data);
667 btn = mp_widget_create_toolbar_btn(layout,
668 MP_TOOLBAR_BTN_DEFULTL, GET_STR("IDS_MUSIC_OPT_DELETE"), mp_edit_view_delete_cb, data);
669 elm_object_item_part_content_set(navi_it, "toolbar_button1", btn);
670 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_DELETE] = btn;
672 mp_view_manager_set_back_button(layout, navi_it, mp_edit_view_cencel_cb, data);
679 if(!layout_data->ad->b_add_tracks)
681 mp_view_manager_set_back_button(last_history->view_layout, last_history->navi_item, mp_common_back_button_cb, view_data);
685 layout_data->navibar_title = g_strdup(title);
687 if (MP_TRACK_BY_ALBUM == layout_data->track_type
688 || MP_TRACK_BY_ARTIST == layout_data->track_type)
689 layout_data->navibar_title = g_strdup(layout_data->type_str);
691 layout_data->callback_data = data;
692 if (layout_data->category != MP_LAYOUT_PLAYLIST_LIST)
694 if (layout_data->ad->b_add_tracks)
697 btn = mp_widget_create_toolbar_btn(layout,
698 MP_TOOLBAR_BTN_DEFULTL, GET_STR("IDS_MUSIC_BODY_ADD_TO_PLAYLIST"), mp_track_view_add_to_playlist_done_cb, data);
699 elm_object_item_part_content_set(navi_it, "toolbar_button1", btn);
700 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_ADD_TO_PLAYLIST] = btn;
703 mp_view_manager_set_back_button(layout, navi_it, mp_track_view_add_to_playlist_cancel_cb, data);
706 else if (layout_data->track_type == MP_TRACK_BY_PLAYLIST)
708 if (!mp_view_manager_get_view_layout(ad, MP_VIEW_CONTENT_SEARCH))
711 btn = mp_widget_create_toolbar_btn(layout,
712 MP_TOOLBAR_BTN_LEFT, GET_SYS_STR("IDS_COM_SK_EDIT"), mp_common_edit_button_cb, data);
713 elm_object_item_part_content_set(navi_it, "toolbar_button1", btn);
714 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_EDIT] = btn;
716 if (layout_data->playlist_id > 0)
718 btn = mp_widget_create_toolbar_btn(layout,
719 MP_TOOLBAR_BTN_RIGHT, GET_SYS_STR("IDS_COM_SK_ADD"), mp_playlist_view_add_button_cb, data);
720 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_CREATE_PLAYLIST] = btn;
724 btn = mp_widget_create_toolbar_btn(layout,
725 MP_TOOLBAR_BTN_RIGHT, GET_SYS_STR("IDS_COM_SK_SEARCH"), mp_common_search_button_cb, data);
726 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_SEARCH] = btn;
728 elm_object_item_part_content_set(navi_it, "toolbar_button2", btn);
733 btn = mp_widget_create_toolbar_btn(layout,
734 MP_TOOLBAR_BTN_DEFULTL, GET_SYS_STR("IDS_COM_SK_EDIT"), mp_common_edit_button_cb, data);
735 elm_object_item_part_content_set(navi_it, "toolbar_button1", btn);
736 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_EDIT] = btn;
742 if (layout_data->category == MP_LAYOUT_GROUP_LIST)
744 if (!mp_view_manager_get_view_layout(ad, MP_VIEW_CONTENT_SEARCH))
747 btn = mp_widget_create_toolbar_btn(layout,
748 MP_TOOLBAR_BTN_LEFT, GET_STR("IDS_MUSIC_BODY_ADD_TO_PLAYLIST"), mp_common_edit_button_cb, data);
749 elm_object_item_part_content_set(navi_it, "toolbar_button1", btn);
750 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_ADD_TO_PLAYLIST] = btn;
752 btn = mp_widget_create_toolbar_btn(layout,
753 MP_TOOLBAR_BTN_RIGHT, GET_SYS_STR("IDS_COM_SK_SEARCH"), mp_common_search_button_cb, data);
754 elm_object_item_part_content_set(navi_it, "toolbar_button2", btn);
755 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_SEARCH] = btn;
761 btn = mp_widget_create_toolbar_btn(layout,
762 MP_TOOLBAR_BTN_DEFULTL, GET_STR("IDS_MUSIC_BODY_ADD_TO_PLAYLIST"), mp_common_edit_button_cb, data);
763 elm_object_item_part_content_set(navi_it, "toolbar_button1", btn);
764 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_ADD_TO_PLAYLIST] = btn;
769 if (!mp_view_manager_get_view_layout(ad, MP_VIEW_CONTENT_SEARCH))
772 btn = mp_widget_create_toolbar_btn(layout,
773 MP_TOOLBAR_BTN_LEFT, GET_SYS_STR("IDS_COM_SK_EDIT"), mp_common_edit_button_cb, data);
774 elm_object_item_part_content_set(navi_it, "toolbar_button1", btn);
775 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_EDIT] = btn;
777 btn = mp_widget_create_toolbar_btn(layout,
778 MP_TOOLBAR_BTN_RIGHT, GET_SYS_STR("IDS_COM_SK_SEARCH"), mp_common_search_button_cb, data);
779 elm_object_item_part_content_set(navi_it, "toolbar_button2", btn);
780 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_SEARCH] = btn;
785 btn = mp_widget_create_toolbar_btn(layout,
786 MP_TOOLBAR_BTN_DEFULTL, GET_SYS_STR("IDS_COM_SK_EDIT"), mp_common_edit_button_cb, data);
787 elm_object_item_part_content_set(navi_it, "toolbar_button1", btn);
788 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_EDIT] = btn;
795 DEBUG_TRACE("layout_data->item_count=%d", layout_data->item_count);
796 btn = mp_widget_create_toolbar_btn(layout,
797 MP_TOOLBAR_BTN_LEFT, GET_SYS_STR("IDS_COM_SK_EDIT"), mp_common_edit_button_cb, data);
798 elm_object_item_part_content_set(navi_it, "toolbar_button1", btn);
799 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_EDIT] = btn;
801 btn = mp_widget_create_toolbar_btn(layout,
802 MP_TOOLBAR_BTN_RIGHT, GET_SYS_STR("IDS_COM_SK_SEARCH"), mp_common_search_button_cb, data);
803 elm_object_item_part_content_set(navi_it, "toolbar_button2", btn);
804 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_SEARCH] = btn;
806 btn = mp_widget_create_toolbar_btn(layout, MP_TOOLBAR_BTN_MORE, NULL, _mp_view_manager_more_btn_cb, view_data);
807 evas_object_data_set(btn, "more_btn_type", (void *)MP_MORE_BUTTON_TYPE_DEFAULT);
808 evas_object_data_set(btn, "cb_data", data);
809 elm_object_item_part_content_set(navi_it, "toolbar_more_btn", btn);
812 /* update the first controlba item */
813 mp_view_manager_update_first_controlbar_item(layout_data);
817 else if (last_history->content_type == MP_VIEW_CONTENT_SEARCH)
819 DEBUG_TRACE("MP_VIEW_CONTENT_SEARCH. ");
820 mp_view_manager_set_back_button(last_history->view_layout, last_history->navi_item, mp_common_back_button_cb, view_data);
822 else if (last_history->content_type == MP_VIEW_CONTENT_PLAY)
824 DEBUG_TRACE("MP_VIEW_CONTENT_PLAY. ");
825 mp_play_view_set_snd_path_sensitivity(ad);
827 else if (last_history->content_type == MP_VIEW_CONTENT_INFO)
829 DEBUG_TRACE("MP_VIEW_CONTENT_INFO. ");
830 mp_view_manager_set_back_button(last_history->view_layout, last_history->navi_item, mp_play_view_info_back_cb, ad);
834 WARN_TRACE("unexpected value: %d", last_history->content_type);
840 mp_view_manager_set_now_playing(view_data_t * view_data, bool show)
843 MP_CHECK_VIEW_DATA(view_data);
845 mp_view_histroy_t *history = NULL;
846 struct appdata *ad = view_data->ad;
849 GList *item = g_list_last(ad->view_history);
850 GList *last_item = item;
854 history = item->data;
855 if (history->content_type == MP_VIEW_CONTENT_LIST)
859 mp_view_layout_show_now_playing(history->view_layout);
860 if(item != last_item) //freeze timer not to update every view. update top view.
861 mp_view_layout_progress_timer_freeze(history->view_layout);
864 mp_view_layout_hide_now_playing(history->view_layout);
866 mp_view_layout_set_now_playing_info(history->view_layout);
868 item = g_list_previous(item);
875 mp_view_manager_freeze_progress_timer(struct appdata *ad)
877 Evas_Object *top_view = mp_view_manager_get_last_view_layout(ad);
879 mp_view_layout_progress_timer_freeze(top_view);
881 mp_play_view_progress_timer_freeze(ad);
885 mp_view_manager_thaw_progress_timer(struct appdata *ad)
887 mp_retm_if(ad->is_lcd_off, "LCD off. not thaw progress timer.. ");
889 Evas_Object *top_view = mp_view_manager_get_last_view_layout(ad);
891 mp_view_layout_progress_timer_thaw(top_view);
893 mp_play_view_progress_timer_thaw(ad);
896 void mp_view_manager_update_first_controlbar_item(void *data)
898 mp_layout_data_t *layout_data = (mp_layout_data_t *)data;
899 MP_CHECK(layout_data);
900 Evas_Object *edit_item = mp_view_manager_get_controlbar_item(layout_data->ad, MP_NAVI_CONTROL_BUTTON_EDIT);
903 if (layout_data->item_count < 1) {
904 elm_object_disabled_set(edit_item, true);
906 elm_object_disabled_set(edit_item, false);
912 mp_view_manager_get_controlbar_item(struct appdata * ad, mp_navi_control_button_type type)
916 Evas_Object *cur_view = ad->naviframe;
917 MP_CHECK_NULL(cur_view);
919 view_data_t *cur_view_data = evas_object_data_get(cur_view, "view_data");
920 MP_CHECK_NULL(cur_view_data);
921 MP_CHECK_VIEW_DATA(cur_view_data);
923 GList *last_item = g_list_last(ad->view_history);
924 MP_CHECK_NULL(last_item);
926 mp_view_histroy_t *last_history = last_item->data;
927 MP_CHECK_NULL(last_history);
929 return last_history->control_buttons[type];
933 mp_view_manager_get_navi_item(struct appdata * ad)
937 Evas_Object *cur_view = ad->naviframe;
938 MP_CHECK_NULL(cur_view);
940 view_data_t *cur_view_data = evas_object_data_get(cur_view, "view_data");
941 MP_CHECK_NULL(cur_view_data);
942 MP_CHECK_VIEW_DATA(cur_view_data);
944 GList *last_item = g_list_last(ad->view_history);
945 MP_CHECK_NULL(last_item);
947 mp_view_histroy_t *last_history = last_item->data;
948 MP_CHECK_NULL(last_history);
950 return last_history->navi_item;
954 mp_view_manager_pop_info_view(struct appdata *ad)
957 MP_CHECK(ad->naviframe);
959 view_data_t *view_data = evas_object_data_get(ad->naviframe, "view_data");
963 mp_view_manager_pop_to_view_content(view_data, MP_VIEW_CONTENT_PLAY);
965 MP_CHECK(ad->playing_view);
966 evas_object_show(ad->playing_view->layout);
970 mp_view_manager_pop_play_view(struct appdata *ad)
973 MP_CHECK(ad->naviframe);
975 view_data_t *view_data;
977 view_data = evas_object_data_get(ad->naviframe, "view_data");
980 if (ad->playing_view)
981 mp_view_manager_pop_to_view_content(view_data, MP_VIEW_CONTENT_PLAY);
985 mp_view_manager_clear(struct appdata *ad)
989 GList *view_item = ad->view_history;
992 mp_view_histroy_t *last_history = view_item->data;
993 mp_language_mgr_unregister_object_item(last_history->navi_item);
994 SAFE_FREE(last_history);
995 view_item = g_list_delete_link(view_item, view_item);
997 ad->view_history = NULL;
1001 mp_view_manager_set_controlbar_visible(Elm_Object_Item *navi_item, bool visible)
1004 MP_CHECK(navi_item);
1006 DEBUG_TRACE("visible: %d", visible);
1008 elm_object_item_signal_emit(navi_item, "elm,state,toolbar,open", "");
1010 elm_object_item_signal_emit(navi_item, "elm,state,toolbar,close", "");