diff options
Diffstat (limited to 'src/livebox.cpp')
-rw-r--r-- | src/livebox.cpp | 144 |
1 files changed, 87 insertions, 57 deletions
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); } |