Modification due to the change of CBaseView
[profile/tv/apps/native/musicplayer.git] / src / views / base-view.cpp
index 0bcaf37..3fb613d 100644 (file)
@@ -232,8 +232,8 @@ void CMusicBaseView::m_UpdateFocusSequence(void)
        elm_object_focus_next_object_set(m->srcbtn, m->srcbtn, ELM_FOCUS_DOWN);
        elm_object_focus_next_object_set(m->sortbtn, m->sortbtn, ELM_FOCUS_DOWN);
 
-       elm_object_part_text_set(m->base, MUSIC_PART_NO_CONTENT,     MUSIC_STR_EMPTY);
-       elm_object_part_text_set(m->base, MUSIC_PART_NO_CONTENT_SUB, MUSIC_STR_EMPTY);
+       elm_object_part_text_set(Base(), MUSIC_PART_NO_CONTENT,     MUSIC_STR_EMPTY);
+       elm_object_part_text_set(Base(), MUSIC_PART_NO_CONTENT_SUB, MUSIC_STR_EMPTY);
 }
 
 
@@ -252,8 +252,8 @@ void CMusicBaseView::m_UpdateEmptyFocusSequence(void)
        elm_object_focus_next_object_set(m->srcbtn,    m->group_btn[GROUP_BTN_SONG], ELM_FOCUS_DOWN);
        elm_object_focus_next_object_set(m->sortbtn,   m->group_btn[GROUP_BTN_SONG], ELM_FOCUS_DOWN);
 
-       elm_object_part_text_set(m->base, MUSIC_PART_NO_CONTENT,     _(NO_MUSIC_MESSAGE));
-       elm_object_part_text_set(m->base, MUSIC_PART_NO_CONTENT_SUB, _(NO_MUSIC_MESSAGE_SUB));
+       elm_object_part_text_set(Base(), MUSIC_PART_NO_CONTENT,     _(NO_MUSIC_MESSAGE));
+       elm_object_part_text_set(Base(), MUSIC_PART_NO_CONTENT_SUB, _(NO_MUSIC_MESSAGE_SUB));
 }
 
 
@@ -262,7 +262,7 @@ void CMusicBaseView::m_ShowCurrentLayout(void)
        const char *layoutId = NULL;
        Evas_Object *evasLayout = NULL;
 
-       elm_object_part_content_unset(m->base, MUSIC_PART_CONTENT);
+       elm_object_part_content_unset(Base(), MUSIC_PART_CONTENT);
 
        if (m->c_grpbtn == m->group_btn[GROUP_BTN_SONG]) {
                layoutId = MUSIC_SONG_LAYOUT;
@@ -294,7 +294,7 @@ void CMusicBaseView::m_ShowCurrentLayout(void)
                m_UpdateEmptyFocusSequence();
        }
        else {
-               elm_object_part_content_set(m->base, MUSIC_PART_CONTENT, evasLayout);
+               elm_object_part_content_set(Base(), MUSIC_PART_CONTENT, evasLayout);
                m->lmgr->Show(layoutId);
                m_UpdateFocusSequence();
        }
@@ -328,7 +328,7 @@ void CMusicBaseView::m_CreateCtxPopup(int btnType)
                CSourceCtxPopup *srcCtxPopup = NULL;
                m->btntype = btnType;
                srcCtxPopup = new CSourceCtxPopup;
-               srcCtxPopup->Create(m->base, &cb);
+               srcCtxPopup->Create(Base(), &cb);
 
                m->srcCtxPopup = srcCtxPopup;
        }
@@ -359,7 +359,7 @@ void CMusicBaseView::m_CreateCtxPopup(int btnType)
                        }
                }
 
