remove SetSendSigCallback function 43/37043/2 accepted/tizen/tv/20150401.123953 submit/tizen_tv/20150401.080439
authorJehun Lim <jehun.lim@samsung.com>
Wed, 18 Mar 2015 10:34:33 +0000 (19:34 +0900)
committerJehun Lim <jehun.lim@samsung.com>
Thu, 19 Mar 2015 01:32:14 +0000 (10:32 +0900)
Change-Id: I0dc9f7d728b20dcf86bdfbc831df4af0f1796510
Signed-off-by: Jehun Lim <jehun.lim@samsung.com>
include/view/allsource_view.h
include/view/nearby_layout.h
include/view/plugged_layout.h
src/view/allsource_view.cpp
src/view/nearby_layout.cpp
src/view/plugged_layout.cpp

index 7d12832..5759c16 100644 (file)
@@ -30,6 +30,11 @@ enum launch_mode {
        SRC_NEARBY,
 };
 
+struct SSigCallbackPair {
+       void (*cb)(void *cookie, int sig);
+       void *cookie;
+};
+
 class CAllSourceView : public CBaseView, IMouseMoveListener, IFocusedListener {
 private:
        struct SAllSourceView* m;
@@ -41,6 +46,7 @@ private:
        static void sm_CbGetSignalFromLayout(void *cookie, int signal);
        static void sm_CbUpdateSrcList(void *cookie, void *data,
                                enum update_ui type);
+       SSigCallbackPair *m_CreateSigCbPair(void);
        Evas_Object *m_AddLayout(Evas_Object *win);
        Evas_Object *m_AddBtn(const char *style, const char *str);
        bool m_AddMenuArea(void);
index 17b7e42..e33fe15 100644 (file)
@@ -54,8 +54,6 @@ public:
 
        void Update(void *data, enum update_ui type);
 
-       bool SetSendSigCallback(void (*cb)(void *cookie, int sig), void *cookie);
-
 public:
        void OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev);
        void OnMouseMove(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev);
index 9444051..c7a8d75 100644 (file)
@@ -47,8 +47,6 @@ public:
 
        void Update(void *data, enum update_ui type);
 
-       bool SetSendSigCallback(void (*cb)(void *cookie, int sig), void *cookie);
-
 public:
        void OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev);
        void OnMouseMove(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev);
index b9fb48c..d279ca8 100644 (file)
@@ -58,6 +58,8 @@ struct SAllSourceView {
        CPluggedLayout *pPluggedLayout;
        CNearbyLayout *pNearbyLayout;
 
+       SSigCallbackPair *sigCb;
+
        SAllSourceView() {
                memset(this, 0, sizeof(SAllSourceView));
        }
@@ -137,6 +139,22 @@ bool CAllSourceView::m_AddMenuArea(void)
        return true;
 }
 
+SSigCallbackPair *CAllSourceView::m_CreateSigCbPair(void)
+{
+       ASSERT(m);
+
+       SSigCallbackPair *scb = new SSigCallbackPair;
+       if (!scb)
+               return NULL;
+
+       scb->cb = sm_CbGetSignalFromLayout;
+       scb->cookie = m;
+
+       m->sigCb = scb;
+
+       return scb;
+}
+
 void CAllSourceView::sm_CbGetSignalFromLayout(void *cookie, int signal)
 {
        SAllSourceView *m = (SAllSourceView *)cookie;
@@ -185,15 +203,14 @@ bool CAllSourceView::Create(void *data)
                _CHECK(win = vmgr->Window());
                _CHECK(m = new SAllSourceView);
                _CHECK(m->base = m_AddLayout(win));
+               _CHECK(m->sigCb = m_CreateSigCbPair());
                _CHECK(CSourceMgr::Initialize(sm_CbUpdateSrcList, m));
                _CHECK(m->pLayoutMgr = new CLayoutMgr);
                _CHECK(m->pLayoutMgr->Create(m->base, NULL));
                _CHECK(m->pPluggedLayout = new CPluggedLayout(LAYOUT_PLUGGED));
                _CHECK(m->pNearbyLayout = new CNearbyLayout(LAYOUT_NEARBY));
-               _CHECK(m->pPluggedLayout->Create(m->pLayoutMgr, NULL));
-               _CHECK(m->pPluggedLayout->SetSendSigCallback(sm_CbGetSignalFromLayout, m));
-               _CHECK(m->pNearbyLayout->Create(m->pLayoutMgr, NULL));
-               _CHECK(m->pNearbyLayout->SetSendSigCallback(sm_CbGetSignalFromLayout, m));
+               _CHECK(m->pPluggedLayout->Create(m->pLayoutMgr, m->sigCb));
+               _CHECK(m->pNearbyLayout->Create(m->pLayoutMgr, m->sigCb));
                _CHECK(m->pLayoutMgr->AddLayout(m->pPluggedLayout));
                _CHECK(m->pLayoutMgr->AddLayout(m->pNearbyLayout));
                _CHECK(m_AddMenuArea());
@@ -206,15 +223,14 @@ bool CAllSourceView::Create(void *data)
                _CHECK_FAIL{}
                _CHECK_FAIL{ m->pLayoutMgr->RemoveLayout(m->pNearbyLayout); }
                _CHECK_FAIL{ m->pLayoutMgr->RemoveLayout(m->pPluggedLayout); }
-               _CHECK_FAIL{}
                _CHECK_FAIL{ m->pNearbyLayout->Destroy(); }
-               _CHECK_FAIL{}
                _CHECK_FAIL{ m->pPluggedLayout->Destroy(); }
-               _CHECK_FAIL{ delete m->pNearbyLayout; m->pNearbyLayout = NULL; }
-               _CHECK_FAIL{ delete m->pPluggedLayout; m->pPluggedLayout = NULL; }
+               _CHECK_FAIL{ delete m->pNearbyLayout; }
+               _CHECK_FAIL{ delete m->pPluggedLayout; }
                _CHECK_FAIL{ m->pLayoutMgr->Destroy(); }
-               _CHECK_FAIL{ delete m->pLayoutMgr; m->pLayoutMgr = NULL; }
+               _CHECK_FAIL{ delete m->pLayoutMgr; }
                _CHECK_FAIL{ CSourceMgr::Finalize(); }
+               _CHECK_FAIL{ delete m->sigCb; }
                _CHECK_FAIL{ evas_object_del(m->base); }
                _CHECK_FAIL{ delete m; m = NULL; }
                _CHECK_FAIL{}
@@ -230,9 +246,20 @@ void CAllSourceView::Destroy(void)
        CBaseView::Destroy();
 
        m->pLayoutMgr->RemoveLayout(m->pPluggedLayout);
+       m->pPluggedLayout->Destroy();
+       delete m->pPluggedLayout;
+
        m->pLayoutMgr->RemoveLayout(m->pNearbyLayout);
+       m->pNearbyLayout->Destroy();
+       delete m->pNearbyLayout;
+
+       m->pLayoutMgr->Destroy();
+       delete m->pLayoutMgr;
+
+       delete m->sigCb;
 
        CSourceMgr::Finalize();
+
        delete m;
        m = NULL;
 }
