}
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) {
}
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;
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;
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;
dlist_foreach(m_pList, l, item) {
box = (CLiveBoxImpl *)item;
- if (!strcmp(filename, box->Filename()))
+ if (!strcmp(id, box->Filename())) {
return box;
+ }
}
return NULL;
int CModule::NeedToCreate(const char *cluster, const char *category)
{
- if (!m_fNeedToCreate)
+ if (!m_fNeedToCreate) {
return 0;
+ }
return m_fNeedToCreate(cluster, category);
}
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;
}
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);
}
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);
}