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 elm_object_item_part_content_set(navi_it, "toolbar_more_btn", NULL);
598 if (last_history->content_type == MP_VIEW_CONTENT_LIST)
600 mp_layout_data_t *layout_data = evas_object_data_get(last_history->view_layout, "layout_data");
601 MP_CHECK(layout_data);
602 DEBUG_TRACE("layout_data: 0x%x", layout_data);
603 MP_CHECK_LAYOUT_DATA(layout_data);
605 DEBUG_TRACE("MP_VIEW_CONTENT_LIST. category: %d, rename mode: %d, add tracks : %d ",
606 layout_data->category, layout_data->rename_mode, layout_data->ad->b_add_tracks);
607 DEBUG_TRACE("layout_data->playlist_id: %d", layout_data->playlist_id);
609 if (layout_data->edit_mode)
611 if (layout_data->ad->b_add_tracks)
615 btn = mp_widget_create_toolbar_btn(layout,
616 MP_TOOLBAR_BTN_DEFULTL, GET_STR("IDS_MUSIC_BODY_ADD_TO_PLAYLIST"), mp_track_view_add_to_playlist_cancel_cb, data);
617 elm_object_item_part_content_set(navi_it, "toolbar_button1", btn);
618 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_ADD_TO_PLAYLIST] = btn;
620 mp_view_manager_set_back_button(layout, navi_it, mp_track_view_add_to_playlist_cancel_cb, data);
625 if (layout_data->category == MP_LAYOUT_TRACK_LIST)
629 btn = mp_widget_create_toolbar_btn(layout,
630 MP_TOOLBAR_BTN_LEFT, GET_STR("IDS_MUSIC_OPT_DELETE"), mp_edit_view_delete_cb, data);
631 elm_object_item_part_content_set(navi_it, "toolbar_button1", btn);
632 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_DELETE] = btn;
634 btn = mp_widget_create_toolbar_btn(layout,
635 MP_TOOLBAR_BTN_RIGHT, GET_STR("IDS_MUSIC_SK_SHARE"), mp_edit_view_share_cb, data);
636 elm_object_item_part_content_set(navi_it, "toolbar_button2", btn);
637 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_SHARE] = btn;
639 btn = mp_widget_create_toolbar_btn(layout, MP_TOOLBAR_BTN_MORE, NULL, _mp_view_manager_more_btn_cb, view_data);
640 evas_object_data_set(btn, "more_btn_type", (void *)MP_MORE_BUTTON_TYPE_TRACK_LIST);
641 elm_object_item_part_content_set(navi_it, "toolbar_more_btn", btn);
642 evas_object_data_set(btn, "cb_data", data);
644 mp_view_manager_set_back_button(layout, navi_it, mp_edit_view_cencel_cb, data);
647 else if (layout_data->category == MP_LAYOUT_GROUP_LIST)
650 btn = mp_widget_create_toolbar_btn(layout,
651 MP_TOOLBAR_BTN_DEFULTL, GET_STR("IDS_MUSIC_BODY_ADD_TO_PLAYLIST"), mp_edit_view_add_to_plst_cb, data);
652 elm_object_item_part_content_set(navi_it, "toolbar_button1", btn);
653 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_ADD_TO_PLAYLIST] = btn;
655 mp_view_manager_set_back_button(layout, navi_it, mp_edit_view_cencel_cb, data);
662 btn = mp_widget_create_toolbar_btn(layout,
663 MP_TOOLBAR_BTN_DEFULTL, GET_STR("IDS_MUSIC_OPT_DELETE"), mp_edit_view_delete_cb, data);
664 elm_object_item_part_content_set(navi_it, "toolbar_button1", btn);
665 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_DELETE] = btn;
667 mp_view_manager_set_back_button(layout, navi_it, mp_edit_view_cencel_cb, data);
674 if(!layout_data->ad->b_add_tracks)
676 mp_view_manager_set_back_button(last_history->view_layout, last_history->navi_item, mp_common_back_button_cb, view_data);
680 layout_data->navibar_title = g_strdup(title);
682 if (MP_TRACK_BY_ALBUM == layout_data->track_type
683 || MP_TRACK_BY_ARTIST == layout_data->track_type)
684 layout_data->navibar_title = g_strdup(layout_data->type_str);
686 layout_data->callback_data = data;
687 if (layout_data->category != MP_LAYOUT_PLAYLIST_LIST)
689 if (layout_data->ad->b_add_tracks)
692 btn = mp_widget_create_toolbar_btn(layout,
693 MP_TOOLBAR_BTN_DEFULTL, GET_STR("IDS_MUSIC_BODY_ADD_TO_PLAYLIST"), mp_track_view_add_to_playlist_done_cb, data);
694 elm_object_item_part_content_set(navi_it, "toolbar_button1", btn);
695 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_ADD_TO_PLAYLIST] = btn;
698 mp_view_manager_set_back_button(layout, navi_it, mp_track_view_add_to_playlist_cancel_cb, data);
701 else if (layout_data->track_type == MP_TRACK_BY_PLAYLIST)
703 if (!mp_view_manager_get_view_layout(ad, MP_VIEW_CONTENT_SEARCH))
706 btn = mp_widget_create_toolbar_btn(layout,
707 MP_TOOLBAR_BTN_LEFT, GET_SYS_STR("IDS_COM_SK_EDIT"), mp_common_edit_button_cb, data);
708 elm_object_item_part_content_set(navi_it, "toolbar_button1", btn);
709 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_EDIT] = btn;
711 if (layout_data->playlist_id > 0)
713 btn = mp_widget_create_toolbar_btn(layout,
714 MP_TOOLBAR_BTN_RIGHT, GET_SYS_STR("IDS_COM_SK_ADD"), mp_playlist_view_add_button_cb, data);
715 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_CREATE_PLAYLIST] = btn;
719 btn = mp_widget_create_toolbar_btn(layout,
720 MP_TOOLBAR_BTN_RIGHT, GET_SYS_STR("IDS_COM_SK_SEARCH"), mp_common_search_button_cb, data);
721 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_SEARCH] = btn;
723 elm_object_item_part_content_set(navi_it, "toolbar_button2", btn);
728 btn = mp_widget_create_toolbar_btn(layout,
729 MP_TOOLBAR_BTN_DEFULTL, GET_SYS_STR("IDS_COM_SK_EDIT"), mp_common_edit_button_cb, data);
730 elm_object_item_part_content_set(navi_it, "toolbar_button1", btn);
731 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_EDIT] = btn;
737 if (layout_data->category == MP_LAYOUT_GROUP_LIST)
739 if (!mp_view_manager_get_view_layout(ad, MP_VIEW_CONTENT_SEARCH))
742 btn = mp_widget_create_toolbar_btn(layout,
743 MP_TOOLBAR_BTN_LEFT, GET_STR("IDS_MUSIC_BODY_ADD_TO_PLAYLIST"), mp_common_edit_button_cb, data);
744 elm_object_item_part_content_set(navi_it, "toolbar_button1", btn);
745 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_ADD_TO_PLAYLIST] = btn;
747 btn = mp_widget_create_toolbar_btn(layout,
748 MP_TOOLBAR_BTN_RIGHT, GET_SYS_STR("IDS_COM_SK_SEARCH"), mp_common_search_button_cb, data);
749 elm_object_item_part_content_set(navi_it, "toolbar_button2", btn);
750 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_SEARCH] = btn;
756 btn = mp_widget_create_toolbar_btn(layout,
757 MP_TOOLBAR_BTN_DEFULTL, GET_STR("IDS_MUSIC_BODY_ADD_TO_PLAYLIST"), mp_common_edit_button_cb, data);
758 elm_object_item_part_content_set(navi_it, "toolbar_button1", btn);
759 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_ADD_TO_PLAYLIST] = btn;
764 if (!mp_view_manager_get_view_layout(ad, MP_VIEW_CONTENT_SEARCH))
767 btn = mp_widget_create_toolbar_btn(layout,
768 MP_TOOLBAR_BTN_LEFT, GET_SYS_STR("IDS_COM_SK_EDIT"), mp_common_edit_button_cb, data);
769 elm_object_item_part_content_set(navi_it, "toolbar_button1", btn);
770 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_EDIT] = btn;
772 btn = mp_widget_create_toolbar_btn(layout,
773 MP_TOOLBAR_BTN_RIGHT, GET_SYS_STR("IDS_COM_SK_SEARCH"), mp_common_search_button_cb, data);
774 elm_object_item_part_content_set(navi_it, "toolbar_button2", btn);
775 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_SEARCH] = btn;
780 btn = mp_widget_create_toolbar_btn(layout,
781 MP_TOOLBAR_BTN_DEFULTL, GET_SYS_STR("IDS_COM_SK_EDIT"), mp_common_edit_button_cb, data);
782 elm_object_item_part_content_set(navi_it, "toolbar_button1", btn);
783 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_EDIT] = btn;
790 DEBUG_TRACE("layout_data->item_count=%d", layout_data->item_count);
791 btn = mp_widget_create_toolbar_btn(layout,
792 MP_TOOLBAR_BTN_LEFT, GET_SYS_STR("IDS_COM_SK_EDIT"), mp_common_edit_button_cb, data);
793 elm_object_item_part_content_set(navi_it, "toolbar_button1", btn);
794 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_EDIT] = btn;
796 btn = mp_widget_create_toolbar_btn(layout,
797 MP_TOOLBAR_BTN_RIGHT, GET_SYS_STR("IDS_COM_SK_SEARCH"), mp_common_search_button_cb, data);
798 elm_object_item_part_content_set(navi_it, "toolbar_button2", btn);
799 last_history->control_buttons[MP_NAVI_CONTROL_BUTTON_SEARCH] = btn;
801 btn = mp_widget_create_toolbar_btn(layout, MP_TOOLBAR_BTN_MORE, NULL, _mp_view_manager_more_btn_cb, view_data);
802 evas_object_data_set(btn, "more_btn_type", (void *)MP_MORE_BUTTON_TYPE_DEFAULT);
803 evas_object_data_set(btn, "cb_data", data);
804 elm_object_item_part_content_set(navi_it, "toolbar_more_btn", btn);
807 /* update the first controlba item */
808 mp_view_manager_update_first_controlbar_item(layout_data);
812 else if (last_history->content_type == MP_VIEW_CONTENT_SEARCH)
814 DEBUG_TRACE("MP_VIEW_CONTENT_SEARCH. ");
815 mp_view_manager_set_back_button(last_history->view_layout, last_history->navi_item, mp_common_back_button_cb, view_data);
817 else if (last_history->content_type == MP_VIEW_CONTENT_PLAY)
819 DEBUG_TRACE("MP_VIEW_CONTENT_PLAY. ");
820 mp_play_view_set_snd_path_sensitivity(ad);
822 else if (last_history->content_type == MP_VIEW_CONTENT_INFO)
824 DEBUG_TRACE("MP_VIEW_CONTENT_INFO. ");
825 mp_view_manager_set_back_button(last_history->view_layout, last_history->navi_item, mp_play_view_info_back_cb, ad);
829 WARN_TRACE("unexpected value: %d", last_history->content_type);
835 mp_view_manager_set_now_playing(view_data_t * view_data, bool show)
838 MP_CHECK_VIEW_DATA(view_data);
840 mp_view_histroy_t *history = NULL;
841 struct appdata *ad = view_data->ad;
844 GList *item = g_list_last(ad->view_history);
845 GList *last_item = item;
849 history = item->data;
850 if (history->content_type == MP_VIEW_CONTENT_LIST)
854 mp_view_layout_show_now_playing(history->view_layout);
855 if(item != last_item) //freeze timer not to update every view. update top view.
856 mp_view_layout_progress_timer_freeze(history->view_layout);
859 mp_view_layout_hide_now_playing(history->view_layout);
861 mp_view_layout_set_now_playing_info(history->view_layout);
863 item = g_list_previous(item);
870 mp_view_manager_freeze_progress_timer(struct appdata *ad)
872 Evas_Object *top_view = mp_view_manager_get_last_view_layout(ad);
874 mp_view_layout_progress_timer_freeze(top_view);
876 mp_play_view_progress_timer_freeze(ad);
880 mp_view_manager_thaw_progress_timer(struct appdata *ad)
882 mp_retm_if(ad->is_lcd_off, "LCD off. not thaw progress timer.. ");
884 Evas_Object *top_view = mp_view_manager_get_last_view_layout(ad);
886 mp_view_layout_progress_timer_thaw(top_view);
888 mp_play_view_progress_timer_thaw(ad);
891 void mp_view_manager_update_first_controlbar_item(void *data)
893 mp_layout_data_t *layout_data = (mp_layout_data_t *)data;
894 MP_CHECK(layout_data);
895 Evas_Object *edit_item = mp_view_manager_get_controlbar_item(layout_data->ad, MP_NAVI_CONTROL_BUTTON_EDIT);
898 if (layout_data->item_count < 1) {
899 elm_object_disabled_set(edit_item, true);
901 elm_object_disabled_set(edit_item, false);
907 mp_view_manager_get_controlbar_item(struct appdata * ad, mp_navi_control_button_type type)
911 Evas_Object *cur_view = ad->naviframe;
912 MP_CHECK_NULL(cur_view);
914 view_data_t *cur_view_data = evas_object_data_get(cur_view, "view_data");
915 MP_CHECK_NULL(cur_view_data);
916 MP_CHECK_VIEW_DATA(cur_view_data);
918 GList *last_item = g_list_last(ad->view_history);
919 MP_CHECK_NULL(last_item);
921 mp_view_histroy_t *last_history = last_item->data;
922 MP_CHECK_NULL(last_history);
924 return last_history->control_buttons[type];
928 mp_view_manager_get_navi_item(struct appdata * ad)
932 Evas_Object *cur_view = ad->naviframe;
933 MP_CHECK_NULL(cur_view);
935 view_data_t *cur_view_data = evas_object_data_get(cur_view, "view_data");
936 MP_CHECK_NULL(cur_view_data);
937 MP_CHECK_VIEW_DATA(cur_view_data);
939 GList *last_item = g_list_last(ad->view_history);
940 MP_CHECK_NULL(last_item);
942 mp_view_histroy_t *last_history = last_item->data;
943 MP_CHECK_NULL(last_history);
945 return last_history->navi_item;
949 mp_view_manager_pop_info_view(struct appdata *ad)
952 MP_CHECK(ad->naviframe);
954 view_data_t *view_data = evas_object_data_get(ad->naviframe, "view_data");
958 mp_view_manager_pop_to_view_content(view_data, MP_VIEW_CONTENT_PLAY);
960 MP_CHECK(ad->playing_view);
961 evas_object_show(ad->playing_view->layout);
965 mp_view_manager_pop_play_view(struct appdata *ad)
968 MP_CHECK(ad->naviframe);
970 view_data_t *view_data;
972 view_data = evas_object_data_get(ad->naviframe, "view_data");
975 if (ad->playing_view)
976 mp_view_manager_pop_to_view_content(view_data, MP_VIEW_CONTENT_PLAY);
980 mp_view_manager_clear(struct appdata *ad)
984 GList *view_item = ad->view_history;
987 mp_view_histroy_t *last_history = view_item->data;
988 mp_language_mgr_unregister_object_item(last_history->navi_item);
989 SAFE_FREE(last_history);
990 view_item = g_list_delete_link(view_item, view_item);
992 ad->view_history = NULL;
996 mp_view_manager_set_controlbar_visible(Elm_Object_Item *navi_item, bool visible)
1001 DEBUG_TRACE("visible: %d", visible);
1003 elm_object_item_signal_emit(navi_item, "elm,state,toolbar,open", "");
1005 elm_object_item_signal_emit(navi_item, "elm,state,toolbar,close", "");