SRC_NEARBY,
};
+struct SSigCallbackPair {
+ void (*cb)(void *cookie, int sig);
+ void *cookie;
+};
+
class CAllSourceView : public CBaseView, IMouseMoveListener, IFocusedListener {
private:
struct SAllSourceView* m;
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);
CPluggedLayout *pPluggedLayout;
CNearbyLayout *pNearbyLayout;
+ SSigCallbackPair *sigCb;
+
SAllSourceView() {
memset(this, 0, sizeof(SAllSourceView));
}
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;
_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());
_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{}
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;
}
#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;
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);
m->srcmgr = srcmgr;
m->vmgr = vmgr;
+ m->SigCb = (SSigCallbackPair *)data;
evas_object_data_set(m->base, PLUGGED_DATA, m);