summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiwoong Im <jiwoong.im@samsung.com>2016-11-29 07:08:49 (GMT)
committerJiwoong Im <jiwoong.im@samsung.com>2017-04-26 02:35:47 (GMT)
commit660cad6d9c412c0e3ce785e4e9fe329363d8d249 (patch)
tree2aa05a4028a6161f17d95d8b6f5901248d6ed9ee
parent27d7d92aff7278392e1b28a3eec4fde4046a9960 (diff)
downloadui-gadget-1-660cad6d9c412c0e3ce785e4e9fe329363d8d249.zip
ui-gadget-1-660cad6d9c412c0e3ce785e4e9fe329363d8d249.tar.gz
ui-gadget-1-660cad6d9c412c0e3ce785e4e9fe329363d8d249.tar.bz2
modify sources about diff with tizen_2.4refs/changes/40/127040/1
- add execption handling codes remove unnecessary codes modify codes related with "transition,finished" in ug-efl-engine add indicator update codes Change-Id: I9e1baacc7fb962cf0b4bd0488163c10777bc4394 Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
-rw-r--r--client/ug-client.c62
-rwxr-xr-xinclude/ug.h1
-rw-r--r--src/manager.c330
-rwxr-xr-xug-efl-engine/ug-efl-engine.c82
4 files changed, 349 insertions, 126 deletions
diff --git a/client/ug-client.c b/client/ug-client.c
index eaac938..bb88469 100644
--- a/client/ug-client.c
+++ b/client/ug-client.c
@@ -415,49 +415,6 @@ _ug_client_dbus_signal_filter(DBusConnection *conn, DBusMessage *message,
return DBUS_HANDLER_RESULT_HANDLED;
}
-static int _ug_client_dbus_listen_signal(void *data)
-{
- DBusError error;
- char rule[128];
-
- if (ug_dbus_signal_handler_initialized)
- return 0;
-
- dbus_threads_init_default();
-
- dbus_error_init(&error);
- bus = dbus_bus_get_private(DBUS_BUS_SYSTEM, &error);
- if (!bus) {
- LOGW("Failed to connect to the D-BUS daemon: %s", error.message);
- dbus_error_free(&error);
- return -1;
- }
- dbus_connection_setup_with_g_main(bus, NULL);
-
- snprintf(rule, 128,
- "path='%s',type='signal',interface='%s'", "/aul/dbus_handler",
- "org.tizen.aul.signal");
- /* listening to messages */
- dbus_bus_add_match(bus, rule, &error);
- if (dbus_error_is_set(&error)) {
- LOGW("Fail to rule set: %s", error.message);
- dbus_error_free(&error);
- return -1;
- }
-
- if (dbus_connection_add_filter(bus,
- _ug_client_dbus_signal_filter, data, NULL) == FALSE) {
- LOGW("dbus conntaction add fileter fail");
- return -1;
- }
-
- LOGD("bus : %p / filter func pointer : %p", bus , _ug_client_dbus_signal_filter);
-
- ug_dbus_signal_handler_initialized = 1;
-
- return 0;
-}
-
static void _ug_client_dbus_signal_handler_fini(void *data)
{
DBusError error;
@@ -556,31 +513,12 @@ static int app_resume(void *data)
return 0;
}
-static int svc_cb(void *data)
-{
- LOGD("svc_cb called");
- return 0;
-}
-
static int app_reset(bundle *b, void *data)
{
struct appdata *ad = data;
struct ug_cbs cbs = { 0, };
app_control_h app_control;
enum ug_mode mode = UG_MODE_FULLVIEW;
- int ret;
- Ecore_X_Window id2 = elm_win_xwindow_get(ad->win);
-
- ret = aul_svc_request_transient_app(b, id2, svc_cb, "svc test");
-
- if (ret) {
- LOGD("fail to request transient app: return value(%d)", ret);
- if (_ug_client_dbus_listen_signal(data) < 0)
- LOGW("home screen dbus register error");
- } else {
- /* check home screen raise */
- ad->is_transient = 1;
- }
if (ad->win) {
elm_win_activate(ad->win);
diff --git a/include/ug.h b/include/ug.h
index 2e42798..eed7444 100755
--- a/include/ug.h
+++ b/include/ug.h
@@ -50,6 +50,7 @@ enum ug_layout_state {
enum ug_ui_req {
UG_UI_REQ_GET_CONFORMANT = 0x00,
+ UG_UI_REQ_UNSET_CONTENT = 0x01,
UG_UI_REQ_MAX
};
diff --git a/src/manager.c b/src/manager.c
index 0a1a336..e10935e 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -30,6 +30,8 @@
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <Ecore_X.h>
+#else
+#include <Ecore_Wayland.h>
#endif
#include <Ecore.h>
@@ -62,8 +64,6 @@ struct ug_manager {
Display *disp;
#endif
- void *conform;
-
enum ug_option base_opt;
enum ug_event last_rotate_evt;
@@ -297,6 +297,31 @@ static void ugman_tree_dump(ui_gadget_h ug)
}
}
+static int ugman_ug_free(ui_gadget_h ug)
+{
+ if (!ug) {
+ _ERR("ug free failed: Invalid ug");
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (ug->module)
+ ug_module_unload(ug->module);
+
+ if (ug->name) {
+ free((void *)ug->name);
+ ug->name = NULL;
+ }
+ if (ug->app_control) {
+ app_control_destroy(ug->app_control);
+ ug->app_control = NULL;
+ }
+ free(ug);
+ ug = NULL;
+ return 0;
+}
+
+
static int ugman_ug_find(ui_gadget_h p, ui_gadget_h ug)
{
GSList *child = NULL;
@@ -348,12 +373,32 @@ static int ugman_ug_pause(void *data)
struct ug_module_ops *ops = NULL;
GSList *child = NULL;
+ if (!ug_man.is_initted) {
+ _ERR("ugman_pause failed: manager is not initted");
+ return -1;
+ }
+
+ if (!ug_man.root) {
+ _WRN("ugman_pause failed: no root");
+ return -1;
+ }
+
+ if (ug_man.destroy_all == 1) {
+ _WRN("ugman_pause skipped : app is termanating with ug_destory_all");
+ return -1;
+ }
+
+ if ((data != ug_man.root) && (!ugman_ug_find(ug_man.root, data))) {
+ _WRN("ugman_pause skipped : invalid ug(%p)", data);
+ return -1;
+ }
+
job_start();
- if (!ug || ug->state != UG_STATE_RUNNING)
+ if (!ug) {
+ _WRN("ug pointer is null");
goto end;
-
- ug->state = UG_STATE_STOPPED;
+ }
if (ug->children) {
child = ug->children;
@@ -363,11 +408,21 @@ static int ugman_ug_pause(void *data)
}
}
+ if (ug->state != UG_STATE_RUNNING) {
+ if (ug != ug_man.root)
+ _WRN("ug(%p)->state : %d", ug, ug->state);
+ goto end;
+ }
+
if (ug->module)
ops = &ug->module->ops;
- if (ops && ops->pause)
+ if (ops && ops->pause) {
+ _DBG("call ug(%p) pause cb", ug);
ops->pause(ug, ug->app_control, ops->priv);
+ }
+
+ ug->state = UG_STATE_STOPPED;
end:
job_end();
@@ -380,12 +435,45 @@ static int ugman_ug_resume(void *data)
struct ug_module_ops *ops = NULL;
GSList *child = NULL;
+ if (!ug_man.is_initted) {
+ _ERR("ugman_resume failed: manager is not initted");
+ return -1;
+ }
+
+ if (!ug_man.root) {
+ _WRN("ugman_resume failed: no root");
+ return -1;
+ }
+
+ if (ug_man.destroy_all == 1) {
+ _WRN("ugman_resume skipped : app is termanating with ug_destory_all");
+ return -1;
+ }
+
+ if ((data != ug_man.root) && (!ugman_ug_find(ug_man.root, data))) {
+ _WRN("ugman_resume skipped : invalid ug(%p)", data);
+ return -1;
+ }
+
job_start();
- if (!ug)
+ if (!ug) {
+ _WRN("ug pointer is null");
goto end;
+ }
+
+ if (ug->children) {
+ child = ug->children;
+ while (child) {
+ ugman_ug_resume(child->data);
+ child = g_slist_next(child);
+ }
+ }
- _DBG("ug(%p)->state : %d", ug, ug->state);
+ if (ug->state != UG_STATE_STOPPED) {
+ if (ug != ug_man.root)
+ _WRN("ug(%p)->state : %d", ug, ug->state);
+ }
switch (ug->state) {
case UG_STATE_CREATED:
@@ -397,31 +485,100 @@ static int ugman_ug_resume(void *data)
goto end;
}
- ug->state = UG_STATE_RUNNING;
-
- if (ug->children) {
- child = ug->children;
- while (child) {
- ugman_ug_resume(child->data);
- child = g_slist_next(child);
- }
- }
-
if (ug->module)
ops = &ug->module->ops;
- if (ops && ops->resume)
+ if (ops && ops->resume) {
+ _DBG("call ug(%p) resume cb", ug);
ops->resume(ug, ug->app_control, ops->priv);
+ }
+
+ ug->state = UG_STATE_RUNNING;
end:
job_end();
return 0;
}
+#ifdef UG_WAYLAND
+static void _ugman_enable_indicator(Evas_Object *win, int enable)
+{
+ Ecore_Wl_Window *wlwin = elm_win_wl_window_get(win);
+
+ if (enable == 1)
+ ecore_wl_window_indicator_state_set(wlwin, ECORE_WL_INDICATOR_STATE_ON);
+ else
+ ecore_wl_window_indicator_state_set(wlwin, ECORE_WL_INDICATOR_STATE_OFF);
+}
+
+static int _ugman_get_indicator_state(Evas_Object *win)
+{
+ Ecore_Wl_Window *wlwin = elm_win_wl_window_get(win);
+ Ecore_Wl_Indicator_State state;
+ int ret;
+
+ state = ecore_wl_window_indicator_state_get(wlwin);
+ if (state == ECORE_WL_INDICATOR_STATE_OFF)
+ ret = 0;
+ else if (state == ECORE_WL_INDICATOR_STATE_ON)
+ ret = 1;
+ else
+ ret = -1;
+
+ return ret;
+}
+#endif
+
static int ugman_indicator_update(enum ug_option opt, enum ug_event event)
{
+#ifndef UG_WAYLAND
_ERR("controlling indicator is disabled");
+#else
+ int enable;
+ int cur_state;
+
+ cur_state = _ugman_get_indicator_state(ug_man.win);
+
+ _DBG("indicator update opt(%d) cur_state(%d)", opt, cur_state);
+
+ switch (opt) {
+#ifndef ENABLE_UG_HANDLE_INDICATOR_HIDE
+ case UG_OPT_INDICATOR_ENABLE:
+ case UG_OPT_INDICATOR_PORTRAIT_ONLY:
+ case UG_OPT_INDICATOR_LANDSCAPE_ONLY:
+ case UG_OPT_INDICATOR_DISABLE:
+ enable = 1;
+ break;
+#else
+ case UG_OPT_INDICATOR_ENABLE:
+ if (event == UG_EVENT_NONE)
+ enable = 1;
+ else
+ enable = cur_state ? 1 : 0;
+ break;
+ case UG_OPT_INDICATOR_PORTRAIT_ONLY:
+ enable = ug_man.is_landscape ? 0 : 1;
+ break;
+ case UG_OPT_INDICATOR_LANDSCAPE_ONLY:
+ enable = ug_man.is_landscape ? 1 : 0;
+ break;
+ case UG_OPT_INDICATOR_DISABLE:
+ enable = 0;
+ break;
+#endif
+ case UG_OPT_INDICATOR_MANUAL:
+ return 0;
+ default:
+ _ERR("update failed: Invalid opt(%d)", opt);
+ return -1;
+ }
+ if (cur_state != enable) {
+ _DBG("set indicator status as %d", enable);
+ _ugman_enable_indicator(ug_man.win, enable);
+ }
+
+#endif
return 0;
}
@@ -526,6 +683,11 @@ static int ugman_ug_destroy(void *data)
} else {
_WRN("pended parent ug(%p) will be destroyed after another children is destroyed", ug->parent);
}
+ } else {
+ if (ug->parent)
+ _DBG("ug parent(%p) state(%d)", ug->parent, ug->parent->state);
+ else
+ _WRN("ug parent is null");
}
if (ug != ug_man.root)
@@ -542,7 +704,7 @@ static int ugman_ug_destroy(void *data)
}
_DBG("free ug(%p)", ug);
- ug_free(ug);
+ ugman_ug_free(ug);
if (ug_man.root == ug)
ug_man.root = NULL;
@@ -571,9 +733,11 @@ static int ugman_ug_create(void *data)
struct ug_module_ops *ops = NULL;
struct ug_cbs *cbs;
struct ug_engine_ops *eng_ops = NULL;
+ void *conformant = NULL;
+
if (!ug || ug->state != UG_STATE_READY) {
- _ERR("ug(%p) input param error");
+ _ERR("ug(%p) input param error", ug);
return -1;
}
@@ -588,15 +752,18 @@ static int ugman_ug_create(void *data)
if (ops && ops->create) {
ug->layout = ops->create(ug, ug->mode, ug->app_control, ops->priv);
if (!ug->layout) {
- ug_relation_del(ug);
_ERR("ug(%p) layout is null", ug);
return -1;
}
if (ug->mode == UG_MODE_FULLVIEW) {
if (eng_ops && eng_ops->create) {
- ug_man.conform = eng_ops->create(ug_man.win, ug, ugman_ug_start);
- if (!ug_man.conform)
+ conformant = eng_ops->create(ug_man.win, ug, ugman_ug_start);
+ if (!conformant) {
+ _ERR("conformant(%p) error. ug(%p) destory cb is invoked.",
+ conformant, ug);
+ ops->destroy(ug, ug->app_control, ops->priv);
return -1;
+ }
}
}
cbs = &ug->cbs;
@@ -639,10 +806,27 @@ static int ugman_ug_create(void *data)
return 0;
}
+static ui_gadget_h ugman_root_ug_create(void)
+{
+ ui_gadget_h ug;
+
+ ug = calloc(1, sizeof(struct ui_gadget_s));
+ if (!ug) {
+ _ERR("ug root create failed: Memory allocation failed");
+ return NULL;
+ }
+
+ ug->mode = UG_MODE_FULLVIEW;
+ ug->state = UG_STATE_RUNNING;
+ ug->children = NULL;
+
+ return ug;
+}
+
int ugman_ug_add(ui_gadget_h parent, ui_gadget_h ug)
{
if (!ug_man.is_initted) {
- _ERR("failed: manager is not initted");
+ _ERR("failed: manager is not initialized");
return -1;
}
@@ -653,7 +837,7 @@ int ugman_ug_add(ui_gadget_h parent, ui_gadget_h ug)
return -1;
}
- ug_man.root = ug_root_create();
+ ug_man.root = ugman_root_ug_create();
if (!ug_man.root) {
_ERR("failed : ug root create fail");
return -1;
@@ -683,6 +867,7 @@ int ugman_ug_add(ui_gadget_h parent, ui_gadget_h ug)
if (ugman_ug_create(ug) == -1) {
_ERR("failed : ugman_ug_create fail");
+ ug_relation_del(ug);
return -1;
}
if (ug->mode == UG_MODE_FULLVIEW)
@@ -724,14 +909,14 @@ ui_gadget_h ugman_ug_load(ui_gadget_h parent,
r = ugman_ug_add(parent, ug);
if (r) {
- _ERR("ug_create() failed: Tree update failed");
+ _ERR("ugman ug add failed");
goto load_fail;
}
return ug;
load_fail:
- ug_free(ug);
+ ugman_ug_free(ug);
return NULL;
}
@@ -739,7 +924,23 @@ int ugman_ug_destroying(ui_gadget_h ug)
{
struct ug_module_ops *ops = NULL;
- _DBG("ugman_ug_destroying");
+ _DBG("ugman_ug_destroying start ug(%p)", ug);
+
+ if (!ug || !ugman_ug_exist(ug)) {
+ _ERR("ugman_ug_destroying failed: Invalid ug(%p)");
+ errno = EINVAL;
+ return -1;
+ }
+
+ switch (ug->state) {
+ case UG_STATE_DESTROYING:
+ case UG_STATE_PENDING_DESTROY:
+ case UG_STATE_DESTROYED:
+ _WRN("ug(%p) state(%d) is already on destroying", ug, ug->state);
+ return 0;
+ default:
+ break;
+ }
ug->destroy_me = 1;
ug->state = UG_STATE_DESTROYING;
@@ -757,13 +958,23 @@ int ugman_ug_del(ui_gadget_h ug)
{
struct ug_engine_ops *eng_ops = NULL;
- if (!ug || !ugman_ug_exist(ug) || ug->state == UG_STATE_DESTROYED) {
+ _DBG("ugman_ug_del start ug(%p)", ug);
+
+ if (!ug || !ugman_ug_exist(ug)) {
_ERR("ugman_ug_del failed: Invalid ug(%p)");
errno = EINVAL;
return -1;
}
- _DBG("ugman_ug_del start ug(%p)", ug);
+ switch (ug->state) {
+ case UG_STATE_DESTROYING:
+ case UG_STATE_PENDING_DESTROY:
+ case UG_STATE_DESTROYED:
+ _WRN("ug(%p) state(%d) is already on destroying", ug, ug->state);
+ return 0;
+ default:
+ break;
+ }
if (ug->destroy_me) {
_WRN("ugman_ug_del failed: ug is alreay on destroying");
@@ -771,7 +982,7 @@ int ugman_ug_del(ui_gadget_h ug)
}
if (!ug_man.is_initted) {
- _WRN("ugman_ug_del failed: manager is not initted");
+ _WRN("ugman_ug_del failed: manager is not initialized");
return -1;
}
@@ -853,11 +1064,30 @@ int ugman_ug_del_child(ui_gadget_h ug)
return 0;
}
+static void ugman_ug_unset_content(void)
+{
+ struct ug_engine_ops *eng_ops = NULL;
+
+ if (ug_man.engine) {
+ eng_ops = &ug_man.engine->ops;
+ } else {
+ _WRN("ui engine is not loaded");
+ return;
+ }
+
+ if (eng_ops && eng_ops->create)
+ eng_ops->request(ug_man.win, NULL, UG_UI_REQ_UNSET_CONTENT);
+ else
+ _WRN("ui engine is not loaded");
+
+ return;
+}
+
int ugman_ug_del_all(void)
{
/* Terminate */
if (!ug_man.is_initted) {
- _ERR("ugman_ug_del_all failed: manager is not initted");
+ _ERR("ugman_ug_del_all failed: manager is not initialized");
return -1;
}
@@ -868,10 +1098,12 @@ int ugman_ug_del_all(void)
_DBG("ug_del_all. root(%p) walking(%d) ", ug_man.root, ug_man.walking);
- if (ug_man.walking > 0)
+ if (ug_man.walking > 0) {
ug_man.destroy_all = 1;
- else
+ } else {
+ ugman_ug_unset_content();
ugman_ug_del_child(ug_man.root);
+ }
return 0;
}
@@ -924,7 +1156,7 @@ int ugman_resume(void)
{
/* RESUME */
if (!ug_man.is_initted) {
- _ERR("ugman_resume failed: manager is not initted");
+ _ERR("ugman_resume failed: manager is not initialized");
return -1;
}
@@ -933,6 +1165,11 @@ int ugman_resume(void)
return -1;
}
+ if (ug_man.destroy_all == 1) {
+ _WRN("ugman_resume skip : app is termanating with ug_destory_all");
+ return 0;
+ }
+
_DBG("ugman_resume called");
ugman_idler_add((Idle_Cb)ugman_ug_resume, ug_man.root);
@@ -963,7 +1200,7 @@ int ugman_pause(void)
{
/* PAUSE (Background) */
if (!ug_man.is_initted) {
- _ERR("ugman_pause failed: manager is not initted");
+ _ERR("ugman_pause failed: manager is not initialized");
return -1;
}
@@ -972,6 +1209,11 @@ int ugman_pause(void)
return -1;
}
+ if (ug_man.destroy_all == 1) {
+ _WRN("ugman_pause skip : app is termanating with ug_destory_all");
+ return 0;
+ }
+
_DBG("ugman_pause called");
ugman_idler_add((Idle_Cb)ugman_ug_pause, ug_man.root);
@@ -1015,7 +1257,7 @@ int ugman_send_event(enum ug_event event)
/* Propagate event */
if (!ug_man.is_initted) {
- _ERR("ugman_send_event failed: manager is not initted");
+ _ERR("ugman_send_event failed: manager is not initialized");
return -1;
}
@@ -1063,8 +1305,6 @@ static int ugman_send_key_event_to_ug(ui_gadget_h ug,
if (ops && ops->key_event)
ops->key_event(ug, event, ug->app_control, ops->priv);
- else
- return -1;
return 0;
}
@@ -1072,7 +1312,7 @@ static int ugman_send_key_event_to_ug(ui_gadget_h ug,
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");
+ _ERR("ugman_send_key_event failed: manager is not initialized");
return -1;
}
@@ -1089,7 +1329,7 @@ int ugman_send_message(ui_gadget_h ug, app_control_h msg)
{
struct ug_module_ops *ops = NULL;
if (!ug || !ugman_ug_exist(ug) || ug->state == UG_STATE_DESTROYED) {
- _ERR("ugman_send_message failed: Invalid ug");
+ _ERR("ugman_send_message failed: Invalid ug(%p)", ug);
errno = EINVAL;
return -1;
}
@@ -1119,11 +1359,6 @@ void *ugman_get_conformant(void)
struct ug_engine_ops *eng_ops = NULL;
void* ret = NULL;
- if (ug_man.conform) {
- _DBG("return cached conform(%p) info", ug_man.conform);
- return ug_man.conform;
- }
-
if (ug_man.engine) {
eng_ops = &ug_man.engine->ops;
} else {
@@ -1133,7 +1368,6 @@ void *ugman_get_conformant(void)
if (eng_ops && eng_ops->create) {
ret = eng_ops->request(ug_man.win, NULL, UG_UI_REQ_GET_CONFORMANT);
- ug_man.conform = ret;
} else {
_WRN("ui engine is not loaded");
}
diff --git a/ug-efl-engine/ug-efl-engine.c b/ug-efl-engine/ug-efl-engine.c
index c60e48e..5088a4c 100755
--- a/ug-efl-engine/ug-efl-engine.c
+++ b/ug-efl-engine/ug-efl-engine.c
@@ -66,8 +66,6 @@ static void _layout_del_cb(void *data, Evas_Object *obj, void *event_info)
evas_object_event_callback_del(ug->layout, EVAS_CALLBACK_DEL,
(Evas_Object_Event_Cb)_layout_del_cb);
-
- ug->layout_state = UG_LAYOUT_DESTROY;
ug->layout = NULL;
}
@@ -95,14 +93,25 @@ static void __del_effect_end(ui_gadget_h ug)
static void __del_finished(void *data, Evas_Object *obj, void *event_info)
{
- ui_gadget_h ug = (ui_gadget_h)data;
- if (!ug)
+ if (!event_info) {
+ _ERR("invalid event_info param");
return;
+ }
+ Elm_Object_Item *item = event_info;
+ if (!item) {
+ _ERR("item is null");
+ return;
+ }
- _DBG("\t obj=%p ug=%p", obj, ug);
+ ui_gadget_h ug = (ui_gadget_h) elm_object_item_data_get(item);
+ if (!ug) {
+ _ERR("ug is null");
+ return;
+ }
- evas_object_smart_callback_del(obj, "transition,finished",
- __del_finished);
+ _WRN("\t obj=%p ug=%p", obj, ug);
+
+ elm_object_item_del_cb_set(obj, NULL);
if (ug->layout_state == UG_LAYOUT_HIDEEFFECT)
__del_effect_end(ug);
@@ -112,9 +121,9 @@ static void __del_finished(void *data, Evas_Object *obj, void *event_info)
static void __del_effect_top_layout(ui_gadget_h ug)
{
- _DBG("\t cb transition add ug=%p", ug);
- evas_object_smart_callback_add(navi, "transition,finished",
- __del_finished, ug);
+ _WRN("\t cb transition add ug=%p", ug);
+
+ elm_object_item_del_cb_set(ug->effect_layout, __del_finished);
elm_naviframe_item_pop(navi);
ug->effect_layout = NULL;
ug->layout_state = UG_LAYOUT_HIDEEFFECT;
@@ -184,6 +193,18 @@ static void __on_hideonly_cb(void *data, Evas_Object *obj)
_DBG("\t obj=%p ug=%p layout_state=%d state=%d", obj, ug, ug->layout_state, ug->state);
evas_object_intercept_hide_callback_del(ug->layout, __on_hideonly_cb);
+
+ switch (ug->state) {
+ case UG_STATE_READY:
+ case UG_STATE_DESTROYING:
+ case UG_STATE_PENDING_DESTROY:
+ case UG_STATE_DESTROYED:
+ _DBG("wrong ug state");
+ return;
+ default:
+ break;
+ }
+
evas_object_event_callback_add(ug->layout, EVAS_CALLBACK_SHOW, on_show_cb, ug);
if (ug->layout_state == UG_LAYOUT_SHOW) {
@@ -202,6 +223,7 @@ static void __on_hideonly_cb(void *data, Evas_Object *obj)
__hide_finished, ug);
elm_naviframe_item_pop(navi);
ug->layout_state = UG_LAYOUT_HIDEEFFECT;
+ ug->effect_layout = NULL;
} else {
elm_object_item_del(ug->effect_layout);
__hide_end(ug);
@@ -246,7 +268,9 @@ static void on_destroy(ui_gadget_h ug, ui_gadget_h t_ug,
|| ug->layout_state == UG_LAYOUT_NOEFFECT) {
__del_effect_layout(ug, t_ug);
} else if (ug->layout_state == UG_LAYOUT_HIDEEFFECT) {
- ;
+ evas_object_smart_callback_del(navi, "transition,finished",
+ __hide_finished);
+ elm_object_item_del_cb_set(ug->effect_layout, __del_finished);
} else {
_WRN("[UG Effect Plug-in] : layout state(%p) error!!", ug->layout_state);
__del_effect_end(ug);
@@ -277,6 +301,14 @@ static void __show_finished(void *data, Evas_Object *obj, void *event_info)
return;
}
+static int __show_end_cb_by_job_add(void *data)
+{
+ if (show_end_cb)
+ show_end_cb(data);
+
+ return 0;
+}
+
static void on_show_cb(void *data, Evas *e, Evas_Object *obj,
void *event_info)
{
@@ -293,6 +325,7 @@ static void on_show_cb(void *data, Evas *e, Evas_Object *obj,
/*
* if 'elm.swallow.ug' string is changed, msg team have to apply this changes.
*/
+ evas_object_show(navi);
elm_object_part_content_set(conform, "elm.swallow.ug", navi);
if (ug->layout_state == UG_LAYOUT_HIDEEFFECT
@@ -305,14 +338,13 @@ static void on_show_cb(void *data, Evas *e, Evas_Object *obj,
__show_finished, ug);
ug->effect_layout = elm_naviframe_item_push(navi, NULL, NULL, NULL,
ug->layout, NULL);
+ elm_object_item_data_set(ug->effect_layout, (void *)ug);
} else if (ug->layout_state == UG_LAYOUT_NOEFFECT) {
_DBG("\t UG_LAYOUT_NOEFFECT obj=%p", obj);
Elm_Object_Item *navi_top = elm_naviframe_top_item_get(navi);
ug->effect_layout = elm_naviframe_item_insert_after(navi,
navi_top, NULL, NULL, NULL, ug->layout, NULL);
-
- if (show_end_cb)
- show_end_cb(ug);
+ ecore_job_add((Ecore_Cb)__show_end_cb_by_job_add, (void *)data);
} else {
_ERR("\tlayout state error!! state=%d\n", ug->layout_state);
}
@@ -341,7 +373,6 @@ static void *on_create(void *win, ui_gadget_h ug,
if (!navi) {
navi = elm_naviframe_add(conform);
- elm_object_focus_allow_set(navi, EINA_FALSE);
elm_object_style_set(navi, "uglib");
elm_naviframe_content_preserve_on_pop_set(navi, EINA_TRUE);
_DBG("\t new navi first navi=%p", navi);
@@ -369,7 +400,9 @@ static void *on_create(void *win, ui_gadget_h ug,
static void *on_request(void *data, ui_gadget_h ug, int req)
{
- void *ret;
+ void *ret = NULL;
+ Elm_Object_Item *navi_bottom_item = NULL;
+ Elm_Object_Item *navi_top_item = NULL;
_DBG("on_request ug(%p) req(%d)", ug, req);
@@ -377,6 +410,23 @@ static void *on_request(void *data, ui_gadget_h ug, int req)
case UG_UI_REQ_GET_CONFORMANT:
ret = (void *)_get_win_conformant((Evas_Object *)data);
break;
+ case UG_UI_REQ_UNSET_CONTENT:
+ _DBG("unset swallow ug content");
+ if (navi) {
+ navi_bottom_item = elm_naviframe_bottom_item_get(navi);
+ navi_top_item = elm_naviframe_top_item_get(navi);
+
+ while (navi_bottom_item != navi_top_item) {
+ _DBG("navi item : %p", navi_top_item);
+ elm_object_item_del(navi_top_item);
+ navi_top_item = elm_naviframe_top_item_get(navi);
+ }
+
+ _DBG("\t unset navi");
+ elm_object_part_content_unset(conform, "elm.swallow.ug");
+ evas_object_hide(navi);
+ }
+ break;
default:
_WRN("wrong req id(%d)", req);
return NULL;