summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSung-jae Park <nicesj.park@samsung.com>2013-08-13 01:25:58 (GMT)
committerSung-jae Park <nicesj.park@samsung.com>2013-08-13 01:25:58 (GMT)
commit01c9f3ab3df21d80e3bfb4fa492e956041657c1c (patch)
tree225d4b4ed53b244c7f0f2b3d0438177f237b2836
parent3d4662356e753853531c745e76bbddcb1a94a427 (diff)
downloadlivebox-cpp-tizen_2.2.zip
livebox-cpp-tizen_2.2.tar.gz
livebox-cpp-tizen_2.2.tar.bz2
Change-Id: I643ca5a64d5e3d72db1bf94e6fbb0e931479b002
-rw-r--r--include/CModule.h4
-rw-r--r--packaging/liblivebox-cpp.spec7
-rw-r--r--src/CModule.cpp21
-rw-r--r--src/dlist.cpp18
-rw-r--r--src/livebox.cpp144
5 files changed, 120 insertions, 74 deletions
diff --git a/include/CModule.h b/include/CModule.h
index f7c66ac..2851257 100644
--- a/include/CModule.h
+++ b/include/CModule.h
@@ -37,11 +37,11 @@ public:
static CModule *Load(const char *pkgname);
int Unload(void);
- int Create(const char *filename, const char *content, const char *cluster, const char *category);
+ int Create(const char *id, const char *content, const char *cluster, const char *category);
int NeedToCreate(const char *cluster, const char *category);
int Destroy(CLiveBoxImpl *inst);
- CLiveBoxImpl *FindLiveBox(const char *filename);
+ CLiveBoxImpl *FindLiveBox(const char *id);
const char *PackageName(void) { return m_sPkgname; }
};
diff --git a/packaging/liblivebox-cpp.spec b/packaging/liblivebox-cpp.spec
index 24a21bc..238a233 100644
--- a/packaging/liblivebox-cpp.spec
+++ b/packaging/liblivebox-cpp.spec
@@ -1,6 +1,6 @@
Name: liblivebox-cpp
Summary: C++ adaptor for a livebox
-Version: 0.2.7
+Version: 0.2.8
Release: 1
Group: HomeTF/Livebox
License: Flora License
@@ -26,6 +26,11 @@ Livebox development library (C++) (dev)
%setup -q
%build
+%if 0%{?tizen_build_binary_release_type_eng}
+export CFLAGS="${CFLAGS} -DTIZEN_ENGINEER_MODE"
+export CXXFLAGS="${CXXFLAGS} -DTIZEN_ENGINEER_MODE"
+export FFLAGS="${FFLAGS} -DTIZEN_ENGINEER_MODE"
+%endif
%cmake .
make %{?jobs:-j%jobs}
diff --git a/src/CModule.cpp b/src/CModule.cpp
index e06f365..e37cc52 100644
--- a/src/CModule.cpp
+++ b/src/CModule.cpp
@@ -81,8 +81,9 @@ CModule *CModule::Load(const char *pkgname)
}
inst->m_fNeedToCreate = (int (*)(const char *, const char *))dlsym(inst->m_pHandle, "livebox_need_to_create");
- if (!inst->m_fNeedToCreate)
+ if (!inst->m_fNeedToCreate) {
DbgPrint("%s has no livebox_need_to_create\n", pkgname);
+ }
inst->m_fInitialize = (int (*)(const char *))dlsym(inst->m_pHandle, "livebox_initialize");
if (!inst->m_fInitialize) {
@@ -99,8 +100,9 @@ CModule *CModule::Load(const char *pkgname)
}
inst->m_fFinalize = (int (*)(void))dlsym(inst->m_pHandle, "livebox_finalize");
- if (!inst->m_fFinalize)
+ if (!inst->m_fFinalize) {
DbgPrint("%s has no livebox_finalize\n", pkgname);
+ }
m_pModuleList = dlist_append(m_pModuleList, inst);
return inst;
@@ -125,14 +127,14 @@ int CModule::Unload(void)
return LB_STATUS_SUCCESS;
}
-int CModule::Create(const char *filename, const char *content, const char *cluster, const char *category)
+int CModule::Create(const char *id, const char *content, const char *cluster, const char *category)
{
CLiveBoxImpl *inst;
inst = (CLiveBoxImpl *)m_fNew();
if (inst) {
int ret;
- ret = inst->Create(filename, content, cluster, category);
+ ret = inst->Create(id, content, cluster, category);
if (ret < 0) {
delete inst;
return ret;
@@ -150,15 +152,16 @@ int CModule::Destroy(CLiveBoxImpl *inst)
struct dlist *l;
l = dlist_find_data(m_pList, inst);
- if (!l)
+ if (!l) {
return LB_STATUS_ERROR_NOT_EXIST;
+ }
m_pList = dlist_remove(m_pList, l);
delete inst;
return LB_STATUS_SUCCESS;
}
-CLiveBoxImpl *CModule::FindLiveBox(const char *filename)
+CLiveBoxImpl *CModule::FindLiveBox(const char *id)
{
struct dlist *l;
void *item;
@@ -166,8 +169,9 @@ CLiveBoxImpl *CModule::FindLiveBox(const char *filename)
dlist_foreach(m_pList, l, item) {
box = (CLiveBoxImpl *)item;
- if (!strcmp(filename, box->Filename()))
+ if (!strcmp(id, box->Filename())) {
return box;
+ }
}
return NULL;
@@ -175,8 +179,9 @@ CLiveBoxImpl *CModule::FindLiveBox(const char *filename)
int CModule::NeedToCreate(const char *cluster, const char *category)
{
- if (!m_fNeedToCreate)
+ if (!m_fNeedToCreate) {
return 0;
+ }
return m_fNeedToCreate(cluster, category);
}
diff --git a/src/dlist.cpp b/src/dlist.cpp
index 980f59a..678afaa 100644
--- a/src/dlist.cpp
+++ b/src/dlist.cpp
@@ -31,8 +31,9 @@ struct dlist *dlist_append(struct dlist *list, void *data)
struct dlist *item;
item = (struct dlist *)malloc(sizeof(*item));
- if (!item)
+ if (!item) {
return NULL;
+ }
item->next = NULL;
item->data = data;
@@ -58,8 +59,9 @@ struct dlist *dlist_prepend(struct dlist *list, void *data)
struct dlist *item;
item = (struct dlist *)malloc(sizeof(*item));
- if (!item)
+ if (!item) {
return NULL;
+ }
if (!list) {
item->prev = item;
@@ -75,8 +77,9 @@ struct dlist *dlist_prepend(struct dlist *list, void *data)
struct dlist *dlist_remove(struct dlist *list, struct dlist *l)
{
- if (!list || !l)
+ if (!list || !l) {
return NULL;
+ }
if (l == list) {
l->prev = list->prev;
@@ -85,8 +88,9 @@ struct dlist *dlist_remove(struct dlist *list, struct dlist *l)
l->prev->next = l->next;
}
- if (l->next)
+ if (l->next) {
l->next->prev = l->prev;
+ }
free(l);
return list;
@@ -98,8 +102,9 @@ struct dlist *dlist_find_data(struct dlist *list, void *data)
void *_data;
dlist_foreach(list, l, _data) {
- if (data == _data)
+ if (data == _data) {
return l;
+ }
}
return NULL;
@@ -142,8 +147,9 @@ struct dlist *dlist_nth(struct dlist *l, int nth)
i = 0;
dlist_foreach(l, n, data) {
- if (i == nth)
+ if (i == nth) {
return l;
+ }
i++;
}
diff --git a/src/livebox.cpp b/src/livebox.cpp
index 75f1b1a..03e1766 100644
--- a/src/livebox.cpp
+++ b/src/livebox.cpp
@@ -33,12 +33,14 @@ EAPI int livebox_initialize(const char *pkgname)
CModule *module;
module = CModule::FindModule(pkgname);
- if (module)
+ if (module) {
return LB_STATUS_SUCCESS;
+ }
module = CModule::Load(pkgname);
- if (!module)
+ if (!module) {
return LB_STATUS_ERROR_FAULT;
+ }
return LB_STATUS_SUCCESS;
}
@@ -48,173 +50,194 @@ EAPI int livebox_finalize(const char *pkgname)
CModule *module;
module = CModule::FindModule(pkgname);
- if (!module)
+ if (!module) {
return LB_STATUS_ERROR_NOT_EXIST;
+ }
module->Unload();
return LB_STATUS_SUCCESS;
}
-EAPI int livebox_create(const char *pkgname, const char *filename, const char *content, const char *cluster, const char *category)
+EAPI int livebox_create(const char *pkgname, const char *id, const char *content, const char *cluster, const char *category)
{
CLiveBoxImpl *box;
CModule *module;
int ret;
module = CModule::FindModule(pkgname);
- if (!module)
+ if (!module) {
return LB_STATUS_ERROR_INVALID;
+ }
- box = module->FindLiveBox(filename);
- if (box)
+ box = module->FindLiveBox(id);
+ if (box) {
return LB_STATUS_ERROR_NOT_EXIST;
+ }
- ret = module->Create(filename, content, cluster, category);
+ ret = module->Create(id, content, cluster, category);
return ret;
}
-EAPI int livebox_destroy(const char *pkgname, const char *filename)
+EAPI int livebox_destroy(const char *pkgname, const char *id)
{
CModule *module;
CLiveBoxImpl *box;
int ret;
module = CModule::FindModule(pkgname);
- if (!module)
+ if (!module) {
return LB_STATUS_ERROR_INVALID;
+ }
- box = module->FindLiveBox(filename);
- if (!box)
+ box = module->FindLiveBox(id);
+ if (!box) {
return LB_STATUS_ERROR_NOT_EXIST;
+ }
ret = module->Destroy(box);
return ret;
}
-EAPI int livebox_need_to_update(const char *pkgname, const char *filename)
+EAPI int livebox_need_to_update(const char *pkgname, const char *id)
{
CLiveBoxImpl *box;
CModule *module;
module = CModule::FindModule(pkgname);
- if (!module)
+ if (!module) {
return LB_STATUS_ERROR_INVALID;
+ }
- box = module->FindLiveBox(filename);
- if (!box)
+ box = module->FindLiveBox(id);
+ if (!box) {
return LB_STATUS_ERROR_NOT_EXIST;
+ }
return box->NeedToUpdate();
}
-EAPI int livebox_need_to_destroy(const char *pkgname, const char *filename)
+EAPI int livebox_need_to_destroy(const char *pkgname, const char *id)
{
CLiveBoxImpl *box;
CModule *module;
module = CModule::FindModule(pkgname);
- if (!module)
+ if (!module) {
return LB_STATUS_ERROR_INVALID;
+ }
- box = module->FindLiveBox(filename);
- if (!box)
+ box = module->FindLiveBox(id);
+ if (!box) {
return LB_STATUS_ERROR_NOT_EXIST;
+ }
return box->NeedToDestroy();
}
-EAPI int livebox_update_content(const char *pkgname, const char *filename)
+EAPI int livebox_update_content(const char *pkgname, const char *id)
{
CLiveBoxImpl *box;
CModule *module;
module = CModule::FindModule(pkgname);
- if (!module)
+ if (!module) {
return LB_STATUS_ERROR_INVALID;
+ }
- box = module->FindLiveBox(filename);
- if (!box)
+ box = module->FindLiveBox(id);
+ if (!box) {
return LB_STATUS_ERROR_NOT_EXIST;
+ }
return box->UpdateContent();
}
-EAPI int livebox_clicked(const char *pkgname, const char *filename, const char *event, double timestamp, double x, double y)
+EAPI int livebox_clicked(const char *pkgname, const char *id, const char *event, double timestamp, double x, double y)
{
CLiveBoxImpl *box;
CModule *module;
module = CModule::FindModule(pkgname);
- if (!module)
+ if (!module) {
return LB_STATUS_ERROR_INVALID;
+ }
- box = module->FindLiveBox(filename);
- if (!box)
+ box = module->FindLiveBox(id);
+ if (!box) {
return LB_STATUS_ERROR_NOT_EXIST;
+ }
return box->Clicked(event, timestamp, x, y);
}
-EAPI int livebox_content_event(const char *pkgname, const char *filename, const char *emission, const char *source, struct event_info *event_info)
+EAPI int livebox_content_event(const char *pkgname, const char *id, const char *emission, const char *source, struct event_info *event_info)
{
CLiveBoxImpl *box;
CModule *module;
module = CModule::FindModule(pkgname);
- if (!module)
+ if (!module) {
return LB_STATUS_ERROR_INVALID;
+ }
- box = module->FindLiveBox(filename);
- if (!box)
+ box = module->FindLiveBox(id);
+ if (!box) {
return LB_STATUS_ERROR_NOT_EXIST;
+ }
return box->ContentEvent(emission, source, event_info);
}
-EAPI int livebox_resize(const char *pkgname, const char *filename, int type)
+EAPI int livebox_resize(const char *pkgname, const char *id, int type)
{
CLiveBoxImpl *box;
CModule *module;
module = CModule::FindModule(pkgname);
- if (!module)
+ if (!module) {
return LB_STATUS_ERROR_INVALID;
+ }
- box = module->FindLiveBox(filename);
- if (!box)
+ box = module->FindLiveBox(id);
+ if (!box) {
return LB_STATUS_ERROR_NOT_EXIST;
+ }
return box->Resize(type);
}
-EAPI int livebox_change_group(const char *pkgname, const char *filename, const char *cluster, const char *category)
+EAPI int livebox_change_group(const char *pkgname, const char *id, const char *cluster, const char *category)
{
CLiveBoxImpl *box;
CModule *module;
module = CModule::FindModule(pkgname);
- if (!module)
+ if (!module) {
return LB_STATUS_ERROR_INVALID;
+ }
- box = module->FindLiveBox(filename);
- if (!box)
+ box = module->FindLiveBox(id);
+ if (!box) {
return LB_STATUS_ERROR_NOT_EXIST;
+ }
return box->ChangeGroup(cluster, category);
}
-EAPI int livebox_get_info(const char *pkgname, const char *filename, int *w, int *h, double *priority, char **content, char **title)
+EAPI int livebox_get_info(const char *pkgname, const char *id, int *w, int *h, double *priority, char **content, char **title)
{
CLiveBoxImpl *box;
CModule *module;
module = CModule::FindModule(pkgname);
- if (!module)
+ if (!module) {
return LB_STATUS_ERROR_INVALID;
+ }
- box = module->FindLiveBox(filename);
- if (!box)
+ box = module->FindLiveBox(id);
+ if (!box) {
return LB_STATUS_ERROR_NOT_EXIST;
+ }
return box->GetInfo(w, h, priority, content, title);
}
@@ -224,56 +247,63 @@ EAPI int livebox_need_to_create(const char *pkgname, const char *cluster, const
CModule *module;
module = CModule::FindModule(pkgname);
- if (!module)
+ if (!module) {
return LB_STATUS_ERROR_INVALID;
+ }
return module->NeedToCreate(cluster, category);
}
-EAPI char *livebox_pinup(const char *pkgname, const char *filename, int pinup)
+EAPI char *livebox_pinup(const char *pkgname, const char *id, int pinup)
{
CLiveBoxImpl *box;
CModule *module;
module = CModule::FindModule(pkgname);
- if (!module)
+ if (!module) {
return NULL;
+ }
- box = module->FindLiveBox(filename);
- if (!box)
+ box = module->FindLiveBox(id);
+ if (!box) {
return NULL;
+ }
return box->PinUp(pinup);
}
-EAPI int livebox_is_pinned_up(const char *pkgname, const char *filename)
+EAPI int livebox_is_pinned_up(const char *pkgname, const char *id)
{
CLiveBoxImpl *box;
CModule *module;
module = CModule::FindModule(pkgname);
- if (!module)
+ if (!module) {
return NULL;
+ }
- box = module->FindLiveBox(filename);
- if (!box)
+ box = module->FindLiveBox(id);
+ if (!box) {
return NULL;
+ }
return box->IsPinnedUp();
}
-EAPI int livebox_system_event(const char *pkgname, const char *filename, int event)
+EAPI int livebox_system_event(const char *pkgname, const char *id, int event)
{
CLiveBoxImpl *box;
CModule *module;
module = CModule::FindModule(pkgname);
- if (!module)
+ if (!module) {
return NULL;
+ }
- box = module->FindLiveBox(filename);
- if (!box)
+ box = module->FindLiveBox(id);
+ if (!box) {
return NULL;
+ }
return box->SystemEvent(event);
}