add code to remove ui cb under ug_destroy_all case
authorHyungdeuk Kim <hd3.kim@samsung.com>
Wed, 20 Mar 2013 09:29:34 +0000 (18:29 +0900)
committerHyungdeuk Kim <hd3.kim@samsung.com>
Wed, 20 Mar 2013 09:40:05 +0000 (18:40 +0900)
Change-Id: I8670645e3385e0bd645c55720bb054237857f0e1

CMakeLists.txt
client/ug-client.c
include/ug-dbg.h
packaging/ui-gadget-1.spec
src/manager.c
src/module.c
ug-efl-engine/ug-efl-engine.c

index f6a577afcf0239895a0bf86259e8abe4a25d7509..71b34376f1895c34a4b7af72b8d1b9e18885cf57 100755 (executable)
@@ -28,7 +28,7 @@ SET(SRCS src/ug.c
 
 ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
 
-PKG_CHECK_MODULES(PKGS REQUIRED glib-2.0 utilX bundle dlog x11 capi-appfw-application appsvc capi-appfw-app-manager elementary)
+PKG_CHECK_MODULES(PKGS REQUIRED glib-2.0 utilX bundle dlog x11 capi-appfw-application appsvc capi-appfw-app-manager ecore)
 FOREACH(flag ${PKGS_CFLAGS})
        SET(CFLAGS "${CFLAGS} ${flag}")
 ENDFOREACH(flag)
index 04e3c10365576c11d656f3e694ec5db546e35704..7c2ac361ac1595618f8a26235f003f8683b3558c 100755 (executable)
@@ -396,8 +396,6 @@ int main(int argc, char *argv[])
        };
        int cmdlen = 0;
 
-       setenv("ELM_ENGINE", "gl", 1); //enabling the OpenGL as the backend of the EFL.
-
        memset(&ad, 0x0, sizeof(struct appdata));
        ops.data = &ad;
 
index 00167b0727a356d2e36f3d4999b7199abc5c2f0f..d4e59050601e1af3e7fa774728c16afca72429ae 100755 (executable)
@@ -33,5 +33,6 @@
 #define _ERR(fmt, arg...) LOGE("\x1b[31m" fmt "\x1b[0m", ##arg)
 #define _DBG(fmt, arg...) LOGD("\x1b[32m" fmt "\x1b[0m", ##arg)
 #define _INFO(fmt, arg...) LOGI("\x1b[33m" fmt "\x1b[0m", ##arg)
+#define _WRN(fmt, arg...) LOGW("\x1b[34m" fmt "\x1b[0m", ##arg)
 
 #endif                         /* __UG_DBG_H__ */
index c00f77c7bde3b4222c05908e943d6115ab74f007..04ed768e85f64f2be8e9909cfb27b48039913bfa 100755 (executable)
@@ -1,7 +1,7 @@
 
 Name:       ui-gadget-1
 Summary:    UI Gadget Library
-Version:    0.1.17
+Version:    0.1.18
 Release:    1
 Group:      System/Libraries
 License:    Apache License, Version 2.0
index 6b30a1336ce17bc1d9dc7dd0bf955a7fc4498654..7af9fb34bc2a2cff25c599e148a29496ef74afa7 100755 (executable)
@@ -28,7 +28,6 @@
 #include <X11/Xatom.h>
 #include <X11/Xutil.h>
 
-#include <Elementary.h>
 #include <Ecore.h>
 
 #include "ug.h"
@@ -383,16 +382,16 @@ static int ugman_indicator_update(enum ug_option opt, enum ug_event event)
        int enable;
        int cur_state;
 
-       _DBG("indicator update opt(%d)", opt);
+       cur_state = utilx_get_indicator_state(ug_man.disp, ug_man.win_id);
+
+       _DBG("indicator update opt(%d) cur_state(%d)", opt, cur_state);
 
        switch (GET_OPT_INDICATOR_VAL(opt)) {
        case UG_OPT_INDICATOR_ENABLE:
                if (event == UG_EVENT_NONE)
                        enable = 1;
-               else {
-                       cur_state = utilx_get_indicator_state(ug_man.disp, ug_man.win_id);
+               else
                        enable = cur_state ? 1 : 0;
-               }
                break;
        case UG_OPT_INDICATOR_PORTRAIT_ONLY:
                enable = ug_man.is_landscape ? 0 : 1;
@@ -410,8 +409,9 @@ static int ugman_indicator_update(enum ug_option opt, enum ug_event event)
                return -1;
        }
 
-       utilx_enable_indicator(ug_man.disp, ug_man.win_id, enable);
-
+       if(cur_state != enable) {
+               utilx_enable_indicator(ug_man.disp, ug_man.win_id, enable);
+       }
        return 0;
 }
 
@@ -481,12 +481,9 @@ static int ugman_ug_destroy(void *data)
 
        ug->state = UG_STATE_DESTROYED;
 
-       if (ug->module)
-               ops = &ug->module->ops;
-
        if (ug->children) {
                child = ug->children;
-               _DBG("ug_destroy ug(%p) has child(%p)", ug, child);
+               _DBG("ug_destroy ug(%p) has child(%p)", ug, child->data);
                while (child) {
                        trail = g_slist_next(child);
                        ugman_ug_destroy(child->data);
@@ -494,12 +491,28 @@ static int ugman_ug_destroy(void *data)
                }
        }
 
+       if((ug != ug_man.root) && (ug->layout) &&
+               (ug->layout_state != UG_LAYOUT_DESTROY)) {
+               /* ug_destroy_all case */
+               struct ug_engine_ops *eng_ops = NULL;
+
+               if (ug_man.engine)
+                       eng_ops = &ug_man.engine->ops;
+
+               if (eng_ops && eng_ops->destroy)
+                       eng_ops->destroy(ug, NULL, NULL);
+       }
+
+       if (ug->module)
+               ops = &ug->module->ops;
+
        if (ops && ops->destroy) {
                _DBG("ug(%p) module destory cb call", ug);
                ops->destroy(ug, ug->service, ops->priv);
        }
 
