ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
-PKG_CHECK_MODULES(PKGS REQUIRED glib-2.0 utilX bundle dlog x11 capi-appfw-application appsvc)
+PKG_CHECK_MODULES(PKGS REQUIRED glib-2.0 utilX bundle dlog x11 capi-appfw-application appsvc capi-appfw-app-manager)
FOREACH(flag ${PKGS_CFLAGS})
SET(CFLAGS "${CFLAGS} ${flag}")
ENDFOREACH(flag)
return 0;
}
-void layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
+void _ug_client_layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
{
struct appdata *ad;
Evas_Object *base;
}
}
-void result_cb(ui_gadget_h ug, service_h result, void *priv)
+void _ug_client_result_cb(ui_gadget_h ug, service_h result, void *priv)
{
struct appdata *ad;
int ret;
LOGE("service_reply_to_launch_request failed, %d", ret);
}
-void destroy_cb(ui_gadget_h ug, void *priv)
+void _ug_client_destroy_cb(ui_gadget_h ug, void *priv)
{
if (!ug)
return;
return eo;
}
-static Evas_Object *load_edj(Evas_Object *parent, const char *file,
+static Evas_Object *_ug_client_load_edj(Evas_Object *parent, const char *file,
const char *group)
{
Evas_Object *eo;
ad->conform = conform;
/* load edje */
- ly = load_edj(conform, EDJ_FILE, GRP_MAIN);
+ ly = _ug_client_load_edj(conform, EDJ_FILE, GRP_MAIN);
if (ly == NULL)
return -1;
elm_win_resize_object_add(win, conform);
struct appdata *ad = data;
ug_destroy_all();
- if (ad->ly_main)
+
+ if (ad->ly_main) {
evas_object_del(ad->ly_main);
+ ad->ly_main = NULL;
+ }
- if (ad->win)
+ if (ad->win) {
evas_object_del(ad->win);
+ ad->win = NULL;
+ }
return 0;
}
ug_pause();
if (!ad->is_transient) {
- LOGD("app_pause received. close ug service\n");
+ LOGD("app_pause received. close ug service");
elm_exit();
}
return 0;
static int svc_cb(void *data)
{
- LOGD("svc_cb called\n");
+ LOGD("svc_cb called");
return 0;
}
ret = appsvc_request_transient_app(b, id2, svc_cb, "svc test");
if (ret)
- LOGD("fail to request transient app: return value(%d)\n", ret);
+ LOGD("fail to request transient app: return value(%d)", ret);
else
ad->is_transient = 1;
else
service_create_event(b, &service);
- service_clone(&ad->request, service);
+ if(service) {
+ service_clone(&ad->request, service);
+ service_destroy(service);
+ }
- cbs.layout_cb = layout_cb;
- cbs.destroy_cb = destroy_cb;
- cbs.result_cb = result_cb;
+ cbs.layout_cb = _ug_client_layout_cb;
+ cbs.destroy_cb = _ug_client_destroy_cb;
+ cbs.result_cb = _ug_client_result_cb;
cbs.priv = ad;
mode = ad->is_frameview ? UG_MODE_FRAMEVIEW : UG_MODE_FULLVIEW;
- ad->ug = ug_create(NULL, ad->name, mode, service, &cbs);
+ ad->ug = ug_create(NULL, ad->name, mode, ad->request, &cbs);
if (ad->ug == NULL) {
LOGE("ug_create fail: %s", ad->name);
elm_exit();
Name: ui-gadget-1
Summary: UI Gadget Library
-Version: 0.1.6
+Version: 0.1.8
Release: 1
Group: System/Libraries
License: Apache License, Version 2.0
BuildRequires: pkgconfig(appsvc)
BuildRequires: pkgconfig(capi-appfw-application)
BuildRequires: pkgconfig(capi-system-runtime-info)
+BuildRequires: pkgconfig(capi-appfw-app-manager)
BuildRequires: cmake
BuildRequires: edje-bin
}
free(engine);
+ engine = NULL;
return 0;
}
}
}
- if (ops && ops->destroy)
+ if (ops && ops->destroy) {
+ _DBG("ug module destory cb call");
ops->destroy(ug, ug->service, ops->priv);
+ }
ug_relation_del(ug);
ugman_ug_destroying(ug);
+ /* pre call for indicator update time issue */
+ if (ug_man.fv_top == ug) {
+ ui_gadget_h t;
+ t = g_slist_nth_data(ug_man.fv_list, 1);
+ ugman_ug_getopt(t);
+ }
+
if (ug_man.engine)
eng_ops = &ug_man.engine->ops;
}
if (!ug_man.root) {
- _ERR("ugman_send_event failed: no root\n");
+ _ERR("ugman_send_event failed: no root");
return -1;
}
int ugman_send_key_event(enum ug_key_event event)
{
if (!ug_man.is_initted) {
- _ERR("ugman_send_key_event failed: manager is not initted\n");
+ _ERR("ugman_send_key_event failed: manager is not initted");
return -1;
}
if (!ug_man.fv_top || !ugman_ug_exist(ug_man.fv_top)
|| ug_man.fv_top->state == UG_STATE_DESTROYED) {
- _ERR("ugman_send_key_event failed: full view top UG is invalid\n");
+ _ERR("ugman_send_key_event failed: full view top UG is invalid");
return -1;
}
{
struct ug_module_ops *ops = NULL;
if (!ug || !ugman_ug_exist(ug) || ug->state == UG_STATE_DESTROYED) {
- _ERR("ugman_send_message failed: Invalid ug\n");
+ _ERR("ugman_send_message failed: Invalid ug");
errno = EINVAL;
return -1;
}
if (!msg) {
- _ERR("ugman_send_message failed: Invalid msg\n");
+ _ERR("ugman_send_message failed: Invalid msg");
errno = EINVAL;
return -1;
}
#include <unistd.h>
#include <sys/types.h>
+#include <app_manager.h>
+
#include "ug-module.h"
#include "ug-dbg.h"
void *handle;
struct ug_module *module;
char ug_file[PATH_MAX];
-
- uid_t uid;
+ char *pkg_name = NULL;
int (*module_init) (struct ug_module_ops *ops);
return NULL;
}
-#if 0
- char *pkg_name = NULL;
- pkg_name = getenv("PKG_NAME");
- uid = geteuid();
-#endif
+ app_manager_get_package(getpid(), &pkg_name);
do {
-#if 0
if (pkg_name) {
snprintf(ug_file, PATH_MAX, "/usr/apps/%s/lib/libug-%s.so", pkg_name, name);
if (file_exist(ug_file))
if (file_exist(ug_file))
break;
}
-#endif
snprintf(ug_file, PATH_MAX, "/usr/ug/lib/libug-%s.so", name);
if (file_exist(ug_file))
break;
break;
} while (0);
+ if(pkg_name) {
+ free(pkg_name);
+ pkg_name = NULL;
+ }
+
handle = dlopen(ug_file, RTLD_LAZY);
if (!handle) {
- _ERR("dlopen failed: %s\n", dlerror());
+ _ERR("dlopen failed: %s", dlerror());
goto module_free;
}
module_init = dlsym(handle, UG_MODULE_INIT_SYM);
if (!module_init) {
- _ERR("dlsym failed: %s\n", dlerror());
+ _ERR("dlsym failed: %s", dlerror());
goto module_dlclose;
}
if (module_exit)
module_exit(&module->ops);
else
- _ERR("dlsym failed: %s\n", dlerror());
+ _ERR("dlsym failed: %s", dlerror());
dlclose(module->handle);
+ module->handle = NULL;
}
free(module);
ug = calloc(1, sizeof(struct ui_gadget_s));
if (!ug) {
- _ERR("ug root create failed: Memory allocation failed\n");
+ _ERR("ug root create failed: Memory allocation failed");
return NULL;
}
int ug_free(ui_gadget_h ug)
{
if (!ug) {
- _ERR("ug free failed: Invalid ug\n");
+ _ERR("ug free failed: Invalid ug");
errno = EINVAL;
return -1;
}
- if (ug->module)
+ if (ug->module) {
ug_module_unload(ug->module);
- if (ug->name)
+ }
+ if (ug->name) {
free((void *)ug->name);
- if (ug->service)
+ ug->name = NULL;
+ }
+ if (ug->service) {
service_destroy(ug->service);
+ ug->service = NULL;
+ }
free(ug);
ug = NULL;
return 0;
service_h service, struct ug_cbs *cbs)
{
if (!name) {
- _ERR("ug_create() failed: Invalid name\n");
+ _ERR("ug_create() failed: Invalid name");
errno = EINVAL;
return NULL;
}
if (mode < UG_MODE_FULLVIEW || mode >= UG_MODE_INVALID) {
- _ERR("ug_create() failed: Invalid mode\n");
+ _ERR("ug_create() failed: Invalid mode");
errno = EINVAL;
return NULL;
}
UG_API int ug_init(Display *disp, Window xid, void *win, enum ug_option opt)
{
if (!win || !xid || !disp) {
- _ERR("ug_init() failed: Invalid arguments\n");
+ _ERR("ug_init() failed: Invalid arguments");
return -1;
}
if (opt < UG_OPT_INDICATOR_ENABLE || opt >= UG_OPT_MAX) {
- _ERR("ug_init() failed: Invalid option\n");
+ _ERR("ug_init() failed: Invalid option");
return -1;
}
UG_API int ug_destroy_me(ui_gadget_h ug)
{
if (!ug || !ugman_ug_exist(ug)) {
- _ERR("ug_destroy_me() failed: Invalid ug\n");
+ _ERR("ug_destroy_me() failed: Invalid ug");
errno = EINVAL;
return -1;
}
if (!ug->cbs.destroy_cb) {
_ERR("ug_destroy_me() failed: destroy callback does not "
- "exist\n");
+ "exist");
return -1;
}
UG_API void *ug_get_layout(ui_gadget_h ug)
{
if (!ug || !ugman_ug_exist(ug)) {
- _ERR("ug_get_layout() failed: Invalid ug\n");
+ _ERR("ug_get_layout() failed: Invalid ug");
errno = EINVAL;
return NULL;
}
{
ui_gadget_h parent;
if (!ug || !ugman_ug_exist(ug)) {
- _ERR("ug_get_parent_layout() failed: Invalid ug\n");
+ _ERR("ug_get_parent_layout() failed: Invalid ug");
errno = EINVAL;
return NULL;
}
UG_API enum ug_mode ug_get_mode(ui_gadget_h ug)
{
if (!ug || !ugman_ug_exist(ug)) {
- _ERR("ug_get_mode() failed: Invalid ug\n");
+ _ERR("ug_get_mode() failed: Invalid ug");
errno = EINVAL;
return UG_MODE_INVALID;
}
UG_API int ug_send_event(enum ug_event event)
{
if (event <= UG_EVENT_NONE || event >= UG_EVENT_MAX) {
- _ERR("ug_send_event() failed: Invalid event\n");
+ _ERR("ug_send_event() failed: Invalid event");
return -1;
}
UG_API int ug_send_key_event(enum ug_key_event event)
{
if (event <= UG_KEY_EVENT_NONE || event >= UG_KEY_EVENT_MAX) {
- _ERR("ug_send_key_event() failed: Invalid event\n");
+ _ERR("ug_send_key_event() failed: Invalid event");
return -1;
}
service_h result_dup = NULL;
if (!ug || !ugman_ug_exist(ug)) {
- _ERR("ug_send_result() failed: Invalid ug\n");
+ _ERR("ug_send_result() failed: Invalid ug");
errno = EINVAL;
return -1;
}
if (!ug->cbs.result_cb) {
- _ERR("ug_send_result() failed: result callback does not exist\n");
+ _ERR("ug_send_result() failed: result callback does not exist");
return -1;
}
if (result) {
service_clone(&result_dup, result);
if (!result_dup) {
- _ERR("ug_send_result() failed: service_destroy failed\n");
+ _ERR("ug_send_result() failed: service_destroy failed");
return -1;
}
}
if (msg) {
service_clone(&msg_dup, msg);
if (!msg_dup) {
- _ERR("ug_send_message() failed: service_destroy failed\n");
+ _ERR("ug_send_message() failed: service_destroy failed");
return -1;
}
}
UG_API int ug_disable_effect(ui_gadget_h ug)
{
if (ug->layout_state != UG_LAYOUT_INIT) {
- _ERR("ug_disable_effect() failed: ug has already been shown\n");
+ _ERR("ug_disable_effect() failed: ug has already been shown");
return -1;
}
ug->layout_state = UG_LAYOUT_NOEFFECT;