index ed7eafa..66efc0e 100644 (file)
@@ -54,11 +54,6 @@ enum EObjectType {
        NEARBY_BTN_LAYOUT
 };
 
-struct SSigCallbackPair {
-       void (*cb)(void *cookie, int sig);
-       void *cookie;
-};
-
 struct SNearbyLayout {
        Evas_Object *base;
        Evas_Object *grid;
@@ -214,22 +209,6 @@ Evas_Object *CNearbyLayout::m_DrawGengrid(Evas_Object *layout)
        return grid;
 }
 
-bool CNearbyLayout::SetSendSigCallback(void (*cb)(void *cookie, int sig), void *cookie)
-{
-       ASSERT(m);
-
-       SSigCallbackPair *rcb = new SSigCallbackPair;
-       if (!rcb)
-               return false;
-
-       rcb->cb = cb;
-       rcb->cookie = cookie;
-
-       m->SigCb = rcb;
-
-       return true;
-}
-
 bool CNearbyLayout::Create(CLayoutMgr *lmgr, void *data)
 {
        ASSERT(!m);
@@ -274,6 +253,7 @@ bool CNearbyLayout::Create(CLayoutMgr *lmgr, void *data)
 
        m->srcmgr = srcmgr;
        m->vmgr = vmgr;
+       m->SigCb = (SSigCallbackPair *)data;
 
        evas_object_data_set(m->base, NEARBY_DATA, m);
 
index 9565199..d5d2b60 100644 (file)
 #define TEXT_NO_SRC_TEXT_LINE1 "No plugged source"
 #define TEXT_NO_SRC_TEXT_LINE2 "Check connection status or install any cloud service."
 
-struct SSigCallbackPair {
-       void (*cb)(void *cookie, int sig);
-       void *cookie;
-};
-
 struct SPluggedLayout {
        Evas_Object *base;
        Evas_Object *grid;
@@ -73,22 +68,6 @@ Evas_Object *CPluggedLayout::m_DrawGengrid(Evas_Object *layout)
        return grid;
 }
 
-bool CPluggedLayout::SetSendSigCallback(void (*cb)(void *cookie, int sig), void *cookie)
-{
-       ASSERT(m);
-
-       SSigCallbackPair *rcb = new SSigCallbackPair;
-       if (!rcb)
-               return false;
-
-       rcb->cb = cb;
-       rcb->cookie = cookie;
-
-       m->SigCb = rcb;
-
-       return true;
-}
-
 bool CPluggedLayout::Create(CLayoutMgr *lmgr, void *data)
 {
        ASSERT(!m);
@@ -133,6 +112,7 @@ bool CPluggedLayout::Create(CLayoutMgr *lmgr, void *data)
 
        m->srcmgr = srcmgr;
        m->vmgr = vmgr;
+       m->SigCb = (SSigCallbackPair *)data;
 
        evas_object_data_set(m->base, PLUGGED_DATA, m);