-       ug_relation_del(ug);
+       if (ug != ug_man.root)
+               ug_relation_del(ug);
 
        if (ug->mode == UG_MODE_FULLVIEW) {
                if (ug_man.fv_top == ug) {
@@ -572,11 +585,9 @@ static int ugman_ug_create(void *data)
        }
 
        if(ug_man.last_rotate_evt == UG_EVENT_NONE) {
-               ugman_ug_event(ug,
-                       __ug_x_rotation_get(ug_man.disp, ug_man.win_id));
-       } else {
-               ugman_ug_event(ug, ug_man.last_rotate_evt);
+               ug_man.last_rotate_evt = __ug_x_rotation_get(ug_man.disp, ug_man.win_id);
        }
+       ugman_ug_event(ug, ug_man.last_rotate_evt);
 
        if(ug->mode == UG_MODE_FRAMEVIEW)
                ugman_ug_start(ug);
@@ -703,7 +714,7 @@ 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) {
-               _ERR("ugman_ug_del failed: Invalid ug");
+               _ERR("ugman_ug_del failed: Invalid ug(%p)");
                errno = EINVAL;
                return -1;
        }
@@ -808,7 +819,7 @@ int ugman_resume(void)
        }
 
        if (!ug_man.root) {
-               _ERR("ugman_resume failed: no root");
+               _WRN("ugman_resume failed: no root");
                return -1;
        }
 
@@ -861,7 +872,7 @@ int ugman_send_event(enum ug_event event)
        }
 
        if (!ug_man.root) {
-               _ERR("ugman_send_event failed: no root");
+               _WRN("ugman_send_event failed: no root");
                return -1;
        }
 
index da518d377e76368a78dbd1d5f08c33bf3ffee865..2f4915e91724a003809c96071f4716a162825772 100644 (file)
@@ -57,7 +57,6 @@ struct ug_module *ug_module_load(const char *name)
        int (*module_init) (struct ug_module_ops *ops);
 
        module = calloc(1, sizeof(struct ug_module));
-
        if (!module) {
                errno = ENOMEM;
                return NULL;
@@ -103,6 +102,7 @@ struct ug_module *ug_module_load(const char *name)
                goto module_dlclose;
 
        module->handle = handle;
+       module->module_name = strdup(name);
        return module;
 
  module_dlclose:
@@ -133,6 +133,9 @@ int ug_module_unload(struct ug_module *module)
                module->handle = NULL;
        }
 
+       if(module->module_name)
+               free(module->module_name);
+
        free(module);
        return 0;
 }
index b7abc37a11365268ac690a2edd6544930ee4ad63..dcdef3654fd2af96b36c415c7a1df4aec47b22d5 100755 (executable)
@@ -38,6 +38,19 @@ static void __hide_finished(void *data, Evas_Object *obj, void *event_info);
 static void (*show_end_cb)(void* data) = NULL;
 static void (*hide_end_cb)(void* data) = NULL;
 
+static void _layout_del_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       ui_gadget_h ug = (ui_gadget_h)data;
+       if (!ug)
+               return;
+
+       _WRN("ug(%p) layout is deleted by abnormal path", ug);
+
+       evas_object_event_callback_del(ug->layout, EVAS_CALLBACK_DEL, _layout_del_cb);
+
+       ug->layout_state = UG_LAYOUT_DESTROY;
+       ug->layout = NULL;
+}
 
 static void __del_effect_top_layout(ui_gadget_h ug)
 {
@@ -91,7 +104,10 @@ static void __del_effect_end(ui_gadget_h ug)
                        navi = NULL;
                }
        }
-       evas_object_hide(ug->layout);
+       if (ug->layout) {
+               evas_object_hide(ug->layout);
+               evas_object_event_callback_del(ug->layout, EVAS_CALLBACK_DEL, _layout_del_cb);
+       }
 
        ecore_idler_add((Ecore_Task_Cb)__destroy_end_cb, (void *)ug);
 
@@ -156,10 +172,9 @@ static void __on_hideonly_cb(void *data, Evas_Object *obj)
        if (!ug)
                return;
 
-       _DBG("\t obj=%p ug=%p state=%d", obj, ug, ug->layout_state);
+       _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);
-
        evas_object_event_callback_add(ug->layout, EVAS_CALLBACK_SHOW, on_show_cb, ug);
 
        if (ug->layout_state == UG_LAYOUT_SHOW) {
@@ -190,6 +205,12 @@ static void on_destroy(ui_gadget_h ug, ui_gadget_h t_ug,
        evas_object_intercept_hide_callback_del(ug->layout,
                                                __on_hideonly_cb);
 
+       if(hide_cb == NULL) {
+               /* ug_destroy_all case */
+               evas_object_event_callback_del(ug->layout, EVAS_CALLBACK_DEL, _layout_del_cb);
+               return;
+       }
+
        if(!hide_end_cb)
                hide_end_cb = hide_cb;
 
@@ -259,6 +280,7 @@ static void on_show_cb(void *data, Evas *e, Evas_Object *obj,
 
        evas_object_intercept_hide_callback_add(ug->layout,
                                                __on_hideonly_cb, ug);
+       evas_object_event_callback_add(ug->layout, EVAS_CALLBACK_DEL, _layout_del_cb, ug);
 
        //if 'elm.swallow.ug' string is changed, msg team have to apply this changes.
        elm_object_part_content_set(conform, "elm.swallow.ug", navi);