-               sortCtxPopup->Create(m->base, &cb, sortBtnType);
+               sortCtxPopup->Create(Base(), &cb, sortBtnType);
                m->sortCtxPopup = sortCtxPopup;
        }
        else {
@@ -435,7 +435,7 @@ Evas_Object *CMusicBaseView::m_CreateLoadingPopup(void)
 
        scale = elm_config_scale_get();
 
-       popup = elm_popup_add(m->base);
+       popup = elm_popup_add(Base());
        if (!popup)
                return NULL;
 
@@ -542,7 +542,7 @@ void CMusicBaseView::m_AddPlaysongLabel(void)
 {
        double scale = elm_config_scale_get();
 
-       m->plsonglbl = elm_label_add(m->base);
+       m->plsonglbl = elm_label_add(Base());
        if (!m->plsonglbl)
                return;
 
@@ -553,7 +553,7 @@ void CMusicBaseView::m_AddPlaysongLabel(void)
        elm_label_slide_go(m->plsonglbl);
        evas_object_size_hint_weight_set(m->plsonglbl, EVAS_HINT_EXPAND,
                EVAS_HINT_EXPAND);
-       elm_object_part_content_set(m->base, MUSIC_PART_PLAYSONG_LBL,
+       elm_object_part_content_set(Base(), MUSIC_PART_PLAYSONG_LBL,
                m->plsonglbl);
        evas_object_show(m->plsonglbl);
 }
@@ -578,20 +578,20 @@ void CMusicBaseView::m_CreateTopSection(void)
        btninfo[BTN_SORT].style = MUSIC_STYLE_SORT_BTN;
        btninfo[BTN_SORT].type = BASE_VIEW_SORT_BUTTON;
 
-       elm_object_part_text_set(m->base, MUSIC_PART_TITLE,
+       elm_object_part_text_set(Base(), MUSIC_PART_TITLE,
                _(MUSIC_TEXT_TITLE));
 
        m_AddPlaysongLabel();
 
        for (i = 0; i < TOTAL_TOP_BTNS; i++) {
-               btn = s_AddButton(m->base);
+               btn = s_AddButton(Base());
                if (!btn) {
                        _ERR(" Adding btn failed ");
                        return;
                }
 
                elm_object_style_set(btn, btninfo[i].style);
-               elm_object_part_content_set(m->base, btninfo[i].part, btn);
+               elm_object_part_content_set(Base(), btninfo[i].part, btn);
 
                Connect(btn, btninfo[i].type,
                        TYPE_KEY_DOWN | TYPE_KEY_UP | TYPE_MOUSE_MOVE | TYPE_CLICKED);
@@ -643,7 +643,7 @@ void CMusicBaseView::m_CreateLeftSection(void)
        btninfo[GROUP_BTN_PLAYLIST].icon_path = MUSIC_IMAGE_GRPBTN_PLAYLISTS;
        btninfo[GROUP_BTN_PLAYLIST].type = BASE_VIEW_GROUP_PLAYLIST;
 
-       box = CCommonUI::AddBox(m->base);
+       box = CCommonUI::AddBox(Base());
        if (!box)
                return;
 
@@ -671,7 +671,7 @@ void CMusicBaseView::m_CreateLeftSection(void)
                }
        }
 
-       elm_object_part_content_set(m->base, MUSIC_PART_GROUPBTN_BOX, box);
+       elm_object_part_content_set(Base(), MUSIC_PART_GROUPBTN_BOX, box);
 }
 
 
@@ -716,19 +716,21 @@ char *CMusicBaseView::m_Argument(void *data)
 }
 
 
-bool CMusicBaseView::Create(void *data)
+bool CMusicBaseView::Create(void *data, Evas_Object *eoBase)
 {
        ASSERT(!m);
 
        _CREATE_BEGIN{
+               Evas_Object *eoBase;
+
                _CHECK(m = new SMusicBaseView)
                _CHECK(m->win = CViewMgr::GetInstance()->Window())
                _CHECK(m->pController = new CMusicController)
                _CHECK(m->pController->Create())
-               _CHECK(m->base = CCommonUI::AddBase(m->win, MUSIC_BASE_VIEW))
+               _CHECK(eoBase = CCommonUI::AddBase(m->win, MUSIC_BASE_VIEW))
+               _CHECK(CBaseView::Create(NULL, eoBase))
                _CHECK(m->lmgr = new CLayoutMgr)
-               _CHECK(m->lmgr->Create(m->base, NULL))
-               _CHECK(CBaseView::Create(NULL))
+               _CHECK(m->lmgr->Create(eoBase, NULL))
                _CHECK(m->layoutSong = new CSongLayout(MUSIC_SONG_LAYOUT))
                _CHECK(m->layoutSong->Create(m->lmgr, m_Argument(data)))
                _CHECK(m->lmgr->AddLayout(m->layoutSong))
@@ -748,7 +750,7 @@ bool CMusicBaseView::Create(void *data)
                _CHECK(m->layoutFolder->Create(m->lmgr))
                _CHECK(m->lmgr->AddLayout(m->layoutFolder))
                _CHECK(m->pHandleVolume = new CHandleVolume)
-               _CHECK(m->pHandleVolume->Create(m->base))
+               _CHECK(m->pHandleVolume->Create(eoBase))
                _CHECK(m->pController->AddListener(this))
 
                _WHEN_SUCCESS{
@@ -760,14 +762,14 @@ bool CMusicBaseView::Create(void *data)
                        m->layoutGenre->SetEmptyStatusHandleCallback(sm_CbHandleEmptyStatus, this);
                        m->layoutPlaylists->SetEmptyStatusHandleCallback(sm_CbHandleEmptyStatus, this);
 
-                       elm_object_part_content_unset(m->base, MUSIC_PART_CONTENT);
+                       elm_object_part_content_unset(eoBase, MUSIC_PART_CONTENT);
                        m_SetSourceType();
-                       evas_object_data_set(m->base, BASE_VIEW_DATA, m);
+                       evas_object_data_set(eoBase, BASE_VIEW_DATA, m);
 
                        m_CreateFullView();
                        m_UpdateFocusSequence();
 
-                       Connect(m->base, BASE_VIEW, TYPE_KEY_DOWN | TYPE_KEY_UP);
+                       Connect(eoBase, BASE_VIEW, TYPE_KEY_DOWN | TYPE_KEY_UP);
                }
 
                _CHECK_FAIL{ m->pController->RemoveListener(this); }
@@ -791,10 +793,10 @@ bool CMusicBaseView::Create(void *data)
                _CHECK_FAIL{ m->lmgr->RemoveLayout(m->layoutSong); }
                _CHECK_FAIL{ m->layoutSong->Destroy(); }
                _CHECK_FAIL{ delete m->layoutSong; }
-               _CHECK_FAIL{ CBaseView::Destroy(); }
                _CHECK_FAIL{ m->lmgr->Destroy(); }
                _CHECK_FAIL{ delete m->lmgr; }
-               _CHECK_FAIL{ evas_object_del(m->base); }
+               _CHECK_FAIL{ CBaseView::Destroy(); }
+               _CHECK_FAIL{ evas_object_del(eoBase); }
                _CHECK_FAIL{ m->pController->Destroy(); }
                _CHECK_FAIL{ delete m->pController; }
                _CHECK_FAIL{ /* win */ }
@@ -809,6 +811,10 @@ void CMusicBaseView::Destroy(void)
 {
        ASSERT(m);
 
+       Evas_Object *eoBase = Base();
+
+       Disconnect(eoBase);
+
        m->pController->RemoveListener(this);
        m->pHandleVolume->Destroy();
 
@@ -836,10 +842,11 @@ void CMusicBaseView::Destroy(void)
        m->layoutSong->Destroy();
        delete m->layoutSong;
 
-       CBaseView::Destroy();
        m->lmgr->Destroy();
        delete m->lmgr;
-       evas_object_del(m->base);
+
+       CBaseView::Destroy();
+       evas_object_del(eoBase);
 
        m->pController->Destroy();
        delete m->pController;
@@ -848,19 +855,11 @@ void CMusicBaseView::Destroy(void)
 }
 
 
-Evas_Object* CMusicBaseView::Base(void)
-{
-       ASSERT(m);
-
-       return m->base;
-}
-
-
 void CMusicBaseView::t_OnShow(void)
 {
        ASSERT(m);
 
-       evas_object_show(m->base);
+       evas_object_show(Base());
 
        if (!m->fresh_view) {
                elm_object_focus_set(m->plbackbtn, EINA_TRUE);
@@ -963,7 +962,7 @@ void CMusicBaseView::t_OnHide(void)
 {
        ASSERT(m);
 
-       evas_object_hide(m->base);
+       evas_object_hide(Base());
 }