Sync with the latest private repository.
authorSung-jae Park <nicesj.park@samsung.com>
Wed, 12 Nov 2014 10:06:58 +0000 (19:06 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Wed, 12 Nov 2014 10:07:35 +0000 (19:07 +0900)
Initiate project using latest private code

Change-Id: Ib75d7a5276938fe3eebe9868ba355df1c47b9c24

36 files changed:
CMakeLists.txt
data/.icon_font.edc.swp [new file with mode: 0644]
data/CMakeLists.txt
data/icon_effect_font.edc
data/icon_font.edc
icon_src/main.c [changed mode: 0644->0755]
icon_src/script_handler.c
include/conf.h
include/connection.h [new file with mode: 0644]
include/dbox.h [new file with mode: 0644]
include/lb.h [deleted file]
include/so_handler.h
include/theme_loader.h [new file with mode: 0644]
include/util.h
org.tizen.data-provider-slave.desktop [deleted file]
org.tizen.data-provider-slave.rule
org.tizen.data-provider-slave.xml
packaging/org.tizen.data-provider-slave.manifest
packaging/org.tizen.data-provider-slave.spec
res/CMakeLists.txt
res/com.samsung.data-provider-slave_ChangeableColorInfo.xml [new file with mode: 0644]
src/client.c
src/conf.c [deleted file]
src/connection.c [new file with mode: 0644]
src/critical_log.c
src/dbox.c [new file with mode: 0644]
src/fault.c
src/lb.c [deleted file]
src/main.c
src/so_handler.c
src/theme_loader.c [new file with mode: 0644]
src/update_monitor.c
src/util.c
src/util_wayland.c [new file with mode: 0644]
src/util_x11.c [new file with mode: 0644]
stub/main.c

index b1ec5e4..c5372ee 100644 (file)
@@ -14,13 +14,12 @@ pkg_check_modules(pkg REQUIRED
        glib-2.0
        gio-2.0
        bundle
-       ecore-x
        ecore
-       provider
-       livebox-service
+       dynamicbox_provider
+       dynamicbox_service
        edje
        evas
-       livebox
+       dynamicbox
        elementary
        capi-system-system-settings
        com-core
@@ -29,10 +28,23 @@ pkg_check_modules(pkg REQUIRED
        json-glib-1.0
 )
 
+IF (X11_SUPPORT)
+pkg_check_modules(pkg_extra REQUIRED
+       ecore-x
+)
+ENDIF (X11_SUPPORT)
+
+IF (WAYLAND_SUPPORT)
+pkg_check_modules(pkg_extra REQUIRED
+       ecore-wayland
+)
+ENDIF (WAYLAND_SUPPORT)
+
 SET(PACKAGE "${PROJECT_NAME}")
 SET(LOCALEDIR "/usr/apps/org.tizen.${PROJECT_NAME}/res/locale")
 SET(ICON_PROVIDER "icon-provider-slave")
 SET(EXE_LOADER "${PROJECT_NAME}")
+SET(THEME_DIR "/opt/usr/share/data-provider-slave/theme")
 
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
 
@@ -53,71 +65,63 @@ ADD_DEFINITIONS("-DNDEBUG")
 #ADD_DEFINITIONS("-D_ENABLE_MCHECK")
 ADD_DEFINITIONS("-DLOG_TAG=\"DATA_PROVIDER_SLAVE\"")
 ADD_DEFINITIONS("-D_USE_ECORE_TIME_GET")
+ADD_DEFINITIONS("-DTHEME_DIR=\"${THEME_DIR}\"")
 #ADD_DEFINITIONS("-D_ESTIMATE_PERF")
 
 ADD_DEFINITIONS(${pkg_CFLAGS})
+ADD_DEFINITIONS(${pkg_LDFLAGS})
+ADD_DEFINITIONS(${pkg_extra_CFLAGS})
+ADD_DEFINITIONS(${pkg_extra_LDFLAGS})
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Winline -Werror -g -fno-builtin-malloc -fpie")
+
+SET(BUILD_SOURCE
+    src/main.c
+    src/so_handler.c
+    src/fault.c
+    src/update_monitor.c
+    src/util.c
+    src/dbox.c
+    src/client.c
+    src/critical_log.c
+    src/connection.c
+    src/theme_loader.c
+)
 
-FOREACH(flag ${pkg_CFLAGS})
-       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-       SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-IF (MOBILE)
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DMOBILE")
-ENDIF (MOBILE)
-
-IF (WEARABLE)
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DWEARABLE")
-ENDIF (WEARABLE)
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall")
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS} -Wall")
-
-# -fpie
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Winline -Werror -g -fno-builtin-malloc")
-#SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
-
-SET(EXTRA_LDFLAGS "-ldl")
-FOREACH(flag ${pkg_LDFLAGS})
-       IF (flag STREQUAL -L)
-               MESSAGE("Ignore -L")
-       ELSE()
-               SET(EXTRA_LDFLAGS "${EXTRA_LDFLAGS} ${flag}")
-       ENDIF()
-ENDFOREACH(flag)
-SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EXTRA_LDFLAGS}")
+IF (WAYLAND_SUPPORT)
+       ADD_DEFINITIONS("-DHAVE_WAYLAND")
+       SET(BUILD_SOURCE 
+               ${BUILD_SOURCE}
+               src/util_wayland.c
+       )
+ENDIF (WAYLAND_SUPPORT)
+
+IF (X11_SUPPORT)
+       ADD_DEFINITIONS("-DHAVE_X11")
+       SET(BUILD_SOURCE 
+               ${BUILD_SOURCE}
+               src/util_x11.c
+       )
+ENDIF (X11_SUPPORT)
 
 ADD_EXECUTABLE("${PROJECT_NAME}"
-       src/main.c
-       src/so_handler.c
-       src/fault.c
-       src/update_monitor.c
-       src/conf.c
-       src/util.c
-       src/lb.c
-       src/client.c
-       src/critical_log.c
+       ${BUILD_SOURCE}
 )
-TARGET_LINK_LIBRARIES("${PROJECT_NAME}" ${EXTRA_LDFLAGS})
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} "-ldl -pie" ${pkg_extra_LDFLAGS} ${pkg_LDFLAGS})
 
 ADD_EXECUTABLE(${ICON_PROVIDER}
        icon_src/main.c
        icon_src/script_handler.c
        src/util.c
 )
-TARGET_LINK_LIBRARIES(${ICON_PROVIDER} ${EXTRA_LDFLAGS})
+TARGET_LINK_LIBRARIES(${ICON_PROVIDER} "-ldl -pie" ${pkg_extra_LDFLAGS} ${pkg_LDFLAGS})
 
 #INSTALL(FILES ${CMAKE_SOURCE_DIR}/org.tizen.data-provider-slave.desktop DESTINATION /usr/share/applications)
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/org.tizen.data-provider-slave.xml DESTINATION /usr/share/packages)
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME "org.tizen.${PROJECT_NAME}")
-
-IF (WEARABLE)
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/org.tizen.data-provider-slave.rule DESTINATION /etc/smack/accesses2.d)
-ELSE (WEARABLE)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/org.tizen.data-provider-slave.rule DESTINATION /opt/etc/smack/accesses.d)
-ENDIF (WEARABLE)
-
-
 INSTALL(TARGETS ${ICON_PROVIDER} DESTINATION /usr/apps/org.tizen.${PROJECT_NAME}/bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
 INSTALL(TARGETS ${EXE_LOADER} DESTINATION /usr/apps/org.tizen.${PROJECT_NAME}/bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
 
diff --git a/data/.icon_font.edc.swp b/data/.icon_font.edc.swp
new file mode 100644 (file)
index 0000000..9ded4f5
Binary files /dev/null and b/data/.icon_font.edc.swp differ
index 7ba0cee..2ba9e89 100644 (file)
@@ -1,27 +1,21 @@
-IF (MOBILE)
-SET(EDJE_FLAGS "-DMOBILE")
-ELSE (MOBILE)
-SET(EDJE_FLAGS "-DWERABLE")
-ENDIF (MOBILE)
-
 ADD_CUSTOM_TARGET(icon.edj ALL
-               COMMAND edje_cc -sd ${CMAKE_CURRENT_SOURCE_DIR} -id ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/icon.edc icon.edj ${EDJE_FLAGS}
+               COMMAND edje_cc -sd ${CMAKE_CURRENT_SOURCE_DIR} -id ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/icon.edc icon.edj
                DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/icon.edc
 )
 ADD_DEPENDENCIES(${PROJECT_NAME} icon_font.edj)
 ADD_CUSTOM_TARGET(icon_font.edj ALL
-               COMMAND edje_cc -sd ${CMAKE_CURRENT_SOURCE_DIR} -id ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/icon_font.edc icon_font.edj ${EDJE_FLAGS}
+               COMMAND edje_cc -sd ${CMAKE_CURRENT_SOURCE_DIR} -id ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/icon_font.edc icon_font.edj
                DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/icon_font.edc
 )
 ADD_DEPENDENCIES(${PROJECT_NAME} icon_font.edj)
 
 ADD_CUSTOM_TARGET(icon_effect.edj ALL
-               COMMAND edje_cc -sd ${CMAKE_CURRENT_SOURCE_DIR} -id ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/icon_effect.edc icon_effect.edj ${EDJE_FLAGS}
+               COMMAND edje_cc -sd ${CMAKE_CURRENT_SOURCE_DIR} -id ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/icon_effect.edc icon_effect.edj
                DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/icon_effect.edc
 )
 ADD_DEPENDENCIES(${PROJECT_NAME} icon_effect.edj)
 ADD_CUSTOM_TARGET(icon_effect_font.edj ALL
-               COMMAND edje_cc -sd ${CMAKE_CURRENT_SOURCE_DIR} -id ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/icon_effect_font.edc icon_effect_font.edj ${EDJE_FLAGS}
+               COMMAND edje_cc -sd ${CMAKE_CURRENT_SOURCE_DIR} -id ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/icon_effect_font.edc icon_effect_font.edj
                DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/icon_effect_font.edc
 )
 ADD_DEPENDENCIES(${PROJECT_NAME} icon_effect_font.edj)
index bfb00b9..15fa700 100644 (file)
@@ -59,9 +59,7 @@ collections {
                        part {
                                name: "name";
                                type: TEXT;
-#if defined(WEARABLE)
                                effect: TIZEN_GLOW_SHADOW;      // TIZEN_SOFT_GLOW_SHADOW, TIZEN_SHADOW
-#endif
                                description {
                                        rel1 { relative: 10/175 133/175; }
                                        rel2 { relative: 165/175 167/175; }
@@ -108,9 +106,7 @@ collections {
                        part {
                                name: "name";
                                type: TEXT;
-#if defined(WEARABLE)
-                               effect: TIZEN_GLOW_SHADOW;      // TIZEN_SOFT_GLOW_SHADOW, TIZEN_SHADOW
-#endif
+                               effect: TIZEN_GLOW_SHADOW;
                                description {
                                        rel1 { relative: 99.5/354 133/175; }
                                        rel2 { relative: 254.5/354 167/175; }
@@ -157,9 +153,7 @@ collections {
                        part {
                                name: "name";
                                type: TEXT;
-#if defined(WEARABLE)
-                               effect: TIZEN_GLOW_SHADOW;      // TIZEN_SOFT_GLOW_SHADOW, TIZEN_SHADOW
-#endif
+                               effect: TIZEN_GLOW_SHADOW;
                                description {
                                        rel1 { relative: 99.5/354 222.5/354; }
                                        rel2 { relative: 254.5/354 256.5/354; }
@@ -206,9 +200,7 @@ collections {
                        part {
                                name: "name";
                                type: TEXT;
-#if defined(WEARABLE)
-                               effect: TIZEN_GLOW_SHADOW;      // TIZEN_SOFT_GLOW_SHADOW, TIZEN_SHADOW
-#endif
+                               effect: TIZEN_GLOW_SHADOW;
                                description {
                                        rel1 { relative: 278.5/712 133/175; }
                                        rel2 { relative: 433.5/712 167/175; }
@@ -255,9 +247,7 @@ collections {
                        part {
                                name: "name";
                                type: TEXT;
-#if defined(WEARABLE)
-                               effect: TIZEN_GLOW_SHADOW;      // TIZEN_SOFT_GLOW_SHADOW, TIZEN_SHADOW
-#endif
+                               effect: TIZEN_GLOW_SHADOW;
                                description {
                                        rel1 { relative: 278.5/712 222.5/354; }
                                        rel2 { relative: 433.5/712 256.5/354; }
@@ -304,9 +294,7 @@ collections {
                        part {
                                name: "name";
                                type: TEXT;
-#if defined(WEARABLE)
-                               effect: TIZEN_GLOW_SHADOW;      // TIZEN_SOFT_GLOW_SHADOW, TIZEN_SHADOW
-#endif
+                               effect: TIZEN_GLOW_SHADOW;
                                description {
                                        rel1 { relative: 278.5/712 312/533; }
                                        rel2 { relative: 433.5/712 346/533; }
@@ -353,9 +341,7 @@ collections {
                        part {
                                name: "name";
                                type: TEXT;
-#if defined(WEARABLE)
-                               effect: TIZEN_GLOW_SHADOW;      // TIZEN_SOFT_GLOW_SHADOW, TIZEN_SHADOW
-#endif
+                               effect: TIZEN_GLOW_SHADOW;
                                description {
                                        rel1 { relative: 278.5/712 401.5/712; }
                                        rel2 { relative: 433.5/712 435.5/712; }
@@ -402,9 +388,7 @@ collections {
                        part {
                                name: "name";
                                type: TEXT;
-#if defined(WEARABLE)
-                               effect: TIZEN_GLOW_SHADOW;      // TIZEN_SOFT_GLOW_SHADOW, TIZEN_SHADOW
-#endif
+                               effect: TIZEN_GLOW_SHADOW;
                                description {
                                        rel1 { relative: 278.5/712 491/891; }
                                        rel2 { relative: 433.5/712 525/891; }
@@ -451,9 +435,7 @@ collections {
                        part {
                                name: "name";
                                type: TEXT;
-#if defined(WEARABLE)
-                               effect: TIZEN_GLOW_SHADOW;      // TIZEN_SOFT_GLOW_SHADOW, TIZEN_SHADOW
-#endif
+                               effect: TIZEN_GLOW_SHADOW;
                                description {
                                        rel1 { relative: 278.5/712 580.5/1070; }
                                        rel2 { relative: 433.5/712 614.5/1070; }
index 526aae6..9933f04 100644 (file)
@@ -60,9 +60,7 @@ collections {
                        part {
                                name: "name";
                                type: TEXT;
-#if defined(WEARABLE)
-                               effect: TIZEN_GLOW_SHADOW;      // TIZEN_SOFT_GLOW_SHADOW, TIZEN_SHADOW
-#endif
+                               effect: TIZEN_GLOW_SHADOW;
                                description {
                                        rel1 { relative: 10/175 133/175; }
                                        rel2 { relative: 165/175 167/175; }
@@ -109,9 +107,7 @@ collections {
                        part {
                                name: "name";
                                type: TEXT;
-#if defined(WEARABLE)
-                               effect: TIZEN_GLOW_SHADOW;      // TIZEN_SOFT_GLOW_SHADOW, TIZEN_SHADOW
-#endif
+                               effect: TIZEN_GLOW_SHADOW;
                                description {
                                        rel1 { relative: 99.5/354 133/175; }
                                        rel2 { relative: 254.5/354 167/175; }
@@ -158,9 +154,7 @@ collections {
                        part {
                                name: "name";
                                type: TEXT;
-#if defined(WEARABLE)
-                               effect: TIZEN_GLOW_SHADOW;      // TIZEN_SOFT_GLOW_SHADOW, TIZEN_SHADOW
-#endif
+                               effect: TIZEN_GLOW_SHADOW;
                                description {
                                        rel1 { relative: 99.5/354 222.5/354; }
                                        rel2 { relative: 254.5/354 256.5/354; }
@@ -207,9 +201,7 @@ collections {
                        part {
                                name: "name";
                                type: TEXT;
-#if defined(WEARABLE)
-                               effect: TIZEN_GLOW_SHADOW;      // TIZEN_SOFT_GLOW_SHADOW, TIZEN_SHADOW
-#endif
+                               effect: TIZEN_GLOW_SHADOW;
                                description {
                                        rel1 { relative: 278.5/712 133/175; }
                                        rel2 { relative: 433.5/712 167/175; }
@@ -256,9 +248,7 @@ collections {
                        part {
                                name: "name";
                                type: TEXT;
-#if defined(WEARABLE)
-                               effect: TIZEN_GLOW_SHADOW;      // TIZEN_SOFT_GLOW_SHADOW, TIZEN_SHADOW
-#endif
+                               effect: TIZEN_GLOW_SHADOW;
                                description {
                                        rel1 { relative: 278.5/712 222.5/354; }
                                        rel2 { relative: 433.5/712 256.5/354; }
@@ -305,9 +295,7 @@ collections {
                        part {
                                name: "name";
                                type: TEXT;
-#if defined(WEARABLE)
-                               effect: TIZEN_GLOW_SHADOW;      // TIZEN_SOFT_GLOW_SHADOW, TIZEN_SHADOW
-#endif
+                               effect: TIZEN_GLOW_SHADOW;
                                description {
                                        rel1 { relative: 278.5/712 312/533; }
                                        rel2 { relative: 433.5/712 346/533; }
@@ -354,9 +342,7 @@ collections {
                        part {
                                name: "name";
                                type: TEXT;
-#if defined(WEARABLE)
-                               effect: TIZEN_GLOW_SHADOW;      // TIZEN_SOFT_GLOW_SHADOW, TIZEN_SHADOW
-#endif
+                               effect: TIZEN_GLOW_SHADOW;
                                description {
                                        rel1 { relative: 278.5/712 401.5/712; }
                                        rel2 { relative: 433.5/712 435.5/712; }
@@ -403,9 +389,7 @@ collections {
                        part {
                                name: "name";
                                type: TEXT;
-#if defined(WEARABLE)
-                               effect: TIZEN_GLOW_SHADOW;      // TIZEN_SOFT_GLOW_SHADOW, TIZEN_SHADOW
-#endif
+                               effect: TIZEN_GLOW_SHADOW;
                                description {
                                        rel1 { relative: 278.5/712 491/891; }
                                        rel2 { relative: 433.5/712 525/891; }
@@ -452,9 +436,7 @@ collections {
                        part {
                                name: "name";
                                type: TEXT;
-#if defined(WEARABLE)
-                               effect: TIZEN_GLOW_SHADOW;      // TIZEN_SOFT_GLOW_SHADOW, TIZEN_SHADOW
-#endif
+                               effect: TIZEN_GLOW_SHADOW;
                                description {
                                        rel1 { relative: 278.5/712 580.5/1070; }
                                        rel2 { relative: 433.5/712 614.5/1070; }
old mode 100644 (file)
new mode 100755 (executable)
index d20647d..12e4748
@@ -37,9 +37,9 @@
 #include <vconf.h>
 #include <dlog.h>
 #include <bundle.h>
-#include <livebox-service.h>
-#include <livebox-errno.h>
-#include <provider.h>
+#include <dynamicbox_service.h>
+#include <dynamicbox_errno.h>
+#include <dynamicbox_provider.h>
 
 #include <system_settings.h>
 
 #include <com-core_packet.h>
 
 #include <shortcut.h>
+#include <shortcut_private.h>
 
 #include "util.h"
 #include "debug.h"
 
 #define UTILITY_ADDR   "/tmp/.utility.service"
+#if !defined(DEFAULT_ICON_LAYOUT)
 #define DEFAULT_ICON_LAYOUT "/usr/apps/org.tizen.data-provider-slave/res/edje/icon.edj"
+#endif
+
+#if !defined(DEFAULT_ICON_GROUP)
 #define DEFAULT_ICON_GROUP "default"
+#endif
 
 #define TEXT_CLASS     "tizen"
 #define DEFAULT_FONT_SIZE      -100
@@ -75,21 +81,21 @@ static struct info {
 #define QUALITY_N_COMPRESS "quality=100 compress=1"
 
 /*!
- * Defined for liblivebox
+ * Defined for libdynamicbox
  */
-const char *livebox_find_pkgname(const char *filename)
+const char *dynamicbox_find_pkgname(const char *filename)
 {
        return NULL;
 }
 
-int livebox_request_update_by_id(const char *filename)
+int dynamicbox_request_update_by_id(const char *filename)
 {
-       return LB_STATUS_ERROR_NOT_EXIST;
+       return DBOX_STATUS_ERROR_NOT_EXIST;
 }
 
-int livebox_trigger_update_monitor(const char *id, int is_pd)
+int dynamicbox_trigger_update_monitor(const char *id, int is_pd)
 {
-       return LB_STATUS_ERROR_INVALID;
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
 }
 
 static inline Evas *create_virtual_canvas(int w, int h)
@@ -208,45 +214,45 @@ static inline int convert_shortcut_type_to_lb_type(int shortcut_type, char **str
        }
 
        switch (shortcut_type) {
-       case LIVEBOX_TYPE_1x1:
+       case DYNAMICBOX_TYPE_1x1:
                *str = "1x1";
-               return LB_SIZE_TYPE_1x1;
-       case LIVEBOX_TYPE_2x1:
+               return DBOX_SIZE_TYPE_1x1;
+       case DYNAMICBOX_TYPE_2x1:
                *str = "2x1";
-               return LB_SIZE_TYPE_2x1;
-       case LIVEBOX_TYPE_2x2:
+               return DBOX_SIZE_TYPE_2x1;
+       case DYNAMICBOX_TYPE_2x2:
                *str = "2x2";
-               return LB_SIZE_TYPE_2x2;
-       case LIVEBOX_TYPE_4x1:
+               return DBOX_SIZE_TYPE_2x2;
+       case DYNAMICBOX_TYPE_4x1:
                *str = "4x1";
-               return LB_SIZE_TYPE_4x1;
-       case LIVEBOX_TYPE_4x2:
+               return DBOX_SIZE_TYPE_4x1;
+       case DYNAMICBOX_TYPE_4x2:
                *str = "4x2";
-               return LB_SIZE_TYPE_4x2;
-       case LIVEBOX_TYPE_4x3:
+               return DBOX_SIZE_TYPE_4x2;
+       case DYNAMICBOX_TYPE_4x3:
                *str = "4x3";
-               return LB_SIZE_TYPE_4x3;
-       case LIVEBOX_TYPE_4x4:
+               return DBOX_SIZE_TYPE_4x3;
+       case DYNAMICBOX_TYPE_4x4:
                *str = "4x4";
-               return LB_SIZE_TYPE_4x4;
-       case LIVEBOX_TYPE_4x5:
+               return DBOX_SIZE_TYPE_4x4;
+       case DYNAMICBOX_TYPE_4x5:
                *str = "4x5";
-               return LB_SIZE_TYPE_4x5;
-       case LIVEBOX_TYPE_4x6:
+               return DBOX_SIZE_TYPE_4x5;
+       case DYNAMICBOX_TYPE_4x6:
                *str = "4x6";
-               return LB_SIZE_TYPE_4x6;
-       case LIVEBOX_TYPE_EASY_1x1:
+               return DBOX_SIZE_TYPE_4x6;
+       case DYNAMICBOX_TYPE_EASY_1x1:
                *str = "easy,1x1";
-               return LB_SIZE_TYPE_EASY_1x1;
-       case LIVEBOX_TYPE_EASY_3x1:
+               return DBOX_SIZE_TYPE_EASY_1x1;
+       case DYNAMICBOX_TYPE_EASY_3x1:
                *str = "easy,3x1";
-               return LB_SIZE_TYPE_EASY_3x1;
-       case LIVEBOX_TYPE_EASY_3x3:
+               return DBOX_SIZE_TYPE_EASY_3x1;
+       case DYNAMICBOX_TYPE_EASY_3x3:
                *str = "easy,3x3";
-               return LB_SIZE_TYPE_EASY_3x3;
+               return DBOX_SIZE_TYPE_EASY_3x3;
        default:
                *str = "?x?";
-               return LB_SIZE_TYPE_UNKNOWN;
+               return DBOX_SIZE_TYPE_UNKNOWN;
        }
 }
 
@@ -284,8 +290,8 @@ static struct packet *icon_create(pid_t pid, int handle, const struct packet *pa
        }
        DbgPrint("Selected layout: %s(%s)\n", edje_path, group);
 
-       ret = livebox_service_get_size(size_type, &w, &h);
-       if (ret != LB_STATUS_SUCCESS) {
+       ret = dynamicbox_service_get_size(size_type, &w, &h);
+       if (ret != DBOX_STATUS_ERROR_NONE) {
                ErrPrint("Unable to get size(%d): %d\n", size_type, ret);
                goto out;
        }
@@ -293,7 +299,7 @@ static struct packet *icon_create(pid_t pid, int handle, const struct packet *pa
        e = create_virtual_canvas(w, h);
        if (!e) {
                ErrPrint("Unable to create a canvas: %dx%d\n", w, h);
-               ret = LB_STATUS_ERROR_FAULT;
+               ret = DBOX_STATUS_ERROR_FAULT;
                goto out;
        }
 
@@ -301,7 +307,7 @@ static struct packet *icon_create(pid_t pid, int handle, const struct packet *pa
        if (!parent) {
                ErrPrint("Unable to create a parent\n");
                destroy_virtual_canvas(e);
-               ret = LB_STATUS_ERROR_FAULT;
+               ret = DBOX_STATUS_ERROR_FAULT;
                goto out;
        }
 
@@ -332,7 +338,7 @@ static struct packet *icon_create(pid_t pid, int handle, const struct packet *pa
        evas_object_resize(edje, w, h);
        evas_object_show(edje);
 
-       if (script_handler_parse_desc(edje, desc_file) != LB_STATUS_SUCCESS) {
+       if (script_handler_parse_desc(edje, desc_file) != DBOX_STATUS_ERROR_NONE) {
                ErrPrint("Unable to parse the %s\n", desc_file);
        }
 
@@ -434,9 +440,7 @@ static void font_changed_cb(keynode_t *node, void *user_data)
 {
        char *font_name;
 
-#if defined(WEARABLE)
        evas_font_reinit();
-#endif
 
        if (s_info.font_name) {
                font_name = vconf_get_str("db/setting/accessibility/font_name");
@@ -519,7 +523,7 @@ static void app_resume(void *data)
        return;
 }
 
-static void app_service(service_h service, void *data)
+static void app_control(app_control_h service, void *data)
 {
 }
 
@@ -532,7 +536,7 @@ int main(int argc, char *argv[])
        event_callback.terminate = app_terminate;
        event_callback.pause = app_pause;
        event_callback.resume = app_resume;
-       event_callback.service = app_service;
+       event_callback.app_control = app_control;
        event_callback.low_memory = NULL;
        event_callback.low_battery = NULL;
        event_callback.device_orientation = NULL;
index 571717d..14a149c 100644 (file)
@@ -12,7 +12,7 @@
 #include <efl_assist.h>
 
 #include <dlog.h>
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
 
 #include "debug.h"
 #include "util.h"
@@ -133,14 +133,14 @@ static int update_script_color(Evas_Object *edje, struct block *block)
 
        if (!block || !block->part || !block->data) {
                ErrPrint("Block or part or data is not valid\n");
-               return LB_STATUS_ERROR_INVALID;
+               return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
        if (block->id) {
                edje = find_edje(block->id);
                if (!edje) {
                        ErrPrint("Edje is not exists: %s\n", block->id);
-                       return LB_STATUS_ERROR_NOT_EXIST;
+                       return DBOX_STATUS_ERROR_NOT_EXIST;
                }
                DbgPrint("EDJE[%s] is selected (%p)\n", block->id, edje);
        }
@@ -151,7 +151,7 @@ static int update_script_color(Evas_Object *edje, struct block *block)
                                        r + 2, g + 2, b + 2, a + 2);    /* SHADOW */
        if (ret != 12) {
                DbgPrint("id[%s] part[%s] rgba[%s]\n", block->id, block->part, block->data);
-               return LB_STATUS_ERROR_INVALID;
+               return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
        ret = edje_object_color_class_set(elm_layout_edje_get(edje), block->part,
@@ -160,27 +160,27 @@ static int update_script_color(Evas_Object *edje, struct block *block)
                                r[2], g[2], b[2], a[2]); /* SHADOW */
 
        DbgPrint("color class is %s changed", ret == EINA_TRUE ? "successfully" : "not");
-       return LB_STATUS_SUCCESS;
+       return DBOX_STATUS_ERROR_NONE;
 }
 
 static int update_script_text(Evas_Object *edje, struct block *block)
 {
        if (!block || !block->part || !block->data) {
                ErrPrint("Block or part or data is not valid\n");
-               return LB_STATUS_ERROR_INVALID;
+               return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
        if (block->id) {
                edje = find_edje(block->id);
                if (!edje) {
                        ErrPrint("Failed to find EDJE\n");
-                       return LB_STATUS_ERROR_NOT_EXIST;
+                       return DBOX_STATUS_ERROR_NOT_EXIST;
                }
        }
 
        elm_object_part_text_set(edje, block->part, block->data ? block->data : "");
 
-       return LB_STATUS_SUCCESS;
+       return DBOX_STATUS_ERROR_NONE;
 }
 
 static void parse_aspect(struct image_option *img_opt, const char *value, int len)
@@ -428,14 +428,14 @@ static int update_script_image(Evas_Object *edje, struct block *block)
                edje = find_edje(block->id);
                if (!edje) {
                        ErrPrint("No such object: %s\n", block->id);
-                       return LB_STATUS_ERROR_NOT_EXIST;
+                       return DBOX_STATUS_ERROR_NOT_EXIST;
                }
        }
 
        obj_info = evas_object_data_get(edje, "obj_info");
        if (!obj_info) {
                ErrPrint("Object info is not available\n");
-               return LB_STATUS_ERROR_FAULT;
+               return DBOX_STATUS_ERROR_FAULT;
        }
 
        img = elm_object_part_content_unset(edje, block->part);
@@ -460,20 +460,20 @@ static int update_script_image(Evas_Object *edje, struct block *block)
 
        if (!block->data || !strlen(block->data) || access(block->data, R_OK) != 0) {
                DbgPrint("SKIP - Path: [%s]\n", block->data);
-               return LB_STATUS_SUCCESS;
+               return DBOX_STATUS_ERROR_NONE;
        }
 
        child = malloc(sizeof(*child));
        if (!child) {
                ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
+               return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
        }
 
        child->part = strdup(block->part);
        if (!child->part) {
                ErrPrint("Heap: %s\n", strerror(errno));
                free(child);
-               return LB_STATUS_ERROR_MEMORY;
+               return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
        }
 
        img = evas_object_image_add(evas_object_evas_get(edje));
@@ -481,7 +481,7 @@ static int update_script_image(Evas_Object *edje, struct block *block)
                ErrPrint("Failed to add an image object\n");
                free(child->part);
                free(child);
-               return LB_STATUS_ERROR_FAULT;
+               return DBOX_STATUS_ERROR_FAULT;
        }
 
        evas_object_image_preload(img, EINA_FALSE);
@@ -495,7 +495,7 @@ static int update_script_image(Evas_Object *edje, struct block *block)
                evas_object_del(img);
                free(child->part);
                free(child);
-               return LB_STATUS_ERROR_IO;
+               return DBOX_STATUS_ERROR_IO_ERROR;
        }
 
        evas_object_image_size_get(img, &w, &h);
@@ -534,7 +534,7 @@ static int update_script_image(Evas_Object *edje, struct block *block)
                                evas_object_del(img);
                                free(child->part);
                                free(child);
-                               return LB_STATUS_ERROR_INVALID;
+                               return DBOX_STATUS_ERROR_INVALID_PARAMETER;
                        }
 
                        if (evas_object_image_region_support_get(img)) {
@@ -556,7 +556,7 @@ static int update_script_image(Evas_Object *edje, struct block *block)
                                        evas_object_del(img);
                                        free(child->part);
                                        free(child);
-                                       return LB_STATUS_ERROR_FAULT;
+                                       return DBOX_STATUS_ERROR_FAULT;
                                }
 
                                ecore_evas_alpha_set(ee, EINA_TRUE);
@@ -569,7 +569,7 @@ static int update_script_image(Evas_Object *edje, struct block *block)
                                        evas_object_del(img);
                                        free(child->part);
                                        free(child);
-                                       return LB_STATUS_ERROR_FAULT;
+                                       return DBOX_STATUS_ERROR_FAULT;
                                }
 
                                src_img = evas_object_image_filled_add(e);
@@ -580,7 +580,7 @@ static int update_script_image(Evas_Object *edje, struct block *block)
                                        evas_object_del(img);
                                        free(child->part);
                                        free(child);
-                                       return LB_STATUS_ERROR_FAULT;
+                                       return DBOX_STATUS_ERROR_FAULT;
                                }
 
                                evas_object_image_alpha_set(src_img, EINA_TRUE);
@@ -597,7 +597,7 @@ static int update_script_image(Evas_Object *edje, struct block *block)
                                        evas_object_del(img);
                                        free(child->part);
                                        free(child);
-                                       return LB_STATUS_ERROR_IO;
+                                       return DBOX_STATUS_ERROR_IO_ERROR;
                                }
                                evas_object_image_size_get(src_img, &rw, &rh);
                                evas_object_image_fill_set(src_img, 0, 0, rw, rh);
@@ -614,7 +614,7 @@ static int update_script_image(Evas_Object *edje, struct block *block)
                                        evas_object_del(img);
                                        free(child->part);
                                        free(child);
-                                       return LB_STATUS_ERROR_IO;
+                                       return DBOX_STATUS_ERROR_IO_ERROR;
                                }
 
                                e = evas_object_evas_get(img);
@@ -626,7 +626,7 @@ static int update_script_image(Evas_Object *edje, struct block *block)
 
                                        free(child->part);
                                        free(child);
-                                       return LB_STATUS_ERROR_MEMORY;
+                                       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
                                }
 
                                evas_object_image_colorspace_set(img, EVAS_COLORSPACE_ARGB8888);
@@ -701,7 +701,6 @@ static int update_script_image(Evas_Object *edje, struct block *block)
        img_opt.shadow.color = 0x99000000;
 #endif
        if (img_opt.shadow.enabled) {
-#if defined(WEARABLE)
                ea_effect_h *ea_effect;
 
                ea_effect = ea_image_effect_create();
@@ -712,7 +711,6 @@ static int update_script_image(Evas_Object *edje, struct block *block)
 
                        ea_image_effect_destroy(ea_effect);
                }
-#endif
        }
 
        /*!
@@ -729,7 +727,7 @@ static int update_script_image(Evas_Object *edje, struct block *block)
         * This object is not registered as an access object.
         * So the developer should add it to access list manually, using DESC_ACCESS block.
         */
-       return LB_STATUS_SUCCESS;
+       return DBOX_STATUS_ERROR_NONE;
 }
 
 static void edje_del_cb(void *_info, Evas *e, Evas_Object *obj, void *event_info)
@@ -798,14 +796,14 @@ static int update_script_script(Evas_Object *edje, struct block *block)
                edje = find_edje(block->id);
                if (!edje) {
                        ErrPrint("Edje is not exists\n");
-                       return LB_STATUS_ERROR_NOT_EXIST;
+                       return DBOX_STATUS_ERROR_NOT_EXIST;
                }
        }
 
        obj_info = evas_object_data_get(edje, "obj_info");
        if (!obj_info) {
                ErrPrint("Object info is not valid\n");
-               return LB_STATUS_ERROR_INVALID;
+               return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
        obj = elm_object_part_content_unset(edje, block->part);
@@ -836,13 +834,13 @@ static int update_script_script(Evas_Object *edje, struct block *block)
 
        if (!block->data || !strlen(block->data) || access(block->data, R_OK) != 0) {
                DbgPrint("SKIP - Path: [%s]\n", block->data);
-               return LB_STATUS_SUCCESS;
+               return DBOX_STATUS_ERROR_NONE;
        }
 
        obj = elm_layout_add(edje);
        if (!obj) {
                ErrPrint("Failed to add a new edje object\n");
-               return LB_STATUS_ERROR_FAULT;
+               return DBOX_STATUS_ERROR_FAULT;
        }
 
        if (!elm_layout_file_set(obj, block->data, block->option)) {
@@ -853,7 +851,7 @@ static int update_script_script(Evas_Object *edje, struct block *block)
                        ErrPrint("Could not load %s from %s: %s\n", block->option, block->data, edje_load_error_str(err));
                }
                evas_object_del(obj);
-               return LB_STATUS_ERROR_IO;
+               return DBOX_STATUS_ERROR_IO_ERROR;
        }
 
        evas_object_show(obj);
@@ -862,7 +860,7 @@ static int update_script_script(Evas_Object *edje, struct block *block)
        if (!new_obj_info) {
                ErrPrint("Failed to add a obj_info\n");
                evas_object_del(obj);
-               return LB_STATUS_ERROR_MEMORY;
+               return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
        }
 
        new_obj_info->id = strdup(block->target_id);
@@ -870,7 +868,7 @@ static int update_script_script(Evas_Object *edje, struct block *block)
                ErrPrint("Failed to add a obj_info\n");
                free(new_obj_info);
                evas_object_del(obj);
-               return LB_STATUS_ERROR_MEMORY;
+               return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
        }
 
        child = malloc(sizeof(*child));
@@ -879,7 +877,7 @@ static int update_script_script(Evas_Object *edje, struct block *block)
                free(new_obj_info->id);
                free(new_obj_info);
                evas_object_del(obj);
-               return LB_STATUS_ERROR_MEMORY;
+               return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
        }
 
        child->part = strdup(block->part);
@@ -889,7 +887,7 @@ static int update_script_script(Evas_Object *edje, struct block *block)
                free(new_obj_info->id);
                free(new_obj_info);
                evas_object_del(obj);
-               return LB_STATUS_ERROR_MEMORY;
+               return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
        }
 
        child->obj = obj;
@@ -901,31 +899,31 @@ static int update_script_script(Evas_Object *edje, struct block *block)
        DbgPrint("%s part swallow edje %p\n", block->part, obj);
        elm_object_part_content_set(edje, block->part, obj);
        obj_info->children = eina_list_append(obj_info->children, child);
-       return LB_STATUS_SUCCESS;
+       return DBOX_STATUS_ERROR_NONE;
 }
 
 static int update_script_signal(Evas_Object *edje, struct block *block)
 {
        ErrPrint("Signal emit function is not supported\n");
-       return LB_STATUS_ERROR_INVALID;
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
 }
 
 static int update_script_drag(Evas_Object *edje, struct block *block)
 {
        ErrPrint("Signal emit function is not supported\n");
-       return LB_STATUS_ERROR_INVALID;
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
 }
 
 static int update_info(Evas_Object *edje, struct block *block)
 {
        ErrPrint("Signal emit function is not supported\n");
-       return LB_STATUS_ERROR_INVALID;
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
 }
 
 static int update_access(Evas_Object *edje, struct block *block)
 {
        ErrPrint("Accessibility is not able to be apply for making a shot\n");
-       return LB_STATUS_ERROR_INVALID;
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
 }
 
 static inline void consuming_parsed_block(Evas_Object *edje, int lineno, struct block *block)
@@ -1037,7 +1035,7 @@ HAPI int script_handler_parse_desc(Evas_Object *edje, const char *descfile)
        fp = fopen(descfile, "rt");
        if (!fp) {
                ErrPrint("Error: %s [%s]\n", descfile, strerror(errno));
-               return LB_STATUS_ERROR_IO;
+               return DBOX_STATUS_ERROR_IO_ERROR;
        }
 
        /*!
@@ -1056,7 +1054,7 @@ HAPI int script_handler_parse_desc(Evas_Object *edje, const char *descfile)
                if (fclose(fp) != 0) {
                        ErrPrint("fclose: %s\n", strerror(errno));
                }
-               return LB_STATUS_ERROR_MEMORY;
+               return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
        }
        info->id = NULL;
        info->children = NULL;
@@ -1087,7 +1085,7 @@ HAPI int script_handler_parse_desc(Evas_Object *edje, const char *descfile)
                                if (fclose(fp) != 0) {
                                        ErrPrint("fclose: %s\n", strerror(errno));
                                }
-                               return LB_STATUS_ERROR_INVALID;
+                               return DBOX_STATUS_ERROR_INVALID_PARAMETER;
                        }
                        break;
 
@@ -1107,7 +1105,7 @@ HAPI int script_handler_parse_desc(Evas_Object *edje, const char *descfile)
                                if (fclose(fp) != 0) {
                                        ErrPrint("fclose: %s\n", strerror(errno));
                                }
-                               return LB_STATUS_ERROR_MEMORY;
+                               return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
                        }
 
                        state = FIELD;
@@ -1422,7 +1420,7 @@ HAPI int script_handler_parse_desc(Evas_Object *edje, const char *descfile)
        if (fclose(fp) != 0) {
                ErrPrint("fclose: %s\n", strerror(errno));
        }
-       return LB_STATUS_SUCCESS;
+       return DBOX_STATUS_ERROR_NONE;
 
 errout:
        ErrPrint("Parse error at %d file %s\n", lineno, util_basename(descfile));
@@ -1432,7 +1430,7 @@ errout:
        if (fclose(fp) != 0) {
                ErrPrint("fclose: %s\n", strerror(errno));
        }
-       return LB_STATUS_ERROR_INVALID;
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
 }
 
 /* End of a file */
index f1e9d44..6260287 100644 (file)
  * limitations under the License.
  */
 
-struct conf {
-       int width;
-       int height;
+#define DEFAULT_LIFE_TIMER 20
+#define DEFAULT_LOAD_TIMER 20
+#define MINIMUM_UPDATE_INTERVAL 0.1f
 
-       int base_width;
-       int base_height;
-       double minimum_period;
-
-       struct {
-               char *script;
-               char *abi;
-               char *pd_group;
-               double period;
-       } default_conf;
-
-       struct {
-               char *name;
-               char *secured;
-               char *abi;
-       } launch_key;
-
-       double default_packet_time;
-
-       char *empty_content;
-       char *empty_title;
-
-       char *default_content;
-       char *default_title;
-
-       unsigned long minimum_space;
-
-       char *replace_tag;
-
-       double slave_ttl;
-       double slave_activate_time;
-       double slave_relaunch_time;
-       int slave_relaunch_count;
-
-       int max_log_line;
-       int max_log_file;
-
-       unsigned long sqlite_flush_max;
-
-       struct {
-               char *conf;
-               char *image;
-               char *script;
-               char *root;
-               char *script_port;
-               char *slave_log;
-               char *reader;
-               char *always;
-               char *db;
-               char *module;
-               char *input;
-       } path;
-
-       int max_size_type;
-
-       int slave_max_load;
-
-       double ping_time;
-
-       int use_sw_backend;
-       char *provider_method;
-       int debug_mode;
-       int overwrite_content;
-       int com_core_thread;
-       int use_xmonitor;
-       int premultiplied;
-};
-
-extern struct conf g_conf;
-
-extern int conf_loader(void);
-extern void conf_update_size(void);
-
-#define BASE_W                 g_conf.base_width
-#define BASE_H                 g_conf.base_height
-
-#define CR 13
-#define LF 10
-
-#define USE_XMONITOR           g_conf.use_xmonitor
-#define USE_SW_BACKEND         g_conf.use_sw_backend
-#define PROVIDER_METHOD                g_conf.provider_method
-#define DEBUG_MODE             g_conf.debug_mode
-#define OVERWRITE_CONTENT      g_conf.overwrite_content
-#define COM_CORE_THREAD                g_conf.com_core_thread
-
-#define MINIMUM_PERIOD         g_conf.minimum_period
-
-#define DEFAULT_SCRIPT         g_conf.default_conf.script
-#define DEFAULT_ABI            g_conf.default_conf.abi
-#define DEFAULT_GROUP          g_conf.default_conf.pd_group
-#define DEFAULT_PERIOD         g_conf.default_conf.period
-#define PRIORITY_NO_CHANGE     -1.0f
-
-#define BUNDLE_SLAVE_NAME      g_conf.launch_key.name
-#define BUNDLE_SLAVE_SECURED   g_conf.launch_key.secured
-#define BUNDLE_SLAVE_ABI       g_conf.launch_key.abi
-#define PACKET_TIME            g_conf.default_packet_time
-#define CONTENT_NO_CHANGE      g_conf.empty_content
-#define TITLE_NO_CHANGE                g_conf.empty_title
-#define DEFAULT_TITLE          g_conf.default_title
-#define DEFAULT_CONTENT                g_conf.default_content
-#define MINIMUM_SPACE          g_conf.minimum_space
-
-#define IMAGE_PATH             g_conf.path.image
-#define SCRIPT_PATH            g_conf.path.script
-#define SCRIPT_PORT_PATH       g_conf.path.script_port
-#define CONF_PATH              g_conf.path.conf
-#define ROOT_PATH              g_conf.path.root
-#define SLAVE_LOG_PATH         g_conf.path.slave_log
-#define READER_PATH            g_conf.path.reader
-#define ALWAYS_PATH            g_conf.path.always
-#define MODULE_PATH            g_conf.path.module
-#define INPUT_PATH             g_conf.path.input
-
-#define REPLACE_TAG_APPID      g_conf.replace_tag
-#define SLAVE_TTL              g_conf.slave_ttl
-#define SLAVE_ACTIVATE_TIME    g_conf.slave_activate_time
-#define SLAVE_RELAUNCH_TIME    g_conf.slave_relaunch_time
-#define SLAVE_RELAUNCH_COUNT   g_conf.slave_relaunch_count
-
-#define MAX_LOG_LINE           g_conf.max_log_line
-#define MAX_LOG_FILE           g_conf.max_log_file
-
-#define SQLITE_FLUSH_MAX       g_conf.sqlite_flush_max
-#define DBFILE                 g_conf.path.db
-
-#define SLAVE_MAX_LOAD         g_conf.slave_max_load
-#define DEFAULT_PING_TIME      g_conf.ping_time
-#define PREMULTIPLIED_COLOR    g_conf.premultiplied
-
-#define MAX_ABI                256
-#define MAX_PKGNAME    512
-#define DELAY_TIME     0.0000001f
-#define DEFAULT_CLUSTER        "user,created"
-#define MINIMUM_REACTIVATION_TIME      10
-
-#define HAPI __attribute__((visibility("hidden")))
-
-/* Set language */
-#if !defined(LOCALEDIR)
-#define LOCALEDIR "/usr/share/locale"
-#endif
-
-/* Set language */
-#if !defined(PACKAGE)
-#define PACKAGE "data-provider-slave"
-#endif
-
-#define DATA_MASTER "data-provider-master"
-
-#define DEFAULT_LIFE_TIMER     20
-#define DEFAULT_LOAD_TIMER     20
-#define MINIMUM_UPDATE_INTERVAL        0.1f
-
-/*!
- * \note
+/**
+ * @note
  * NO_ALARM is used for disabling the alarm code
- * This will turn off the alarm for checking the return of livebox functions
+ * This will turn off the alarm for checking the return of dynamicbox functions
  */
 #define NO_ALARM 1
 
-/*!
- * \note
+/**
+ * @note
  * This is default action.
- * This will enable the 'alarm' for checking the return time of livebox functions
+ * This will enable the alarm for checking the return time of dynamicbox functions
+ * If the function doesn't return before alarm rining, it will be deal as a faulted one
  */
 #define USE_ALARM 0
 
-//#define DLAPI __attribute__((visibility("default")))
+#if !defined(LOCALEDIR)
+#define LOCALEDIR "/usr/share/locale"
+#endif
+
+#define HAPI __attribute__((visibility("hidden")))
 
 /* End of a file */
diff --git a/include/connection.h b/include/connection.h
new file mode 100644 (file)
index 0000000..8694b31
--- /dev/null
@@ -0,0 +1,29 @@
+
+enum connection_event_type {
+       CONNECTION_EVENT_TYPE_CONNECTED = 0x00,
+       CONNECTION_EVENT_TYPE_DISCONNECTED = 0x01,
+       CONNECTION_EVENT_TYPE_UNKNOWN = 0xFF,
+};
+
+struct connection;
+
+extern int connection_init(void);
+extern int connection_fini(void);
+
+extern struct connection *connection_create(const char *addr, void *table);
+
+extern struct connection *connection_find_by_addr(const char *addr);
+extern struct connection *connection_find_by_fd(int fd);
+
+extern int connection_add_event_handler(enum connection_event_type type, int (*event_cb)(int handle, void *data), void *data);
+extern void *connection_del_event_handler(enum connection_event_type type, int (*event_cb)(int handle, void *data));
+
+extern struct connection *connection_unref(struct connection *handle);
+extern struct connection *connection_ref(struct connection *handle);
+
+extern int connection_handle(struct connection *connection);
+extern const char *connection_addr(struct connection *connection);
+
+#define connection_destroy(handle)     connection_unref(handle);
+
+/* End of a file */
diff --git a/include/dbox.h b/include/dbox.h
new file mode 100644 (file)
index 0000000..a7787ad
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2013  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+extern void dbox_init(void);
+extern void dbox_fini(void);
+
+struct dbox_create_arg {
+       double period;
+       int timeout;
+       int has_dynamicbox_script;
+       int skip_need_to_create;
+       const char *content;
+       const char *cluster;
+       const char *category;
+       const char *abi;
+       const char *direct_addr;
+};
+
+extern int dbox_create(const char *pkgname, const char *id, struct dbox_create_arg *arg, int *w, int *h, double *priority, char **content, char **title);
+extern int dbox_destroy(const char *pkgname, const char *id, int type);
+
+extern int dbox_resize(const char *pkgname, const char *id, int w, int h);
+extern int dbox_clicked(const char *pkgname, const char *id, const char *event, double timestamp, double x, double y);
+extern int dbox_set_content_info(const char *pkgname, const char *id, const char *content_info);
+extern int dbox_set_content_info_all(const char *pkgname, const char *content);
+
+extern int dbox_script_event(const char *pkgname, const char *id, const char *emission, const char *source, dynamicbox_event_info_t event_info);
+extern int dbox_change_group(const char *pkgname, const char *id, const char *cluster, const char *category);
+
+extern int dbox_update(const char *pkgname, const char *id, int force);
+extern int dbox_update_all(const char *pkgname, const char *cluster, const char *category, int force);
+extern void dbox_pause_all(void);
+extern void dbox_resume_all(void);
+extern int dbox_set_period(const char *pkgname, const char *id, double period);
+extern char *dbox_pinup(const char *pkgname, const char *id, int pinup);
+extern int dbox_system_event(const char *pkgname, const char *id, int event);
+extern int dbox_system_event_all(int event);
+
+extern int dbox_open_gbar(const char *pkgname, const char *id);
+extern int dbox_close_gbar(const char *pkgname, const char *id);
+
+extern int dbox_pause(const char *pkgname, const char *id);
+extern int dbox_resume(const char *pkgname, const char *id);
+
+extern int dbox_is_pinned_up(const char *pkgname, const char *id);
+
+extern void dbox_turn_secured_on(void);
+
+extern int dbox_is_all_paused(void);
+extern int dbox_delete_all_deleteme(void);
+extern int dbox_delete_all(void);
+
+/**
+ * @brief
+ * Exported API for each dynamicboxes
+ */
+extern const char *dynamicbox_find_pkgname(const char *filename);
+extern int dynamicbox_request_update_by_id(const char *filename);
+extern int dynamicbox_trigger_update_monitor(const char *id, int is_gbar);
+extern int dynamicbox_update_extra_info(const char *id, const char *content, const char *title, const char *icon, const char *name);
+extern int dynamicbox_send_updated(const char *pkgname, const char *id, int idx, int x, int y, int w, int h, int gbar, const char *descfile);
+extern int dynamicbox_send_buffer_updated(const char *pkgname, const char *id, dynamicbox_buffer_h handle, int idx, int x, int y, int w, int h, int gbar, const char *descfile);
+
+/* End of a file */
diff --git a/include/lb.h b/include/lb.h
deleted file mode 100644 (file)
index 315643a..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2013  Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-extern int lb_init(void);
-extern int lb_fini(void);
-
-extern int lb_create(const char *pkgname, const char *id, const char *content_info, int timeout, int has_livebox_script, double period, const char *cluster, const char *category, int *w, int *h, double *priority, int skip_need_to_create, const char *abi, char **out_content, char **out_title);
-extern int lb_destroy(const char *pkgname, const char *id);
-
-extern int lb_resize(const char *pkgname, const char *id, int w, int h);
-extern int lb_clicked(const char *pkgname, const char *id, const char *event, double timestamp, double x, double y);
-
-extern int lb_script_event(const char *pkgname, const char *id, const char *emission, const char *source, struct event_info *event_info);
-extern int lb_change_group(const char *pkgname, const char *id, const char *cluster, const char *category);
-
-extern int lb_update(const char *pkgname, const char *id, int force);
-extern int lb_update_all(const char *pkgname, const char *cluster, const char *category, int force);
-extern void lb_pause_all(void);
-extern void lb_resume_all(void);
-extern int lb_set_period(const char *pkgname, const char *id, double period);
-extern char *lb_pinup(const char *pkgname, const char *id, int pinup);
-extern int lb_system_event(const char *pkgname, const char *id, int event);
-extern int lb_system_event_all(int event);
-
-extern int lb_open_pd(const char *pkgname, const char *id);
-extern int lb_close_pd(const char *pkgname, const char *id);
-
-extern int lb_pause(const char *pkgname, const char *id);
-extern int lb_resume(const char *pkgname, const char *id);
-
-extern int lb_is_pinned_up(const char *pkgname, const char *id);
-
-extern void lb_turn_secured_on(void);
-
-extern int lb_is_all_paused(void);
-extern int lb_delete_all_deleteme(void);
-extern int lb_delete_all(void);
-
-/*!
- * Exported API for each liveboxes
- */
-extern const char *livebox_find_pkgname(const char *filename);
-extern int livebox_request_update_by_id(const char *filename);
-extern int livebox_trigger_update_monitor(const char *id, int is_pd);
-extern int livebox_update_extra_info(const char *id, const char *content, const char *title, const char *icon, const char *name);
-
-/* End of a file */
index b9fbd20..b54e3c2 100644 (file)
@@ -20,7 +20,7 @@ typedef int (*is_updated_t)(const char *filename);
 typedef int (*need_to_destroy_t)(const char *filename);
 typedef int (*update_content_t)(const char *filename);
 typedef int (*clicked_t)(const char *filename, const char *event, double timestamp, double x, double y);
-typedef int (*script_t)(const char *filename, const char *emission, const char *source, struct event_info *event_info);
+typedef int (*script_t)(const char *filename, const char *emission, const char *source, dynamicbox_event_info_t event_info);
 typedef int (*resize_t)(const char *filename, int type);
 typedef int (*create_needed_t)(const char *cluster, const char *category);
 typedef int (*change_group_t)(const char *filename, const char *cluster, const char *category);
@@ -31,6 +31,7 @@ typedef char *(*pinup_t)(const char *filename, int pinup);
 typedef int (*is_pinned_up_t)(const char *filename);
 typedef int (*system_event_t)(const char *filename, int type);
 typedef int (*get_alt_info_t)(const char *filename, char **icon, char **name);
+typedef int (*set_content_info_t)(const char *filename, const char *content_info);
 
 typedef int (*adaptor_create_t)(const char *pkgname, const char *filename, const char *content, const char *cluster, const char *category);
 typedef int (*adaptor_destroy_t)(const char *pkgname, const char *filename);
@@ -38,7 +39,7 @@ typedef int (*adaptor_is_updated_t)(const char *pkgname, const char *filename);
 typedef int (*adaptor_need_to_destroy_t)(const char *pkgname, const char *filename);
 typedef int (*adaptor_update_content_t)(const char *pkgname, const char *filename);
 typedef int (*adaptor_clicked_t)(const char *pkgname, const char *filename, const char *event, double timestamp, double x, double y);
-typedef int (*adaptor_script_t)(const char *pkgname, const char *filename, const char *emission, const char *source, struct event_info *event_info);
+typedef int (*adaptor_script_t)(const char *pkgname, const char *filename, const char *emission, const char *source, dynamicbox_event_info_t event_info);
 typedef int (*adaptor_resize_t)(const char *pkgname, const char *filename, int type);
 typedef int (*adaptor_create_needed_t)(const char *pkgname, const char *cluster, const char *category);
 typedef int (*adaptor_change_group_t)(const char *pkgname, const char *filename, const char *cluster, const char *category);
@@ -49,6 +50,7 @@ typedef char *(*adaptor_pinup_t)(const char *pkgname, const char *filename, int
 typedef int (*adaptor_is_pinned_up_t)(const char *pkgname, const char *filename);
 typedef int (*adaptor_system_event_t)(const char *pkgname, const char *filename, int type);
 typedef int (*adaptor_get_alt_info_t)(const char *pkgname, const char *filename, char **icon, char **name);
+typedef int (*adaptor_set_content_info_t)(const char *pkgname, const char *filename, const char *content_info);
 
 struct instance {
        struct so_item *item;
@@ -69,7 +71,7 @@ struct so_item {
        char *pkgname;
        void *handle;
        int timeout;
-       int has_livebox_script;
+       int has_dynamicbox_script;
 
        Eina_List *inst_list;
 
@@ -91,7 +93,8 @@ struct so_item {
                is_pinned_up_t is_pinned_up;
                system_event_t sys_event;
                get_alt_info_t get_alt_info;
-       } livebox;
+               set_content_info_t set_content_info;
+       } dynamicbox;
 
        struct {
                adaptor_initialize_t initialize;
@@ -111,36 +114,38 @@ struct so_item {
                adaptor_is_pinned_up_t is_pinned_up;
                adaptor_system_event_t sys_event;
                adaptor_get_alt_info_t get_alt_info;
+               adaptor_set_content_info_t set_content_info;
        } adaptor;
 };
 
 enum current_operations {
-       LIVEBOX_OP_UNKNOWN,
-       LIVEBOX_OP_CREATE,
-       LIVEBOX_OP_RESIZE,
-       LIVEBOX_OP_CONTENT_EVENT,
-       LIVEBOX_OP_NEED_TO_UPDATE,
-       LIVEBOX_OP_NEED_TO_DESTROY,
-       LIVEBOX_OP_NEED_TO_CREATE,
-       LIVEBOX_OP_CHANGE_GROUP,
-       LIVEBOX_OP_GET_INFO,
-       LIVEBOX_OP_UPDATE_CONTENT,
-       LIVEBOX_OP_CLICKED,
-       LIVEBOX_OP_SYSTEM_EVENT,
-       LIVEBOX_OP_PINUP,
-       LIVEBOX_OP_IS_PINNED_UP,
-       LIVEBOX_OP_DESTROY,
-       LIVEBOX_OP_GET_ALT_INFO
+       DBOX_OP_UNKNOWN,
+       DBOX_OP_CREATE,
+       DBOX_OP_RESIZE,
+       DBOX_OP_CONTENT_EVENT,
+       DBOX_OP_NEED_TO_UPDATE,
+       DBOX_OP_NEED_TO_DESTROY,
+       DBOX_OP_NEED_TO_CREATE,
+       DBOX_OP_CHANGE_GROUP,
+       DBOX_OP_GET_INFO,
+       DBOX_OP_UPDATE_CONTENT,
+       DBOX_OP_CLICKED,
+       DBOX_OP_SYSTEM_EVENT,
+       DBOX_OP_PINUP,
+       DBOX_OP_IS_PINNED_UP,
+       DBOX_OP_DESTROY,
+       DBOX_OP_GET_ALT_INFO,
+       DBOX_OP_SET_CONTENT_INFO
 };
 
 extern struct instance *so_find_instance(const char *pkgname, const char *filename);
-extern int so_create(const char *pkgname, const char *filename, const char *content_info, int timeout, int has_livebox_script, const char *cluster, const char *category, const char *abi, struct instance **inst);
+extern int so_create(const char *pkgname, const char *filename, const char *content_info, int timeout, int has_dynamicbox_script, const char *cluster, const char *category, const char *abi, struct instance **inst);
 extern int so_is_updated(struct instance *inst);
 extern int so_need_to_destroy(struct instance *inst);
 extern int so_update(struct instance *inst);
-extern int so_destroy(struct instance *inst);
+extern int so_destroy(struct instance *inst, int unload);
 extern int so_clicked(struct instance *inst, const char *event, double timestamp, double x, double y);
-extern int so_script_event(struct instance *inst, const char *emission, const char *source, struct event_info *event_info);
+extern int so_script_event(struct instance *inst, const char *emission, const char *source, dynamicbox_event_info_t event_info);
 extern int so_resize(struct instance *inst, int w, int h);
 extern int so_create_needed(const char *pkgname, const char *cluster, const char *category, const char *abi);
 extern int so_change_group(struct instance *inst, const char *cluster, const char *category);
@@ -149,6 +154,7 @@ extern char *so_pinup(struct instance *inst, int pinup);
 extern int so_is_pinned_up(struct instance *inst);
 extern int so_sys_event(struct instance *inst, int event);
 extern int so_get_alt_info(struct instance *inst, char **icon, char **name);
+extern int so_set_content_info(struct instance *inst, const char *content_info);
 
 extern enum current_operations so_current_op(void);
 
diff --git a/include/theme_loader.h b/include/theme_loader.h
new file mode 100644 (file)
index 0000000..c701b05
--- /dev/null
@@ -0,0 +1,2 @@
+extern int theme_loader_load(const char *path);
+extern void theme_loader_unload(void);
index a63cbe5..0efaeb1 100644 (file)
@@ -23,6 +23,12 @@ extern void *util_timer_add(double interval, Eina_Bool (*cb)(void *data), void *
 extern void util_timer_interval_set(void *timer, double interval);
 extern int util_get_filesize(const char *filename);
 extern double util_time_delay_for_compensation(double period);
+extern void util_dump_current_so_info(const char *path);
+
+extern void *util_screen_get(void);
+extern int util_screen_size_get(int *width, int *height);
+extern int util_screen_init(void);
+extern int util_screen_fini(void);
 
 #define SCHEMA_FILE    "file://"
 #define SCHEMA_PIXMAP  "pixmap://"
diff --git a/org.tizen.data-provider-slave.desktop b/org.tizen.data-provider-slave.desktop
deleted file mode 100644 (file)
index 42df73c..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-Name=Live Data Provider - Slave
-Type=Application
-Exec=/usr/apps/org.tizen.data-provider-slave/bin/data-provider-slave
-Icon=org.tizen.data-provider-slave.png
-NoDisplay=True
-Network=True
-Comment=Homescreen-Live Box content data provider (slave)
-X-TIZEN-TaskManage=False
-X-TIZEN-Multiple=True
index 6125a8e..7291921 100644 (file)
@@ -2,7 +2,7 @@ org.tizen.data-provider-slave app.default include
 org.tizen.data-provider-slave device::app_logging w
 org.tizen.data-provider-slave system::use_internet rw
 org.tizen.data-provider-slave ail::db rw
-org.tizen.data-provider-slave app-svc::db rl
+org.tizen.data-provider-slave app-svc::db rw
 org.tizen.data-provider-slave xorg rw
 org.tizen.data-provider-slave isf rwx
 org.tizen.data-provider-slave dbus wx
@@ -12,9 +12,15 @@ org.tizen.data-provider-slave data-provider-master::db rl
 org.tizen.data-provider-slave data-provider-master rw
 org.tizen.data-provider-slave data-provider-master::utility rw
 org.tizen.data-provider-slave e17 rx
-org.tizen.app-tray org.tizen.data-provider-slave rx
+org.tizen.data-provider-slave dali x
 dbus org.tizen.data-provider-slave rwx
 org.tizen.data-provider-slave sound_server rw
 org.tizen.data-provider-slave tts-server rwx
 org.tizen.data-provider-slave aul::launch x
 org.tizen.data-provider-slave security-server::api-cookie-check w
+org.tizen.data-provider-slave ug-setting-call-efl::vconf r
+org.tizen.data-provider-slave deviced::haptic rw
+
+# Weather
+org.tizen.data-provider-slave privacy-manager::read r
+system::use_internet org.tizen.data-provider-slave rw
index a90bb8f..5fb46ae 100644 (file)
@@ -1,17 +1,46 @@
 <?xml version="1.0" encoding="utf-8" ?>
-<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.data-provider-slave" version="0.5.4" install-location="auto">
-       <label>Dynamic Box Provider (Default)</label>
+<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.data-provider-slave" version="1.0.0" install-location="auto" support-mode="screen-reader">
+       <label>Dynamic Box Provider (slave)</label>
        <author email="nicesj.park@samsung.com" href="www.samsung.com">Sung-jae Park</author>
        <author email="yjoo93.park@samsung.com" href="www.samsung.com">Youngjoo Park</author>
-       <description>Dynamic Box Provider (Default)</description>
+       <description>Dynamic Box Provider (slave)</description>
 
        <ui-application appid="org.tizen.data-provider-slave" exec="/usr/apps/org.tizen.data-provider-slave/bin/data-provider-slave" nodisplay="true" multiple="true" type="capp" taskmanage="false">
                <icon>org.tizen.data-provider-slave.png</icon>
-               <label>Dynamic Box Provider (Default)</label>
-               <label xml:lang="en-us">Dynamic Box Provider (Default)</label>
+               <label>Home Boxes</label>
+               <label xml:lang="as-in">গৃহ বক্সসমূহ</label>
+               <label xml:lang="bn-in">হোম বক্সগুলি</label>
+               <label xml:lang="en-gb">Home Boxes</label>
+               <label xml:lang="en-ph">Home Boxes</label>
+               <label xml:lang="en-us">Home Boxes</label>
+               <label xml:lang="es-us">Home Boxes</label>
+               <label xml:lang="gu-in">હોમ બોક્સીસ</label>
+               <label xml:lang="hi-in">होम बॉक्सेज</label>
+               <label xml:lang="id-id">Kotak Depan</label>
+               <label xml:lang="km-kh">ប្រអប់​គេហ</label>
+               <label xml:lang="kn-in">ಹೋಮ್ ಬಾಕ್ಸ್‌ಗಳು</label>
+               <label xml:lang="ko-kr">Home Box</label>
+               <label xml:lang="lo-la">Home Boxes</label>
+               <label xml:lang="ml-in">ഹോം ബോക്സുകൾ</label>
+               <label xml:lang="mr-in">होम बॉक्सेस</label>
+               <label xml:lang="ms-my">Home Boxes</label>
+               <label xml:lang="my-mm">မူလ ေသတၱာမ်ား</label>
+               <label xml:lang="ne-np">होम बक्सहरू</label>
+               <label xml:lang="or-in">ହୋମ୍ ବକ୍ସଗୁଡିକ</label>
+               <label xml:lang="pa-in">ਹੋਮ ਬਾੱਕਸਸ</label>
+               <label xml:lang="pt-br">Home Boxes</label>
+               <label xml:lang="si-lk">හෝම් බොක්සස්</label>
+               <label xml:lang="ta-in">முகப்புப் பெட்டிகள்</label>
+               <label xml:lang="te-in">హోమ్ బాక్స్‌లు</label>
+               <label xml:lang="th-th">Home Box</label>
+               <label xml:lang="tl-ph">Mga home Box</label>
+               <label xml:lang="ur-pk">ہوم باکسز</label>
+               <label xml:lang="vi-vn">Home Box</label>
+               <label xml:lang="zh-cn">主页框</label>
        </ui-application>
        <privileges>
                <privilege>http://tizen.org/privilege/location</privilege>
+               <privilege>http://developer.samsung.com/tizen/privilege/privacymanager.read</privilege> <!-- weather -->
        </privileges>
 
        <ui-application appid="org.tizen.data-provider-slave.icon" exec="/usr/apps/org.tizen.data-provider-slave/bin/icon-provider-slave" nodisplay="true" multiple="false" type="capp" taskmanage="false">
index 1aa5157..f00a47c 100644 (file)
@@ -1,16 +1,12 @@
 <manifest>
        <!-- Provider slave label -->
        <define>
-               <domain name="org.tizen.data-provider-slave" policy="shared" />
-               <request>
-                       <smack request="contacts-service" type="rwx" />
-                       <smack request="contacts-service::vconf" type="rwxl" />
-                       <smack request="contacts-service::db" type="rw" />
-                       <smack request="contacts-service::svc" type="rlw" />
-                       <smack request="contacts-service::vconf-private" type="rl" />
-               </request>
+               <domain name="org.tizen.data-provider-slave" policy="restricted" />
        </define>
-       
+       <request>
+               <domain name="org.tizen.data-provider-slave" />
+       </request>
+
        <assign>
                <!-- Application folder -->
                <filesystem path="/usr/apps/org.tizen.data-provider-slave" label="org.tizen.data-provider-slave" />
@@ -29,5 +25,9 @@
                <!-- Application Data folder -->
                <filesystem path="/opt/usr/apps/org.tizen.data-provider-slave/data" label="org.tizen.data-provider-slave" />
                <filesystem path="/opt/usr/apps/org.tizen.data-provider-slave" label="org.tizen.data-provider-slave" />
+
+               <!-- resource folder -->
+               <filesystem path="/opt/usr/share/data-provider-slave" label="org.tizen.data-provider-slave" />
+               <filesystem path="/opt/usr/share/data-provider-slave/theme" label="org.tizen.data-provider-slave" />
        </assign>
 </manifest>
index 5151a3a..dc84f97 100644 (file)
@@ -1,8 +1,9 @@
+%bcond_with wayland
 %define app_data /opt/usr/apps/org.tizen.data-provider-slave/data
 
 Name: org.tizen.data-provider-slave
-Summary: Plugin type livebox service provider
-Version: 0.14.1
+Summary: Plugin type dynamicbox service provider
+Version: 1.0.0
 Release: 1
 Group: HomeTF/Livebox
 License: Flora
@@ -19,32 +20,36 @@ BuildRequires: pkgconfig(db-util)
 BuildRequires: pkgconfig(glib-2.0)
 BuildRequires: pkgconfig(gio-2.0)
 BuildRequires: pkgconfig(bundle)
-BuildRequires: pkgconfig(ecore-x)
-BuildRequires: pkgconfig(provider)
-BuildRequires: pkgconfig(heap-monitor)
-BuildRequires: pkgconfig(livebox-service)
+BuildRequires: pkgconfig(dynamicbox_provider)
+BuildRequires: pkgconfig(dynamicbox_service)
 BuildRequires: pkgconfig(capi-appfw-application)
 BuildRequires: pkgconfig(capi-appfw-app-manager)
 BuildRequires: pkgconfig(ecore)
 BuildRequires: pkgconfig(edje)
 BuildRequires: pkgconfig(evas)
-BuildRequires: pkgconfig(livebox)
+BuildRequires: pkgconfig(dynamicbox)
 BuildRequires: pkgconfig(elementary)
 BuildRequires: pkgconfig(com-core)
 BuildRequires: pkgconfig(shortcut)
 BuildRequires: pkgconfig(efl-assist)
 BuildRequires: pkgconfig(json-glib-1.0)
+%if %{with wayland}
+BuildRequires: pkgconfig(ecore-wayland)
+%else
+BuildRequires: pkgconfig(ecore-x)
+%endif
 BuildRequires: hash-signer
 BuildRequires: pkgconfig(capi-system-system-settings)
+Requires(post): signing-client
 
 %if "%{sec_product_feature_livebox}" == "0"
 ExclusiveArch:
 %endif
 
 %description
-Plugin type liveboxes are managed by this.
+Plugin type dynamicboxes are managed by this.
 Supporting the EFL.
-Supporting the In-house livebox only.
+Supporting the In-house dynamicbox only.
 
 %prep
 %setup -q
@@ -63,17 +68,16 @@ export CXXFLAGS="${CXXFLAGS} -DTIZEN_ENGINEER_MODE"
 export FFLAGS="${FFLAGS} -DTIZEN_ENGINEER_MODE"
 %endif
 
-%if "%{_repository}" == "wearable"
-export MOBILE=Off
-export WEARABLE=On
+%if %{with wayland}
+export WAYLAND_SUPPORT=On
+export X11_SUPPORT=Off
 %else
-export MOBILE=On
-export WEARABLE=Off
+export WAYLAND_SUPPORT=Off
+export X11_SUPPORT=On
 %endif
 
-%cmake . -DMOBILE=${MOBILE} -DWEARABLE=${WEARABLE}
-#-fpie  LDFLAGS="${LDFLAGS} -pie -O3"
-CFLAGS="${CFLAGS} -Wall -Winline -Werror -fno-builtin-malloc" make %{?jobs:-j%jobs}
+%cmake . -DWAYLAND_SUPPORT=${WAYLAND_SUPPORT} -DX11_SUPPORT=${X11_SUPPORT}
+make %{?jobs:-j%jobs}
 
 %install
 rm -rf %{buildroot}
@@ -87,6 +91,7 @@ mkdir -p %{buildroot}/%{_datarootdir}/license
 mkdir -p %{buildroot}%{app_data}
 
 %post
+/usr/bin/signing-client/hash-signer-client.sh -a -d -p platform %{_prefix}/apps/%{name}
 chown 5000:5000 %{app_data}
 chmod 755 %{app_data}
 
@@ -96,12 +101,8 @@ chmod 755 %{app_data}
 %{_prefix}/apps/%{name}
 %{_datarootdir}/packages/%{name}.xml
 %{_datarootdir}/license/*
-
-%if "%{_repository}" == "wearable"
 %{_sysconfdir}/smack/accesses2.d/%{name}.rule
-%else
-/opt/%{_sysconfdir}/smack/accesses.d/%{name}.rule
-%endif
+/opt/usr/share/data-provider-slave/*
 %dir %{app_data}
 
 # End of a file
index e69de29..232d495 100644 (file)
@@ -0,0 +1 @@
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.tizen.data-provider-slave_ChangeableColorInfo.xml DESTINATION ${THEME_DIR}/color)
diff --git a/res/com.samsung.data-provider-slave_ChangeableColorInfo.xml b/res/com.samsung.data-provider-slave_ChangeableColorInfo.xml
new file mode 100644 (file)
index 0000000..bbfa521
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ChangeableColorTable num="1">
+       <Theme style="Dark">
+               <ChangeableColorInfo id="AO007" hue="0" saturation="0" value="0" alpha="5" />
+       </Theme>
+       <Theme style="Light">
+               <ChangeableColorInfo id="AO007" hue="0" saturation="0" value="0" alpha="5" />
+       </Theme>
+</ChangeableColorTable>
+<ChangeableColorTable num="2">
+       <Theme style="Dark">
+       </Theme>
+       <Theme style="Light">
+       </Theme>
+</ChangeableColorTable>
+<ChangeableColorTable num="3">
+       <Theme style="Dark">
+       </Theme>
+       <Theme style="Light">
+       </Theme>
+</ChangeableColorTable>
index 9497abb..4dcf7e8 100644 (file)
 #include <Ecore.h>
 #include <Ecore_X.h>
 
+#include <app.h>
 #include <dlog.h>
 #include <aul.h>
 #include <sqlite3.h>
 
-#include <provider.h>
-#include <livebox-errno.h>
-#include <livebox.h> /* LB_SYS_EVENT_XXX */
+#include <dynamicbox_provider.h> /* dynamicbox_provider */
+#include <dynamicbox_errno.h> /* dynamicbox_service */
+#include <dynamicbox_script.h> /* dynamicbox_service - dynamicbox_event_info */
+#include <dynamicbox_conf.h>
+#include <dynamicbox.h> /* dynamicbox - DBOX_SYS_EVENT_XXX */
 
 #include "critical_log.h"
-#include "conf.h"
 #include "debug.h"
 #include "client.h"
 #include "so_handler.h"
-#include "lb.h"
+#include "dbox.h"
 #include "util.h"
+#include "conf.h"
 
 static struct info {
-       Ecore_Timer *ping_timer;
+    Ecore_Timer *ping_timer;
 } s_info = {
-       .ping_timer = NULL,
+    .ping_timer = NULL,
 };
 
-static int method_new(struct event_arg *arg, int *width, int *height, double *priority, void *data)
+static int method_new(struct dynamicbox_event_arg *arg, int *width, int *height, double *priority, void *data)
 {
-       int ret;
-       DbgPrint("Create: pkgname[%s], id[%s], content[%s], timeout[%d], has_script[%d], period[%lf], cluster[%s], category[%s], skip[%d], abi[%s], size: %dx%d\n",
-               arg->pkgname,
-               arg->id,
-               arg->info.lb_create.content,
-               arg->info.lb_create.timeout,
-               arg->info.lb_create.has_script,
-               arg->info.lb_create.period,
-               arg->info.lb_create.cluster, arg->info.lb_create.category,
-               arg->info.lb_create.skip_need_to_create,
-               arg->info.lb_create.abi,
-               arg->info.lb_create.width,
-               arg->info.lb_create.height);
-
-       if (!arg->info.lb_create.content || !strlen(arg->info.lb_create.content)) {
-               DbgPrint("Use default content: \"%s\"\n", DEFAULT_CONTENT);
-               arg->info.lb_create.content = DEFAULT_CONTENT;
-       }
-
-       ret = lb_create(arg->pkgname, arg->id,
-                       arg->info.lb_create.content,
-                       arg->info.lb_create.timeout,
-                       arg->info.lb_create.has_script,
-                       arg->info.lb_create.period,
-                       arg->info.lb_create.cluster,
-                       arg->info.lb_create.category,
-                       width, height, priority,
-                       arg->info.lb_create.skip_need_to_create,
-                       arg->info.lb_create.abi,
-                       &arg->info.lb_create.out_content,
-                       &arg->info.lb_create.out_title);
-
-       if (ret == 0) {
-               if (arg->info.lb_create.width > 0 && arg->info.lb_create.height > 0) {
-                       DbgPrint("Create size: %dx%d (created: %dx%d)\n", arg->info.lb_create.width, arg->info.lb_create.height, *width, *height);
-                       if (*width != arg->info.lb_create.width || *height != arg->info.lb_create.height) {
-                               int tmp;
-                               tmp = lb_resize(arg->pkgname, arg->id, arg->info.lb_create.width, arg->info.lb_create.height);
-                               DbgPrint("lb_resize returns: %d\n", tmp);
-                               if (tmp == (int)LB_STATUS_SUCCESS) {
-                                       /*!
-                                        * \note
-                                        * Just returns resized canvas size.
-                                        * Even if it is not ready to render contents.
-                                        * Provider will allocate render buffer using this size.
-                                        */
-                                       *width = arg->info.lb_create.width;
-                                       *height = arg->info.lb_create.height;
-                               }
-                       }
+    int ret;
+    struct dbox_create_arg _arg;
+    DbgPrint("Create: pkgname[%s], id[%s], content[%s], timeout[%d], has_script[%d], period[%lf], cluster[%s], category[%s], skip[%d], abi[%s], size: %dx%d\n",
+           arg->pkgname,
+           arg->id,
+           arg->info.dbox_create.content,
+           arg->info.dbox_create.timeout,
+           arg->info.dbox_create.has_script,
+           arg->info.dbox_create.period,
+           arg->info.dbox_create.cluster, arg->info.dbox_create.category,
+           arg->info.dbox_create.skip_need_to_create,
+           arg->info.dbox_create.abi,
+           arg->info.dbox_create.width,
+           arg->info.dbox_create.height);
+
+    if (!arg->info.dbox_create.content || !strlen(arg->info.dbox_create.content)) {
+       DbgPrint("Use default content: \"%s\"\n", DYNAMICBOX_CONF_DEFAULT_CONTENT);
+       arg->info.dbox_create.content = DYNAMICBOX_CONF_DEFAULT_CONTENT;
+    }
+
+    _arg.content = arg->info.dbox_create.content;
+    _arg.timeout = arg->info.dbox_create.timeout;
+    _arg.has_dynamicbox_script = arg->info.dbox_create.has_script;
+    _arg.period = arg->info.dbox_create.period;
+    _arg.cluster = arg->info.dbox_create.cluster;
+    _arg.category = arg->info.dbox_create.category;
+    _arg.abi = arg->info.dbox_create.abi;
+    _arg.skip_need_to_create = arg->info.dbox_create.skip_need_to_create;
+    _arg.direct_addr = arg->info.dbox_create.direct_addr;
+
+    ret = dbox_create(arg->pkgname, arg->id,
+           &_arg,
+           width, height, priority,
+           &arg->info.dbox_create.out_content,
+           &arg->info.dbox_create.out_title);
+
+    if (ret == 0) {
+       if (arg->info.dbox_create.width > 0 && arg->info.dbox_create.height > 0) {
+           DbgPrint("Create size: %dx%d (created: %dx%d)\n", arg->info.dbox_create.width, arg->info.dbox_create.height, *width, *height);
+           if (*width != arg->info.dbox_create.width || *height != arg->info.dbox_create.height) {
+               int tmp;
+               tmp = dbox_resize(arg->pkgname, arg->id, arg->info.dbox_create.width, arg->info.dbox_create.height);
+               DbgPrint("dbox_resize returns: %d\n", tmp);
+               if (tmp == (int)DBOX_STATUS_ERROR_NONE) {
+                   /*!
+                    * \note
+                    * Just returns resized canvas size.
+                    * Even if it is not ready to render contents.
+                    * Provider will allocate render buffer using this size.
+                    */
+                   *width = arg->info.dbox_create.width;
+                   *height = arg->info.dbox_create.height;
                }
-
-               arg->info.lb_create.out_is_pinned_up = (lb_is_pinned_up(arg->pkgname, arg->id) == 1);
-       } else {
-               ErrPrint("lb_create returns %d\n", ret);
+           }
        }
 
-       if (lb_is_all_paused()) {
-               DbgPrint("Box is paused\n");
-               (void)lb_system_event(arg->pkgname, arg->id, LB_SYS_EVENT_PAUSED);
-       }
+       arg->info.dbox_create.out_is_pinned_up = (dbox_is_pinned_up(arg->pkgname, arg->id) == 1);
+    } else {
+       ErrPrint("dbox_create returns %d\n", ret);
+    }
+
+    if (dbox_is_all_paused()) {
+       DbgPrint("Box is paused\n");
+       (void)dbox_system_event(arg->pkgname, arg->id, DBOX_SYS_EVENT_PAUSED);
+    }
 
-       return ret;
+    return ret;
 }
 
-static int method_renew(struct event_arg *arg, void *data)
+static int method_renew(struct dynamicbox_event_arg *arg, void *data)
 {
-        int ret;
-        int w;
-        int h;
-        double priority;
-
-       DbgPrint("Re-create: pkgname[%s], id[%s], content[%s], timeout[%d], has_script[%d], period[%lf], cluster[%s], category[%s], abi[%s]\n",
-               arg->pkgname, arg->id,
-               arg->info.lb_recreate.content,
-               arg->info.lb_recreate.timeout,
-               arg->info.lb_recreate.has_script,
-               arg->info.lb_recreate.period,
-               arg->info.lb_recreate.cluster,
-               arg->info.lb_recreate.category,
-               arg->info.lb_recreate.abi);
-
-       if (!arg->info.lb_recreate.content || !strlen(arg->info.lb_recreate.content)) {
-               DbgPrint("Use default content: \"%s\"\n", DEFAULT_CONTENT);
-               arg->info.lb_recreate.content = DEFAULT_CONTENT;
-       }
-
-        ret = lb_create(arg->pkgname, arg->id,
-                       arg->info.lb_recreate.content,
-                       arg->info.lb_recreate.timeout,
-                       arg->info.lb_recreate.has_script,
-                       arg->info.lb_recreate.period,
-                       arg->info.lb_recreate.cluster,
-                       arg->info.lb_recreate.category,
-                       &w, &h, &priority,
-                       1,
-                       arg->info.lb_recreate.abi,
-                       &arg->info.lb_recreate.out_content,
-                       &arg->info.lb_recreate.out_title);
-       if (ret == 0) {
-               if (w != arg->info.lb_recreate.width || h != arg->info.lb_recreate.height) {
-                       int tmp;
-                       tmp = lb_resize(arg->pkgname, arg->id, arg->info.lb_recreate.width, arg->info.lb_recreate.height);
-                       if (tmp < 0) {
-                               DbgPrint("Resize[%dx%d] returns: %d\n", arg->info.lb_recreate.width, arg->info.lb_recreate.height, tmp);
-                       }
-               } else {
-                       DbgPrint("No need to change the size: %dx%d\n", w, h);
-               }
-
-               arg->info.lb_recreate.out_is_pinned_up = (lb_is_pinned_up(arg->pkgname, arg->id) == 1);
+    int ret;
+    int w;
+    int h;
+    double priority;
+    struct dbox_create_arg _arg;
+
+    DbgPrint("Re-create: pkgname[%s], id[%s], content[%s], timeout[%d], has_script[%d], period[%lf], cluster[%s], category[%s], abi[%s]\n",
+           arg->pkgname, arg->id,
+           arg->info.dbox_recreate.content,
+           arg->info.dbox_recreate.timeout,
+           arg->info.dbox_recreate.has_script,
+           arg->info.dbox_recreate.period,
+           arg->info.dbox_recreate.cluster,
+           arg->info.dbox_recreate.category,
+           arg->info.dbox_recreate.abi);
+
+    if (!arg->info.dbox_recreate.content || !strlen(arg->info.dbox_recreate.content)) {
+       DbgPrint("Use default content: \"%s\"\n", DYNAMICBOX_CONF_DEFAULT_CONTENT);
+       arg->info.dbox_recreate.content = DYNAMICBOX_CONF_DEFAULT_CONTENT;
+    }
+
+    _arg.content = arg->info.dbox_recreate.content;
+    _arg.timeout = arg->info.dbox_recreate.timeout;
+    _arg.has_dynamicbox_script = arg->info.dbox_recreate.has_script;
+    _arg.period = arg->info.dbox_recreate.period;
+    _arg.cluster = arg->info.dbox_recreate.cluster;
+    _arg.category = arg->info.dbox_recreate.category;
+    _arg.abi = arg->info.dbox_recreate.abi;
+    _arg.skip_need_to_create = 1;
+    _arg.direct_addr = arg->info.dbox_recreate.direct_addr;
+
+    ret = dbox_create(arg->pkgname, arg->id,
+           &_arg,
+           &w, &h, &priority,
+           &arg->info.dbox_recreate.out_content,
+           &arg->info.dbox_recreate.out_title);
+    if (ret == 0) {
+       if (w != arg->info.dbox_recreate.width || h != arg->info.dbox_recreate.height) {
+           int tmp;
+           tmp = dbox_resize(arg->pkgname, arg->id, arg->info.dbox_recreate.width, arg->info.dbox_recreate.height);
+           if (tmp < 0) {
+               DbgPrint("Resize[%dx%d] returns: %d\n", arg->info.dbox_recreate.width, arg->info.dbox_recreate.height, tmp);
+           }
        } else {
-               ErrPrint("lb_create returns %d\n", ret);
+           DbgPrint("No need to change the size: %dx%d\n", w, h);
        }
 
-       if (lb_is_all_paused()) {
-               DbgPrint("Box is paused\n");
-               (void)lb_system_event(arg->pkgname, arg->id, LB_SYS_EVENT_PAUSED);
-       }
+       arg->info.dbox_recreate.out_is_pinned_up = (dbox_is_pinned_up(arg->pkgname, arg->id) == 1);
+    } else {
+       ErrPrint("dbox_create returns %d\n", ret);
+    }
+
+    if (dbox_is_all_paused()) {
+       DbgPrint("Box is paused\n");
+       (void)dbox_system_event(arg->pkgname, arg->id, DBOX_SYS_EVENT_PAUSED);
+    }
 
-       return ret;
+    return ret;
 }
 
-static int method_delete(struct event_arg *arg, void *data)
+static int method_delete(struct dynamicbox_event_arg *arg, void *data)
 {
-       int ret;
-       DbgPrint("pkgname[%s] id[%s]\n", arg->pkgname, arg->id);
-       ret = lb_destroy(arg->pkgname, arg->id);
-       return ret;
+    int ret;
+
+    DbgPrint("pkgname[%s] id[%s]\n", arg->pkgname, arg->id);
+
+    if (arg->info.dbox_destroy.type == DBOX_DESTROY_TYPE_DEFAULT || arg->info.dbox_destroy.type == DBOX_DESTROY_TYPE_UNINSTALL) {
+       DbgPrint("Box is deleted from the viewer\n");
+       (void)dbox_system_event(arg->pkgname, arg->id, DBOX_SYS_EVENT_DELETED);
+    }
+
+    ret = dbox_destroy(arg->pkgname, arg->id, 0);
+    return ret;
 }
 
-static int method_content_event(struct event_arg *arg, void *data)
+static int method_content_event(struct dynamicbox_event_arg *arg, void *data)
 {
-       int ret;
-       struct event_info info;
+    int ret;
+    struct dynamicbox_event_info info;
 
-       info = arg->info.content_event.info;
+    info = arg->info.content_event.info;
 
-       ret = lb_script_event(arg->pkgname, arg->id,
-                               arg->info.content_event.emission, arg->info.content_event.source,
-                               &info);
-       return ret;
+    ret = dbox_script_event(arg->pkgname, arg->id,
+           arg->info.content_event.emission, arg->info.content_event.source,
+           &info);
+    return ret;
 }
 
-static int method_clicked(struct event_arg *arg, void *data)
+static int method_clicked(struct dynamicbox_event_arg *arg, void *data)
 {
-       int ret;
+    int ret;
 
-       DbgPrint("pkgname[%s] id[%s] event[%s] timestamp[%lf] x[%lf] y[%lf]\n",
-                                                               arg->pkgname, arg->id,
-                                                               arg->info.clicked.event, arg->info.clicked.timestamp,
-                                                               arg->info.clicked.x, arg->info.clicked.y);
-       ret = lb_clicked(arg->pkgname, arg->id,
-                       arg->info.clicked.event,
-                       arg->info.clicked.timestamp, arg->info.clicked.x, arg->info.clicked.y);
+    DbgPrint("pkgname[%s] id[%s] event[%s] timestamp[%lf] x[%lf] y[%lf]\n",
+           arg->pkgname, arg->id,
+           arg->info.clicked.event, arg->info.clicked.timestamp,
+           arg->info.clicked.x, arg->info.clicked.y);
+    ret = dbox_clicked(arg->pkgname, arg->id,
+           arg->info.clicked.event,
+           arg->info.clicked.timestamp, arg->info.clicked.x, arg->info.clicked.y);
 
-       return ret;
+    return ret;
 }
 
-static int method_text_signal(struct event_arg *arg, void *data)
+static int method_text_signal(struct dynamicbox_event_arg *arg, void *data)
 {
-       int ret;
-       struct event_info info;
+    int ret;
+    struct dynamicbox_event_info info;
 
-       info = arg->info.text_signal.info;
+    info = arg->info.text_signal.info;
 
-       DbgPrint("pkgname[%s] id[%s] emission[%s] source[%s]\n", arg->pkgname, arg->id, arg->info.text_signal.emission, arg->info.text_signal.source);
-       ret = lb_script_event(arg->pkgname, arg->id,
-                               arg->info.text_signal.emission, arg->info.text_signal.source,
-                               &info);
+    DbgPrint("pkgname[%s] id[%s] emission[%s] source[%s]\n", arg->pkgname, arg->id, arg->info.text_signal.emission, arg->info.text_signal.source);
+    ret = dbox_script_event(arg->pkgname, arg->id,
+           arg->info.text_signal.emission, arg->info.text_signal.source,
+           &info);
 
-       return ret;
+    return ret;
 }
 
-static int method_resize(struct event_arg *arg, void *data)
+static int method_resize(struct dynamicbox_event_arg *arg, void *data)
 {
-       int ret;
+    int ret;
 
-       DbgPrint("pkgname[%s] id[%s] w[%d] h[%d]\n", arg->pkgname, arg->id, arg->info.resize.w, arg->info.resize.h);
-       ret = lb_resize(arg->pkgname, arg->id, arg->info.resize.w, arg->info.resize.h);
+    DbgPrint("pkgname[%s] id[%s] w[%d] h[%d]\n", arg->pkgname, arg->id, arg->info.resize.w, arg->info.resize.h);
+    ret = dbox_resize(arg->pkgname, arg->id, arg->info.resize.w, arg->info.resize.h);
 
-       return ret;
+    return ret;
 }
 
-static int method_set_period(struct event_arg *arg, void *data)
+static int method_set_period(struct dynamicbox_event_arg *arg, void *data)
 {
-       int ret;
-       DbgPrint("pkgname[%s] id[%s] period[%lf]\n", arg->pkgname, arg->id, arg->info.set_period.period);
-       ret = lb_set_period(arg->pkgname, arg->id, arg->info.set_period.period);
-       return ret;
+    int ret;
+    DbgPrint("pkgname[%s] id[%s] period[%lf]\n", arg->pkgname, arg->id, arg->info.set_period.period);
+    ret = dbox_set_period(arg->pkgname, arg->id, arg->info.set_period.period);
+    return ret;
 }
 
-static int method_change_group(struct event_arg *arg, void *data)
+static int method_change_group(struct dynamicbox_event_arg *arg, void *data)
 {
-       int ret;
-       DbgPrint("pkgname[%s] id[%s] cluster[%s] category[%s]\n", arg->pkgname, arg->id, arg->info.change_group.cluster, arg->info.change_group.category);
-       ret = lb_change_group(arg->pkgname, arg->id, arg->info.change_group.cluster, arg->info.change_group.category);
-       return ret;
+    int ret;
+    DbgPrint("pkgname[%s] id[%s] cluster[%s] category[%s]\n", arg->pkgname, arg->id, arg->info.change_group.cluster, arg->info.change_group.category);
+    ret = dbox_change_group(arg->pkgname, arg->id, arg->info.change_group.cluster, arg->info.change_group.category);
+    return ret;
 }
 
-static int method_pinup(struct event_arg *arg, void *data)
+static int method_pinup(struct dynamicbox_event_arg *arg, void *data)
 {
-       DbgPrint("pkgname[%s] id[%s] state[%d]\n", arg->pkgname, arg->id, arg->info.pinup.state);
-       arg->info.pinup.content_info = lb_pinup(arg->pkgname, arg->id, arg->info.pinup.state);
-       return arg->info.pinup.content_info ? LB_STATUS_SUCCESS : LB_STATUS_ERROR_NOT_IMPLEMENTED;
+    DbgPrint("pkgname[%s] id[%s] state[%d]\n", arg->pkgname, arg->id, arg->info.pinup.state);
+    arg->info.pinup.content_info = dbox_pinup(arg->pkgname, arg->id, arg->info.pinup.state);
+    return arg->info.pinup.content_info ? DBOX_STATUS_ERROR_NONE : DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
 }
 
-static int method_update_content(struct event_arg *arg, void *data)
+static int method_update_content(struct dynamicbox_event_arg *arg, void *data)
 {
-       int ret;
+    int ret;
 
-       if (!arg->id || !strlen(arg->id)) {
-               DbgPrint("pkgname[%s] cluster[%s] category[%s]\n", arg->pkgname, arg->info.update_content.cluster, arg->info.update_content.category);
-               ret = lb_update_all(arg->pkgname, arg->info.update_content.cluster, arg->info.update_content.category, arg->info.update_content.force);
+    if (!arg->id || !strlen(arg->id)) {
+       if (arg->info.update_content.content && strlen(arg->info.update_content.content)) {
+           DbgPrint("pkgname[%s] content[%s]\n", arg->pkgname, arg->info.update_content.content);
+           ret = dbox_set_content_info_all(arg->pkgname, arg->info.update_content.content);
+       } else {
+           DbgPrint("pkgname[%s] cluster[%s] category[%s]\n", arg->pkgname, arg->info.update_content.cluster, arg->info.update_content.category);
+           ret = dbox_update_all(arg->pkgname, arg->info.update_content.cluster, arg->info.update_content.category, arg->info.update_content.force);
+       }
+    } else {
+       if (arg->info.update_content.content && strlen(arg->info.update_content.content)) {
+           DbgPrint("id[%s] content[%s]\n", arg->id, arg->info.update_content.content);
+           ret = dbox_set_content_info(arg->pkgname, arg->id, arg->info.update_content.content);
        } else {
-               DbgPrint("Update [%s]\n", arg->id);
-               ret = lb_update(arg->pkgname, arg->id, arg->info.update_content.force);
+           DbgPrint("Update [%s]\n", arg->id);
+           ret = dbox_update(arg->pkgname, arg->id, arg->info.update_content.force);
        }
+    }
 
-       return ret;
+    return ret;
 }
 
-static int method_pause(struct event_arg *arg, void *data)
+static int method_pause(struct dynamicbox_event_arg *arg, void *data)
 {
-       lb_pause_all();
-       if (s_info.ping_timer) {
-               ecore_timer_freeze(s_info.ping_timer);
-       }
+    dbox_pause_all();
+    if (s_info.ping_timer) {
+       ecore_timer_freeze(s_info.ping_timer);
+    }
 
-       sqlite3_release_memory(SQLITE_FLUSH_MAX);
-       malloc_trim(0);
-       return LB_STATUS_SUCCESS;
+    sqlite3_release_memory(DYNAMICBOX_CONF_SQLITE_FLUSH_MAX);
+    elm_cache_all_flush();
+    malloc_trim(0);
+
+    return DBOX_STATUS_ERROR_NONE;
 }
 
-static int method_resume(struct event_arg *arg, void *data)
+static int method_resume(struct dynamicbox_event_arg *arg, void *data)
 {
-       lb_resume_all();
-       if (s_info.ping_timer) {
-               ecore_timer_thaw(s_info.ping_timer);
-       }
-       return LB_STATUS_SUCCESS;
+    dbox_resume_all();
+    if (s_info.ping_timer) {
+       ecore_timer_thaw(s_info.ping_timer);
+    }
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static Eina_Bool send_ping_cb(void *data)
 {
-       provider_send_ping();
-       return ECORE_CALLBACK_RENEW;
+    dynamicbox_provider_send_ping();
+    return ECORE_CALLBACK_RENEW;
 }
 
-static int method_disconnected(struct event_arg *arg, void *data)
+static int method_disconnected(struct dynamicbox_event_arg *arg, void *data)
 {
-       if (s_info.ping_timer) {
-               ecore_timer_del(s_info.ping_timer);
-               s_info.ping_timer = NULL;
-       }
+    if (s_info.ping_timer) {
+       ecore_timer_del(s_info.ping_timer);
+       s_info.ping_timer = NULL;
+    }
 
-       elm_exit();
-       return LB_STATUS_SUCCESS;
+    ui_app_exit();
+    return DBOX_STATUS_ERROR_NONE;
 }
 
-static int method_connected(struct event_arg *arg, void *data)
+static int method_connected(struct dynamicbox_event_arg *arg, void *data)
 {
-       int ret;
-       ret = provider_send_hello();
-       if (ret == 0) {
-               s_info.ping_timer = ecore_timer_add(DEFAULT_PING_TIME, send_ping_cb, NULL);
-               if (!s_info.ping_timer) {
-                       ErrPrint("Failed to add a ping timer\n");
-               }
+    int ret;
+    ret = dynamicbox_provider_send_hello();
+    if (ret == 0) {
+       double ping_interval;
+
+       ping_interval = DYNAMICBOX_CONF_DEFAULT_PING_TIME / 2.0f;
+       DbgPrint("Ping Timer: %lf\n", ping_interval);
+
+       s_info.ping_timer = ecore_timer_add(ping_interval, send_ping_cb, NULL);
+       if (!s_info.ping_timer) {
+           ErrPrint("Failed to add a ping timer\n");
        }
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
-static int method_pd_created(struct event_arg *arg, void *data)
+static int method_gbar_created(struct dynamicbox_event_arg *arg, void *data)
 {
-       int ret;
+    int ret;
 
-       ret = lb_open_pd(arg->pkgname, arg->id);
-       if (ret < 0) {
-               DbgPrint("%s Open PD: %d\n", arg->id, ret);
-       }
+    ret = dbox_open_gbar(arg->pkgname, arg->id);
+    if (ret < 0) {
+       DbgPrint("%s Open PD: %d\n", arg->id, ret);
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
-static int method_pd_destroyed(struct event_arg *arg, void *data)
+static int method_gbar_destroyed(struct dynamicbox_event_arg *arg, void *data)
 {
-       int ret;
+    int ret;
 
-       ret = lb_close_pd(arg->pkgname, arg->id);
-       if (ret < 0) {
-               DbgPrint("%s Close PD: %d\n", arg->id, ret);
-       }
+    ret = dbox_close_gbar(arg->pkgname, arg->id);
+    if (ret < 0) {
+       DbgPrint("%s Close PD: %d\n", arg->id, ret);
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
-static int method_pd_moved(struct event_arg *arg, void *data)
+static int method_gbar_moved(struct dynamicbox_event_arg *arg, void *data)
 {
-       int ret;
-       struct event_info info;
+    int ret;
+    struct dynamicbox_event_info info;
 
-       memset(&info, 0, sizeof(info));
-       info.pointer.x = arg->info.pd_move.x;
-       info.pointer.y = arg->info.pd_move.y;
-       info.pointer.down = 0;
+    memset(&info, 0, sizeof(info));
+    info.pointer.x = arg->info.gbar_move.x;
+    info.pointer.y = arg->info.gbar_move.y;
+    info.pointer.down = 0;
 
-       ret = lb_script_event(arg->pkgname, arg->id,
-                               "pd,move", util_uri_to_path(arg->id), &info);
-       return ret;
+    ret = dbox_script_event(arg->pkgname, arg->id,
+           "gbar,move", util_uri_to_path(arg->id), &info);
+    return ret;
 }
 
-static int method_lb_pause(struct event_arg *arg, void *data)
+static int method_dbox_pause(struct dynamicbox_event_arg *arg, void *data)
 {
-       return lb_pause(arg->pkgname, arg->id);
+    int ret;
+
+    ret = dbox_pause(arg->pkgname, arg->id);
+
+    sqlite3_release_memory(DYNAMICBOX_CONF_SQLITE_FLUSH_MAX);
+    elm_cache_all_flush();
+    malloc_trim(0);
+
+    return ret;
 }
 
-static int method_lb_resume(struct event_arg *arg, void *data)
+static int method_dbox_resume(struct dynamicbox_event_arg *arg, void *data)
 {
-       return lb_resume(arg->pkgname, arg->id);
+    return dbox_resume(arg->pkgname, arg->id);
 }
 
 HAPI int client_init(const char *name)
 {
-       struct event_handler table = {
-               .lb_create = method_new,
-               .lb_recreate = method_renew,
-               .lb_destroy = method_delete,
-               .content_event = method_content_event,
-               .clicked = method_clicked,
-               .text_signal = method_text_signal,
-               .resize = method_resize,
-               .set_period = method_set_period,
-               .change_group = method_change_group,
-               .pinup = method_pinup,
-               .update_content = method_update_content,
-               .pause = method_pause,
-               .resume = method_resume,
-               .disconnected = method_disconnected,
-               .connected = method_connected,
-               .pd_create = method_pd_created,
-               .pd_destroy = method_pd_destroyed,
-               .pd_move = method_pd_moved,
-               .lb_pause = method_lb_pause,
-               .lb_resume = method_lb_resume,
-       };
-
-       return provider_init(ecore_x_display_get(), name, &table, NULL);
+    struct dynamicbox_event_table table = {
+       .dbox_create = method_new,
+       .dbox_recreate = method_renew,
+       .dbox_destroy = method_delete,
+       .content_event = method_content_event,
+       .clicked = method_clicked,
+       .text_signal = method_text_signal,
+       .resize = method_resize,
+       .set_period = method_set_period,
+       .change_group = method_change_group,
+       .pinup = method_pinup,
+       .update_content = method_update_content,
+       .pause = method_pause,
+       .resume = method_resume,
+       .disconnected = method_disconnected,
+       .connected = method_connected,
+       .gbar_create = method_gbar_created,
+       .gbar_destroy = method_gbar_destroyed,
+       .gbar_move = method_gbar_moved,
+       .dbox_pause = method_dbox_pause,
+       .dbox_resume = method_dbox_resume,
+    };
+
+    return dynamicbox_provider_init(util_screen_get(), name, &table, NULL, 1, 1);
 }
 
 HAPI int client_fini(void)
 {
-       (void)provider_fini();
-       return LB_STATUS_SUCCESS;
+    (void)dynamicbox_provider_fini();
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 /* End of a file */
diff --git a/src/conf.c b/src/conf.c
deleted file mode 100644 (file)
index 60688f6..0000000
+++ /dev/null
@@ -1,713 +0,0 @@
-/*
- * Copyright 2013  Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <Ecore_X.h>
-#include <ctype.h>
-
-#include <dlog.h>
-#include <Eina.h>
-
-#include <livebox-errno.h>
-
-#include "conf.h"
-#include "util.h"
-#include "debug.h"
-
-struct conf g_conf = {
-       .width = 0,
-       .height = 0,
-
-       .base_width = 720,
-       .base_height = 1280,
-
-       .minimum_period = 1.0f,
-
-       .default_conf.script = "edje",
-       .default_conf.abi = "c",
-       .default_conf.pd_group = "disclosure",
-       .default_conf.period = -1.0f,
-
-       .launch_key.name = "name",
-       .launch_key.secured = "secured",
-       .launch_key.abi = "abi",
-
-       .default_packet_time = 0.0001f,
-
-       .empty_content = "",
-       .empty_title = "",
-
-       .default_content = "default",
-       .default_title = "",
-
-       .minimum_space = 5242880,
-
-       .replace_tag = "/APPID/",
-
-       .slave_ttl = 30.0f,
-       .slave_activate_time = 30.0f,
-       .slave_relaunch_time = 3.0f,
-
-       .max_log_line = 1000,
-       .max_log_file = 3,
-
-       .sqlite_flush_max = 1048576,
-
-       .path = {
-               .image = "/opt/usr/share/live_magazine/",
-               .slave_log = "/opt/usr/share/live_magazine/log",
-               .reader = "/opt/usr/share/live_magazine/reader",
-               .always = "/opt/usr/share/live_magazine/always",
-               .root = "/opt/usr/live/",
-               .script_port = "/opt/usr/live/script_port/",
-               .db = "/opt/dbspace/.livebox.db",
-
-               /*!
-                * This is not loaded from the conf file
-                */
-               .conf = "/opt/usr/live/%s/etc/%s.conf",
-               .script = "/opt/usr/live/%s/res/script/%s.edj",
-               .module = "/opt/usr/live/%s/libexec/liblive-%s.so",
-               .input = "/dev/input/event1",
-       },
-
-       .ping_time = 120.0f,
-       .slave_max_load = 30,
-
-       .use_sw_backend = 0,
-       .provider_method = "pixmap",
-       .debug_mode = 0,
-       .overwrite_content = 0,
-       .com_core_thread = 1,
-       .use_xmonitor = 1,
-       .premultiplied = 1,
-};
-
-HAPI void conf_update_size(void)
-{
-       ecore_x_window_size_get(0, &g_conf.width, &g_conf.height);
-}
-
-static void use_xmonitor(char *buffer)
-{
-       g_conf.use_xmonitor = !strcasecmp(buffer, "true");
-}
-
-static void use_sw_backend_handler(char *buffer)
-{
-       g_conf.use_sw_backend = !strcasecmp(buffer, "true");
-}
-
-static void provider_method_handler(char *buffer)
-{
-       g_conf.provider_method = strdup(buffer);
-       if (!g_conf.provider_method) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void debug_mode_handler(char *buffer)
-{
-       g_conf.debug_mode = !strcasecmp(buffer, "true");
-}
-
-static void overwrite_content_handler(char *buffer)
-{
-       g_conf.overwrite_content = !strcasecmp(buffer, "true");
-}
-
-static void com_core_thread_handler(char *buffer)
-{
-       g_conf.com_core_thread = !strcasecmp(buffer, "true");
-}
-
-static void base_width_handler(char *buffer)
-{
-       if (sscanf(buffer, "%d", &g_conf.base_width) != 1) {
-               ErrPrint("Failed to parse the base_width\n");
-       }
-}
-
-static void base_height_handler(char *buffer)
-{
-       if (sscanf(buffer, "%d", &g_conf.base_height) != 1) {
-               ErrPrint("Failed to parse the base_height\n");
-       }
-}
-
-static void minimum_period_handler(char *buffer)
-{
-       if (sscanf(buffer, "%lf", &g_conf.minimum_period) != 1) {
-               ErrPrint("Failed to parse the minimum_period\n");
-       }
-       DbgPrint("Minimum period: %lf\n", g_conf.minimum_period);
-}
-
-static void script_handler(char *buffer)
-{
-       g_conf.default_conf.script = strdup(buffer);
-       if (!g_conf.default_conf.script) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void default_abi_handler(char *buffer)
-{
-       g_conf.default_conf.abi = strdup(buffer);
-       if (!g_conf.default_conf.abi) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void default_group_handler(char *buffer)
-{
-       g_conf.default_conf.pd_group = strdup(buffer);
-       if (!g_conf.default_conf.pd_group) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void default_period_handler(char *buffer)
-{
-       if (sscanf(buffer, "%lf", &g_conf.default_conf.period) != 1) {
-               ErrPrint("Failed to parse the default_period\n");
-       }
-       DbgPrint("Default Period: %lf\n", g_conf.default_conf.period);
-}
-
-static void default_packet_time_handler(char *buffer)
-{
-       if (sscanf(buffer, "%lf", &g_conf.default_packet_time) != 1) {
-               ErrPrint("Failed to parse the default_packet_time\n");
-       }
-       DbgPrint("Default packet time: %lf\n", g_conf.default_packet_time);
-}
-
-static void default_content_handler(char *buffer)
-{
-       g_conf.default_content = strdup(buffer);
-       if (!g_conf.default_content) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void default_title_handler(char *buffer)
-{
-       g_conf.default_title = strdup(buffer);
-       if (!g_conf.default_title) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void minimum_space_handler(char *buffer)
-{
-       if (sscanf(buffer, "%lu", &g_conf.minimum_space) != 1) {
-               ErrPrint("Failed to parse the minimum_space\n");
-       }
-}
-
-static void replace_tag_handler(char *buffer)
-{
-       g_conf.replace_tag = strdup(buffer);
-       if (!g_conf.replace_tag) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void slave_ttl_handler(char *buffer)
-{
-       if (sscanf(buffer, "%lf", &g_conf.slave_ttl) != 1) {
-               ErrPrint("Failed to parse the slave_ttl\n");
-       }
-       DbgPrint("Slave TTL: %lf\n", g_conf.slave_ttl);
-}
-
-static void slave_activate_time_handler(char *buffer)
-{
-       if (sscanf(buffer, "%lf", &g_conf.slave_activate_time) != 1) {
-               ErrPrint("Failed to parse the slave_activate_time\n");
-       }
-       DbgPrint("Slave activate time: %lf\n", g_conf.slave_activate_time);
-}
-
-static void slave_relaunch_time_handler(char *buffer)
-{
-       if (sscanf(buffer, "%lf", &g_conf.slave_relaunch_time) != 1) {
-               ErrPrint("Failed to parse the slave_relaunch_time\n");
-       }
-       DbgPrint("Slave relaunch time: %lf\n", g_conf.slave_relaunch_time);
-}
-
-static void slave_relaunch_count_handler(char *buffer)
-{
-       if (sscanf(buffer, "%d", &g_conf.slave_relaunch_count) != 1) {
-               ErrPrint("Failed to parse the relaunch count\n");
-       }
-}
-
-static void max_log_line_handler(char *buffer)
-{
-       if (sscanf(buffer, "%d", &g_conf.max_log_line) != 1) {
-               ErrPrint("Failed to parse the max_log_line\n");
-       }
-}
-
-static void max_log_file_handler(char *buffer)
-{
-       if (sscanf(buffer, "%d", &g_conf.max_log_file) != 1) {
-               ErrPrint("Failed to parse the max_log_file\n");
-       }
-}
-
-static void sqlite_flush_max_handler(char *buffer)
-{
-       if (sscanf(buffer, "%lu", &g_conf.sqlite_flush_max) != 1) {
-               ErrPrint("Failed to parse the sqlite_flush_max\n");
-       }
-}
-
-static void db_path_handler(char *buffer)
-{
-       g_conf.path.db = strdup(buffer);
-       if (!g_conf.path.db) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void reader_path_handler(char *buffer)
-{
-       g_conf.path.reader = strdup(buffer);
-       if (!g_conf.path.reader) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void always_path_handler(char *buffer)
-{
-       g_conf.path.always = strdup(buffer);
-       if (!g_conf.path.always) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void log_path_handler(char *buffer)
-{
-       g_conf.path.slave_log = strdup(buffer);
-       if (!g_conf.path.slave_log) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void script_port_path_handler(char *buffer)
-{
-       g_conf.path.script_port = strdup(buffer);
-       if (!g_conf.path.script_port) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void share_path_handler(char *buffer)
-{
-       g_conf.path.image = strdup(buffer);
-       if (!g_conf.path.image) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void input_path_handler(char *buffer)
-{
-       g_conf.path.input = strdup(buffer);
-       if (!g_conf.path.input) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void ping_time_handler(char *buffer)
-{
-       if (sscanf(buffer, "%lf", &g_conf.ping_time) != 1) {
-               ErrPrint("Failed to parse the ping_time\n");
-       }
-       g_conf.ping_time /= 2.0f; /*!< Half */
-       DbgPrint("Default ping time: %lf\n", g_conf.ping_time);
-}
-
-static void slave_max_loader(char *buffer)
-{
-       if (sscanf(buffer, "%d", &g_conf.slave_max_load) != 1) {
-               ErrPrint("Failed to parse the slave_max_load\n");
-       }
-}
-
-static void premultiplied_handler(char *buffer)
-{
-       if (sscanf(buffer, "%d", &g_conf.premultiplied) != 1) {
-               ErrPrint("Failed to parse the premultiplied color\n");
-       }
-
-       DbgPrint("Premultiplied: %d\n", g_conf.premultiplied);
-}
-
-HAPI int conf_loader(void)
-{
-       FILE *fp;
-       int c;
-       enum state {
-               START,
-               SPACE,
-               TOKEN,
-               VALUE,
-               ERROR,
-               COMMENT,
-               END
-       } state;
-       int ch_idx;
-       int token_idx;
-       int buffer_idx;
-       int quote;
-       int linelen;
-       char buffer[256];
-       static const struct token_parser {
-               const char *name;
-               void (*handler)(char *buffer);
-       } token_handler[] = {
-               {
-                       .name = "base_width",
-                       .handler = base_width_handler,
-               },
-               {
-                       .name = "base_height",
-                       .handler = base_height_handler,
-               },
-               {
-                       .name = "minimum_period",
-                       .handler = minimum_period_handler,
-               },
-               {
-                       .name = "script",
-                       .handler = script_handler,
-               },
-               {
-                       .name = "default_abi",
-                       .handler = default_abi_handler,
-               },
-               {
-                       .name = "default_group",
-                       .handler = default_group_handler,
-               },
-               {
-                       .name = "default_period",
-                       .handler = default_period_handler,
-               },
-               {
-                       .name = "default_packet_time",
-                       .handler = default_packet_time_handler,
-               },
-               {
-                       .name = "default_content",
-                       .handler = default_content_handler,
-               },
-               {
-                       .name = "default_title",
-                       .handler = default_title_handler,
-               },
-               {
-                       .name = "minimum_space",
-                       .handler = minimum_space_handler,
-               },
-               {
-                       .name = "replace_tag",
-                       .handler = replace_tag_handler,
-               },
-               {
-                       .name = "slave_ttl",
-                       .handler = slave_ttl_handler,
-               },
-               {
-                       .name = "slave_activate_time",
-                       .handler = slave_activate_time_handler,
-               },
-               {
-                       .name = "slave_relaunch_time",
-                       .handler = slave_relaunch_time_handler,
-               },
-               {
-                       .name = "slave_relaunch_count",
-                       .handler = slave_relaunch_count_handler,
-               },
-               {
-                       .name = "max_log_line",
-                       .handler = max_log_line_handler,
-               },
-               {
-                       .name = "max_log_file",
-                       .handler = max_log_file_handler,
-               },
-               {
-                       .name = "sqilte_flush_max",
-                       .handler = sqlite_flush_max_handler,
-               },
-               {
-                       .name = "db_path",
-                       .handler = db_path_handler,
-               },
-               {
-                       .name = "log_path",
-                       .handler = log_path_handler,
-               },
-               {
-                       .name = "reader_path",
-                       .handler = reader_path_handler,
-               },
-               {
-                       .name = "always_path",
-                       .handler = always_path_handler,
-               },
-               {
-                       .name = "share_path",
-                       .handler = share_path_handler,
-               },
-               {
-                       .name = "script_port_path",
-                       .handler = script_port_path_handler,
-               },
-               {
-                       .name = "ping_interval",
-                       .handler = ping_time_handler,
-               },
-               {
-                       .name = "slave_max_load",
-                       .handler = slave_max_loader,
-               },
-               {
-                       .name = "use_sw_backend",
-                       .handler = use_sw_backend_handler,
-               },
-               {
-                       .name = "use_xmonitor",
-                       .handler = use_xmonitor,
-               },
-               {
-                       .name = "provider_method",
-                       .handler = provider_method_handler,
-               },
-               {
-                       .name = "debug_mode",
-                       .handler = debug_mode_handler,
-               },
-               {
-                       .name = "overwrite_content",
-                       .handler = overwrite_content_handler,
-               },
-               {
-                       .name = "com_core_thread",
-                       .handler = com_core_thread_handler,
-               },
-               {
-                       .name = "input",
-                       .handler = input_path_handler,
-               },
-               {
-                       .name = "premultiplied",
-                       .handler = premultiplied_handler,
-               },
-               {
-                       .name = NULL,
-                       .handler = NULL,
-               },
-       };
-
-       fp = fopen(CONF_FILE, "rt");
-       if (!fp) {
-               ErrPrint("Error: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_IO;
-       }
-
-       state = START;
-       ch_idx = 0;
-       token_idx = -1;
-       buffer_idx = 0;
-       quote = 0;
-       linelen = 0;
-       do {
-               c = getc(fp);
-               if ((c == EOF) && (state == VALUE)) {
-                       DbgPrint("[%s:%d] VALUE state EOF\n", __func__, __LINE__);
-                       state = END;
-               }
-
-               switch (state) {
-               case COMMENT:
-                       if (c == CR || c == LF || c == EOF) {
-                               buffer[buffer_idx] = '\0';
-
-                               state = START;
-                               token_idx = -1;
-                               ch_idx = 0;
-                               buffer_idx = 0;
-                               linelen = -1; /* Will be ZERO by follwing increment code */
-                               quote = 0;
-                       } else {
-                               buffer[buffer_idx++] = c;
-                               if (buffer_idx == (sizeof(buffer) - 1)) {
-                                       buffer[buffer_idx] = '\0';
-                                       buffer_idx = 0;
-                               }
-                       }
-                       break;
-               case START:
-                       if (linelen == 0 && c == '#') {
-                               state = COMMENT;
-                       } else if (isspace(c)) {
-                               /* Ignore empty space */
-                       } else {
-                               state = TOKEN;
-                               if (ungetc(c, fp) != c) {
-                                       ErrPrint("ungetc: %s\n", strerror(errno));
-                               }
-                       }
-                       break;
-               case SPACE:
-                       if (c == '=') {
-                               state = VALUE;
-                       } else if (!isspace(c)) {
-                               state = ERROR;
-                       }
-                       break;
-               case VALUE:
-                       if (c == '"') {
-                               if (quote == 1) {
-                                       buffer[buffer_idx] = '\0';
-                                       state = END;
-                               } else if (buffer_idx != 0) {
-                                       buffer[buffer_idx++] = c;
-                                       if (buffer_idx >= sizeof(buffer)) {
-                                               state = ERROR;
-                                       }
-                               } else {
-                                       quote = 1;
-                               }
-                       } else if (isspace(c)) {
-                               if (buffer_idx == 0) {
-                                       /* Ignore */
-                               } else if (quote == 1) {
-                                       buffer[buffer_idx++] = c;
-                                       if (buffer_idx >= sizeof(buffer)) {
-                                               state = ERROR;
-                                       }
-                               } else {
-                                       buffer[buffer_idx] = '\0';
-                                       if (ungetc(c, fp) != c) {
-                                               ErrPrint("ungetc: %s\n", strerror(errno));
-                                       }
-                                       state = END;
-                               }
-                       } else {
-                               buffer[buffer_idx++] = c;
-                               if (buffer_idx >= sizeof(buffer)) {
-                                       state = ERROR;
-                               }
-                       }
-                       break;
-               case TOKEN:
-                       if (c == '=') {
-                               if (token_idx < 0) {
-                                       state = ERROR;
-                               } else {
-                                       state = VALUE;
-                               }
-                       } else if (isspace(c)) {
-                               if (token_idx < 0) {
-                                       break;
-                               }
-
-                               if (token_handler[token_idx].name[ch_idx] != '\0') {
-                                       state = ERROR;
-                               } else {
-                                       state = SPACE;
-                               }
-                       } else  {
-                               if (token_idx < 0) {
-                                       /* Now start to find a token! */
-                                       token_idx = 0;
-                               }
-
-                               if (token_handler[token_idx].name[ch_idx] == c) {
-                                       ch_idx++;
-                               } else {
-                                       if (ungetc(c, fp) != c) {
-                                               ErrPrint("ungetc: %s\n", strerror(errno));
-                                       }
-                                       while (ch_idx-- > 0) {
-                                               if (ungetc(token_handler[token_idx].name[ch_idx], fp) != token_handler[token_idx].name[ch_idx]) {
-                                                       ErrPrint("ungetc: %s\n", strerror(errno));
-                                               }
-                                       }
-
-                                       token_idx++;
-
-                                       if (token_handler[token_idx].name == NULL) {
-                                               state = ERROR;
-                                       } else {
-                                               ch_idx = 0;
-                                       }
-                               }
-                       }
-                       break;
-               case ERROR:
-                       if (c == CR || c == LF || c == EOF) {
-                               state = START;
-                               token_idx = -1;
-                               buffer_idx = 0;
-                               ch_idx = 0;
-                               linelen = -1;
-                               quote = 0;
-                       }
-                       break;
-               case END:
-                       if (c == LF || c == CR || c == EOF) {
-                               state = START;
-
-                               if (token_idx >= 0 && token_handler[token_idx].handler) {
-                                       buffer[buffer_idx] = '\0';
-                                       token_handler[token_idx].handler(buffer);
-                               }
-
-                               token_idx = -1;
-                               ch_idx = 0;
-                               buffer_idx = 0;
-                               linelen = -1;
-                               quote = 0;
-                               /* Finish */
-                       } else if (isspace(c)) {
-                               /* ignore */
-                       } else {
-                               state = ERROR;
-                       }
-                       break;
-               default:
-                       /* ?? */
-                       break;
-               }
-
-               linelen++;
-        } while (c != EOF);
-
-       if (fclose(fp) != 0) {
-               ErrPrint("fclose: %s\n", strerror(errno));
-       }
-       return LB_STATUS_SUCCESS;
-}
-
-/* End of a file */
diff --git a/src/connection.c b/src/connection.c
new file mode 100644 (file)
index 0000000..af981c8
--- /dev/null
@@ -0,0 +1,296 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#include <Eina.h>
+
+#include <com-core.h>
+#include <packet.h>
+#include <secure_socket.h>
+#include <com-core_packet.h>
+#include <dynamicbox_errno.h>
+
+#include <dlog.h>
+
+#include "debug.h"
+#include "connection.h"
+
+static struct info {
+    Eina_List *connection_list;
+    Eina_List *connected_list;
+    Eina_List *disconnected_list;
+
+    enum {
+       IDLE = 0x00,
+       DISCONNECTION = 0x01,
+       CONNECTION = 0x02,
+    } process;
+} s_info = {
+    .connection_list = NULL,
+    .connected_list = NULL,
+    .disconnected_list = NULL,
+    .process = IDLE,
+};
+
+int errno;
+
+struct event_item {
+    int (*event_cb)(int handle, void *data);
+    void *data;
+    int deleted;
+};
+
+struct connection {
+    char *addr;
+    int fd;
+    int refcnt;
+};
+
+/**
+ * When we get this connected callback,
+ * The connection handle is not prepared yet.
+ * So it is not possible to find a connection handle using socket fd.
+ * In this case, just propagate this event to upper layer.
+ * Make them handles this.
+ */
+static int connected_cb(int handle, void *data)
+{
+    Eina_List *l;
+    Eina_List *n;
+    struct event_item *item;
+
+    EINA_LIST_FOREACH_SAFE(s_info.connected_list, l, n, item) {
+       s_info.process = DISCONNECTION;
+       if (item->deleted || item->event_cb(handle, item->data) < 0 || item->deleted) {
+           s_info.connected_list = eina_list_remove(s_info.connected_list, item);
+           free(item);
+       }
+       s_info.process = IDLE;
+    }
+
+    return 0;
+}
+
+static int disconnected_cb(int handle, void *data)
+{
+    Eina_List *l;
+    Eina_List *n;
+    struct event_item *item;
+
+    EINA_LIST_FOREACH_SAFE(s_info.disconnected_list, l, n, item) {
+       s_info.process = DISCONNECTION;
+       if (item->deleted || item->event_cb(handle, item->data) < 0 || item->deleted) {
+           s_info.disconnected_list = eina_list_remove(s_info.disconnected_list, item);
+           free(item);
+       }
+       s_info.process = IDLE;
+    }
+
+    return 0;
+}
+
+int connection_init(void)
+{
+    if (com_core_add_event_callback(CONNECTOR_DISCONNECTED, disconnected_cb, NULL) < 0) {
+       ErrPrint("Unable to register the disconnected callback\n");
+    }
+
+    if (com_core_add_event_callback(CONNECTOR_CONNECTED, connected_cb, NULL) < 0) {
+       ErrPrint("Unable to register the disconnected callback\n");
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+int connection_fini(void)
+{
+    (void)com_core_del_event_callback(CONNECTOR_DISCONNECTED, disconnected_cb, NULL);
+    (void)com_core_del_event_callback(CONNECTOR_CONNECTED, connected_cb, NULL);
+
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+struct connection *connection_create(const char *addr, void *table)
+{
+    struct connection *handle;
+
+    handle = calloc(1, sizeof(*handle));
+    if (!handle) {
+       ErrPrint("calloc: %s\n", strerror(errno));
+       return NULL;
+    }
+
+    handle->addr = strdup(addr);
+    if (!handle->addr) {
+       ErrPrint("strdup: %s (%s)\n", strerror(errno), addr);
+       free(handle);
+       return NULL;
+    }
+
+    handle->fd = com_core_packet_client_init(handle->addr, 0, table);
+    if (handle->fd < 0) {
+       ErrPrint("Unable to make a connection %s\n", handle->addr);
+       free(handle->addr);
+       free(handle);
+       return NULL;
+    }
+
+    handle->refcnt = 1;
+
+    s_info.connection_list = eina_list_append(s_info.connection_list, handle);
+    return handle;
+}
+
+struct connection *connection_ref(struct connection *handle)
+{
+    if (!handle) {
+       return NULL;
+    }
+
+    handle->refcnt++;
+    return handle;
+}
+
+struct connection *connection_unref(struct connection *handle)
+{
+    if (!handle) {
+       return NULL;
+    }
+
+    handle->refcnt--;
+    if (handle->refcnt > 0) {
+       return handle;
+    }
+
+    s_info.connection_list = eina_list_remove(s_info.connection_list, handle);
+
+    if (handle->fd >= 0) {
+       com_core_packet_client_fini(handle->fd);
+    }
+
+    free(handle->addr);
+    free(handle);
+    return NULL;
+}
+
+struct connection *connection_find_by_addr(const char *addr)
+{
+    Eina_List *l;
+    struct connection *handle;
+
+    if (!addr) {
+       return NULL;
+    }
+
+    EINA_LIST_FOREACH(s_info.connection_list, l, handle) {
+       if (handle->addr && !strcmp(handle->addr, addr)) {
+           return handle;
+       }
+    }
+
+    return NULL;
+}
+
+struct connection *connection_find_by_fd(int fd)
+{
+    Eina_List *l;
+    struct connection *handle;
+
+    if (fd < 0) {
+       return NULL;
+    }
+
+    EINA_LIST_FOREACH(s_info.connection_list, l, handle) {
+       if (handle->fd == fd) {
+           return handle;
+       }
+    }
+
+    return NULL;
+}
+
+int connection_add_event_handler(enum connection_event_type type, int (*event_cb)(int handle, void *data), void *data)
+{
+    struct event_item *item;
+
+    item = malloc(sizeof(*item));
+    if (!item) {
+       ErrPrint("malloc: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    item->event_cb = event_cb;
+    item->data = data;
+
+    switch (type) {
+       case CONNECTION_EVENT_TYPE_CONNECTED:
+           s_info.connected_list = eina_list_append(s_info.connected_list, item);
+           break;
+       case CONNECTION_EVENT_TYPE_DISCONNECTED:
+           s_info.disconnected_list = eina_list_append(s_info.disconnected_list, item);
+           break;
+       default:
+           free(item);
+           return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+void *connection_del_event_handler(enum connection_event_type type, int (*event_cb)(int handle, void *data))
+{
+    Eina_List *l;
+    Eina_List *n;
+    struct event_item *item;
+    void *ret = NULL;
+
+    switch (type) {
+       case CONNECTION_EVENT_TYPE_CONNECTED:
+           EINA_LIST_FOREACH_SAFE(s_info.connected_list, l, n, item) {
+               if (item->event_cb == event_cb) {
+                   if (s_info.process == CONNECTION) {
+                       item->deleted = 1;
+                       ret = item->data;
+                   } else {
+                       s_info.connected_list = eina_list_remove(s_info.connected_list, item);
+                       ret = item->data;
+                       free(item);
+                   }
+                   break;
+               }
+           }
+           break;
+       case CONNECTION_EVENT_TYPE_DISCONNECTED:
+           EINA_LIST_FOREACH_SAFE(s_info.disconnected_list, l, n, item) {
+               if (item->event_cb == event_cb) {
+                   if (s_info.process == DISCONNECTION) {
+                       item->deleted = 1;
+                       ret = item->data;
+                   } else {
+                       s_info.disconnected_list = eina_list_remove(s_info.disconnected_list, item);
+                       ret = item->data;
+                       free(item);
+                   }
+                   break;
+               }
+           }
+           break;
+       default:
+           break;
+    }
+
+    return ret;
+}
+
+int connection_handle(struct connection *connection)
+{
+    return connection->fd;
+}
+
+const char *connection_addr(struct connection *connection)
+{
+    return connection->addr;
+}
+
+/* End of a file */
index cf5a94e..991029d 100644 (file)
 
 #include <dlog.h>
 #include <Eina.h>
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
+#include <dynamicbox_conf.h>
 
 #include "util.h"
-#include "conf.h"
 #include "critical_log.h"
 #include "debug.h"
+#include "conf.h"
 
 static struct {
-       FILE *fp;
-       int file_id;
-       int nr_of_lines;
-       char *filename;
+    FILE *fp;
+    int file_id;
+    int nr_of_lines;
+    char *filename;
 } s_info = {
-       .fp = NULL,
-       .file_id = 0,
-       .nr_of_lines = 0,
-       .filename = NULL,
+    .fp = NULL,
+    .file_id = 0,
+    .nr_of_lines = 0,
+    .filename = NULL,
 };
 
 
 
 static inline void rotate_log(void)
 {
-       char *filename;
-       int namelen;
-
-       if (s_info.nr_of_lines < MAX_LOG_LINE) {
-               return;
-       }
+    char *filename;
+    int namelen;
 
-       s_info.file_id = (s_info.file_id + 1) % MAX_LOG_FILE;
+    if (s_info.nr_of_lines < DYNAMICBOX_CONF_MAX_LOG_LINE) {
+       return;
+    }
 
-       namelen = strlen(s_info.filename) + strlen(SLAVE_LOG_PATH) + 30;
-       filename = malloc(namelen);
-       if (filename) {
-               snprintf(filename, namelen, "%s/%d_%s.%d", SLAVE_LOG_PATH, s_info.file_id, s_info.filename, getpid());
+    s_info.file_id = (s_info.file_id + 1) % DYNAMICBOX_CONF_MAX_LOG_FILE;
 
-               if (s_info.fp) {
-                       if (fclose(s_info.fp) != 0) {
-                               ErrPrint("fclose: %s\n", strerror(errno));
-                       }
-               }
+    namelen = strlen(s_info.filename) + strlen(DYNAMICBOX_CONF_LOG_PATH) + 30;
+    filename = malloc(namelen);
+    if (filename) {
+       snprintf(filename, namelen, "%s/%d_%s.%d", DYNAMICBOX_CONF_LOG_PATH, s_info.file_id, s_info.filename, getpid());
 
-               s_info.fp = fopen(filename, "w+");
-               if (!s_info.fp) {
-                       ErrPrint("Failed to open a file: %s\n", filename);
-               }
+       if (s_info.fp) {
+           if (fclose(s_info.fp) != 0) {
+               ErrPrint("fclose: %s\n", strerror(errno));
+           }
+       }
 
-               DbgFree(filename);
+       s_info.fp = fopen(filename, "w+");
+       if (!s_info.fp) {
+           ErrPrint("Failed to open a file: %s\n", filename);
        }
 
-       s_info.nr_of_lines = 0;
+       DbgFree(filename);
+    }
+
+    s_info.nr_of_lines = 0;
 }
 
 
 
 HAPI int critical_log(const char *func, int line, const char *fmt, ...)
 {
-       va_list ap;
-       int ret;
+    va_list ap;
+    int ret;
 
-       if (!s_info.fp) {
-               return LB_STATUS_ERROR_IO;
-       }
+    if (!s_info.fp) {
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
 
-       fprintf(s_info.fp, "%lf [%s:%d] ", util_timestamp(), util_basename((char *)func), line);
+    fprintf(s_info.fp, "%lf [%s:%d] ", util_timestamp(), util_basename((char *)func), line);
 
-       va_start(ap, fmt);
-       ret = vfprintf(s_info.fp, fmt, ap);
-       va_end(ap);
+    va_start(ap, fmt);
+    ret = vfprintf(s_info.fp, fmt, ap);
+    va_end(ap);
 
-       if (fflush(s_info.fp) != 0) {
-               ErrPrint("fflush: %s\n", strerror(errno));
-       }
+    if (fflush(s_info.fp) != 0) {
+       ErrPrint("fflush: %s\n", strerror(errno));
+    }
 
-       s_info.nr_of_lines++;
-       rotate_log();
-       return ret;
+    s_info.nr_of_lines++;
+    rotate_log();
+    return ret;
 }
 
 
 
 HAPI int critical_log_init(const char *name)
 {
-       int namelen;
-       char *filename;
-
-       if (s_info.fp) {
-               return LB_STATUS_SUCCESS;
-       }
-
-       s_info.filename = strdup(name);
-       if (!s_info.filename) {
-               ErrPrint("Failed to create a log file\n");
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       namelen = strlen(name) + strlen(SLAVE_LOG_PATH) + 30;
-
-       filename = malloc(namelen);
-       if (!filename) {
-               ErrPrint("Failed to create a log file\n");
-               free(s_info.filename);
-               s_info.filename = NULL;
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       snprintf(filename, namelen, "%s/%d_%s.%d", SLAVE_LOG_PATH, s_info.file_id, name, getpid());
-
-       s_info.fp = fopen(filename, "w+");
-       if (!s_info.fp) {
-               ErrPrint("Failed to open log: %s\n", strerror(errno));
-               free(s_info.filename);
-               s_info.filename = NULL;
-               free(filename);
-               return LB_STATUS_ERROR_IO;
-       }
-
+    int namelen;
+    char *filename;
+
+    if (s_info.fp) {
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    s_info.filename = strdup(name);
+    if (!s_info.filename) {
+       ErrPrint("Failed to create a log file\n");
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    namelen = strlen(name) + strlen(DYNAMICBOX_CONF_LOG_PATH) + 30;
+
+    filename = malloc(namelen);
+    if (!filename) {
+       ErrPrint("Failed to create a log file\n");
+       free(s_info.filename);
+       s_info.filename = NULL;
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    snprintf(filename, namelen, "%s/%d_%s.%d", DYNAMICBOX_CONF_LOG_PATH, s_info.file_id, name, getpid());
+
+    s_info.fp = fopen(filename, "w+");
+    if (!s_info.fp) {
+       ErrPrint("Failed to open log: %s\n", strerror(errno));
+       free(s_info.filename);
+       s_info.filename = NULL;
        free(filename);
-       return LB_STATUS_SUCCESS;
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
+
+    free(filename);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 
 
 HAPI int critical_log_fini(void)
 {
-       if (s_info.filename) {
-               free(s_info.filename);
-               s_info.filename = NULL;
-       }
-
-       if (s_info.fp) {
-               if (fclose(s_info.fp) != 0) {
-                       ErrPrint("fclose: %s\n", strerror(errno));
-               }
-               s_info.fp = NULL;
+    if (s_info.filename) {
+       free(s_info.filename);
+       s_info.filename = NULL;
+    }
+
+    if (s_info.fp) {
+       if (fclose(s_info.fp) != 0) {
+           ErrPrint("fclose: %s\n", strerror(errno));
        }
+       s_info.fp = NULL;
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 
diff --git a/src/dbox.c b/src/dbox.c
new file mode 100644 (file)
index 0000000..e5c691f
--- /dev/null
@@ -0,0 +1,2531 @@
+/*
+ * Copyright 2013  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h> /* exit */
+#include <errno.h>
+#include <unistd.h> /* access */
+
+#include <Ecore.h>
+#include <Eina.h>
+
+#include <dlog.h>
+#include <dynamicbox_provider.h>
+#include <dynamicbox_provider_buffer.h>
+#include <dynamicbox.h>
+#include <dynamicbox_errno.h>
+#include <dynamicbox_service.h>
+#include <com-core_packet.h>
+
+#include "critical_log.h"
+#include "debug.h"
+#include "so_handler.h"
+#include "dbox.h"
+#include "update_monitor.h"
+#include "fault.h"
+#include "util.h"
+#include "connection.h"
+#include "conf.h"
+
+#if defined(_ESTIMATE_PERF)
+#define ESTIMATE_START(id)     DbgPrint("%s START\n", id);
+#define ESTIMATE_END(id)       DbgPrint("%s END\n", id);
+#else
+#define ESTIMATE_START(id)
+#define ESTIMATE_END(id)
+#endif
+
+#define IS_DBOX_SHOWN(itm) (!(itm)->inst->item->has_dynamicbox_script || ((itm)->inst->item->has_dynamicbox_script && (itm)->is_dbox_show))
+
+int errno;
+
+#define UPDATE_ITEM_DELETED    (-1)
+#define UPDATE_INVOKED         (-2)
+#define UPDATE_NOT_INVOKED     (0)
+
+enum gbar_open_state {
+    GBAR_IS_OPENED_BUT_NOT_MINE = -1,
+    GBAR_IS_NOT_OPENED = 0,
+    GBAR_IS_OPENED = 1,
+};
+
+struct item {
+    Ecore_Timer *timer;
+    struct instance *inst;
+    int monitor_cnt;
+    Ecore_Timer *monitor;
+    int deleteme;
+    double update_interval;
+    int heavy_updating; /* Only for debugging message */
+    int is_paused; /* 1 is paused, 0 is resumed */
+    double sleep_at;
+
+    unsigned int updated_in_pause;
+
+    int is_dbox_show;
+    int is_gbar_show;
+    int is_dbox_updated;
+    int unload_so;
+    struct connection *direct_path;
+};
+
+static struct info {
+    Eina_List *item_list;
+    Eina_List *force_update_list;
+    Eina_List *update_list;
+    Eina_List *pending_list;
+    Eina_List *hidden_list;
+    Ecore_Timer *force_update_timer;
+    Ecore_Timer *pending_timer;
+    Eina_List *gbar_open_pending_list;
+    Ecore_Timer *gbar_open_pending_timer;
+    int paused;
+    Eina_List *gbar_list;
+    int secured;
+    int pending_timer_freezed;
+    int force_timer_freezed;
+} s_info  = {
+    .item_list = NULL,
+    .force_update_list = NULL,
+    .update_list = NULL,
+    .pending_list = NULL,
+    .hidden_list = NULL,
+    .force_update_timer = NULL,
+    .pending_timer = NULL,
+    .gbar_open_pending_list = NULL,
+    .gbar_open_pending_timer = NULL,
+    .paused = 0,
+    .gbar_list = NULL,
+    .secured = 0,
+    .pending_timer_freezed = 0,
+    .force_timer_freezed = 0,
+};
+
+static Eina_Bool updator_cb(void *data);
+static inline void update_monitor_del(const char *id, struct item *item);
+static int append_force_update_list(struct item *item);
+static void reset_dbox_updated_flag(struct item *item);
+static int append_pending_list(struct item *item);
+
+static void pending_timer_freeze(void)
+{
+    DbgPrint("Freezed Count: %d\n", s_info.pending_timer_freezed);
+    if (!s_info.pending_timer) {
+       return;
+    }
+
+    if (!s_info.pending_timer_freezed) {
+       DbgPrint("Freeze the pending timer\n");
+       ecore_timer_freeze(s_info.pending_timer);
+    }
+
+    s_info.pending_timer_freezed++;
+}
+
+static void pending_timer_thaw(void)
+{
+    DbgPrint("Freezed Count: %d\n", s_info.pending_timer_freezed);
+    if (!s_info.pending_timer_freezed) {
+       return;
+    }
+
+    if (!s_info.pending_timer) {
+       s_info.pending_timer_freezed = 0;
+       return;
+    }
+
+    s_info.pending_timer_freezed--;
+    if (!s_info.pending_timer_freezed) {
+       DbgPrint("Thaw the pending timer\n");
+       ecore_timer_thaw(s_info.pending_timer);
+    }
+}
+
+static void force_timer_freeze(void)
+{
+    DbgPrint("Freeze force timer: %d\n", s_info.force_timer_freezed);
+    if (!s_info.force_update_timer) {
+       return;
+    }
+
+    if (!s_info.force_timer_freezed) {
+       DbgPrint("Force timer freezed\n");
+       ecore_timer_freeze(s_info.force_update_timer);
+    }
+
+    s_info.force_timer_freezed++;
+}
+
+static void force_timer_thaw(void)
+{
+    DbgPrint("Freezed force count: %d\n", s_info.force_timer_freezed);
+    if (!s_info.force_timer_freezed) {
+       return;
+    }
+
+    if (!s_info.force_update_timer) {
+       s_info.force_timer_freezed = 0;
+       return;
+    }
+
+    s_info.force_timer_freezed--;
+    if (!s_info.force_timer_freezed) {
+       DbgPrint("Thaw the force timer\n");
+       ecore_timer_thaw(s_info.force_update_timer);
+    }
+}
+
+/*
+ * -1 : GBAR is opened, but not mine
+ *  0 : GBAR is not opened
+ *  1 : my GBAR is opened
+ */
+static inline enum gbar_open_state gbar_is_opened(const char *pkgname)
+{
+    int i;
+    Eina_List *l;
+    struct instance *inst;
+
+    i = 0;
+    EINA_LIST_FOREACH(s_info.gbar_list, l, inst) {
+       if (pkgname && !strcmp(pkgname, inst->item->pkgname)) {
+           return GBAR_IS_OPENED;
+       }
+
+       i++;
+    }
+
+    return i > 0 ? GBAR_IS_OPENED_BUT_NOT_MINE : GBAR_IS_NOT_OPENED;
+}
+
+static Eina_Bool gbar_open_pended_cmd_consumer_cb(void *data)
+{
+    struct item *item;
+
+    item = eina_list_nth(s_info.gbar_open_pending_list, 0);
+    if (!item) {
+       goto cleanout;
+    }
+
+    if (eina_list_data_find(s_info.update_list, item)) {
+       return ECORE_CALLBACK_RENEW;
+    }
+
+    s_info.gbar_open_pending_list = eina_list_remove(s_info.gbar_open_pending_list, item);
+    /*!
+     * \note
+     * To prevent from checking the is_updated function
+     */
+    if (updator_cb(item) == ECORE_CALLBACK_CANCEL) {
+       /* Item is destroyed */
+    }
+
+    if (s_info.gbar_open_pending_list) {
+       return ECORE_CALLBACK_RENEW;
+    }
+
+cleanout:
+    s_info.gbar_open_pending_timer = NULL;
+    return ECORE_CALLBACK_CANCEL;
+}
+
+static Eina_Bool update_timeout_cb(void *data)
+{
+    struct item *item;
+
+    item = data;
+
+    ErrPrint("UPDATE TIMEOUT ========> %s - %s\n", item->inst->item->pkgname, item->inst->id);
+
+    if (!eina_list_data_find(s_info.update_list, item)) {
+       ErrPrint("Updating item is not matched\n");
+    }
+
+    fault_unmark_call(item->inst->item->pkgname, item->inst->id, "update,crashed", NO_ALARM);
+    fault_mark_call(item->inst->item->pkgname, item->inst->id, "update,timeout", NO_ALARM, DEFAULT_LIFE_TIMER);
+    s_info.update_list = eina_list_remove(s_info.update_list, item);
+
+    exit(ETIME);
+    return ECORE_CALLBACK_CANCEL;
+}
+
+static inline void update_monitor_cnt(struct item *item)
+{
+    double now;
+    double interval;
+
+    now = util_timestamp();
+    interval = now - item->update_interval;
+
+    /*!
+     * \note
+     * If the content update is processed in too short time,
+     * don't increase the monitor counter, instead of it
+     * set the heavy updating flag.
+     * And handling this heavy updating from the
+     * file update callback.
+     */
+    if (interval >= MINIMUM_UPDATE_INTERVAL) {
+       if (eina_list_data_find(s_info.update_list, item)) {
+           /*!
+            * \note
+            * If already in updating mode,
+            * reset the monitor_cnt to 1,
+            * all updated event will be merged into A inotify event
+            */
+           DbgPrint("While waiting updated event, content is updated [%s]\n", item->inst->id);
+           item->monitor_cnt = 1;
+       } else {
+           item->monitor_cnt++;
+       }
+    } else {
+       item->heavy_updating = 1;
+    }
+
+    item->update_interval = now;
+}
+
+static inline void do_force_update(struct item *item)
+{
+    int ret;
+
+    if (item->monitor) { /*!< If this item is already in update process */
+       return;
+    }
+
+    if (!IS_DBOX_SHOWN(item)) {
+       DbgPrint("%s is not shown yet. it will be added to normal pending list\n", item->inst->item->pkgname);
+       (void)append_force_update_list(item);
+       return;
+    }
+
+    if (item->is_paused) {
+       DbgPrint("Item is paused. but it will be updated forcely(%s)\n", item->inst->item->pkgname);
+    }
+
+    item->updated_in_pause = 0;
+
+    ret = so_is_updated(item->inst);
+    if (ret <= 0) {
+       if (so_need_to_destroy(item->inst) == DBOX_NEED_TO_DESTROY) {
+           dynamicbox_provider_send_deleted(item->inst->item->pkgname, item->inst->id);
+           dbox_destroy(item->inst->item->pkgname, item->inst->id, DBOX_DESTROY_TYPE_DEFAULT);
+           /*!
+            * \CRITICAL
+            * Every caller of this, must not access the item from now.
+            */
+           return;
+       }
+
+       reset_dbox_updated_flag(item);
+       return;
+    }
+
+    /*!
+     * \note
+     * Check the update_list, if you want make serialized update
+     */
+    if (/*s_info.update_list || */gbar_is_opened(item->inst->item->pkgname) == GBAR_IS_OPENED_BUT_NOT_MINE) {
+       DbgPrint("%s is busy, migrate to normal pending list\n", item->inst->id);
+       (void)append_pending_list(item);
+       return;
+    }
+
+    item->monitor = ecore_timer_add(item->inst->item->timeout, update_timeout_cb, item);
+    if (!item->monitor) {
+       ErrPrint("Failed to add update monitor %s(%s):%d\n",
+               item->inst->item->pkgname, item->inst->id, item->inst->item->timeout);
+       return;
+    }
+
+    ret = so_update(item->inst);
+    if (ret < 0) {
+       ecore_timer_del(item->monitor);
+       item->monitor = NULL;
+       reset_dbox_updated_flag(item);
+       return;
+    }
+
+    /*!
+     * \note
+     * Counter of the event monitor is only used for asynchronous content updating,
+     * So reset it to 1 from here because the async updating is started now,
+     * even if it is accumulated by other event function before this.
+     */
+    item->monitor_cnt = 1;
+
+    /*!
+     * \note
+     * While waiting the Callback function call,
+     * Add this for finding the crash
+     */
+    fault_mark_call(item->inst->item->pkgname, item->inst->id, "update,crashed", NO_ALARM, DEFAULT_LIFE_TIMER);
+
+    if (ret & DBOX_NEED_TO_SCHEDULE) {
+       (void)append_pending_list(item);
+    }
+
+    if (ret & DBOX_FORCE_TO_SCHEDULE) {
+       DbgPrint("%s Return DBOX_NEED_TO_FORCE_SCHEDULE\n", item->inst->item->pkgname);
+       (void)append_force_update_list(item);
+    }
+
+    if (ret & DBOX_OUTPUT_UPDATED) {
+       /*!
+        * \NOTE 
+        * In this case, there is potential issue
+        * 1. User added update CALLBACK -> Inotify event (Only once)
+        *    > We have to detect this case. Is it possible to be a user callback called faster than inotify event handler?
+        * 2. Inotify event -> User added update CALLBACK -> Inotify event
+        *    > Okay. What we want is this.
+        */
+       update_monitor_cnt(item);
+    }
+
+    /*
+     * \NOTE
+     * This should be updated after "update_monitor_cnt" function call,
+     * because the update_monitor_cnt function will see the s_info.update variable,
+     */
+    s_info.update_list = eina_list_append(s_info.update_list, item);
+
+    return;
+}
+
+static Eina_Bool force_update_cb(void *data)
+{
+    struct item *item;
+
+    item = eina_list_nth(s_info.force_update_list, 0);
+    if (!item) {
+       goto cleanout;
+    }
+
+    s_info.force_update_list = eina_list_remove(s_info.force_update_list, item);
+
+    do_force_update(item);
+
+    if (s_info.force_update_list) {
+       return ECORE_CALLBACK_RENEW;
+    }
+
+cleanout:
+    s_info.force_update_timer = NULL;
+    return ECORE_CALLBACK_CANCEL;
+}
+
+static inline __attribute__((always_inline)) int activate_force_update_consumer(void)
+{
+    if (s_info.force_update_timer) {
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    s_info.force_update_timer = ecore_timer_add(0.000001f, force_update_cb, NULL);
+    if (!s_info.force_update_timer) {
+       ErrPrint("Failed to add a new force update timer\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    DbgPrint("Force update timer is registered\n");
+
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+static inline void deactivate_force_update_consumer(void)
+{
+    if (!s_info.force_update_timer) {
+       return;
+    }
+
+    ecore_timer_del(s_info.force_update_timer);
+    s_info.force_update_timer = NULL;
+
+    DbgPrint("Force update timer is deleted\n");
+}
+
+static Eina_Bool pended_cmd_consumer_cb(void *data)
+{
+    struct item *item;
+
+    item = eina_list_nth(s_info.pending_list, 0);
+    if (!item) {
+       goto cleanout;
+    }
+
+    if (eina_list_data_find(s_info.update_list, item) || gbar_is_opened(item->inst->item->pkgname) == GBAR_IS_OPENED_BUT_NOT_MINE) {
+       return ECORE_CALLBACK_RENEW;
+    }
+
+    s_info.pending_list = eina_list_remove(s_info.pending_list, item);
+    /*!
+     * \note
+     * To prevent from checking the is_updated function
+     */
+    if (updator_cb(item) == ECORE_CALLBACK_CANCEL) {
+       /* item is destroyed */
+    }
+
+    if (s_info.pending_list) {
+       return ECORE_CALLBACK_RENEW;
+    }
+
+cleanout:
+    s_info.pending_timer = NULL;
+    s_info.pending_timer_freezed = 0;
+    return ECORE_CALLBACK_CANCEL;
+}
+
+static inline __attribute__((always_inline)) int activate_pending_consumer(void)
+{
+    if (s_info.pending_timer) {
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    s_info.pending_timer = ecore_timer_add(0.000001f, pended_cmd_consumer_cb, NULL);
+    if (!s_info.pending_timer) {
+       ErrPrint("Failed to add a new pended command consumer\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    /*!
+     * Do not increase the freezed counter.
+     * Just freeze the timer.
+     */
+    if (s_info.pending_timer_freezed) {
+       ecore_timer_freeze(s_info.pending_timer);
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+static inline void deactivate_pending_consumer(void)
+{
+    if (!s_info.pending_timer) {
+       return;
+    }
+
+    ecore_timer_del(s_info.pending_timer);
+    s_info.pending_timer = NULL;
+    s_info.pending_timer_freezed = 0;
+}
+
+static inline void deactivate_gbar_open_pending_consumer(void)
+{
+    if (!s_info.gbar_open_pending_timer) {
+       return;
+    }
+
+    ecore_timer_del(s_info.gbar_open_pending_timer);
+    s_info.gbar_open_pending_timer = NULL;
+}
+
+static inline int __attribute__((always_inline)) activate_gbar_open_pending_consumer(void)
+{
+    if (s_info.gbar_open_pending_timer) {
+       return 0;
+    }
+
+    s_info.gbar_open_pending_timer = ecore_timer_add(0.000001f, gbar_open_pended_cmd_consumer_cb, NULL);
+    if (!s_info.gbar_open_pending_timer) {
+       ErrPrint("Failed to add a new pended command consumer\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    return 0;
+}
+
+static inline void migrate_to_gbar_open_pending_list(const char *pkgname)
+{
+    Eina_List *l;
+    Eina_List *n;
+    struct item *item;
+    int cnt = 0;
+
+    EINA_LIST_FOREACH_SAFE(s_info.pending_list, l, n, item) {
+       if (strcmp(pkgname, item->inst->item->pkgname)) {
+           continue;
+       }
+
+       s_info.pending_list = eina_list_remove(s_info.pending_list, item);
+       s_info.gbar_open_pending_list = eina_list_append(s_info.gbar_open_pending_list, item);
+       cnt++;
+    }
+
+    /*!
+     * These items will be moved to the pending list after the GBAR is closed.
+     * Force list -> pd open list -> pending list.
+     * So there is no way to go back to the foce update list again.
+     *
+     * \warning
+     * the ITEM must only exists in one list, pending list or force_update_list
+     * It is not accepted to exists in two list at same time.
+     */
+    EINA_LIST_FOREACH_SAFE(s_info.force_update_list, l, n, item) {
+       if (strcmp(pkgname, item->inst->item->pkgname)) {
+           continue;
+       }
+
+       s_info.force_update_list = eina_list_remove(s_info.force_update_list, item);
+       s_info.gbar_open_pending_list = eina_list_append(s_info.gbar_open_pending_list, item);
+       cnt++;
+    }
+
+    if (s_info.gbar_open_pending_list) {
+       activate_gbar_open_pending_consumer();
+    }
+
+    if (!s_info.pending_list) {
+       deactivate_pending_consumer();
+    }
+
+    if (!s_info.force_update_list) {
+       deactivate_force_update_consumer();
+    }
+}
+
+static inline void migrate_to_pending_list(const char *pkgname)
+{
+    Eina_List *l;
+    Eina_List *n;
+    struct item *item;
+    int cnt = 0;
+
+    EINA_LIST_FOREACH_SAFE(s_info.gbar_open_pending_list, l, n, item) {
+       if (strcmp(pkgname, item->inst->item->pkgname)) {
+           continue;
+       }
+
+       s_info.gbar_open_pending_list = eina_list_remove(s_info.gbar_open_pending_list, item);
+       s_info.pending_list = eina_list_append(s_info.pending_list, item);
+       cnt++;
+    }
+
+    if (s_info.pending_list) {
+       activate_pending_consumer();
+    }
+
+    if (!s_info.gbar_open_pending_list) {
+       deactivate_gbar_open_pending_consumer();
+    }
+}
+
+static inline int is_pended_item(struct item *item)
+{
+    struct item *in_item;
+    if (gbar_is_opened(item->inst->item->pkgname) == GBAR_IS_OPENED) {
+       in_item = eina_list_data_find(s_info.gbar_open_pending_list, item);
+    } else {
+       in_item = eina_list_data_find(s_info.pending_list, item);
+    }
+
+    return (in_item == item);
+}
+
+static int append_pending_list(struct item *item)
+{
+    if (item->deleteme) {
+       DbgPrint("Item will be deleted, ignore update request: %s\n", item->inst->id);
+       return DBOX_STATUS_ERROR_BUSY;
+    }
+
+    if (eina_list_data_find(s_info.force_update_list, item)) {
+       DbgPrint("Already exists in force list\n");
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    if (gbar_is_opened(item->inst->item->pkgname) == GBAR_IS_OPENED) {
+       if (eina_list_data_find(s_info.gbar_open_pending_list, item) == item) {
+           DbgPrint("Already pended - %s\n", item->inst->item->pkgname);
+           return DBOX_STATUS_ERROR_EXIST;
+       }
+
+       if (activate_gbar_open_pending_consumer() < 0) {
+           ErrPrint("Failed to activate GBAR open pending consumer\n");
+           return DBOX_STATUS_ERROR_FAULT;
+       }
+
+       s_info.gbar_open_pending_list = eina_list_append(s_info.gbar_open_pending_list, item);
+    } else {
+       if (eina_list_data_find(s_info.pending_list, item) == item) {
+           DbgPrint("Already pended - %s\n", item->inst->item->pkgname);
+           return DBOX_STATUS_ERROR_EXIST;
+       }
+
+       if (IS_DBOX_SHOWN(item)) {
+           if (activate_pending_consumer() < 0) {
+               return DBOX_STATUS_ERROR_FAULT;
+           }
+
+           s_info.pending_list = eina_list_append(s_info.pending_list, item);
+       } else {
+           if (eina_list_data_find(s_info.hidden_list, item) == item) {
+               DbgPrint("Already in hidden list - %s\n", item->inst->item->pkgname);
+               return DBOX_STATUS_ERROR_EXIST;
+           }
+
+           s_info.hidden_list = eina_list_append(s_info.hidden_list, item);
+       }
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+static inline int clear_from_pending_list(struct item *item)
+{
+    Eina_List *l;
+    struct item *tmp;
+
+    EINA_LIST_FOREACH(s_info.pending_list, l, tmp) {
+       if (tmp != item) {
+           continue;
+       }
+
+       s_info.pending_list = eina_list_remove_list(s_info.pending_list, l);
+       if (!s_info.pending_list) {
+           deactivate_pending_consumer();
+       }
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    return DBOX_STATUS_ERROR_NOT_EXIST;
+}
+
+static int append_force_update_list(struct item *item)
+{
+    if (item->deleteme) {
+       DbgPrint("Item will be deleted, ignore force update request: %s\n", item->inst->id);
+       return DBOX_STATUS_ERROR_BUSY;
+    }
+
+    /*!
+     * If the item is already in pending list, remove it.
+     */
+    clear_from_pending_list(item);
+
+    if (gbar_is_opened(item->inst->item->pkgname) == GBAR_IS_OPENED) {
+       if (eina_list_data_find(s_info.gbar_open_pending_list, item) == item) {
+           DbgPrint("Already pended - %s\n", item->inst->item->pkgname);
+           return DBOX_STATUS_ERROR_EXIST;
+       }
+
+       if (activate_gbar_open_pending_consumer() < 0) {
+           ErrPrint("Failed to activate GBAR open pending consumer\n");
+           return DBOX_STATUS_ERROR_FAULT;
+       }
+
+       s_info.gbar_open_pending_list = eina_list_append(s_info.gbar_open_pending_list, item);
+    } else {
+       if (eina_list_data_find(s_info.force_update_list, item)) {
+           DbgPrint("Already in force update list\n");
+           return DBOX_STATUS_ERROR_NONE;
+       }
+
+       if (IS_DBOX_SHOWN(item)) {
+           if (activate_force_update_consumer() < 0) {
+               return DBOX_STATUS_ERROR_FAULT;
+           }
+
+           s_info.force_update_list = eina_list_append(s_info.force_update_list, item);
+       } else {
+           if (eina_list_data_find(s_info.hidden_list, item) == item) {
+               DbgPrint("Already in hidden list - %s\n", item->inst->id);
+               return DBOX_STATUS_ERROR_EXIST;
+           }
+
+           s_info.hidden_list = eina_list_append(s_info.hidden_list, item);
+
+           DbgPrint("forced item is moved to hidden_list - %s\n", item->inst->id);
+       }
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+static inline int clear_from_force_update_list(struct item *item)
+{
+    Eina_List *l;
+    struct item *tmp;
+
+    EINA_LIST_FOREACH(s_info.force_update_list, l, tmp) {
+       if (tmp != item) {
+           continue;
+       }
+
+       s_info.force_update_list = eina_list_remove_list(s_info.force_update_list, l);
+       if (!s_info.force_update_list) {
+           deactivate_force_update_consumer();
+       }
+
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    return DBOX_STATUS_ERROR_NOT_EXIST;
+}
+
+static inline void migrate_to_pending_list_from_hidden_list(struct item *item)
+{
+    if (!eina_list_data_find(s_info.hidden_list, item)) {
+       return;
+    }
+
+    s_info.hidden_list = eina_list_remove(s_info.hidden_list, item);
+    append_pending_list(item);
+}
+
+/*!
+ * \brief
+ *   This function can call the update callback
+ * return 0 if there is no changes
+ * return -1 the item is deleted
+ */
+static inline int timer_thaw(struct item *item)
+{
+    double pending;
+    double period;
+    double delay;
+    double sleep_time;
+
+    if (!item->timer) {
+       return 0;
+    }
+
+    ecore_timer_thaw(item->timer);
+    period = ecore_timer_interval_get(item->timer);
+    pending = ecore_timer_pending_get(item->timer);
+    delay = util_time_delay_for_compensation(period) - pending;
+    ecore_timer_delay(item->timer, delay);
+
+    if (item->sleep_at == 0.0f) {
+       return 0;
+    }
+
+    sleep_time = util_timestamp() - item->sleep_at;
+    item->sleep_at = 0.0f;
+
+    if (sleep_time > pending) {
+
+       /*!
+        * Before do updating forcely, clear it from the pending list.
+        * We will consume it from here now.
+        */
+       (void)clear_from_pending_list(item);
+
+       if (updator_cb(item) == ECORE_CALLBACK_CANCEL) {
+           /* item is destroyed */
+           return UPDATE_ITEM_DELETED;
+       } else {
+           return UPDATE_INVOKED;
+       }
+    }
+
+    return UPDATE_NOT_INVOKED;
+}
+
+static void timer_freeze(struct item *item)
+{
+    if (!item->timer) {
+       return;
+    }
+
+    ecore_timer_freeze(item->timer);
+
+    if (ecore_timer_interval_get(item->timer) <= 1.0f) {
+       return;
+    }
+
+#if defined(_USE_ECORE_TIME_GET)
+    item->sleep_at = ecore_time_get();
+#else
+    struct timeval tv;
+    if (gettimeofday(&tv, NULL) < 0) {
+       ErrPrint("gettimeofday: %s\n", strerror(errno));
+       tv.tv_sec = 0;
+       tv.tv_usec = 0;
+    }
+
+    item->sleep_at = (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0f;
+#endif
+}
+
+static inline Eina_List *find_item(struct instance *inst)
+{
+    Eina_List *l;
+    struct item *item;
+
+    EINA_LIST_FOREACH(s_info.item_list, l, item) {
+       if (item->inst == inst) {
+           return l;
+       }
+    }
+
+    return NULL;
+}
+
+static int desc_updated_cb(const char *filename, void *data, int over)
+{
+    struct item *item;
+
+    if (over) {
+       WarnPrint("Event Q overflow\n");
+    }
+
+    item = data;
+
+    DbgPrint("DESC %s is updated\n", filename);
+    if (item->is_gbar_show) {
+       dynamicbox_damage_region_t region = {
+           .x = 0,
+           .y = 0,
+           .w = item->inst->w,
+           .h = item->inst->h,
+       };
+
+       dynamicbox_provider_send_updated(item->inst->item->pkgname, item->inst->id, DBOX_PRIMARY_BUFFER, &region, 1, filename);
+    } else {
+       ErrPrint("But GBAR is not opened, Ignore this update (%s)\n", item->inst->id);
+    }
+    return EXIT_SUCCESS;
+}
+
+static inline int output_handler(struct item *item)
+{
+    int invalid = 0;
+
+    item->monitor_cnt--;
+    if (item->monitor_cnt < 0 || item->heavy_updating) {
+       if (!item->heavy_updating) {
+           WarnPrint("%s has invalid monitor_cnt\n", item->inst->id);
+           invalid = 1;
+       } else {
+           item->heavy_updating = 0;   /* Reset flag */
+       }
+
+       item->monitor_cnt = 0;
+    }
+
+    if (item->monitor_cnt == 0) {
+       if (!invalid) {
+           fault_unmark_call(item->inst->item->pkgname, item->inst->id, "update,crashed", NO_ALARM);
+       }
+
+       if (item->monitor) {
+           ecore_timer_del(item->monitor);
+           item->monitor = NULL;
+       }
+
+       s_info.update_list = eina_list_remove(s_info.update_list, item);
+
+       if (item->deleteme) {
+           update_monitor_del(item->inst->id, item);
+           dynamicbox_provider_send_deleted(item->inst->item->pkgname, item->inst->id);
+           (void)so_destroy(item->inst, item->unload_so);
+           free(item);
+           return EXIT_FAILURE;
+       }
+    }
+
+    return EXIT_SUCCESS;
+}
+
+static int file_updated_cb(const char *filename, void *data, int over)
+{
+    struct item *item;
+    int w;
+    int h;
+    double priority;
+    char *content = NULL;
+    char *title = NULL;
+    int ret;
+    char *icon = NULL;
+    char *name = NULL;
+
+    if (over) {
+       WarnPrint("Event Q overflow\n");
+    }
+
+    item = data;
+
+    if (item->deleteme) {
+       DbgPrint("Item is in deleting process. (%s)\n", filename);
+       goto out;
+    }
+
+    ESTIMATE_START(item->inst->id);
+
+    ret = util_get_filesize(filename);
+    if (ret <= 0) {
+       ErrPrint("Content is updated. but invalid. ret = %d (Update is ignored)\n", ret);
+       ESTIMATE_END(item->inst->id);
+       return EXIT_SUCCESS; /*!< To keep the callback */
+    }
+
+    ret = so_get_output_info(item->inst, &w, &h, &priority, &content, &title);
+    if (ret < 0) {
+       ErrPrint("dynamicbox_get_info returns %d\n", ret);
+       ESTIMATE_END(item->inst->id);
+       return EXIT_SUCCESS; /*!< To keep the callback */
+    }
+
+    /**
+     * Alternative information can be NOT_IMPLEMENTED
+     * And we can ignore its error.
+     */
+    ret = so_get_alt_info(item->inst, &icon, &name);
+    if (ret < 0) {
+       ErrPrint("dynamicbox_get_alt_info returns %d (ignored)\n", ret);
+    }
+
+    if (IS_DBOX_SHOWN(item)) {
+       dynamicbox_damage_region_t region = {
+           .x = 0,
+           .y = 0,
+           .w = item->inst->w,
+           .h = item->inst->h,
+       };
+       /**
+        * If the content is not written on shared buffer (pixmap, shm, raw file, ...)
+        * We cannot use the direct path for sending updated event.
+        */
+       dynamicbox_provider_send_extra_info(item->inst->item->pkgname, item->inst->id, item->inst->priority,
+               content, title, item->inst->icon, item->inst->name);
+       dynamicbox_provider_send_updated(item->inst->item->pkgname, item->inst->id, DBOX_PRIMARY_BUFFER, &region, 0, NULL);
+    } else {
+       item->is_dbox_updated++;
+    }
+
+    ESTIMATE_END(item->inst->id);
+out:
+    return output_handler(item);
+}
+
+static void reset_dbox_updated_flag(struct item *item)
+{
+    dynamicbox_damage_region_t region = {
+       .x = 0,
+       .y = 0,
+       .w = item->inst->w,
+       .h = item->inst->h,
+    };
+
+    if (!item->is_dbox_updated) {
+       return;
+    }
+
+    DbgPrint("[%s] Updated %d times, (content: %s), (title: %s)\n",
+           item->inst->id, item->is_dbox_updated,
+           item->inst->content, item->inst->title);
+
+    /**
+     * If the content is not written on shared buffer (pixmap, shm, raw file, ...)
+     * We cannot use the direct path for sending updated event.
+     */
+    dynamicbox_provider_send_extra_info(item->inst->item->pkgname, item->inst->id, item->inst->priority,
+           item->inst->content, item->inst->title, item->inst->icon, item->inst->name);
+    dynamicbox_provider_send_updated(item->inst->item->pkgname, item->inst->id, DBOX_PRIMARY_BUFFER, &region, 0, NULL);
+
+    item->is_dbox_updated = 0;
+}
+
+static inline int clear_from_gbar_open_pending_list(struct item *item)
+{
+    Eina_List *l;
+    struct item *tmp;
+
+    EINA_LIST_FOREACH(s_info.gbar_open_pending_list, l, tmp) {
+       if (tmp != item) {
+           continue;
+       }
+
+       s_info.gbar_open_pending_list = eina_list_remove_list(s_info.gbar_open_pending_list, l);
+       if (!s_info.gbar_open_pending_list) {
+           deactivate_gbar_open_pending_consumer();
+       }
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    return DBOX_STATUS_ERROR_NOT_EXIST;
+}
+
+/*!
+ * \note
+ * This must has to return ECORE_CALLBACK_CANCEL, only if the item is deleted.
+ * So every caller, should manage the deleted item correctly.
+ */
+static Eina_Bool updator_cb(void *data)
+{
+    struct item *item;
+    int ret;
+
+    item = data;
+
+    if (item->monitor) { /*!< If this item is already in update process */
+       return ECORE_CALLBACK_RENEW;
+    }
+
+    if (!IS_DBOX_SHOWN(item)) {
+       DbgPrint("%s is not shown yet. make delay for updates\n", item->inst->item->pkgname);
+       (void)append_pending_list(item);
+       return ECORE_CALLBACK_RENEW;
+    }
+
+    if (item->is_paused) {
+       item->updated_in_pause++;
+       DbgPrint("%s is paused[%d]. make delay for updating\n", item->inst->item->pkgname, item->updated_in_pause);
+       return ECORE_CALLBACK_RENEW;
+    }
+
+    item->updated_in_pause = 0;
+
+    ret = so_is_updated(item->inst);
+    if (ret <= 0) {
+       if (so_need_to_destroy(item->inst) == DBOX_NEED_TO_DESTROY) {
+           dynamicbox_provider_send_deleted(item->inst->item->pkgname, item->inst->id);
+           dbox_destroy(item->inst->item->pkgname, item->inst->id, DBOX_DESTROY_TYPE_DEFAULT);
+           /*!
+            * \CRITICAL
+            * Every caller of this, must not access the item from now.
+            */
+           return ECORE_CALLBACK_CANCEL;
+       }
+
+       reset_dbox_updated_flag(item);
+       return ECORE_CALLBACK_RENEW;
+    }
+
+    /*!
+     * \note
+     * Check the update_list, if you want make serialized update
+     */
+    if (/*s_info.update_list || */gbar_is_opened(item->inst->item->pkgname) == GBAR_IS_OPENED_BUT_NOT_MINE) {
+       DbgPrint("%s is busy\n", item->inst->id);
+       (void)append_pending_list(item);
+       return ECORE_CALLBACK_RENEW;
+    }
+
+    item->monitor = ecore_timer_add(item->inst->item->timeout, update_timeout_cb, item);
+    if (!item->monitor) {
+       ErrPrint("Failed to add update monitor %s(%s):%d\n",
+               item->inst->item->pkgname, item->inst->id, item->inst->item->timeout);
+       return ECORE_CALLBACK_RENEW;
+    }
+
+    ret = so_update(item->inst);
+    if (ret < 0) {
+       ecore_timer_del(item->monitor);
+       item->monitor = NULL;
+       reset_dbox_updated_flag(item);
+       return ECORE_CALLBACK_RENEW;
+    }
+
+    /*!
+     * \note
+     * Counter of the event monitor is only used for asynchronous content updating,
+     * So reset it to 1 from here because the async updating is started now,
+     * even if it is accumulated by other event function before this.
+     */
+    item->monitor_cnt = 1;
+
+    /*!
+     * \note
+     * While waiting the Callback function call,
+     * Add this for finding the crash
+     */
+    fault_mark_call(item->inst->item->pkgname, item->inst->id, "update,crashed", NO_ALARM, DEFAULT_LIFE_TIMER);
+
+    if (ret & DBOX_NEED_TO_SCHEDULE) {
+       (void)append_pending_list(item);
+    }
+
+    if (ret & DBOX_FORCE_TO_SCHEDULE) {
+       DbgPrint("%s Return DBOX_NEED_TO_FORCE_SCHEDULE\n", item->inst->item->pkgname);
+       (void)append_force_update_list(item);
+    }
+
+    if (ret & DBOX_OUTPUT_UPDATED) {
+       /*!
+        * \NOTE 
+        * In this case, there is potential issue
+        * 1. User added update CALLBACK -> Inotify event (Only once)
+        *    > We have to detect this case. Is it possible to be a user callback called faster than inotify event handler?
+        * 2. Inotify event -> User added update CALLBACK -> Inotify event
+        *    > Okay. What we want is this.
+        */
+       update_monitor_cnt(item);
+    }
+
+    /*
+     * \NOTE
+     * This should be updated after "update_monitor_cnt" function call,
+     * because the update_monitor_cnt function will see the s_info.update variable,
+     */
+    s_info.update_list = eina_list_append(s_info.update_list, item);
+
+    return ECORE_CALLBACK_RENEW;
+}
+
+static inline void update_monitor_del(const char *id, struct item *item)
+{
+    char *tmp;
+    int len;
+
+    update_monitor_del_update_cb(util_uri_to_path(id), file_updated_cb);
+
+    len = strlen(util_uri_to_path(id)) + strlen(".desc") + 1;
+    tmp = malloc(len);
+    if (!tmp) {
+       ErrPrint("Heap: %s (%s.desc)\n", strerror(errno), util_uri_to_path(id));
+       return;
+    }
+
+    snprintf(tmp, len, "%s.desc", util_uri_to_path(id));
+    update_monitor_del_update_cb(tmp, desc_updated_cb);
+    free(tmp);
+}
+
+static inline int add_desc_update_monitor(const char *id, struct item *item)
+{
+    char *filename;
+    int len;
+    int ret;
+
+    len = strlen(util_uri_to_path(id)) + strlen(".desc") + 1;
+    filename = malloc(len);
+    if (!filename) {
+       ErrPrint("Heap: %s (%s.desc)\n", strerror(errno), util_uri_to_path(id));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    snprintf(filename, len, "%s.desc", util_uri_to_path(id));
+    ret = update_monitor_add_update_cb(filename, desc_updated_cb, item);
+    free(filename);
+    return ret;
+}
+
+static inline int add_file_update_monitor(const char *id, struct item *item)
+{
+    return update_monitor_add_update_cb(util_uri_to_path(id), file_updated_cb, item);
+}
+
+static inline int update_monitor_add(const char *id, struct item *item)
+{
+    /*!
+     * \NOTE
+     * item->inst is not available yet.
+     */
+    add_file_update_monitor(id, item);
+    add_desc_update_monitor(id, item);
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+static int disconnected_cb(int handle, void *data)
+{
+    Eina_List *l;
+    struct item *item;
+    struct connection *connection;
+
+    connection = connection_find_by_fd(handle);
+    if (!connection) {
+       return 0;
+    }
+
+    EINA_LIST_FOREACH(s_info.item_list, l, item) {
+       if (item->direct_path == connection) {
+           connection_unref(item->direct_path);
+           item->direct_path = NULL;
+       }
+    }
+
+    return 0;
+}
+
+HAPI void dbox_init(void)
+{
+    int ret;
+    ret = connection_add_event_handler(CONNECTION_EVENT_TYPE_DISCONNECTED, disconnected_cb, NULL);
+    if (ret < 0) {
+       ErrPrint("Unable to add an event handler\n");
+    }
+    return;
+}
+
+HAPI void dbox_fini(void)
+{
+    int ret;
+
+    ret = dbox_delete_all_deleteme();
+    if (ret < 0) {
+       DbgPrint("Delete all deleteme: %d\n", ret);
+    }
+
+    ret = dbox_delete_all();
+    if (ret < 0) {
+       DbgPrint("Delete all: %d\n", ret);
+    }
+
+    /* Just for in case of ... */
+    deactivate_pending_consumer();
+    deactivate_gbar_open_pending_consumer();
+
+    eina_list_free(s_info.gbar_open_pending_list);
+    s_info.gbar_open_pending_list = NULL;
+    eina_list_free(s_info.pending_list);
+    s_info.pending_list = NULL;
+
+    (void)connection_del_event_handler(CONNECTION_EVENT_TYPE_DISCONNECTED, disconnected_cb);
+    return;
+}
+
+/*!
+ * \note
+ * Exported API for each dynamicboxes.
+ */
+int dynamicbox_send_updated(const char *pkgname, const char *id, int idx, int x, int y, int w, int h, int gbar, const char *descfile)
+{
+    Eina_List *l;
+    struct item *item;
+    int ret = DBOX_STATUS_ERROR_NOT_EXIST;
+    dynamicbox_damage_region_t region = {
+       .x = x,
+       .y = y,
+       .w = w,
+       .h = h,
+    };
+
+    EINA_LIST_FOREACH(s_info.item_list, l, item) {
+       if (strcmp(item->inst->item->pkgname, pkgname) || strcmp(item->inst->id, id)) {
+           continue;
+       }
+
+       if (item->direct_path) {
+           ret = dynamicbox_provider_send_direct_updated(connection_handle(item->direct_path), pkgname, id, idx, &region, gbar, descfile);
+       } else {
+           ret = dynamicbox_provider_send_updated(pkgname, id, idx, &region, gbar, descfile);
+       }
+
+       break;
+    }
+
+    return ret;
+}
+
+int dynamicbox_send_buffer_updated(const char *pkgname, const char *id, dynamicbox_buffer_h handle, int idx, int x, int y, int w, int h, int gbar, const char *descfile)
+{
+    Eina_List *l;
+    struct item *item;
+    int ret = DBOX_STATUS_ERROR_NOT_EXIST;
+    dynamicbox_damage_region_t region = {
+       .x = x,
+       .y = y,
+       .w = w,
+       .h = h,
+    };
+
+    EINA_LIST_FOREACH(s_info.item_list, l, item) {
+       if (strcmp(item->inst->item->pkgname, pkgname) || strcmp(item->inst->id, id)) {
+           continue;
+       }
+
+       if (item->direct_path) {
+           ret = dynamicbox_provider_send_direct_buffer_updated(connection_handle(item->direct_path), handle, idx, &region, gbar, descfile);
+       } else {
+           ret = dynamicbox_provider_send_buffer_updated(handle, idx, &region, gbar, descfile);
+       }
+
+       break;
+    }
+
+    return ret;
+}
+
+const char *dynamicbox_find_pkgname(const char *filename)
+{
+    Eina_List *l;
+    struct item *item;
+
+    EINA_LIST_FOREACH(s_info.item_list, l, item) {
+       if (!strcmp(item->inst->id, filename)) {
+           return item->inst->item->pkgname;
+       }
+    }
+
+    return NULL;
+}
+
+int dynamicbox_update_extra_info(const char *id, const char *content, const char *title, const char *icon, const char *name)
+{
+    Eina_List *l;
+    struct item *item;
+
+    EINA_LIST_FOREACH(s_info.item_list, l, item) {
+       if (!strcmp(item->inst->id, id)) {
+           if (content && strlen(content)) {
+               char *_content;
+
+               _content = strdup(content);
+               if (_content) {
+                   if (item->inst->content) {
+                       free(item->inst->content);
+                       item->inst->content = NULL;
+                   }
+
+                   item->inst->content = _content;
+               } else {
+                   ErrPrint("Heap: %s\n", strerror(errno));
+               }
+           }
+
+           if (title && strlen(title)) {
+               char *_title;
+
+               _title = strdup(title);
+               if (_title) {
+                   if (item->inst->title) {
+                       free(item->inst->title);
+                       item->inst->title = NULL;
+                   }
+
+                   item->inst->title = _title;
+               } else {
+                   ErrPrint("Heap: %s\n", strerror(errno));
+               }
+           }
+
+           if (icon && strlen(icon)) {
+               char *_icon;
+
+               _icon = strdup(icon);
+               if (_icon) {
+                   if (item->inst->icon) {
+                       free(item->inst->icon);
+                       item->inst->icon = NULL;
+                   }
+
+                   item->inst->icon = _icon;
+               } else {
+                   ErrPrint("Heap: %s\n", strerror(errno));
+               }
+           }
+
+           if (name && strlen(name)) {
+               char *_name;
+
+               _name = strdup(name);
+               if (_name) {
+                   if (item->inst->name) {
+                       free(item->inst->name);
+                       item->inst->name = NULL;
+                   }
+
+                   item->inst->name = _name;
+               } else {
+                   ErrPrint("Heap: %s\n", strerror(errno));
+               }
+           }
+
+           return DBOX_STATUS_ERROR_NONE;
+       }
+    }
+
+    return DBOX_STATUS_ERROR_NOT_EXIST;
+}
+
+int dynamicbox_request_update_by_id(const char *filename)
+{
+    Eina_List *l;
+    struct item *item;
+
+    if (so_current_op() != DBOX_OP_UNKNOWN) {
+       ErrPrint("Current operation: %d\n", so_current_op());
+       /*!
+        * \note
+        * Some case requires to update the content of other box from dynamicbox_XXX ABI.
+        * In that case this function can be used so we have not to filter it from here.
+        * ex) Setting accessibility.
+        * Press the assistive light, turned on, need to update other instances too.
+        * Then the box will use this function from dynamicbox_clicked function.
+        */
+    }
+
+    EINA_LIST_FOREACH(s_info.item_list, l, item) {
+       if (!strcmp(item->inst->id, filename)) {
+           return append_pending_list(item);
+       }
+    }
+
+    return DBOX_STATUS_ERROR_NOT_EXIST;
+}
+
+int dynamicbox_trigger_update_monitor(const char *filename, int is_gbar)
+{
+    char *fname;
+    int ret;
+
+    if (so_current_op() != DBOX_OP_UNKNOWN) {
+       ErrPrint("Current operation: %d\n", so_current_op());
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    if (is_gbar) {
+       int len;
+       len = strlen(filename) + strlen(".desc");
+
+       fname = malloc(len + 1);
+       if (!fname) {
+           ErrPrint("Heap: %s\n", strerror(errno));
+           return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+       }
+
+       snprintf(fname, len, "%s.desc", filename);
+    } else {
+       fname = strdup(filename);
+       if (!fname) {
+           ErrPrint("Heap: %s\n", strerror(errno));
+           return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+       }
+    }
+
+    if (access(fname, R_OK | W_OK) != 0) {
+       ErrPrint("access: %s (%s)\n", fname, strerror(errno));
+       ret = DBOX_STATUS_ERROR_IO_ERROR;
+    } else {
+       ret = update_monitor_trigger_update_cb(fname, 0);
+    }
+
+    free(fname);
+    return ret;
+}
+
+HAPI int dbox_open_gbar(const char *pkgname, const char *id)
+{
+    struct instance *inst;
+    struct instance *tmp;
+    Eina_List *l;
+
+    inst = so_find_instance(pkgname, id);
+    if (!inst) {
+       ErrPrint("Instance is not found\n");
+       return DBOX_STATUS_ERROR_NOT_EXIST;
+    }
+
+    EINA_LIST_FOREACH(s_info.gbar_list, l, tmp) {
+       if (tmp == inst) {
+           return 0;
+       }
+    }
+
+    if (!s_info.gbar_list) {
+       pending_timer_freeze();
+
+       /*!
+        * \note
+        * Freeze the force timer only in this case.
+        */
+       force_timer_freeze();
+    }
+
+    s_info.gbar_list = eina_list_append(s_info.gbar_list, inst);
+
+    /*!
+     * Find all instances from the pending list.
+     * Move them to gbar_open_pending_timer
+     */
+    migrate_to_gbar_open_pending_list(pkgname);
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+HAPI int dbox_close_gbar(const char *pkgname, const char *id)
+{
+    Eina_List *l;
+    Eina_List *n;
+    struct instance *tmp;
+    struct instance *inst;
+
+    inst = so_find_instance(pkgname, id);
+    if (!inst) {
+       ErrPrint("Insatnce is not found\n");
+       return DBOX_STATUS_ERROR_NOT_EXIST;
+    }
+
+    EINA_LIST_FOREACH_SAFE(s_info.gbar_list, l, n, tmp) {
+       if (tmp != inst) {
+           continue;
+       }
+
+       s_info.gbar_list = eina_list_remove(s_info.gbar_list, tmp);
+       if (!s_info.gbar_list) {
+           pending_timer_thaw();
+           force_timer_thaw();
+       }
+
+       /*!
+        * Move all items in gbar_open_pending_list
+        * to pending_list.
+        */
+       migrate_to_pending_list(pkgname);
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    return DBOX_STATUS_ERROR_NOT_EXIST;
+}
+
+static struct method s_table[] = {
+    {
+       .cmd = NULL,
+       .handler = NULL,
+    },
+};
+
+HAPI int dbox_create(const char *pkgname, const char *id, struct dbox_create_arg *arg, int *w, int *h, double *priority, char **content, char **title)
+{
+    struct instance *inst;
+    struct item *item;
+    int ret;
+    int create_ret;
+    int need_to_create;
+
+    need_to_create = 0;
+    *content = NULL;
+    *title = NULL;
+
+    inst = so_find_instance(pkgname, id);
+    if (inst) {
+       DbgPrint("Instance is already exists [%s - %s] content[%s], cluster[%s], category[%s], abi[%s]\n", pkgname, id, arg->content, arg->cluster, arg->category, arg->abi);
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    if (!arg->skip_need_to_create) {
+       ret = so_create_needed(pkgname, arg->cluster, arg->category, arg->abi);
+       if (ret != DBOX_NEED_TO_CREATE) {
+           return DBOX_STATUS_ERROR_PERMISSION_DENIED;
+       }
+
+       need_to_create = 1;
+    }
+
+    item = calloc(1, sizeof(*item));
+    if (!item) {
+       ErrPrint("Heap: %s (%s - %s, content[%s], cluster[%s], category[%s], abi[%s])\n", strerror(errno), pkgname, id, arg->content, arg->cluster, arg->category, arg->abi);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    ret = update_monitor_add(id, item);
+    if (ret < 0) {
+       free(item);
+       return ret;
+    }
+
+    if (arg->direct_addr) {
+       item->direct_path = connection_find_by_addr(arg->direct_addr);
+       if (!item->direct_path) {
+           item->direct_path = connection_create(arg->direct_addr, (void *)s_table);
+           if (!item->direct_path) {
+               ErrPrint("Direct update-path is not supported\n");
+           } else {
+               DbgPrint("Direct update-path is created: %s\n", id);
+           }
+       } else {
+           item->direct_path = connection_ref(item->direct_path);
+           if (item->direct_path) {
+               DbgPrint("Direct update-path is referred: %s\n", id);
+           }
+       }
+    }
+
+    create_ret = so_create(pkgname, id, arg->content, arg->timeout, arg->has_dynamicbox_script, arg->cluster, arg->category, arg->abi, &inst);
+    if (create_ret < 0) {
+       update_monitor_del(id, item);
+       connection_unref(item->direct_path);
+       item->direct_path = NULL;
+       free(item);
+
+       *w = 0;
+       *h = 0;
+       *priority = 0.0f;
+       return create_ret;
+    }
+
+    item->inst = inst;
+
+    if (arg->period > 0.0f && !s_info.secured) {
+       item->timer = util_timer_add(arg->period, updator_cb, item);
+       if (!item->timer) {
+           ErrPrint("Failed to add timer (%s - %s, content[%s], cluster[%s], category[%s], abi[%s]\n", pkgname, id, arg->content, arg->cluster, arg->category, arg->abi);
+           update_monitor_del(id, item);
+           connection_unref(item->direct_path);
+           item->direct_path = NULL;
+           (void)so_destroy(inst, item->unload_so);
+           free(item);
+           return DBOX_STATUS_ERROR_FAULT;
+       }
+
+       if (s_info.paused) {
+           timer_freeze(item);
+       }
+    } else {
+       DbgPrint("Local update timer is disabled: %lf (%d)\n", arg->period, s_info.secured);
+       item->timer = NULL;
+    }
+
+    s_info.item_list = eina_list_append(s_info.item_list, item);
+
+    if (create_ret & DBOX_NEED_TO_SCHEDULE) {
+       DbgPrint("%s Returns DBOX_NEED_TO_SCHEDULE\n", pkgname);
+       (void)append_pending_list(item);
+    }
+
+    if (create_ret & DBOX_FORCE_TO_SCHEDULE) {
+       DbgPrint("%s Returns DBOX_NEED_TO_FORCE_UPDATE\n", pkgname);
+       (void)append_force_update_list(item);
+    }
+
+    if (create_ret & DBOX_OUTPUT_UPDATED) {
+       update_monitor_cnt(item);
+       /*!
+        * \note
+        * To send a output info, get the info forcely.
+        * but the output file monitor will do this again
+        *
+        * This function will set the tmp_content and tmp_title
+        * even if it has no updates on the content, title,
+        * it will set them to NULL.
+        */
+       if (so_get_output_info(inst, w, h, priority, content, title) == (int)DBOX_STATUS_ERROR_NONE) {
+           if (*content) {
+               char *tmp;
+
+               tmp = strdup(*content);
+               if (!tmp) {
+                   ErrPrint("Memory: %s\n", strerror(errno));
+               }
+
+               *content = tmp;
+           }
+
+           if (*title) {
+               char *tmp;
+
+               tmp = strdup(*title);
+               if (!tmp) {
+                   ErrPrint("Memory: %s\n", strerror(errno));
+               }
+
+               *title = tmp;
+           }
+       }
+    }
+
+    *w = inst->w;
+    *h = inst->h;
+    *priority = inst->priority;
+    return need_to_create;
+}
+
+HAPI int dbox_destroy(const char *pkgname, const char *id, int type)
+{
+    Eina_List *l;
+    Eina_List *n;
+    struct instance *inst;
+    struct instance *tmp;
+    struct item *item;
+
+    inst = so_find_instance(pkgname, id);
+    if (!inst) {
+       ErrPrint("Instance %s - %s is not created\n", pkgname, id);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    EINA_LIST_FOREACH_SAFE(s_info.gbar_list, l, n, tmp) {
+       if (tmp != inst) {
+           continue;
+       }
+
+       s_info.gbar_list = eina_list_remove(s_info.gbar_list, tmp);
+       if (!s_info.gbar_list) {
+           pending_timer_thaw();
+           force_timer_thaw();
+       }
+
+       /*!
+        * Move all items in gbar_open_pending_list
+        * to pending_list.
+        */
+       migrate_to_pending_list(pkgname);
+       break;
+    }
+
+    l = find_item(inst);
+    if (!l) {
+       ErrPrint("Instance is not found (%s - %s)\n", pkgname, id);
+       return DBOX_STATUS_ERROR_NOT_EXIST;
+    }
+
+    item = eina_list_data_get(l);
+    s_info.item_list = eina_list_remove_list(s_info.item_list, l);
+
+    s_info.update_list = eina_list_remove(s_info.update_list, item);
+    s_info.hidden_list = eina_list_remove(s_info.hidden_list, item);
+    clear_from_gbar_open_pending_list(item);
+    clear_from_pending_list(item);
+    clear_from_force_update_list(item);
+    (void)connection_unref(item->direct_path);
+    item->direct_path = NULL;
+
+    if (item->timer) {
+       ecore_timer_del(item->timer);
+       item->timer = NULL;
+    }
+
+    /*
+     * To keep the previous status, we should or'ing the value.
+     */
+    item->unload_so = (item->unload_so || (type == DBOX_DESTROY_TYPE_UNINSTALL));
+
+    if (item->monitor) {
+       item->deleteme = 1;
+    } else {
+       update_monitor_del(id, item);
+       (void)so_destroy(inst, item->unload_so);
+       free(item);
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+HAPI int dbox_resize(const char *pkgname, const char *id, int w, int h)
+{
+    Eina_List *l;
+    struct instance *inst;
+    struct item *item;
+    int ret;
+
+    inst = so_find_instance(pkgname, id);
+    if (!inst) {
+       ErrPrint("Instance %s - %s is not created (%dx%d)\n", pkgname, id, w, h);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    l = find_item(inst);
+    if (!l) {
+       ErrPrint("Instance is not found (%s - %s, %dx%d)\n", pkgname, id, w, h);
+       return DBOX_STATUS_ERROR_NOT_EXIST;
+    }
+
+    item = eina_list_data_get(l);
+
+    ESTIMATE_START(id);
+    ret = so_resize(inst, w, h);
+    ESTIMATE_END(id);
+    if (ret < 0) {
+       return ret;
+    }
+
+    if (ret & DBOX_NEED_TO_SCHEDULE) {
+       DbgPrint("%s Returns DBOX_NEED_TO_SCHEDULE\n", pkgname);
+       (void)append_pending_list(item);
+    }
+
+    if (ret & DBOX_FORCE_TO_SCHEDULE) {
+       DbgPrint("%s Return DBOX_NEED_TO_FORCE_SCHEDULE\n", pkgname);
+       (void)append_force_update_list(item);
+    }
+
+    if (ret & DBOX_OUTPUT_UPDATED) {
+       update_monitor_cnt(item);
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+HAPI char *dbox_pinup(const char *pkgname, const char *id, int pinup)
+{
+    struct instance *inst;
+    char *ret;
+
+    inst = so_find_instance(pkgname, id);
+    if (!inst) {
+       ErrPrint("Instance %s - %s is not found (pinup[%d])\n", pkgname, id, pinup);
+       return NULL;
+    }
+
+    ret = so_pinup(inst, pinup);
+    return ret;
+}
+
+HAPI int dbox_set_period(const char *pkgname, const char *id, double period)
+{
+    Eina_List *l;
+    struct instance *inst;
+    struct item *item;
+
+    inst = so_find_instance(pkgname, id);
+    if (!inst) {
+       ErrPrint("Instance %s - %s is not found (period[%lf])\n", pkgname, id, period);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    l = find_item(inst);
+    if (!l) {
+       ErrPrint("Instance is not found (%s - %s, period[%lf])\n", pkgname, id, period);
+       return DBOX_STATUS_ERROR_NOT_EXIST;
+    }
+
+    item = eina_list_data_get(l);
+
+    if (period <= 0.0f) {
+       if (item->timer) {
+           ecore_timer_del(item->timer);
+           item->timer = NULL;
+       }
+    } else {
+       if (item->timer) {
+           util_timer_interval_set(item->timer, period);
+       } else if (!s_info.secured) {
+           item->timer = util_timer_add(period, updator_cb, item);
+           if (!item->timer) {
+               ErrPrint("Failed to add timer (%s - %s)\n", pkgname, id);
+               return DBOX_STATUS_ERROR_FAULT;
+           }
+
+           if (s_info.paused) {
+               timer_freeze(item);
+           }
+       }
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+HAPI int dbox_clicked(const char *pkgname, const char *id, const char *event, double timestamp, double x, double y)
+{
+    Eina_List *l;
+    struct instance *inst;
+    struct item *item;
+    int ret;
+
+    inst = so_find_instance(pkgname, id);
+    if (!inst) {
+       ErrPrint("Instance %s - %s is not exists (event[%s])\n", pkgname, id, event);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    l = find_item(inst);
+    if (!l) {
+       ErrPrint("Instance is not found (%s - %s, event[%s])\n", pkgname, id, event);
+       return DBOX_STATUS_ERROR_NOT_EXIST;
+    }
+
+    item = eina_list_data_get(l);
+
+    ESTIMATE_START(id);
+    ret = so_clicked(inst, event, timestamp, x, y);
+    ESTIMATE_END(id);
+    if (ret < 0) {
+       return ret;
+    }
+
+    if (ret & DBOX_NEED_TO_SCHEDULE) {
+       DbgPrint("%s Returns DBOX_NEED_TO_SCHEDULE\n", pkgname);
+       (void)append_pending_list(item);
+    }
+
+    if (ret & DBOX_FORCE_TO_SCHEDULE) {
+       DbgPrint("%s Return DBOX_NEED_TO_FORCE_SCHEDULE\n", pkgname);
+       (void)append_force_update_list(item);
+    }
+
+    if (ret & DBOX_OUTPUT_UPDATED) {
+       update_monitor_cnt(item);
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+HAPI int dbox_script_event(const char *pkgname, const char *id, const char *emission, const char *source, dynamicbox_event_info_t event_info)
+{
+    Eina_List *l;
+    struct instance *inst;
+    struct item *item;
+    int ret;
+
+    inst = so_find_instance(pkgname, id);
+    if (!inst) {
+       ErrPrint("Instance %s - %s is not exists (emission[%s], source[%s])\n", pkgname, id, emission, source);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    l = find_item(inst);
+    if (!l) {
+       ErrPrint("Instance is not found (%s - %s, emissino[%s], source[%s])\n", pkgname, id, emission, source);
+       return DBOX_STATUS_ERROR_NOT_EXIST;
+    }
+
+    item = eina_list_data_get(l);
+
+    if (emission && source && !strcmp(source, id)) {
+       if (item->inst->item->has_dynamicbox_script) {
+           if (!strcmp(emission, "dbox,show")) {
+               item->is_dbox_show = 1;
+
+               migrate_to_pending_list_from_hidden_list(item);
+
+               if (item->is_dbox_updated && !is_pended_item(item)) {
+                   reset_dbox_updated_flag(item);
+               }
+
+               source = util_uri_to_path(source);
+           } else if (!strcmp(emission, "dbox,hide")) {
+               DbgPrint("Livebox(%s) script is hide now\n", id);
+               item->is_dbox_show = 0;
+
+               source = util_uri_to_path(source);
+           }
+       }
+
+       if (!strcmp(emission, "gbar,show")) {
+           item->is_gbar_show = 1;
+           source = util_uri_to_path(source);
+       } else if (!strcmp(emission, "gbar,hide")) {
+           item->is_gbar_show = 0;
+           source = util_uri_to_path(source);
+       }
+    }
+
+    ESTIMATE_START(id);
+    ret = so_script_event(inst, emission, source, event_info);
+    ESTIMATE_END(id);
+    if (ret < 0) {
+       return ret;
+    }
+
+    if (ret & DBOX_NEED_TO_SCHEDULE) {
+       DbgPrint("%s Returns DBOX_NEED_TO_SCHEDULE\n", pkgname);
+       (void)append_pending_list(item);
+    }
+
+    if (ret & DBOX_FORCE_TO_SCHEDULE) {
+       DbgPrint("%s Return DBOX_NEED_TO_FORCE_SCHEDULE\n", pkgname);
+       (void)append_force_update_list(item);
+    }
+
+    if (ret & DBOX_OUTPUT_UPDATED) {
+       update_monitor_cnt(item);
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+HAPI int dbox_is_pinned_up(const char *pkgname, const char *id)
+{
+    Eina_List *l;
+    struct instance *inst;
+    struct item *item;
+
+    inst = so_find_instance(pkgname, id);
+    if (!inst) {
+       ErrPrint("Instance %s - %s is not created\n", pkgname, id);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    l = find_item(inst);
+    if (!l) {
+       ErrPrint("Instance is not found(%s - %s)\n", pkgname, id);
+       return DBOX_STATUS_ERROR_NOT_EXIST;
+    }
+
+    item = eina_list_data_get(l);
+    if (!item) {
+       ErrPrint("Invalid item(%s - %s)\n", pkgname, id);
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+    /*!
+     * NOTE:
+     * item is not used.
+     * Maybe this is not neccessary for this operation
+     */
+    return so_is_pinned_up(inst);
+}
+
+HAPI int dbox_change_group(const char *pkgname, const char *id, const char *cluster, const char *category)
+{
+    Eina_List *l;
+    struct instance *inst;
+    struct item *item;
+    int ret;
+
+    inst = so_find_instance(pkgname, id);
+    if (!inst) {
+       ErrPrint("Instance %s - %s is not created (cluster[%s], category[%s])\n", pkgname, id, cluster, category);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    l = find_item(inst);
+    if (!l) {
+       ErrPrint("Instance is not found(%s - %s, cluster[%s], category[%s])\n", pkgname, id, cluster, category);
+       return DBOX_STATUS_ERROR_NOT_EXIST;
+    }
+
+    item = eina_list_data_get(l);
+
+    ret = so_change_group(inst, cluster, category);
+    if (ret < 0) {
+       return ret;
+    }
+
+    if (ret & DBOX_NEED_TO_SCHEDULE) {
+       DbgPrint("%s Returns DBOX_NEED_TO_SCHEDULE\n", pkgname);
+       (void)append_pending_list(item);
+    }
+
+    if (ret & DBOX_FORCE_TO_SCHEDULE) {
+       DbgPrint("%s Return DBOX_NEED_TO_FORCE_SCHEDULE\n", pkgname);
+       (void)append_force_update_list(item);
+    }
+
+    if (ret & DBOX_OUTPUT_UPDATED) {
+       update_monitor_cnt(item);
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+static int dbox_sys_event(struct instance *inst, struct item *item, int event)
+{
+    int ret;
+
+    ret = so_sys_event(inst, event);
+    if (ret < 0) {
+       return ret;
+    }
+
+    if (ret & DBOX_NEED_TO_SCHEDULE) {
+       (void)append_pending_list(item);
+    }
+
+    if (ret & DBOX_FORCE_TO_SCHEDULE) {
+       DbgPrint("%s Return DBOX_NEED_TO_FORCE_SCHEDULE\n", item->inst->item->pkgname);
+       (void)append_force_update_list(item);
+    }
+
+    if (ret & DBOX_OUTPUT_UPDATED) {
+       update_monitor_cnt(item);
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+HAPI int dbox_system_event(const char *pkgname, const char *id, int event)
+{
+    Eina_List *l;
+    struct instance *inst;
+    struct item *item;
+
+    inst = so_find_instance(pkgname, id);
+    if (!inst) {
+       ErrPrint("instance %s - %s is not created\n", pkgname, id);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    l = find_item(inst);
+    if (!l) {
+       ErrPrint("Instance is not found(%s - %s)\n", pkgname, id);
+       return DBOX_STATUS_ERROR_NOT_EXIST;
+    }
+
+    item = eina_list_data_get(l);
+    return dbox_sys_event(inst, item, event);
+}
+
+HAPI int dbox_update(const char *pkgname, const char *id, int force)
+{
+    Eina_List *l;
+    struct instance *inst;
+    struct item *item;
+
+    inst = so_find_instance(pkgname, id);
+    if (!inst) {
+       ErrPrint("Instance %s - %s is not created\n", pkgname, id);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    l = find_item(inst);
+    if (!l) {
+       ErrPrint("Instance is not found(%s - %s)\n", pkgname, id);
+       return DBOX_STATUS_ERROR_NOT_EXIST;
+    }
+
+    item = eina_list_data_get(l);
+    if (force && gbar_is_opened(pkgname) != GBAR_IS_OPENED) {
+       (void)append_force_update_list(item);
+    } else {
+       (void)append_pending_list(item);
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+HAPI int dbox_set_content_info(const char *pkgname, const char *id, const char *content_info)
+{
+    Eina_List *l;
+    struct instance *inst;
+    struct item *item;
+    int ret;
+
+    inst = so_find_instance(pkgname, id);
+    if (!inst) {
+       ErrPrint("Instance %s - %s is not created (%s)\n", pkgname, id, content_info);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    l = find_item(inst);
+    if (!l) {
+       ErrPrint("Instance is not found (%s - %s, %s)\n", pkgname, id, content_info);
+       return DBOX_STATUS_ERROR_NOT_EXIST;
+    }
+
+    item = eina_list_data_get(l);
+    ESTIMATE_START(id);
+    ret = so_set_content_info(inst, content_info);
+    ESTIMATE_END(id);
+    if (ret < 0) {
+       return ret;
+    }
+
+    if (ret & DBOX_NEED_TO_SCHEDULE) {
+       DbgPrint("%s Returns DBOX_NEED_TO_SCHEDULE\n", pkgname);
+       (void)append_pending_list(item);
+    }
+
+    if (ret & DBOX_FORCE_TO_SCHEDULE) {
+       DbgPrint("%s Return DBOX_NEED_TO_FORCE_SCHEDULE\n", pkgname);
+       (void)append_force_update_list(item);
+    }
+
+    if (ret & DBOX_OUTPUT_UPDATED) {
+       update_monitor_cnt(item);
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+HAPI int dbox_update_all(const char *pkgname, const char *cluster, const char *category, int force)
+{
+    Eina_List *l;
+    Eina_List *n;
+    struct item *item;
+
+    DbgPrint("Update content for %s\n", pkgname ? pkgname : "(all)");
+    EINA_LIST_FOREACH_SAFE(s_info.item_list, l, n, item) {
+       if (item->deleteme) {
+           continue;
+       }
+
+       if (cluster && strcasecmp(item->inst->cluster, cluster)) {
+           continue;
+       }
+
+       if (category && strcasecmp(item->inst->category, category)) {
+           continue;
+       }
+
+       if (pkgname && strlen(pkgname)) {
+           if (!strcmp(item->inst->item->pkgname, pkgname)) {
+               if (force && gbar_is_opened(pkgname) != GBAR_IS_OPENED) {
+                   (void)append_force_update_list(item);
+               } else {
+                   (void)append_pending_list(item);
+               }
+           }
+       } else {
+           if (force) {
+               DbgPrint("Update All function doesn't support force update to all dynamicboxes\n");
+           } else {
+               (void)append_pending_list(item);
+           }
+       }
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+HAPI int dbox_set_content_info_all(const char *pkgname, const char *content)
+{
+    Eina_List *l;
+    Eina_List *n;
+    struct item *item;
+    register int cnt = 0;
+
+    EINA_LIST_FOREACH_SAFE(s_info.item_list, l, n, item) {
+       if (item->deleteme) {
+           continue;
+       }
+
+       if (pkgname && strlen(pkgname)) {
+           if (!strcmp(item->inst->item->pkgname, pkgname)) {
+               dbox_set_content_info(item->inst->item->pkgname, item->inst->id, content);
+               cnt++;
+           }
+       } else {
+           dbox_set_content_info(item->inst->item->pkgname, item->inst->id, content);
+           cnt++;
+       }
+    }
+    DbgPrint("Update content for %s - %d\n", pkgname ? pkgname : "(all)", cnt);
+
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+HAPI int dbox_delete_all_deleteme(void)
+{
+    Eina_List *l;
+    Eina_List *n;
+    struct item *item;
+    int cnt = 0;
+
+    EINA_LIST_FOREACH_SAFE(s_info.item_list, l, n, item) {
+       if (!item->deleteme) {
+           continue;
+       }
+
+       update_monitor_del(item->inst->id, item);
+       (void)so_destroy(item->inst, item->unload_so);
+       free(item);
+       cnt++;
+    }
+
+    DbgPrint("Delete all deleteme: %d\n", cnt);
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+HAPI int dbox_delete_all(void)
+{
+    Eina_List *l;
+    Eina_List *n;
+    struct item *item;
+    int cnt = 0;
+
+    EINA_LIST_FOREACH_SAFE(s_info.item_list, l, n, item) {
+       update_monitor_del(item->inst->id, item);
+       (void)so_destroy(item->inst, item->unload_so);
+       free(item);
+       cnt++;
+    }
+
+    DbgPrint("Delete all deleteme: %d\n", cnt);
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+HAPI int dbox_system_event_all(int event)
+{
+    Eina_List *l;
+    Eina_List *n;
+    struct item *item;
+
+    EINA_LIST_FOREACH_SAFE(s_info.item_list, l, n, item) {
+       if (item->deleteme) {
+           continue;
+       }
+
+       DbgPrint("System event for %s (%d)\n", item->inst->id, event);
+       dbox_sys_event(item->inst, item, event);
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+HAPI void dbox_pause_all(void)
+{
+    Eina_List *l;
+    struct item *item;
+
+    s_info.paused = 1;
+
+    pending_timer_freeze();
+    /*!
+     * \note
+     * force timer will not be freezed
+     */
+
+    EINA_LIST_FOREACH(s_info.item_list, l, item) {
+       if (item->deleteme) {
+           DbgPrint("Instance %s skip timer pause (deleteme)\n", item->inst->item->pkgname);
+           continue;
+       }
+
+       if (item->is_paused) {
+           continue;
+       }
+
+       timer_freeze(item);
+
+       dbox_sys_event(item->inst, item, DBOX_SYS_EVENT_PAUSED);
+    }
+}
+
+HAPI void dbox_resume_all(void)
+{
+    Eina_List *l;
+    Eina_List *n;
+    struct item *item;
+
+    s_info.paused = 0;
+
+    pending_timer_thaw();
+
+    /*!
+     * \note
+     * force timer will not affected by this
+     */
+
+    EINA_LIST_FOREACH_SAFE(s_info.item_list, l, n, item) {
+       if (item->deleteme) {
+           DbgPrint("Instance %s skip timer resume (deleteme)\n", item->inst->item->pkgname);
+           continue;
+       }
+
+       if (item->is_paused) {
+           continue;
+       }
+
+       dbox_sys_event(item->inst, item, DBOX_SYS_EVENT_RESUMED);
+
+       if (item->updated_in_pause) {
+           (void)append_pending_list(item);
+           item->updated_in_pause = 0;
+       }
+
+       /*!
+        * \note
+        * After send the resume callback, call this function.
+        * Because the timer_thaw can call the update function.
+        * Before resumed event is notified to the dynamicbox,
+        * Do not call update function
+        */
+       if (timer_thaw(item) == UPDATE_ITEM_DELETED) {
+           /* item is deleted */
+       }
+    }
+}
+
+HAPI int dbox_pause(const char *pkgname, const char *id)
+{
+    struct instance *inst;
+    Eina_List *l;
+    struct item *item;
+
+    inst = so_find_instance(pkgname, id);
+    if (!inst) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    l = find_item(inst);
+    if (!l) {
+       ErrPrint("Instance is not found (%s - %s)\n", pkgname, id);
+       return DBOX_STATUS_ERROR_NOT_EXIST;
+    }
+
+    item = eina_list_data_get(l);
+    if (!item) {
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    if (item->deleteme) {
+       DbgPrint("Instance %s will be deleted (%s)\n", item->inst->item->pkgname, item->inst->id);
+       return DBOX_STATUS_ERROR_BUSY;
+    }
+
+    item->is_paused = 1;
+
+    if (s_info.paused) {
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    timer_freeze(item);
+
+    dbox_sys_event(inst, item, DBOX_SYS_EVENT_PAUSED);
+
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+HAPI int dbox_resume(const char *pkgname, const char *id)
+{
+    struct instance *inst;
+    Eina_List *l;
+    struct item *item;
+    int ret;
+
+    inst = so_find_instance(pkgname, id);
+    if (!inst) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    l = find_item(inst);
+    if (!l) {
+       ErrPrint("Instance is not found (%s - %s)\n", pkgname, id);
+       return DBOX_STATUS_ERROR_NOT_EXIST;
+    }
+
+    item = eina_list_data_get(l);
+    if (!item) {
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    if (item->deleteme) {
+       DbgPrint("Instance %s will be deleted (%s)\n", item->inst->item->pkgname, item->inst->id);
+       return DBOX_STATUS_ERROR_BUSY;
+    }
+
+    item->is_paused = 0;
+
+    if (s_info.paused) {
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    dbox_sys_event(inst, item, DBOX_SYS_EVENT_RESUMED);
+
+    ret = timer_thaw(item);
+    if (ret == UPDATE_ITEM_DELETED) {
+       /*!
+        * \note
+        * ITEM is deleted
+        */
+       return DBOX_STATUS_ERROR_NONE;
+    } else if (ret == UPDATE_INVOKED) {
+       /*!
+        * \note
+        * if the update is successfully done, the updated_in_pause will be reset'd.
+        * or append it to the pending list
+        */
+    }
+
+    if (item->updated_in_pause) {
+       (void)append_pending_list(item);
+       item->updated_in_pause = 0;
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+HAPI void dbox_turn_secured_on(void)
+{
+    s_info.secured = 1;
+}
+
+HAPI int dbox_is_all_paused(void)
+{
+    return s_info.paused;
+}
+
+/* End of a file */
index 73160c0..1114678 100644 (file)
 #include <Eina.h>
 #include <Ecore.h>
 
-#include <provider.h>
+#include <dynamicbox_provider.h>
+#include <dynamicbox_conf.h>
 
 #include "critical_log.h"
 #include "main.h"
 #include "debug.h"
 #include "fault.h"
-#include "conf.h"
 #include "client.h"
 #include "util.h"
+#include "conf.h"
 
 static struct info {
 #if defined(_USE_ECORE_TIME_GET)
-       double alarm_tv;
+    double alarm_tv;
 #else
-       struct timeval alarm_tv;
+    struct timeval alarm_tv;
 #endif
-       int marked;
-       int disable_checker;
-       struct sigaction SEGV_act;
-       struct sigaction ILL_act;
-       struct sigaction ALRM_act;
-       struct sigaction USR1_act;
-       struct sigaction ABRT_act;
-       char **argv;
+    int marked;
+    int disable_checker;
+    struct sigaction SEGV_act;
+    struct sigaction ILL_act;
+    struct sigaction ALRM_act;
+    struct sigaction USR1_act;
+    struct sigaction ABRT_act;
+    char **argv;
 } s_info = {
-       .marked = 0,
-       .disable_checker = 0,
-       .argv = NULL,
+    .marked = 0,
+    .disable_checker = 0,
+    .argv = NULL,
 };
 
 static void signal_handler(int signum, siginfo_t *info, void *unused)
 {
-       char *so_fname;
-       char *symbol = NULL;
+    char *so_fname;
+    char *symbol = NULL;
 
-       so_fname = util_get_current_module(&symbol);
+    so_fname = util_get_current_module(&symbol);
 
-       if (info->si_signo == SIGALRM) {
-               if (!s_info.marked) {
-                       DbgPrint("Ignore false alarm signal [false]\n");
-                       return;
-               }
+    if (info->si_signo == SIGALRM) {
+       if (!s_info.marked) {
+           DbgPrint("Ignore false alarm signal [false]\n");
+           return;
+       }
 
 #if defined(_USE_ECORE_TIME_GET)
-               double tv;
-               tv = ecore_time_get();
-               if (tv - s_info.alarm_tv < DEFAULT_LIFE_TIMER) {
-                       DbgPrint("Ignore false alarm signal [%lf]\n", tv - s_info.alarm_tv);
-                       return;
-               }
-
-               CRITICAL_LOG("ALARM: %lf (%d, %d)\n", tv - s_info.alarm_tv, DEFAULT_LIFE_TIMER, DEFAULT_LOAD_TIMER);
-#else
-               struct timeval tv;
-               struct timeval res_tv;
-
-               if (gettimeofday(&tv, NULL) < 0) {
-                       ErrPrint("gettimeofday: %s\n", strerror(errno));
-                       tv.tv_sec = 0;
-                       tv.tv_usec = 0;
-               }
-
-               timersub(&tv, &s_info.alarm_tv, &res_tv);
-
-               /*!
-                * \note
-                *      GAP: 1 sec
-                */
-               if (res_tv.tv_sec < DEFAULT_LIFE_TIMER) {
-                       DbgPrint("Ignore false alarm signal [%d]\n", res_tv.tv_sec);
-                       return;
-               }
-
-               CRITICAL_LOG("ALARM: %d.%d (%d, %d)\n",
-                               res_tv.tv_sec, res_tv.tv_usec, DEFAULT_LIFE_TIMER, DEFAULT_LOAD_TIMER);
-#endif
-       } else if (so_fname) {
-               int fd;
-               char log_fname[256];
-
-               snprintf(log_fname, sizeof(log_fname), "%s/slave.%d", SLAVE_LOG_PATH, getpid());
-               fd = open(log_fname, O_WRONLY|O_CREAT|O_SYNC, 0644);
-               if (fd >= 0) {
-                       if (write(fd, so_fname, strlen(so_fname)) != strlen(so_fname)) {
-                               ErrPrint("Failed to recording the fault SO filename (%s)\n", so_fname);
-                       }
-                       if (close(fd) < 0) {
-                               ErrPrint("close: %s\n", strerror(errno));
-                       }
-               }
+       double tv;
+       tv = ecore_time_get();
+       if (tv - s_info.alarm_tv < DEFAULT_LIFE_TIMER) {
+           DbgPrint("Ignore false alarm signal [%lf]\n", tv - s_info.alarm_tv);
+           return;
        }
 
-       CRITICAL_LOG("SIGNAL> Received from PID[%d]\n", info->si_pid);
-       CRITICAL_LOG("SIGNAL> Signal: %d (%d)\n", signum, info->si_signo);
-       CRITICAL_LOG("SIGNAL> Error code: %d\n", info->si_code);
-       CRITICAL_LOG("SIGNAL> Address: %p\n", info->si_addr);
-       CRITICAL_LOG("Package: [%s] Symbol[%s]\n", so_fname, symbol);
-
-       if (so_fname) {
-               int len = strlen(s_info.argv[0]);
-               memset(s_info.argv[0], 0, len);
-               strncpy(s_info.argv[0], util_basename(so_fname), len - 1);
-               free(so_fname);
-       } else {
-               CRITICAL_LOG("Unable to find a so_fname (%s)\n", symbol);
+       CRITICAL_LOG("ALARM: %lf (%d, %d)\n", tv - s_info.alarm_tv, DEFAULT_LIFE_TIMER, DEFAULT_LOAD_TIMER);
+#else
+       struct timeval tv;
+       struct timeval res_tv;
+
+       if (gettimeofday(&tv, NULL) < 0) {
+           ErrPrint("gettimeofday: %s\n", strerror(errno));
+           tv.tv_sec = 0;
+           tv.tv_usec = 0;
        }
 
-       free(symbol);
+       timersub(&tv, &s_info.alarm_tv, &res_tv);
+
+       /*!
+        * \note
+        *      GAP: 1 sec
+        */
+       if (res_tv.tv_sec < DEFAULT_LIFE_TIMER) {
+           DbgPrint("Ignore false alarm signal [%d]\n", res_tv.tv_sec);
+           return;
+       }
 
-       switch (signum) {
+       CRITICAL_LOG("ALARM: %d.%d (%d, %d)\n",
+               res_tv.tv_sec, res_tv.tv_usec, DEFAULT_LIFE_TIMER, DEFAULT_LOAD_TIMER);
+#endif
+    } else if (so_fname) {
+       int fd;
+       char log_fname[256];
+
+       snprintf(log_fname, sizeof(log_fname), "%s/slave.%d", DYNAMICBOX_CONF_LOG_PATH, getpid());
+       fd = open(log_fname, O_WRONLY|O_CREAT|O_SYNC, 0644);
+       if (fd >= 0) {
+           if (write(fd, so_fname, strlen(so_fname)) != strlen(so_fname)) {
+               ErrPrint("Failed to recording the fault SO filename (%s)\n", so_fname);
+           }
+           if (close(fd) < 0) {
+               ErrPrint("close: %s\n", strerror(errno));
+           }
+       }
+    }
+
+    CRITICAL_LOG("SIGNAL> Received from PID[%d]\n", info->si_pid);
+    CRITICAL_LOG("SIGNAL> Signal: %d (%d)\n", signum, info->si_signo);
+    CRITICAL_LOG("SIGNAL> Error code: %d\n", info->si_code);
+    CRITICAL_LOG("SIGNAL> Address: %p\n", info->si_addr);
+    CRITICAL_LOG("Package: [%s] Symbol[%s]\n", so_fname, symbol);
+
+    if (so_fname) {
+       int len = strlen(s_info.argv[0]);
+       memset(s_info.argv[0], 0, len);
+       strncpy(s_info.argv[0], util_basename(so_fname), len - 1);
+       free(so_fname);
+    } else {
+       CRITICAL_LOG("Unable to find a so_fname (%s)\n", symbol);
+    }
+
+    free(symbol);
+
+    switch (signum) {
        case SIGSEGV:
-               s_info.SEGV_act.sa_sigaction(signum, info, unused);
-               break;
+           s_info.SEGV_act.sa_sigaction(signum, info, unused);
+           break;
        case SIGALRM:
-               s_info.ALRM_act.sa_sigaction(signum, info, unused);
-               break;
+           s_info.ALRM_act.sa_sigaction(signum, info, unused);
+           break;
        case SIGABRT:
-               s_info.ABRT_act.sa_sigaction(signum, info, unused);
-               break;
+           s_info.ABRT_act.sa_sigaction(signum, info, unused);
+           break;
        case SIGILL:
-               s_info.ILL_act.sa_sigaction(signum, info, unused);
-               break;
+           s_info.ILL_act.sa_sigaction(signum, info, unused);
+           break;
        case SIGUSR1:
-               s_info.USR1_act.sa_sigaction(signum, info, unused);
-               break;
+           s_info.USR1_act.sa_sigaction(signum, info, unused);
+           break;
        default:
-               ErrPrint("Unhandled signal\n");
-               break;
-       }
+           ErrPrint("Unhandled signal\n");
+           break;
+    }
 }
 
 HAPI int fault_init(char **argv)
 {
-       struct sigaction act;
-       char *ecore_abort;
+    struct sigaction act;
+    char *ecore_abort;
 
-       s_info.argv = argv;
+    s_info.argv = argv;
 
-       act.sa_sigaction = signal_handler;
-       act.sa_flags = SA_SIGINFO;
+    act.sa_sigaction = signal_handler;
+    act.sa_flags = SA_SIGINFO;
 
-       if (sigemptyset(&act.sa_mask) != 0) {
-               ErrPrint("Failed to init signal: %s\n", strerror(errno));
-       }
+    if (sigemptyset(&act.sa_mask) != 0) {
+       ErrPrint("Failed to init signal: %s\n", strerror(errno));
+    }
 
-       if (sigaddset(&act.sa_mask, SIGUSR1) != 0) {
-               ErrPrint("Failed to add set: %s\n", strerror(errno));
-       }
+    if (sigaddset(&act.sa_mask, SIGUSR1) != 0) {
+       ErrPrint("Failed to add set: %s\n", strerror(errno));
+    }
 
-       if (sigaddset(&act.sa_mask, SIGALRM) != 0) {
-               ErrPrint("Failed to add set: %s\n", strerror(errno));
+    if (sigaddset(&act.sa_mask, SIGALRM) != 0) {
+       ErrPrint("Failed to add set: %s\n", strerror(errno));
+    }
+
+    ecore_abort = getenv("ECORE_ERROR_ABORT");
+    if (!ecore_abort || ecore_abort[0] != '1') {
+       if (sigaddset(&act.sa_mask, SIGSEGV) != 0) {
+           ErrPrint("Failed to add set: %s\n", strerror(errno));
+       }
+       if (sigaddset(&act.sa_mask, SIGABRT) != 0) {
+           ErrPrint("Failed to add set: %s\n", strerror(errno));
+       }
+       if (sigaddset(&act.sa_mask, SIGILL) != 0) {
+           ErrPrint("Failed to add set: %s\n", strerror(errno));
        }
 
-       ecore_abort = getenv("ECORE_ERROR_ABORT");
-       if (!ecore_abort || ecore_abort[0] != '1') {
-               if (sigaddset(&act.sa_mask, SIGSEGV) != 0) {
-                       ErrPrint("Failed to add set: %s\n", strerror(errno));
-               }
-               if (sigaddset(&act.sa_mask, SIGABRT) != 0) {
-                       ErrPrint("Failed to add set: %s\n", strerror(errno));
-               }
-               if (sigaddset(&act.sa_mask, SIGILL) != 0) {
-                       ErrPrint("Failed to add set: %s\n", strerror(errno));
-               }
-
-               if (sigaction(SIGSEGV, &act, &s_info.SEGV_act) < 0) {
-                       ErrPrint("Failed to install the SEGV handler\n");
-               }
-
-               if (sigaction(SIGABRT, &act, &s_info.ABRT_act) < 0) {
-                       ErrPrint("Faield to install the ABRT handler\n");
-               }
-
-               if (sigaction(SIGILL, &act, &s_info.ILL_act) < 0) {
-                       ErrPrint("Faield to install the ILL handler\n");
-               }
+       if (sigaction(SIGSEGV, &act, &s_info.SEGV_act) < 0) {
+           ErrPrint("Failed to install the SEGV handler\n");
        }
 
-       if (sigaction(SIGUSR1, &act, &s_info.USR1_act) < 0) {
-               ErrPrint("Failed to install the USR1 handler\n");
+       if (sigaction(SIGABRT, &act, &s_info.ABRT_act) < 0) {
+           ErrPrint("Faield to install the ABRT handler\n");
        }
 
-       if (sigaction(SIGALRM, &act, &s_info.ALRM_act) < 0) {
-               ErrPrint("Failed to install the ALRM handler\n");
+       if (sigaction(SIGILL, &act, &s_info.ILL_act) < 0) {
+           ErrPrint("Faield to install the ILL handler\n");
        }
+    }
+
+    if (sigaction(SIGUSR1, &act, &s_info.USR1_act) < 0) {
+       ErrPrint("Failed to install the USR1 handler\n");
+    }
+
+    if (sigaction(SIGALRM, &act, &s_info.ALRM_act) < 0) {
+       ErrPrint("Failed to install the ALRM handler\n");
+    }
 
-       return 0;
+    return 0;
 }
 
 HAPI int fault_fini(void)
 {
-       /*!
-        * \todo
-        * remove all signal handlers
-        */
-       return 0;
+    /*!
+     * \todo
+     * remove all signal handlers
+     */
+    return 0;
 }
 
 HAPI int fault_mark_call(const char *pkgname, const char *filename, const char *funcname, int noalarm, int life_time)
 {
-       if (!s_info.disable_checker) {
-               provider_send_call(pkgname, filename, funcname);
-       }
-       /*!
-        * \NOTE
-        *   To use this "alarm", the livebox have to do not use the 'sleep' series functions.
-        *   because those functions will generate alarm signal.
-        *   then the module will be deactivated
-        *
-        *   Enable alarm for detecting infinite loop
-        */
-       if (!noalarm) {
+    if (!s_info.disable_checker) {
+       dynamicbox_provider_send_call(pkgname, filename, funcname);
+    }
+    /*!
+     * \NOTE
+     *   To use this "alarm", the dynamicbox have to do not use the 'sleep' series functions.
+     *   because those functions will generate alarm signal.
+     *   then the module will be deactivated
+     *
+     *   Enable alarm for detecting infinite loop
+     */
+    if (!noalarm) {
 #if defined(_USE_ECORE_TIME_GET)
-               s_info.alarm_tv = ecore_time_get();
+       s_info.alarm_tv = ecore_time_get();
 #else
-               if (gettimeofday(&s_info.alarm_tv, NULL) < 0) {
-                       ErrPrint("gettimeofday: %s\n", strerror(errno));
-                       s_info.alarm_tv.tv_sec = 0;
-                       s_info.alarm_tv.tv_usec = 0;
-               }
-#endif
-               s_info.marked = 1;
-               alarm(life_time);
+       if (gettimeofday(&s_info.alarm_tv, NULL) < 0) {
+           ErrPrint("gettimeofday: %s\n", strerror(errno));
+           s_info.alarm_tv.tv_sec = 0;
+           s_info.alarm_tv.tv_usec = 0;
        }
+#endif
+       s_info.marked = 1;
+       alarm(life_time);
+    }
 
-       return 0;
+    return 0;
 }
 
 HAPI int fault_unmark_call(const char *pkgname, const char *filename, const char *funcname, int noalarm)
 {
-       if (!noalarm) {
-               /*!
-                * \NOTE
-                * Disable alarm
-                */
-               alarm(0);
-               s_info.marked = 0;
-       }
-
-       if (!s_info.disable_checker) {
-               provider_send_ret(pkgname, filename, funcname);
-       }
-       return 0;
+    if (!noalarm) {
+       /*!
+        * \NOTE
+        * Disable alarm
+        */
+       alarm(0);
+       s_info.marked = 0;
+    }
+
+    if (!s_info.disable_checker) {
+       dynamicbox_provider_send_ret(pkgname, filename, funcname);
+    }
+    return 0;
 }
 
 HAPI void fault_disable_call_option(void)
 {
-       s_info.disable_checker = 1;
+    s_info.disable_checker = 1;
 }
 
 /* End of a file */
diff --git a/src/lb.c b/src/lb.c
deleted file mode 100644 (file)
index d7d814a..0000000
--- a/src/lb.c
+++ /dev/null
@@ -1,2300 +0,0 @@
-/*
- * Copyright 2013  Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h>
-#include <stdlib.h> /* exit */
-#include <errno.h>
-#include <unistd.h> /* access */
-
-#include <Ecore.h>
-#include <Eina.h>
-
-#include <dlog.h>
-#include <provider.h>
-#include <livebox.h>
-#include <livebox-errno.h>
-
-#include "critical_log.h"
-#include "debug.h"
-#include "conf.h"
-#include "so_handler.h"
-#include "lb.h"
-#include "update_monitor.h"
-#include "fault.h"
-#include "util.h"
-
-#if defined(_ESTIMATE_PERF)
-#define ESTIMATE_START(id)     DbgPrint("%s START\n", id);
-#define ESTIMATE_END(id)       DbgPrint("%s END\n", id);
-#else
-#define ESTIMATE_START(id)
-#define ESTIMATE_END(id)
-#endif
-
-#define IS_LB_SHOWN(itm) (!(itm)->inst->item->has_livebox_script || ((itm)->inst->item->has_livebox_script && (itm)->is_lb_show))
-
-int errno;
-
-#define UPDATE_ITEM_DELETED    (-1)
-#define UPDATE_INVOKED         (-2)
-#define UPDATE_NOT_INVOKED     (0)
-
-enum pd_open_state {
-       PD_IS_OPENED_BUT_NOT_MINE = -1,
-       PD_IS_NOT_OPENED = 0,
-       PD_IS_OPENED = 1,
-};
-
-struct item {
-       Ecore_Timer *timer;
-       struct instance *inst;
-       int monitor_cnt;
-       Ecore_Timer *monitor;
-       int deleteme;
-       double update_interval;
-       int heavy_updating; /* Only for debugging message */
-       int is_paused; /* 1 is paused, 0 is resumed */
-       double sleep_at;
-
-       unsigned int updated_in_pause;
-
-       int is_lb_show;
-       int is_pd_show;
-       int is_lb_updated;
-};
-
-static struct info {
-       Eina_List *item_list;
-       Eina_List *force_update_list;
-       Eina_List *update_list;
-       Eina_List *pending_list;
-       Eina_List *hidden_list;
-       Ecore_Timer *force_update_timer;
-       Ecore_Timer *pending_timer;
-       Eina_List *pd_open_pending_list;
-       Ecore_Timer *pd_open_pending_timer;
-       int paused;
-       Eina_List *pd_list;
-       int secured;
-       int pending_timer_freezed;
-       int force_timer_freezed;
-} s_info  = {
-       .item_list = NULL,
-       .force_update_list = NULL,
-       .update_list = NULL,
-       .pending_list = NULL,
-       .hidden_list = NULL,
-       .force_update_timer = NULL,
-       .pending_timer = NULL,
-       .pd_open_pending_list = NULL,
-       .pd_open_pending_timer = NULL,
-       .paused = 0,
-       .pd_list = NULL,
-       .secured = 0,
-       .pending_timer_freezed = 0,
-       .force_timer_freezed = 0,
-};
-
-static Eina_Bool updator_cb(void *data);
-static inline void update_monitor_del(const char *id, struct item *item);
-static int append_force_update_list(struct item *item);
-static void reset_lb_updated_flag(struct item *item);
-static int append_pending_list(struct item *item);
-
-static void pending_timer_freeze(void)
-{
-       DbgPrint("Freezed Count: %d\n", s_info.pending_timer_freezed);
-       if (!s_info.pending_timer) {
-               return;
-       }
-
-       if (!s_info.pending_timer_freezed) {
-               DbgPrint("Freeze the pending timer\n");
-               ecore_timer_freeze(s_info.pending_timer);
-       }
-
-       s_info.pending_timer_freezed++;
-}
-
-static void pending_timer_thaw(void)
-{
-       DbgPrint("Freezed Count: %d\n", s_info.pending_timer_freezed);
-       if (!s_info.pending_timer_freezed) {
-               return;
-       }
-
-       if (!s_info.pending_timer) {
-               s_info.pending_timer_freezed = 0;
-               return;
-       }
-
-       s_info.pending_timer_freezed--;
-       if (!s_info.pending_timer_freezed) {
-               DbgPrint("Thaw the pending timer\n");
-               ecore_timer_thaw(s_info.pending_timer);
-       }
-}
-
-static void force_timer_freeze(void)
-{
-       DbgPrint("Freeze force timer: %d\n", s_info.force_timer_freezed);
-       if (!s_info.force_update_timer) {
-               return;
-       }
-
-       if (!s_info.force_timer_freezed) {
-               DbgPrint("Force timer freezed\n");
-               ecore_timer_freeze(s_info.force_update_timer);
-       }
-
-       s_info.force_timer_freezed++;
-}
-
-static void force_timer_thaw(void)
-{
-       DbgPrint("Freezed force count: %d\n", s_info.force_timer_freezed);
-       if (!s_info.force_timer_freezed) {
-               return;
-       }
-
-       if (!s_info.force_update_timer) {
-               s_info.force_timer_freezed = 0;
-               return;
-       }
-
-       s_info.force_timer_freezed--;
-       if (!s_info.force_timer_freezed) {
-               DbgPrint("Thaw the force timer\n");
-               ecore_timer_thaw(s_info.force_update_timer);
-       }
-}
-
-/*
- * -1 : PD is opened, but not mine
- *  0 : PD is not opened
- *  1 : my PD is opened
- */
-static inline enum pd_open_state pd_is_opened(const char *pkgname)
-{
-       int i;
-       Eina_List *l;
-       struct instance *inst;
-
-       i = 0;
-       EINA_LIST_FOREACH(s_info.pd_list, l, inst) {
-               if (pkgname && !strcmp(pkgname, inst->item->pkgname)) {
-                       return PD_IS_OPENED;
-               }
-
-               i++;
-       }
-
-       return i > 0 ? PD_IS_OPENED_BUT_NOT_MINE : PD_IS_NOT_OPENED;
-}
-
-static Eina_Bool pd_open_pended_cmd_consumer_cb(void *data)
-{
-       struct item *item;
-
-       item = eina_list_nth(s_info.pd_open_pending_list, 0);
-       if (!item) {
-               goto cleanout;
-       }
-
-       if (eina_list_data_find(s_info.update_list, item)) {
-               return ECORE_CALLBACK_RENEW;
-       }
-
-       s_info.pd_open_pending_list = eina_list_remove(s_info.pd_open_pending_list, item);
-       /*!
-        * \note
-        * To prevent from checking the is_updated function
-        */
-       if (updator_cb(item) == ECORE_CALLBACK_CANCEL) {
-               /* Item is destroyed */
-       }
-
-       if (s_info.pd_open_pending_list) {
-               return ECORE_CALLBACK_RENEW;
-       }
-
-cleanout:
-       s_info.pd_open_pending_timer = NULL;
-       return ECORE_CALLBACK_CANCEL;
-}
-
-static Eina_Bool update_timeout_cb(void *data)
-{
-       struct item *item;
-
-       item = data;
-
-       ErrPrint("UPDATE TIMEOUT ========> %s - %s\n", item->inst->item->pkgname, item->inst->id);
-
-       if (!eina_list_data_find(s_info.update_list, item)) {
-               ErrPrint("Updating item is not matched\n");
-       }
-
-       fault_unmark_call(item->inst->item->pkgname, item->inst->id, "update,crashed", NO_ALARM);
-       fault_mark_call(item->inst->item->pkgname, item->inst->id, "update,timeout", NO_ALARM, DEFAULT_LIFE_TIMER);
-       s_info.update_list = eina_list_remove(s_info.update_list, item);
-
-       exit(ETIME);
-       return ECORE_CALLBACK_CANCEL;
-}
-
-static inline void update_monitor_cnt(struct item *item)
-{
-       double now;
-       double interval;
-
-       now = util_timestamp();
-       interval = now - item->update_interval;
-
-       /*!
-        * \note
-        * If the content update is processed in too short time,
-        * don't increase the monitor counter, instead of it
-        * set the heavy updating flag.
-        * And handling this heavy updating from the
-        * file update callback.
-        */
-       if (interval >= MINIMUM_UPDATE_INTERVAL) {
-               if (eina_list_data_find(s_info.update_list, item)) {
-                       /*!
-                        * \note
-                        * If already in updating mode,
-                        * reset the monitor_cnt to 1,
-                        * all updated event will be merged into A inotify event
-                        */
-                       DbgPrint("While waiting updated event, content is updated [%s]\n", item->inst->id);
-                       item->monitor_cnt = 1;
-               } else {
-                       item->monitor_cnt++;
-               }
-       } else {
-               item->heavy_updating = 1;
-       }
-
-       item->update_interval = now;
-}
-
-static inline void do_force_update(struct item *item)
-{
-       int ret;
-
-       if (item->monitor) { /*!< If this item is already in update process */
-               return;
-       }
-
-       if (!IS_LB_SHOWN(item)) {
-               DbgPrint("%s is not shown yet. it will be added to normal pending list\n", item->inst->item->pkgname);
-               (void)append_force_update_list(item);
-               return;
-       }
-
-       if (item->is_paused) {
-               DbgPrint("Item is paused. but it will be updated forcely(%s)\n", item->inst->item->pkgname);
-       }
-
-       item->updated_in_pause = 0;
-
-       ret = so_is_updated(item->inst);
-       if (ret <= 0) {
-               if (so_need_to_destroy(item->inst) == NEED_TO_DESTROY) {
-                       provider_send_deleted(item->inst->item->pkgname, item->inst->id);
-                       lb_destroy(item->inst->item->pkgname, item->inst->id);
-                       /*!
-                        * \CRITICAL
-                        * Every caller of this, must not access the item from now.
-                        */
-                       return;
-               }
-
-               reset_lb_updated_flag(item);
-               return;
-       }
-
-       /*!
-        * \note
-        * Check the update_list, if you want make serialized update
-        */
-       if (/*s_info.update_list || */pd_is_opened(item->inst->item->pkgname) == PD_IS_OPENED_BUT_NOT_MINE) {
-               DbgPrint("%s is busy, migrate to normal pending list\n", item->inst->id);
-               (void)append_pending_list(item);
-               return;
-       }
-
-       item->monitor = ecore_timer_add(item->inst->item->timeout, update_timeout_cb, item);
-       if (!item->monitor) {
-               ErrPrint("Failed to add update monitor %s(%s):%d\n",
-                                       item->inst->item->pkgname, item->inst->id, item->inst->item->timeout);
-               return;
-       }
-
-       ret = so_update(item->inst);
-       if (ret < 0) {
-               ecore_timer_del(item->monitor);
-               item->monitor = NULL;
-               reset_lb_updated_flag(item);
-               return;
-       }
-
-       /*!
-        * \note
-        * Counter of the event monitor is only used for asynchronous content updating,
-        * So reset it to 1 from here because the async updating is started now,
-        * even if it is accumulated by other event function before this.
-        */
-       item->monitor_cnt = 1;
-
-       /*!
-        * \note
-        * While waiting the Callback function call,
-        * Add this for finding the crash
-        */
-       fault_mark_call(item->inst->item->pkgname, item->inst->id, "update,crashed", NO_ALARM, DEFAULT_LIFE_TIMER);
-
-       if (ret & NEED_TO_SCHEDULE) {
-               (void)append_pending_list(item);
-       }
-
-       if (ret & FORCE_TO_SCHEDULE) {
-               DbgPrint("%s Return NEED_TO_FORCE_SCHEDULE\n", item->inst->item->pkgname);
-               (void)append_force_update_list(item);
-       }
-
-       if (ret & OUTPUT_UPDATED) {
-               /*!
-                * \NOTE 
-                * In this case, there is potential issue
-                * 1. User added update CALLBACK -> Inotify event (Only once)
-                *    > We have to detect this case. Is it possible to be a user callback called faster than inotify event handler?
-                * 2. Inotify event -> User added update CALLBACK -> Inotify event
-                *    > Okay. What we want is this.
-                */
-               update_monitor_cnt(item);
-       }
-
-       /*
-        * \NOTE
-        * This should be updated after "update_monitor_cnt" function call,
-        * because the update_monitor_cnt function will see the s_info.update variable,
-        */
-       s_info.update_list = eina_list_append(s_info.update_list, item);
-
-       return;
-}
-
-static Eina_Bool force_update_cb(void *data)
-{
-       struct item *item;
-
-       item = eina_list_nth(s_info.force_update_list, 0);
-       if (!item) {
-               goto cleanout;
-       }
-
-       s_info.force_update_list = eina_list_remove(s_info.force_update_list, item);
-
-       do_force_update(item);
-
-       if (s_info.force_update_list) {
-               return ECORE_CALLBACK_RENEW;
-       }
-
-cleanout:
-       s_info.force_update_timer = NULL;
-       return ECORE_CALLBACK_CANCEL;
-}
-
-static inline __attribute__((always_inline)) int activate_force_update_consumer(void)
-{
-       if (s_info.force_update_timer) {
-               return LB_STATUS_SUCCESS;
-       }
-
-       s_info.force_update_timer = ecore_timer_add(0.000001f, force_update_cb, NULL);
-       if (!s_info.force_update_timer) {
-               ErrPrint("Failed to add a new force update timer\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       DbgPrint("Force update timer is registered\n");
-
-       return LB_STATUS_SUCCESS;
-}
-
-static inline void deactivate_force_update_consumer(void)
-{
-       if (!s_info.force_update_timer) {
-               return;
-       }
-
-       ecore_timer_del(s_info.force_update_timer);
-       s_info.force_update_timer = NULL;
-
-       DbgPrint("Force update timer is deleted\n");
-}
-
-static Eina_Bool pended_cmd_consumer_cb(void *data)
-{
-       struct item *item;
-
-       item = eina_list_nth(s_info.pending_list, 0);
-       if (!item) {
-               goto cleanout;
-       }
-
-       if (eina_list_data_find(s_info.update_list, item) || pd_is_opened(item->inst->item->pkgname) == PD_IS_OPENED_BUT_NOT_MINE) {
-               return ECORE_CALLBACK_RENEW;
-       }
-
-       s_info.pending_list = eina_list_remove(s_info.pending_list, item);
-       /*!
-        * \note
-        * To prevent from checking the is_updated function
-        */
-       if (updator_cb(item) == ECORE_CALLBACK_CANCEL) {
-               /* item is destroyed */
-       }
-
-       if (s_info.pending_list) {
-               return ECORE_CALLBACK_RENEW;
-       }
-
-cleanout:
-       s_info.pending_timer = NULL;
-       s_info.pending_timer_freezed = 0;
-       return ECORE_CALLBACK_CANCEL;
-}
-
-static inline __attribute__((always_inline)) int activate_pending_consumer(void)
-{
-       if (s_info.pending_timer) {
-               return LB_STATUS_SUCCESS;
-       }
-
-       s_info.pending_timer = ecore_timer_add(0.000001f, pended_cmd_consumer_cb, NULL);
-       if (!s_info.pending_timer) {
-               ErrPrint("Failed to add a new pended command consumer\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       /*!
-        * Do not increase the freezed counter.
-        * Just freeze the timer.
-        */
-       if (s_info.pending_timer_freezed) {
-               ecore_timer_freeze(s_info.pending_timer);
-       }
-
-       return LB_STATUS_SUCCESS;
-}
-
-static inline void deactivate_pending_consumer(void)
-{
-       if (!s_info.pending_timer) {
-               return;
-       }
-
-       ecore_timer_del(s_info.pending_timer);
-       s_info.pending_timer = NULL;
-       s_info.pending_timer_freezed = 0;
-}
-
-static inline void deactivate_pd_open_pending_consumer(void)
-{
-       if (!s_info.pd_open_pending_timer) {
-               return;
-       }
-
-       ecore_timer_del(s_info.pd_open_pending_timer);
-       s_info.pd_open_pending_timer = NULL;
-}
-
-static inline int __attribute__((always_inline)) activate_pd_open_pending_consumer(void)
-{
-       if (s_info.pd_open_pending_timer) {
-               return 0;
-       }
-
-       s_info.pd_open_pending_timer = ecore_timer_add(0.000001f, pd_open_pended_cmd_consumer_cb, NULL);
-       if (!s_info.pd_open_pending_timer) {
-               ErrPrint("Failed to add a new pended command consumer\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       return 0;
-}
-
-static inline void migrate_to_pd_open_pending_list(const char *pkgname)
-{
-       Eina_List *l;
-       Eina_List *n;
-       struct item *item;
-       int cnt = 0;
-
-       EINA_LIST_FOREACH_SAFE(s_info.pending_list, l, n, item) {
-               if (strcmp(pkgname, item->inst->item->pkgname)) {
-                       continue;
-               }
-
-               s_info.pending_list = eina_list_remove(s_info.pending_list, item);
-               s_info.pd_open_pending_list = eina_list_append(s_info.pd_open_pending_list, item);
-               cnt++;
-       }
-
-       /*!
-        * These items will be moved to the pending list after the PD is closed.
-        * Force list -> pd open list -> pending list.
-        * So there is no way to go back to the foce update list again.
-        *
-        * \warning
-        * the ITEM must only exists in one list, pending list or force_update_list
-        * It is not accepted to exists in two list at same time.
-        */
-       EINA_LIST_FOREACH_SAFE(s_info.force_update_list, l, n, item) {
-               if (strcmp(pkgname, item->inst->item->pkgname)) {
-                       continue;
-               }
-
-               s_info.force_update_list = eina_list_remove(s_info.force_update_list, item);
-               s_info.pd_open_pending_list = eina_list_append(s_info.pd_open_pending_list, item);
-               cnt++;
-       }
-
-       if (s_info.pd_open_pending_list) {
-               activate_pd_open_pending_consumer();
-       }
-
-       if (!s_info.pending_list) {
-               deactivate_pending_consumer();
-       }
-
-       if (!s_info.force_update_list) {
-               deactivate_force_update_consumer();
-       }
-}
-
-static inline void migrate_to_pending_list(const char *pkgname)
-{
-       Eina_List *l;
-       Eina_List *n;
-       struct item *item;
-       int cnt = 0;
-
-       EINA_LIST_FOREACH_SAFE(s_info.pd_open_pending_list, l, n, item) {
-               if (strcmp(pkgname, item->inst->item->pkgname)) {
-                       continue;
-               }
-
-               s_info.pd_open_pending_list = eina_list_remove(s_info.pd_open_pending_list, item);
-               s_info.pending_list = eina_list_append(s_info.pending_list, item);
-               cnt++;
-       }
-
-       if (s_info.pending_list) {
-               activate_pending_consumer();
-       }
-
-       if (!s_info.pd_open_pending_list) {
-               deactivate_pd_open_pending_consumer();
-       }
-}
-
-static inline int is_pended_item(struct item *item)
-{
-       struct item *in_item;
-       if (pd_is_opened(item->inst->item->pkgname) == PD_IS_OPENED) {
-               in_item = eina_list_data_find(s_info.pd_open_pending_list, item);
-       } else {
-               in_item = eina_list_data_find(s_info.pending_list, item);
-       }
-
-       return (in_item == item);
-}
-
-static int append_pending_list(struct item *item)
-{
-       if (item->deleteme) {
-               DbgPrint("Item will be deleted, ignore update request: %s\n", item->inst->id);
-               return LB_STATUS_ERROR_BUSY;
-       }
-
-       if (eina_list_data_find(s_info.force_update_list, item)) {
-               DbgPrint("Already exists in force list\n");
-               return LB_STATUS_SUCCESS;
-       }
-
-       if (pd_is_opened(item->inst->item->pkgname) == PD_IS_OPENED) {
-               if (eina_list_data_find(s_info.pd_open_pending_list, item) == item) {
-                       DbgPrint("Already pended - %s\n", item->inst->item->pkgname);
-                       return LB_STATUS_ERROR_EXIST;
-               }
-
-               if (activate_pd_open_pending_consumer() < 0) {
-                       ErrPrint("Failed to activate PD open pending consumer\n");
-                       return LB_STATUS_ERROR_FAULT;
-               }
-
-               s_info.pd_open_pending_list = eina_list_append(s_info.pd_open_pending_list, item);
-       } else {
-               if (eina_list_data_find(s_info.pending_list, item) == item) {
-                       DbgPrint("Already pended - %s\n", item->inst->item->pkgname);
-                       return LB_STATUS_ERROR_EXIST;
-               }
-
-               if (IS_LB_SHOWN(item)) {
-                       if (activate_pending_consumer() < 0) {
-                               return LB_STATUS_ERROR_FAULT;
-                       }
-
-                       s_info.pending_list = eina_list_append(s_info.pending_list, item);
-               } else {
-                       if (eina_list_data_find(s_info.hidden_list, item) == item) {
-                               DbgPrint("Already in hidden list - %s\n", item->inst->item->pkgname);
-                               return LB_STATUS_ERROR_EXIST;
-                       }
-
-                       s_info.hidden_list = eina_list_append(s_info.hidden_list, item);
-               }
-       }
-
-       return LB_STATUS_SUCCESS;
-}
-
-static inline int clear_from_pending_list(struct item *item)
-{
-       Eina_List *l;
-       struct item *tmp;
-
-       EINA_LIST_FOREACH(s_info.pending_list, l, tmp) {
-               if (tmp != item) {
-                       continue;
-               }
-
-               s_info.pending_list = eina_list_remove_list(s_info.pending_list, l);
-               if (!s_info.pending_list) {
-                       deactivate_pending_consumer();
-               }
-               return LB_STATUS_SUCCESS;
-       }
-
-       return LB_STATUS_ERROR_NOT_EXIST;
-}
-
-static int append_force_update_list(struct item *item)
-{
-       if (item->deleteme) {
-               DbgPrint("Item will be deleted, ignore force update request: %s\n", item->inst->id);
-               return LB_STATUS_ERROR_BUSY;
-       }
-
-       /*!
-        * If the item is already in pending list, remove it.
-        */
-       clear_from_pending_list(item);
-
-       if (pd_is_opened(item->inst->item->pkgname) == PD_IS_OPENED) {
-               if (eina_list_data_find(s_info.pd_open_pending_list, item) == item) {
-                       DbgPrint("Already pended - %s\n", item->inst->item->pkgname);
-                       return LB_STATUS_ERROR_EXIST;
-               }
-
-               if (activate_pd_open_pending_consumer() < 0) {
-                       ErrPrint("Failed to activate PD open pending consumer\n");
-                       return LB_STATUS_ERROR_FAULT;
-               }
-
-               s_info.pd_open_pending_list = eina_list_append(s_info.pd_open_pending_list, item);
-       } else {
-               if (eina_list_data_find(s_info.force_update_list, item)) {
-                       DbgPrint("Already in force update list\n");
-                       return LB_STATUS_SUCCESS;
-               }
-
-               if (IS_LB_SHOWN(item)) {
-                       if (activate_force_update_consumer() < 0) {
-                               return LB_STATUS_ERROR_FAULT;
-                       }
-
-                       s_info.force_update_list = eina_list_append(s_info.force_update_list, item);
-               } else {
-                       if (eina_list_data_find(s_info.hidden_list, item) == item) {
-                               DbgPrint("Already in hidden list - %s\n", item->inst->id);
-                               return LB_STATUS_ERROR_EXIST;
-                       }
-
-                       s_info.hidden_list = eina_list_append(s_info.hidden_list, item);
-
-                       DbgPrint("forced item is moved to hidden_list - %s\n", item->inst->id);
-               }
-       }
-
-       return LB_STATUS_SUCCESS;
-}
-
-static inline int clear_from_force_update_list(struct item *item)
-{
-       Eina_List *l;
-       struct item *tmp;
-
-       EINA_LIST_FOREACH(s_info.force_update_list, l, tmp) {
-               if (tmp != item) {
-                       continue;
-               }
-
-               s_info.force_update_list = eina_list_remove_list(s_info.force_update_list, l);
-               if (!s_info.force_update_list) {
-                       deactivate_force_update_consumer();
-               }
-
-               return LB_STATUS_SUCCESS;
-       }
-
-       return LB_STATUS_ERROR_NOT_EXIST;
-}
-
-static inline void migrate_to_pending_list_from_hidden_list(struct item *item)
-{
-       if (!eina_list_data_find(s_info.hidden_list, item)) {
-               return;
-       }
-
-       s_info.hidden_list = eina_list_remove(s_info.hidden_list, item);
-       append_pending_list(item);
-}
-
-/*!
- * \brief
- *   This function can call the update callback
- * return 0 if there is no changes
- * return -1 the item is deleted
- */
-static inline int timer_thaw(struct item *item)
-{
-       double pending;
-       double period;
-       double delay;
-       double sleep_time;
-
-       if (!item->timer) {
-               return 0;
-       }
-
-       ecore_timer_thaw(item->timer);
-       period = ecore_timer_interval_get(item->timer);
-       pending = ecore_timer_pending_get(item->timer);
-       delay = util_time_delay_for_compensation(period) - pending;
-       ecore_timer_delay(item->timer, delay);
-
-       if (item->sleep_at == 0.0f) {
-               return 0;
-       }
-
-       sleep_time = util_timestamp() - item->sleep_at;
-       item->sleep_at = 0.0f;
-
-       if (sleep_time > pending) {
-
-               /*!
-                * Before do updating forcely, clear it from the pending list.
-                * We will consume it from here now.
-                */
-               (void)clear_from_pending_list(item);
-
-               if (updator_cb(item) == ECORE_CALLBACK_CANCEL) {
-                       /* item is destroyed */
-                       return UPDATE_ITEM_DELETED;
-               } else {
-                       return UPDATE_INVOKED;
-               }
-       }
-
-       return UPDATE_NOT_INVOKED;
-}
-
-static void timer_freeze(struct item *item)
-{
-       if (!item->timer) {
-               return;
-       }
-
-       ecore_timer_freeze(item->timer);
-
-       if (ecore_timer_interval_get(item->timer) <= 1.0f) {
-               return;
-       }
-
-#if defined(_USE_ECORE_TIME_GET)
-       item->sleep_at = ecore_time_get();
-#else
-       struct timeval tv;
-       if (gettimeofday(&tv, NULL) < 0) {
-               ErrPrint("gettimeofday: %s\n", strerror(errno));
-               tv.tv_sec = 0;
-               tv.tv_usec = 0;
-       }
-
-       item->sleep_at = (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0f;
-#endif
-}
-
-static inline Eina_List *find_item(struct instance *inst)
-{
-       Eina_List *l;
-       struct item *item;
-       
-       EINA_LIST_FOREACH(s_info.item_list, l, item) {
-               if (item->inst == inst) {
-                       return l;
-               }
-       }
-
-       return NULL;
-}
-
-static int desc_updated_cb(const char *filename, void *data, int over)
-{
-       struct item *item;
-
-       if (over) {
-               WarnPrint("Event Q overflow\n");
-       }
-
-       item = data;
-
-       DbgPrint("DESC %s is updated\n", filename);
-       if (item->is_pd_show) {
-               provider_send_desc_updated(item->inst->item->pkgname, item->inst->id, filename);
-       } else {
-               ErrPrint("But PD is not opened, Ignore this update (%s)\n", item->inst->id);
-       }
-       return EXIT_SUCCESS;
-}
-
-static inline int output_handler(struct item *item)
-{
-       int invalid = 0;
-
-       item->monitor_cnt--;
-       if (item->monitor_cnt < 0 || item->heavy_updating) {
-               if (!item->heavy_updating) {
-                       WarnPrint("%s has invalid monitor_cnt\n", item->inst->id);
-                       invalid = 1;
-               } else {
-                       item->heavy_updating = 0;       /* Reset flag */
-               }
-
-               item->monitor_cnt = 0;
-       }
-
-       if (item->monitor_cnt == 0) {
-               if (!invalid) {
-                       fault_unmark_call(item->inst->item->pkgname, item->inst->id, "update,crashed", NO_ALARM);
-               }
-
-               if (item->monitor) {
-                       ecore_timer_del(item->monitor);
-                       item->monitor = NULL;
-               }
-
-               s_info.update_list = eina_list_remove(s_info.update_list, item);
-
-               if (item->deleteme) {
-                       update_monitor_del(item->inst->id, item);
-                       provider_send_deleted(item->inst->item->pkgname, item->inst->id);
-                       (void)so_destroy(item->inst);
-                       free(item);
-                       return EXIT_FAILURE;
-               }
-       }
-
-       return EXIT_SUCCESS;
-}
-
-static int file_updated_cb(const char *filename, void *data, int over)
-{
-       struct item *item;
-       int w;
-       int h;
-       double priority;
-       char *content = NULL;
-       char *title = NULL;
-       int ret;
-       char *icon = NULL;
-       char *name = NULL;
-
-       if (over) {
-               WarnPrint("Event Q overflow\n");
-       }
-
-       item = data;
-
-       if (item->deleteme) {
-               DbgPrint("Item is in deleting process. (%s)\n", filename);
-               goto out;
-       }
-
-       ESTIMATE_START(item->inst->id);
-
-       ret = util_get_filesize(filename);
-       if (ret <= 0) {
-               ErrPrint("Content is updated. but invalid. ret = %d (Update is ignored)\n", ret);
-               ESTIMATE_END(item->inst->id);
-               return EXIT_SUCCESS; /*!< To keep the callback */
-       }
-
-       ret = so_get_output_info(item->inst, &w, &h, &priority, &content, &title);
-       if (ret < 0) {
-               ErrPrint("livebox_get_info returns %d\n", ret);
-               ESTIMATE_END(item->inst->id);
-               return EXIT_SUCCESS; /*!< To keep the callback */
-       }
-
-       /*!
-        * Alternative information can be NOT_IMPLEMENTED
-        * And we can ignore its error.
-        */
-       ret = so_get_alt_info(item->inst, &icon, &name);
-       if (ret < 0) {
-               ErrPrint("livebox_get_alt_info returns %d (ignored)\n", ret);
-       }
-
-       if (IS_LB_SHOWN(item)) {
-               provider_send_updated_NEW(item->inst->item->pkgname, item->inst->id,
-                                       item->inst->w, item->inst->h, item->inst->priority,
-                                       content, title, item->inst->icon, item->inst->name);
-       } else {
-               item->is_lb_updated++;
-       }
-
-       ESTIMATE_END(item->inst->id);
-out:
-       return output_handler(item);
-}
-
-static void reset_lb_updated_flag(struct item *item)
-{
-       if (!item->is_lb_updated) {
-               return;
-       }
-
-       DbgPrint("[%s] Updated %d times, (content: %s), (title: %s)\n",
-                       item->inst->id, item->is_lb_updated,
-                       item->inst->content, item->inst->title);
-
-       provider_send_updated_NEW(item->inst->item->pkgname, item->inst->id,
-                       item->inst->w, item->inst->h, item->inst->priority,
-                       item->inst->content, item->inst->title, item->inst->icon, item->inst->name);
-
-       item->is_lb_updated = 0;
-}
-
-static inline int clear_from_pd_open_pending_list(struct item *item)
-{
-       Eina_List *l;
-       struct item *tmp;
-
-       EINA_LIST_FOREACH(s_info.pd_open_pending_list, l, tmp) {
-               if (tmp != item) {
-                       continue;
-               }
-
-               s_info.pd_open_pending_list = eina_list_remove_list(s_info.pd_open_pending_list, l);
-               if (!s_info.pd_open_pending_list) {
-                       deactivate_pd_open_pending_consumer();
-               }
-               return LB_STATUS_SUCCESS;
-       }
-
-       return LB_STATUS_ERROR_NOT_EXIST;
-}
-
-/*!
- * \note
- * This must has to return ECORE_CALLBACK_CANCEL, only if the item is deleted.
- * So every caller, should manage the deleted item correctly.
- */
-static Eina_Bool updator_cb(void *data)
-{
-       struct item *item;
-       int ret;
-
-       item = data;
-
-       if (item->monitor) { /*!< If this item is already in update process */
-               return ECORE_CALLBACK_RENEW;
-       }
-
-       if (!IS_LB_SHOWN(item)) {
-               DbgPrint("%s is not shown yet. make delay for updates\n", item->inst->item->pkgname);
-               (void)append_pending_list(item);
-               return ECORE_CALLBACK_RENEW;
-       }
-
-       if (item->is_paused) {
-               item->updated_in_pause++;
-               DbgPrint("%s is paused[%d]. make delay for updating\n", item->inst->item->pkgname, item->updated_in_pause);
-               return ECORE_CALLBACK_RENEW;
-       }
-
-       item->updated_in_pause = 0;
-
-       ret = so_is_updated(item->inst);
-       if (ret <= 0) {
-               if (so_need_to_destroy(item->inst) == NEED_TO_DESTROY) {
-                       provider_send_deleted(item->inst->item->pkgname, item->inst->id);
-                       lb_destroy(item->inst->item->pkgname, item->inst->id);
-                       /*!
-                        * \CRITICAL
-                        * Every caller of this, must not access the item from now.
-                        */
-                       return ECORE_CALLBACK_CANCEL;
-               }
-
-               reset_lb_updated_flag(item);
-               return ECORE_CALLBACK_RENEW;
-       }
-
-       /*!
-        * \note
-        * Check the update_list, if you want make serialized update
-        */
-       if (/*s_info.update_list || */pd_is_opened(item->inst->item->pkgname) == PD_IS_OPENED_BUT_NOT_MINE) {
-               DbgPrint("%s is busy\n", item->inst->id);
-               (void)append_pending_list(item);
-               return ECORE_CALLBACK_RENEW;
-       }
-
-       item->monitor = ecore_timer_add(item->inst->item->timeout, update_timeout_cb, item);
-       if (!item->monitor) {
-               ErrPrint("Failed to add update monitor %s(%s):%d\n",
-                                       item->inst->item->pkgname, item->inst->id, item->inst->item->timeout);
-               return ECORE_CALLBACK_RENEW;
-       }
-
-       ret = so_update(item->inst);
-       if (ret < 0) {
-               ecore_timer_del(item->monitor);
-               item->monitor = NULL;
-               reset_lb_updated_flag(item);
-               return ECORE_CALLBACK_RENEW;
-       }
-
-       /*!
-        * \note
-        * Counter of the event monitor is only used for asynchronous content updating,
-        * So reset it to 1 from here because the async updating is started now,
-        * even if it is accumulated by other event function before this.
-        */
-       item->monitor_cnt = 1;
-
-       /*!
-        * \note
-        * While waiting the Callback function call,
-        * Add this for finding the crash
-        */
-       fault_mark_call(item->inst->item->pkgname, item->inst->id, "update,crashed", NO_ALARM, DEFAULT_LIFE_TIMER);
-
-       if (ret & NEED_TO_SCHEDULE) {
-               (void)append_pending_list(item);
-       }
-
-       if (ret & FORCE_TO_SCHEDULE) {
-               DbgPrint("%s Return NEED_TO_FORCE_SCHEDULE\n", item->inst->item->pkgname);
-               (void)append_force_update_list(item);
-       }
-
-       if (ret & OUTPUT_UPDATED) {
-               /*!
-                * \NOTE 
-                * In this case, there is potential issue
-                * 1. User added update CALLBACK -> Inotify event (Only once)
-                *    > We have to detect this case. Is it possible to be a user callback called faster than inotify event handler?
-                * 2. Inotify event -> User added update CALLBACK -> Inotify event
-                *    > Okay. What we want is this.
-                */
-               update_monitor_cnt(item);
-       }
-
-       /*
-        * \NOTE
-        * This should be updated after "update_monitor_cnt" function call,
-        * because the update_monitor_cnt function will see the s_info.update variable,
-        */
-       s_info.update_list = eina_list_append(s_info.update_list, item);
-
-       return ECORE_CALLBACK_RENEW;
-}
-
-static inline void update_monitor_del(const char *id, struct item *item)
-{
-       char *tmp;
-       int len;
-
-       update_monitor_del_update_cb(util_uri_to_path(id), file_updated_cb);
-
-       len = strlen(util_uri_to_path(id)) + strlen(".desc") + 1;
-       tmp = malloc(len);
-       if (!tmp) {
-               ErrPrint("Heap: %s (%s.desc)\n", strerror(errno), util_uri_to_path(id));
-               return;
-       }
-
-       snprintf(tmp, len, "%s.desc", util_uri_to_path(id));
-       update_monitor_del_update_cb(tmp, desc_updated_cb);
-       free(tmp);
-}
-
-static inline int add_desc_update_monitor(const char *id, struct item *item)
-{
-       char *filename;
-       int len;
-       int ret;
-
-       len = strlen(util_uri_to_path(id)) + strlen(".desc") + 1;
-       filename = malloc(len);
-       if (!filename) {
-               ErrPrint("Heap: %s (%s.desc)\n", strerror(errno), util_uri_to_path(id));
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       snprintf(filename, len, "%s.desc", util_uri_to_path(id));
-       ret = update_monitor_add_update_cb(filename, desc_updated_cb, item);
-       free(filename);
-       return ret;
-}
-
-static inline int add_file_update_monitor(const char *id, struct item *item)
-{
-       return update_monitor_add_update_cb(util_uri_to_path(id), file_updated_cb, item);
-}
-
-static inline int update_monitor_add(const char *id, struct item *item)
-{
-       /*!
-        * \NOTE
-        * item->inst is not available yet.
-        */
-       add_file_update_monitor(id, item);
-       add_desc_update_monitor(id, item);
-       return LB_STATUS_SUCCESS;
-}
-
-HAPI int lb_init(void)
-{
-       return LB_STATUS_SUCCESS;
-}
-
-HAPI int lb_fini(void)
-{
-       Eina_List *l;
-       Eina_List *n;
-       struct item *item;
-
-       deactivate_pending_consumer();
-       deactivate_pd_open_pending_consumer();
-
-       EINA_LIST_FREE(s_info.pd_open_pending_list, item);
-       EINA_LIST_FREE(s_info.pending_list, item);
-
-       EINA_LIST_FOREACH_SAFE(s_info.item_list, l, n, item) {
-               provider_send_deleted(item->inst->item->pkgname, item->inst->id);
-               lb_destroy(item->inst->item->pkgname, item->inst->id);
-       }
-
-       return LB_STATUS_SUCCESS;
-}
-
-/*!
- * \note
- * Exported API for each liveboxes.
- */
-const char *livebox_find_pkgname(const char *filename)
-{
-       Eina_List *l;
-       struct item *item;
-
-       EINA_LIST_FOREACH(s_info.item_list, l, item) {
-               if (!strcmp(item->inst->id, filename)) {
-                       return item->inst->item->pkgname;
-               }
-       }
-
-       return NULL;
-}
-
-int livebox_update_extra_info(const char *id, const char *content, const char *title, const char *icon, const char *name)
-{
-       Eina_List *l;
-       struct item *item;
-
-       EINA_LIST_FOREACH(s_info.item_list, l, item) {
-               if (!strcmp(item->inst->id, id)) {
-                       if (content && strlen(content)) {
-                               char *_content;
-
-                               _content = strdup(content);
-                               if (_content) {
-                                       if (item->inst->content) {
-                                               free(item->inst->content);
-                                               item->inst->content = NULL;
-                                       }
-
-                                       item->inst->content = _content;
-                               } else {
-                                       ErrPrint("Heap: %s\n", strerror(errno));
-                               }
-                       }
-
-                       if (title && strlen(title)) {
-                               char *_title;
-
-                               _title = strdup(title);
-                               if (_title) {
-                                       if (item->inst->title) {
-                                               free(item->inst->title);
-                                               item->inst->title = NULL;
-                                       }
-
-                                       item->inst->title = _title;
-                               } else {
-                                       ErrPrint("Heap: %s\n", strerror(errno));
-                               }
-                       }
-
-                       if (icon && strlen(icon)) {
-                               char *_icon;
-
-                               _icon = strdup(icon);
-                               if (_icon) {
-                                       if (item->inst->icon) {
-                                               free(item->inst->icon);
-                                               item->inst->icon = NULL;
-                                       }
-
-                                       item->inst->icon = _icon;
-                               } else {
-                                       ErrPrint("Heap: %s\n", strerror(errno));
-                               }
-                       }
-
-                       if (name && strlen(name)) {
-                               char *_name;
-
-                               _name = strdup(name);
-                               if (_name) {
-                                       if (item->inst->name) {
-                                               free(item->inst->name);
-                                               item->inst->name = NULL;
-                                       }
-
-                                       item->inst->name = _name;
-                               } else {
-                                       ErrPrint("Heap: %s\n", strerror(errno));
-                               }
-                       }
-
-                       return LB_STATUS_SUCCESS;
-               }
-       }
-
-       return LB_STATUS_ERROR_NOT_EXIST;
-}
-
-int livebox_request_update_by_id(const char *filename)
-{
-       Eina_List *l;
-       struct item *item;
-
-       if (so_current_op() != LIVEBOX_OP_UNKNOWN) {
-               ErrPrint("Current operation: %d\n", so_current_op());
-               /*!
-                * \note
-                * Some case requires to update the content of other box from livebox_XXX ABI.
-                * In that case this function can be used so we have not to filter it from here.
-                * ex) Setting accessibility.
-                * Press the assistive light, turned on, need to update other instances too.
-                * Then the box will use this function from livebox_clicked function.
-                */
-       }
-
-       EINA_LIST_FOREACH(s_info.item_list, l, item) {
-               if (!strcmp(item->inst->id, filename)) {
-                       return append_pending_list(item);
-               }
-       }
-
-       return LB_STATUS_ERROR_NOT_EXIST;
-}
-
-int livebox_trigger_update_monitor(const char *filename, int is_pd)
-{
-       char *fname;
-       int ret;
-
-       if (so_current_op() != LIVEBOX_OP_UNKNOWN) {
-               ErrPrint("Current operation: %d\n", so_current_op());
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       if (is_pd) {
-               int len;
-               len = strlen(filename) + strlen(".desc");
-
-               fname = malloc(len + 1);
-               if (!fname) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       return LB_STATUS_ERROR_MEMORY;
-               }
-
-               snprintf(fname, len, "%s.desc", filename);
-       } else {
-               fname = strdup(filename);
-               if (!fname) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       return LB_STATUS_ERROR_MEMORY;
-               }
-       }
-
-       if (access(fname, R_OK | W_OK) != 0) {
-               ErrPrint("access: %s (%s)\n", fname, strerror(errno));
-               ret = LB_STATUS_ERROR_IO;
-       } else {
-               ret = update_monitor_trigger_update_cb(fname, 0);
-       }
-
-       free(fname);
-       return ret;
-}
-
-HAPI int lb_open_pd(const char *pkgname, const char *id)
-{
-       struct instance *inst;
-       struct instance *tmp;
-       Eina_List *l;
-
-       inst = so_find_instance(pkgname, id);
-       if (!inst) {
-               ErrPrint("Instance is not found\n");
-               return LB_STATUS_ERROR_NOT_EXIST;
-       }
-
-       EINA_LIST_FOREACH(s_info.pd_list, l, tmp) {
-               if (tmp == inst) {
-                       return 0;
-               }
-       }
-
-       if (!s_info.pd_list) {
-               pending_timer_freeze();
-
-               /*!
-                * \note
-                * Freeze the force timer only in this case.
-                */
-               force_timer_freeze();
-       }
-
-       s_info.pd_list = eina_list_append(s_info.pd_list, inst);
-
-       /*!
-        * Find all instances from the pending list.
-        * Move them to pd_open_pending_timer
-        */
-       migrate_to_pd_open_pending_list(pkgname);
-       return LB_STATUS_SUCCESS;
-}
-
-HAPI int lb_close_pd(const char *pkgname, const char *id)
-{
-       Eina_List *l;
-       Eina_List *n;
-       struct instance *tmp;
-       struct instance *inst;
-
-       inst = so_find_instance(pkgname, id);
-       if (!inst) {
-               ErrPrint("Insatnce is not found\n");
-               return LB_STATUS_ERROR_NOT_EXIST;
-       }
-
-       EINA_LIST_FOREACH_SAFE(s_info.pd_list, l, n, tmp) {
-               if (tmp != inst) {
-                       continue;
-               }
-
-               s_info.pd_list = eina_list_remove(s_info.pd_list, tmp);
-               if (!s_info.pd_list) {
-                       pending_timer_thaw();
-                       force_timer_thaw();
-               }
-
-               /*!
-                * Move all items in pd_open_pending_list
-                * to pending_list.
-                */
-               migrate_to_pending_list(pkgname);
-               return LB_STATUS_SUCCESS;
-       }
-
-       return LB_STATUS_ERROR_NOT_EXIST;
-}
-
-HAPI int lb_create(const char *pkgname, const char *id, const char *content_info, int timeout, int has_livebox_script, double period, const char *cluster, const char *category, int *w, int *h, double *priority, int skip_need_to_create, const char *abi, char **out_content, char **out_title)
-{
-       struct instance *inst;
-       struct item *item;
-       int ret;
-       int create_ret;
-       int need_to_create;
-
-       need_to_create = 0;
-       *out_content = NULL;
-       *out_title = NULL;
-
-       inst = so_find_instance(pkgname, id);
-       if (inst) {
-               DbgPrint("Instance is already exists [%s - %s] content[%s], cluster[%s], category[%s], abi[%s]\n", pkgname, id, content_info, cluster, category, abi);
-               return LB_STATUS_SUCCESS;
-       }
-
-       if (!skip_need_to_create) {
-               ret = so_create_needed(pkgname, cluster, category, abi);
-               if (ret != NEED_TO_CREATE) {
-                       return LB_STATUS_ERROR_PERMISSION;
-               }
-
-               need_to_create = 1;
-       }
-
-       item = calloc(1, sizeof(*item));
-       if (!item) {
-               ErrPrint("Heap: %s (%s - %s, content[%s], cluster[%s], category[%s], abi[%s])\n", strerror(errno), pkgname, id, content_info, cluster, category, abi);
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       ret = update_monitor_add(id, item);
-       if (ret < 0) {
-               free(item);
-               return ret;
-       }
-
-       create_ret = so_create(pkgname, id, content_info, timeout, has_livebox_script, cluster, category, abi, &inst);
-       if (create_ret < 0) {
-               update_monitor_del(id,  item);
-               free(item);
-
-               *w = 0;
-               *h = 0;
-               *priority = 0.0f;
-               return create_ret;
-       }
-
-       item->inst = inst;
-
-       if (period > 0.0f && !s_info.secured) {
-               item->timer = util_timer_add(period, updator_cb, item);
-               if (!item->timer) {
-                       ErrPrint("Failed to add timer (%s - %s, content[%s], cluster[%s], category[%s], abi[%s]\n", pkgname, id, content_info, cluster, category, abi);
-                       update_monitor_del(id, item);
-                       (void)so_destroy(inst);
-                       free(item);
-                       return LB_STATUS_ERROR_FAULT;
-               }
-
-               if (s_info.paused) {
-                       timer_freeze(item);
-               }
-       } else {
-               DbgPrint("Local update timer is disabled: %lf (%d)\n", period, s_info.secured);
-               item->timer = NULL;
-       }
-
-       s_info.item_list = eina_list_append(s_info.item_list, item);
-
-       if (create_ret & NEED_TO_SCHEDULE) {
-               DbgPrint("%s Returns NEED_TO_SCHEDULE\n", pkgname);
-               (void)append_pending_list(item);
-       }
-
-       if (create_ret & FORCE_TO_SCHEDULE) {
-               DbgPrint("%s Returns NEED_TO_FORCE_UPDATE\n", pkgname);
-               (void)append_force_update_list(item);
-       }
-
-       if (create_ret & OUTPUT_UPDATED) {
-               update_monitor_cnt(item);
-               /*!
-                * \note
-                * To send a output info, get the info forcely.
-                * but the output file monitor will do this again
-                *
-                * This function will set the tmp_content and tmp_title
-                * even if it has no updates on the content, title,
-                * it will set them to NULL.
-                */
-               if (so_get_output_info(inst, w, h, priority, out_content, out_title) == (int)LB_STATUS_SUCCESS) {
-                       if (*out_content) {
-                               char *tmp;
-
-                               tmp = strdup(*out_content);
-                               if (!tmp) {
-                                       ErrPrint("Memory: %s\n", strerror(errno));
-                               }
-
-                               *out_content = tmp;
-                       }
-
-                       if (*out_title) {
-                               char *tmp;
-
-                               tmp = strdup(*out_title);
-                               if (!tmp) {
-                                       ErrPrint("Memory: %s\n", strerror(errno));
-                               }
-
-                               *out_title = tmp;
-                       }
-               }
-       }
-
-       *w = inst->w;
-       *h = inst->h;
-       *priority = inst->priority;
-       return need_to_create;
-}
-
-HAPI int lb_destroy(const char *pkgname, const char *id)
-{
-       Eina_List *l;
-       Eina_List *n;
-       struct instance *inst;
-       struct instance *tmp;
-       struct item *item;
-
-       inst = so_find_instance(pkgname, id);
-       if (!inst) {
-               ErrPrint("Instance %s - %s is not created\n", pkgname, id);
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       EINA_LIST_FOREACH_SAFE(s_info.pd_list, l, n, tmp) {
-               if (tmp != inst) {
-                       continue;
-               }
-
-               s_info.pd_list = eina_list_remove(s_info.pd_list, tmp);
-               if (!s_info.pd_list) {
-                       pending_timer_thaw();
-                       force_timer_thaw();
-               }
-
-               /*!
-                * Move all items in pd_open_pending_list
-                * to pending_list.
-                */
-               migrate_to_pending_list(pkgname);
-               break;
-       }
-
-       l = find_item(inst);
-       if (!l) {
-               ErrPrint("Instance is not found (%s - %s)\n", pkgname, id);
-               return LB_STATUS_ERROR_NOT_EXIST;
-       }
-
-       item = eina_list_data_get(l);
-       s_info.item_list = eina_list_remove_list(s_info.item_list, l);
-
-       s_info.update_list = eina_list_remove(s_info.update_list, item);
-       s_info.hidden_list = eina_list_remove(s_info.hidden_list, item);
-       clear_from_pd_open_pending_list(item);
-       clear_from_pending_list(item);
-       clear_from_force_update_list(item);
-
-       if (item->timer) {
-               ecore_timer_del(item->timer);
-               item->timer = NULL;
-       }
-
-       if (item->monitor) {
-               item->deleteme = 1;
-       } else {
-               update_monitor_del(id, item);
-               free(item);
-               (void)so_destroy(inst);
-       }
-
-       return LB_STATUS_SUCCESS;
-}
-
-HAPI int lb_resize(const char *pkgname, const char *id, int w, int h)
-{
-       Eina_List *l;
-       struct instance *inst;
-       struct item *item;
-       int ret;
-
-       inst = so_find_instance(pkgname, id);
-       if (!inst) {
-               ErrPrint("Instance %s - %s is not created (%dx%d)\n", pkgname, id, w, h);
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       l = find_item(inst);
-       if (!l) {
-               ErrPrint("Instance is not found (%s - %s, %dx%d)\n", pkgname, id, w, h);
-               return LB_STATUS_ERROR_NOT_EXIST;
-       }
-
-       item = eina_list_data_get(l);
-
-       ESTIMATE_START(id);
-       ret = so_resize(inst, w, h);
-       ESTIMATE_END(id);
-       if (ret < 0) {
-               return ret;
-       }
-
-       if (ret & NEED_TO_SCHEDULE) {
-               DbgPrint("%s Returns NEED_TO_SCHEDULE\n", pkgname);
-               (void)append_pending_list(item);
-       }
-
-       if (ret & FORCE_TO_SCHEDULE) {
-               DbgPrint("%s Return NEED_TO_FORCE_SCHEDULE\n", pkgname);
-               (void)append_force_update_list(item);
-       }
-
-       if (ret & OUTPUT_UPDATED) {
-               update_monitor_cnt(item);
-       }
-
-       return LB_STATUS_SUCCESS;
-}
-
-HAPI char *lb_pinup(const char *pkgname, const char *id, int pinup)
-{
-       struct instance *inst;
-       char *ret;
-
-       inst = so_find_instance(pkgname, id);
-       if (!inst) {
-               ErrPrint("Instance %s - %s is not found (pinup[%d])\n", pkgname, id, pinup);
-               return NULL;
-       }
-
-       ret = so_pinup(inst, pinup);
-       return ret;
-}
-
-HAPI int lb_set_period(const char *pkgname, const char *id, double period)
-{
-       Eina_List *l;
-       struct instance *inst;
-       struct item *item;
-
-       inst = so_find_instance(pkgname, id);
-       if (!inst) {
-               ErrPrint("Instance %s - %s is not found (period[%lf])\n", pkgname, id, period);
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       l = find_item(inst);
-       if (!l) {
-               ErrPrint("Instance is not found (%s - %s, period[%lf])\n", pkgname, id, period);
-               return LB_STATUS_ERROR_NOT_EXIST;
-       }
-
-       item = eina_list_data_get(l);
-
-       if (period <= 0.0f) {
-               if (item->timer) {
-                       ecore_timer_del(item->timer);
-                       item->timer = NULL;
-               }
-       } else {
-               if (item->timer) {
-                       util_timer_interval_set(item->timer, period);
-               } else if (!s_info.secured) {
-                       item->timer = util_timer_add(period, updator_cb, item);
-                       if (!item->timer) {
-                               ErrPrint("Failed to add timer (%s - %s)\n", pkgname, id);
-                               return LB_STATUS_ERROR_FAULT;
-                       }
-
-                       if (s_info.paused) {
-                               timer_freeze(item);
-                       }
-               }
-       }
-
-       return LB_STATUS_SUCCESS;
-}
-
-HAPI int lb_clicked(const char *pkgname, const char *id, const char *event, double timestamp, double x, double y)
-{
-       Eina_List *l;
-       struct instance *inst;
-       struct item *item;
-       int ret;
-
-       inst = so_find_instance(pkgname, id);
-       if (!inst) {
-               ErrPrint("Instance %s - %s is not exists (event[%s])\n", pkgname, id, event);
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       l = find_item(inst);
-       if (!l) {
-               ErrPrint("Instance is not found (%s - %s, event[%s])\n", pkgname, id, event);
-               return LB_STATUS_ERROR_NOT_EXIST;
-       }
-
-       item = eina_list_data_get(l);
-
-       ESTIMATE_START(id);
-       ret = so_clicked(inst, event, timestamp, x, y);
-       ESTIMATE_END(id);
-       if (ret < 0) {
-               return ret;
-       }
-
-       if (ret & NEED_TO_SCHEDULE) {
-               DbgPrint("%s Returns NEED_TO_SCHEDULE\n", pkgname);
-               (void)append_pending_list(item);
-       }
-
-       if (ret & FORCE_TO_SCHEDULE) {
-               DbgPrint("%s Return NEED_TO_FORCE_SCHEDULE\n", pkgname);
-               (void)append_force_update_list(item);
-       }
-
-       if (ret & OUTPUT_UPDATED) {
-               update_monitor_cnt(item);
-       }
-
-       return LB_STATUS_SUCCESS;
-}
-
-HAPI int lb_script_event(const char *pkgname, const char *id, const char *emission, const char *source, struct event_info *event_info)
-{
-       Eina_List *l;
-       struct instance *inst;
-       struct item *item;
-       int ret;
-
-       inst = so_find_instance(pkgname, id);
-       if (!inst) {
-               ErrPrint("Instance %s - %s is not exists (emission[%s], source[%s])\n", pkgname, id, emission, source);
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       l = find_item(inst);
-       if (!l) {
-               ErrPrint("Instance is not found (%s - %s, emissino[%s], source[%s])\n", pkgname, id, emission, source);
-               return LB_STATUS_ERROR_NOT_EXIST;
-       }
-
-       item = eina_list_data_get(l);
-
-       if (emission && source && !strcmp(source, id)) {
-               if (item->inst->item->has_livebox_script) {
-                       if (!strcmp(emission, "lb,show")) {
-                               item->is_lb_show = 1;
-
-                               migrate_to_pending_list_from_hidden_list(item);
-
-                               if (item->is_lb_updated && !is_pended_item(item)) {
-                                       reset_lb_updated_flag(item);
-                               }
-
-                               source = util_uri_to_path(source);
-                       } else if (!strcmp(emission, "lb,hide")) {
-                               DbgPrint("Livebox(%s) script is hide now\n", id);
-                               item->is_lb_show = 0;
-
-                               source = util_uri_to_path(source);
-                       }
-               }
-
-               if (!strcmp(emission, "pd,show")) {
-                       item->is_pd_show = 1;
-                       source = util_uri_to_path(source);
-               } else if (!strcmp(emission, "pd,hide")) {
-                       item->is_pd_show = 0;
-                       source = util_uri_to_path(source);
-               }
-       }
-
-       ESTIMATE_START(id);
-       ret = so_script_event(inst, emission, source, event_info);
-       ESTIMATE_END(id);
-       if (ret < 0) {
-               return ret;
-       }
-
-       if (ret & NEED_TO_SCHEDULE) {
-               DbgPrint("%s Returns NEED_TO_SCHEDULE\n", pkgname);
-               (void)append_pending_list(item);
-       }
-
-       if (ret & FORCE_TO_SCHEDULE) {
-               DbgPrint("%s Return NEED_TO_FORCE_SCHEDULE\n", pkgname);
-               (void)append_force_update_list(item);
-       }
-
-       if (ret & OUTPUT_UPDATED) {
-               update_monitor_cnt(item);
-       }
-
-       return LB_STATUS_SUCCESS;
-}
-
-HAPI int lb_is_pinned_up(const char *pkgname, const char *id)
-{
-       Eina_List *l;
-       struct instance *inst;
-       struct item *item;
-
-       inst = so_find_instance(pkgname, id);
-       if (!inst) {
-               ErrPrint("Instance %s - %s is not created\n", pkgname, id);
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       l = find_item(inst);
-       if (!l) {
-               ErrPrint("Instance is not found(%s - %s)\n", pkgname, id);
-               return LB_STATUS_ERROR_NOT_EXIST;
-       }
-
-       item = eina_list_data_get(l);
-       if (!item) {
-               ErrPrint("Invalid item(%s - %s)\n", pkgname, id);
-               return LB_STATUS_ERROR_FAULT;
-       }
-       /*!
-        * NOTE:
-        * item is not used.
-        * Maybe this is not neccessary for this operation
-        */
-       return so_is_pinned_up(inst);
-}
-
-HAPI int lb_change_group(const char *pkgname, const char *id, const char *cluster, const char *category)
-{
-       Eina_List *l;
-       struct instance *inst;
-       struct item *item;
-       int ret;
-
-       inst = so_find_instance(pkgname, id);
-       if (!inst) {
-               ErrPrint("Instance %s - %s is not created (cluster[%s], category[%s])\n", pkgname, id, cluster, category);
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       l = find_item(inst);
-       if (!l) {
-               ErrPrint("Instance is not found(%s - %s, cluster[%s], category[%s])\n", pkgname, id, cluster, category);
-               return LB_STATUS_ERROR_NOT_EXIST;
-       }
-
-       item = eina_list_data_get(l);
-
-       ret = so_change_group(inst, cluster, category);
-       if (ret < 0) {
-               return ret;
-       }
-
-       if (ret & NEED_TO_SCHEDULE) {
-               DbgPrint("%s Returns NEED_TO_SCHEDULE\n", pkgname);
-               (void)append_pending_list(item);
-       }
-
-       if (ret & FORCE_TO_SCHEDULE) {
-               DbgPrint("%s Return NEED_TO_FORCE_SCHEDULE\n", pkgname);
-               (void)append_force_update_list(item);
-       }
-
-       if (ret & OUTPUT_UPDATED) {
-               update_monitor_cnt(item);
-       }
-
-       return LB_STATUS_SUCCESS;
-}
-
-static int lb_sys_event(struct instance *inst, struct item *item, int event)
-{
-       int ret;
-
-       ret = so_sys_event(inst, event);
-       if (ret < 0) {
-               return ret;
-       }
-
-       if (ret & NEED_TO_SCHEDULE) {
-               (void)append_pending_list(item);
-       }
-
-       if (ret & FORCE_TO_SCHEDULE) {
-               DbgPrint("%s Return NEED_TO_FORCE_SCHEDULE\n", item->inst->item->pkgname);
-               (void)append_force_update_list(item);
-       }
-
-       if (ret & OUTPUT_UPDATED) {
-               update_monitor_cnt(item);
-       }
-
-       return LB_STATUS_SUCCESS;
-}
-
-HAPI int lb_system_event(const char *pkgname, const char *id, int event)
-{
-       Eina_List *l;
-       struct instance *inst;
-       struct item *item;
-
-       inst = so_find_instance(pkgname, id);
-       if (!inst) {
-               ErrPrint("instance %s - %s is not created\n", pkgname, id);
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       l = find_item(inst);
-       if (!l) {
-               ErrPrint("Instance is not found(%s - %s)\n", pkgname, id);
-               return LB_STATUS_ERROR_NOT_EXIST;
-       }
-
-       item = eina_list_data_get(l);
-       return lb_sys_event(inst, item, event);
-}
-
-HAPI int lb_update(const char *pkgname, const char *id, int force)
-{
-       Eina_List *l;
-       struct instance *inst;
-       struct item *item;
-
-       inst = so_find_instance(pkgname, id);
-       if (!inst) {
-               ErrPrint("Instance %s - %s is not created\n", pkgname, id);
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       l = find_item(inst);
-       if (!l) {
-               ErrPrint("Instance is not found(%s - %s)\n", pkgname, id);
-               return LB_STATUS_ERROR_NOT_EXIST;
-       }
-
-       item = eina_list_data_get(l);
-       if (force && pd_is_opened(pkgname) != PD_IS_OPENED) {
-               (void)append_force_update_list(item);
-       } else {
-               (void)append_pending_list(item);
-       }
-
-       return LB_STATUS_SUCCESS;
-}
-
-HAPI int lb_update_all(const char *pkgname, const char *cluster, const char *category, int force)
-{
-       Eina_List *l;
-       Eina_List *n;
-       struct item *item;
-
-       DbgPrint("Update content for %s\n", pkgname ? pkgname : "(all)");
-       EINA_LIST_FOREACH_SAFE(s_info.item_list, l, n, item) {
-               if (item->deleteme) {
-                       continue;
-               }
-
-               if (cluster && strcasecmp(item->inst->cluster, cluster)) {
-                       continue;
-               }
-
-               if (category && strcasecmp(item->inst->category, category)) {
-                       continue;
-               }
-
-               if (pkgname && strlen(pkgname)) {
-                       if (!strcmp(item->inst->item->pkgname, pkgname)) {
-                               if (force && pd_is_opened(pkgname) != PD_IS_OPENED) {
-                                       (void)append_force_update_list(item);
-                               } else {
-                                       (void)append_pending_list(item);
-                               }
-                       }
-               } else {
-                       if (force) {
-                               DbgPrint("Update All function doesn't support force update to all liveboxes\n");
-                       } else {
-                               (void)append_pending_list(item);
-                       }
-               }
-       }
-
-       return LB_STATUS_SUCCESS;
-}
-
-HAPI int lb_delete_all_deleteme(void)
-{
-       Eina_List *l;
-       Eina_List *n;
-       struct item *item;
-       int cnt = 0;
-
-       EINA_LIST_FOREACH_SAFE(s_info.item_list, l, n, item) {
-               if (!item->deleteme) {
-                       continue;
-               }
-
-               update_monitor_del(item->inst->id, item);
-               (void)so_destroy(item->inst);
-               free(item);
-               cnt++;
-       }
-
-       DbgPrint("Delete all deleteme: %d\n", cnt);
-       return LB_STATUS_SUCCESS;
-}
-
-HAPI int lb_delete_all(void)
-{
-       Eina_List *l;
-       Eina_List *n;
-       struct item *item;
-       int cnt = 0;
-
-       EINA_LIST_FOREACH_SAFE(s_info.item_list, l, n, item) {
-               update_monitor_del(item->inst->id, item);
-               (void)so_destroy(item->inst);
-               free(item);
-               cnt++;
-       }
-
-       DbgPrint("Delete all deleteme: %d\n", cnt);
-       return LB_STATUS_SUCCESS;
-}
-
-HAPI int lb_system_event_all(int event)
-{
-       Eina_List *l;
-       Eina_List *n;
-       struct item *item;
-
-       EINA_LIST_FOREACH_SAFE(s_info.item_list, l, n, item) {
-               if (item->deleteme) {
-                       continue;
-               }
-
-               DbgPrint("System event for %s (%d)\n", item->inst->id, event);
-               lb_sys_event(item->inst, item, event);
-       }
-
-       return LB_STATUS_SUCCESS;
-}
-
-HAPI void lb_pause_all(void)
-{
-       Eina_List *l;
-       struct item *item;
-
-       s_info.paused = 1;
-
-       pending_timer_freeze();
-       /*!
-        * \note
-        * force timer will not be freezed
-        */
-
-       EINA_LIST_FOREACH(s_info.item_list, l, item) {
-               if (item->deleteme) {
-                       DbgPrint("Instance %s skip timer pause (deleteme)\n", item->inst->item->pkgname);
-                       continue;
-               }
-
-               if (item->is_paused) {
-                       continue;
-               }
-
-               timer_freeze(item);
-
-               lb_sys_event(item->inst, item, LB_SYS_EVENT_PAUSED);
-       }
-}
-
-HAPI void lb_resume_all(void)
-{
-       Eina_List *l;
-       Eina_List *n;
-       struct item *item;
-
-       s_info.paused = 0;
-
-       pending_timer_thaw();
-
-       /*!
-        * \note
-        * force timer will not affected by this
-        */
-
-       EINA_LIST_FOREACH_SAFE(s_info.item_list, l, n, item) {
-               if (item->deleteme) {
-                       DbgPrint("Instance %s skip timer resume (deleteme)\n", item->inst->item->pkgname);
-                       continue;
-               }
-
-               if (item->is_paused) {
-                       continue;
-               }
-
-               lb_sys_event(item->inst, item, LB_SYS_EVENT_RESUMED);
-
-               if (item->updated_in_pause) {
-                       (void)append_pending_list(item);
-                       item->updated_in_pause = 0;
-               }
-
-               /*!
-                * \note
-                * After send the resume callback, call this function.
-                * Because the timer_thaw can call the update function.
-                * Before resumed event is notified to the livebox,
-                * Do not call update function
-                */
-               if (timer_thaw(item) == UPDATE_ITEM_DELETED) {
-                       /* item is deleted */
-               }
-       }
-}
-
-HAPI int lb_pause(const char *pkgname, const char *id)
-{
-       struct instance *inst;
-       Eina_List *l;
-       struct item *item;
-
-       inst = so_find_instance(pkgname, id);
-       if (!inst) {
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       l = find_item(inst);
-       if (!l) {
-               ErrPrint("Instance is not found (%s - %s)\n", pkgname, id);
-               return LB_STATUS_ERROR_NOT_EXIST;
-       }
-
-       item = eina_list_data_get(l);
-       if (!item) {
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       if (item->deleteme) {
-               DbgPrint("Instance %s will be deleted (%s)\n", item->inst->item->pkgname, item->inst->id);
-               return LB_STATUS_ERROR_BUSY;
-       }
-
-       item->is_paused = 1;
-
-       if (s_info.paused) {
-               return LB_STATUS_SUCCESS;
-       }
-
-       timer_freeze(item);
-
-       lb_sys_event(inst, item, LB_SYS_EVENT_PAUSED);
-
-       return LB_STATUS_SUCCESS;
-}
-
-HAPI int lb_resume(const char *pkgname, const char *id)
-{
-       struct instance *inst;
-       Eina_List *l;
-       struct item *item;
-       int ret;
-
-       inst = so_find_instance(pkgname, id);
-       if (!inst) {
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       l = find_item(inst);
-       if (!l) {
-               ErrPrint("Instance is not found (%s - %s)\n", pkgname, id);
-               return LB_STATUS_ERROR_NOT_EXIST;
-       }
-
-       item = eina_list_data_get(l);
-       if (!item) {
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       if (item->deleteme) {
-               DbgPrint("Instance %s will be deleted (%s)\n", item->inst->item->pkgname, item->inst->id);
-               return LB_STATUS_ERROR_BUSY;
-       }
-
-       item->is_paused = 0;
-
-       if (s_info.paused) {
-               return LB_STATUS_SUCCESS;
-       }
-
-       lb_sys_event(inst, item, LB_SYS_EVENT_RESUMED);
-
-       ret = timer_thaw(item);
-       if (ret == UPDATE_ITEM_DELETED) {
-               /*!
-                * \note
-                * ITEM is deleted
-                */
-               return LB_STATUS_SUCCESS;
-       } else if (ret == UPDATE_INVOKED) {
-               /*!
-                * \note
-                * if the update is successfully done, the updated_in_pause will be reset'd.
-                * or append it to the pending list
-                */
-       }
-
-       if (item->updated_in_pause) {
-               (void)append_pending_list(item);
-               item->updated_in_pause = 0;
-       }
-
-       return LB_STATUS_SUCCESS;
-}
-
-HAPI void lb_turn_secured_on(void)
-{
-       s_info.secured = 1;
-}
-
-HAPI int lb_is_all_paused(void)
-{
-       return s_info.paused;
-}
-
-/* End of a file */
index 4fbe0b9..1b2b74f 100644 (file)
 #include <app.h>
 #include <Edje.h>
 #include <Eina.h>
+#include <efl_assist.h>
 
 #include <system_settings.h>
 
 #include <dlog.h>
 #include <bundle.h>
-#include <livebox-service.h>
-#include <provider.h>
+#include <dynamicbox_service.h>
+#include <dynamicbox_provider.h>
+#include <dynamicbox_script.h>
+#include <dynamicbox_conf.h>
+#include <dynamicbox.h>
 #include <vconf.h>
-#include <livebox.h>
 
 #include "critical_log.h"
 #include "debug.h"
-#include "conf.h"
 #include "fault.h"
 #include "update_monitor.h"
 #include "client.h"
 #include "util.h"
 #include "so_handler.h"
-#include "lb.h"
+#include "dbox.h"
+#include "conf.h"
+#include "theme_loader.h"
 
-#define TEXT_CLASS     "tizen"
-#define DEFAULT_FONT_SIZE      -100
+#define TEXT_CLASS         "tizen"
+#define DEFAULT_FONT_SIZE  -100
+#define WVGA_DEFAULT_SCALE 1.8f
 
 #if !defined(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME)
 #define VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME "db/setting/accessibility/font_name"
 #endif
 
 static struct info {
-       char *font_name;
-       int font_size;
-       int (*heap_monitor_initialized)(void);
-       size_t (*heap_monitor_target_usage)(const char *name);
-       int (*heap_monitor_add_target)(const char *name);
-       int (*heap_monitor_del_target)(const char *name);
-       void *heap_monitor;
+    char *font_name;
+    int font_size;
+    int (*heap_monitor_initialized)(void);
+    size_t (*heap_monitor_target_usage)(const char *name);
+    int (*heap_monitor_add_target)(const char *name);
+    int (*heap_monitor_del_target)(const char *name);
+    void *heap_monitor;
+    Ea_Theme_Font_Table *table;
+
+    app_event_handler_h lang_changed_handler;
+    app_event_handler_h region_changed_handler;
 } s_info = {
-       .font_name = NULL,
-       .font_size = DEFAULT_FONT_SIZE,
-       .heap_monitor_initialized = NULL,
-       .heap_monitor_target_usage = NULL,
-       .heap_monitor_add_target = NULL,
-       .heap_monitor_del_target = NULL,
-       .heap_monitor = NULL,
+    .font_name = NULL,
+    .font_size = DEFAULT_FONT_SIZE,
+    .heap_monitor_initialized = NULL,
+    .heap_monitor_target_usage = NULL,
+    .heap_monitor_add_target = NULL,
+    .heap_monitor_del_target = NULL,
+    .heap_monitor = NULL,
+    .table = NULL,
+    .lang_changed_handler = NULL,
+    .region_changed_handler = NULL,
 };
 
-static void update_font_cb(void *data)
+#define SLAVE_VCONFKEY_FONT_NAME "db/setting/accessibility/font_name"
+
+static void font_changed_cb(void *user_data)
 {
-       Eina_List *list;
-       char *text;
-
-       list = edje_text_class_list();
-       DbgPrint("List: %p\n", list);
-       if (list) {
-               EINA_LIST_FREE(list, text) {
-                       if (!strncasecmp(text, TEXT_CLASS, strlen(TEXT_CLASS))) {
-                               DbgPrint("Update text class %s (%s, %d)\n", text, s_info.font_name, DEFAULT_FONT_SIZE);
-                               edje_text_class_del(text);
-                               edje_text_class_set(text, s_info.font_name, DEFAULT_FONT_SIZE);
-                       } else {
-                               DbgPrint("Skip text class %s\n", text);
-                       }
-               }
-       } else {
-               DbgPrint("New (%s, %d)\n", s_info.font_name, DEFAULT_FONT_SIZE);
-               edje_text_class_set(TEXT_CLASS, s_info.font_name, DEFAULT_FONT_SIZE);
-       }
+    char *font_name;
 
-       DbgPrint("Call system event\n");
-       lb_system_event_all(LB_SYS_EVENT_FONT_CHANGED);
-}
+    evas_font_reinit();
 
-static void font_changed_cb(keynode_t *node, void *user_data)
-{
-       char *font_name;
+    if (s_info.font_name) {
+       font_name = vconf_get_str(SLAVE_VCONFKEY_FONT_NAME);
+       if (!font_name) {
+           ErrPrint("Invalid font name (NULL)\n");
+           return;
+       }
 
-#if defined(WEARABLE)
-       evas_font_reinit();
-#endif
+       if (!strcmp(s_info.font_name, font_name)) {
+           DbgPrint("Font is not changed (Old: %s(%p) <> New: %s(%p))\n", s_info.font_name, s_info.font_name, font_name, font_name);
+           free(font_name);
+           return;
+       }
 
-       if (s_info.font_name) {
-               font_name = vconf_get_str("db/setting/accessibility/font_name");
-               if (!font_name) {
-                       ErrPrint("Invalid font name (NULL)\n");
-                       return;
-               }
-
-               if (!strcmp(s_info.font_name, font_name)) {
-                       DbgPrint("Font is not changed (Old: %s(%p) <> New: %s(%p))\n", s_info.font_name, s_info.font_name, font_name, font_name);
-                       free(font_name);
-                       return;
-               }
-
-               DbgPrint("Release old font name: %s(%p)\n", s_info.font_name, s_info.font_name);
-               free(s_info.font_name);
-       } else {
-               int ret;
-
-               font_name = NULL;
-               ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_FONT_TYPE, &font_name);
-               if (ret != SYSTEM_SETTINGS_ERROR_NONE || !font_name) {
-                       ErrPrint("System settings: %d, font_name[%p]\n", ret, font_name);
-                       return;
-               }
+       DbgPrint("Release old font name: %s(%p)\n", s_info.font_name, s_info.font_name);
+       free(s_info.font_name);
+    } else {
+       int ret;
+
+       font_name = NULL;
+       ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_FONT_TYPE, &font_name);
+       if (ret != SYSTEM_SETTINGS_ERROR_NONE || !font_name) {
+           ErrPrint("System settings: %d, font_name[%p]\n", ret, font_name);
+           return;
        }
+    }
 
-       s_info.font_name = font_name;
-       DbgPrint("Font name is changed to %s(%p)\n", s_info.font_name, s_info.font_name);
+    s_info.font_name = font_name;
+    DbgPrint("Font name is changed to %s(%p)\n", s_info.font_name, s_info.font_name);
 
-       /*!
-        * \NOTE
-        * Try to update all liveboxes
-        */
-       update_font_cb(NULL);
+    /**
+     * @NOTE
+     * Try to update all dynamicboxes
+     */
+    edje_text_class_set(TEXT_CLASS, s_info.font_name, DEFAULT_FONT_SIZE);
+
+    DbgPrint("Call system event\n");
+    dbox_system_event_all(DBOX_SYS_EVENT_FONT_CHANGED);
 }
 
 static inline int convert_font_size(int size)
 {
-       switch (size) {
+    switch (size) {
        case SYSTEM_SETTINGS_FONT_SIZE_SMALL:
-               size = -80;
-               break;
+           size = -80;
+           break;
        case SYSTEM_SETTINGS_FONT_SIZE_NORMAL:
-               size = -100;
-               break;
+           size = -100;
+           break;
        case SYSTEM_SETTINGS_FONT_SIZE_LARGE:
-               size = -150;
-               break;
+           size = -150;
+           break;
        case SYSTEM_SETTINGS_FONT_SIZE_HUGE:
-               size = -190;
-               break;
+           size = -190;
+           break;
        case SYSTEM_SETTINGS_FONT_SIZE_GIANT:
-               size = -250;
-               break;
+           size = -250;
+           break;
        default:
-               size = -100;
-               break;
-       }
+           size = -100;
+           break;
+    }
 
-       DbgPrint("Return size: %d\n", size);
-       return size;
+    DbgPrint("Return size: %d\n", size);
+    return size;
 }
 
 static void font_size_cb(system_settings_key_e key, void *user_data)
 {
-       int size;
+    int size;
 
-       if (system_settings_get_value_int(SYSTEM_SETTINGS_KEY_FONT_SIZE, &size) != SYSTEM_SETTINGS_ERROR_NONE) {
-               return;
-       }
+    if (system_settings_get_value_int(SYSTEM_SETTINGS_KEY_FONT_SIZE, &size) != SYSTEM_SETTINGS_ERROR_NONE) {
+       return;
+    }
 
-       size = convert_font_size(size);
+    size = convert_font_size(size);
 
-       if (size == s_info.font_size) {
-               DbgPrint("Font size is not changed\n");
-               return;
-       }
+    if (size == s_info.font_size) {
+       DbgPrint("Font size is not changed\n");
+       return;
+    }
 
-       s_info.font_size = size;
-       DbgPrint("Font size is changed to %d, but don't try to update it.\n", size);
+    s_info.font_size = size;
+    DbgPrint("Font size is changed to %d, but don't try to update it.\n", size);
+}
+
+static void tts_changed_cb(keynode_t *node, void *user_data)
+{
+    DbgPrint("TTS status is changed\n");
+    dbox_system_event_all(DBOX_SYS_EVENT_TTS_CHANGED);
 }
 
 static void mmc_changed_cb(keynode_t *node, void *user_data)
 {
-       DbgPrint("MMC status is changed\n");
-       lb_system_event_all(LB_SYS_EVENT_MMC_STATUS_CHANGED);
+    DbgPrint("MMC status is changed\n");
+    dbox_system_event_all(DBOX_SYS_EVENT_MMC_STATUS_CHANGED);
 }
 
 static void time_changed_cb(keynode_t *node, void *user_data)
 {
-       if (vconf_keynode_get_int(node) != VCONFKEY_SYSMAN_STIME_CHANGED) {
-               return;
-       }
-
-       DbgPrint("Time is changed\n");
-       lb_system_event_all(LB_SYS_EVENT_TIME_CHANGED);
+    DbgPrint("Time is changed\n");
+    dbox_system_event_all(DBOX_SYS_EVENT_TIME_CHANGED);
 }
 
 static void initialize_glib_type_system(void)
 {
-       GType type;
-
-       type = G_TYPE_DBUS_ACTION_GROUP;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_ANNOTATION_INFO;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_ARG_INFO;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_AUTH_OBSERVER;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_CALL_FLAGS;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_CAPABILITY_FLAGS;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_CONNECTION;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_CONNECTION_FLAGS;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_ERROR;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_INTERFACE;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_INTERFACE_INFO;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_INTERFACE_SKELETON;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_INTERFACE_SKELETON_FLAGS;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_MENU_MODEL;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_MESSAGE;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_MESSAGE_BYTE_ORDER;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_MESSAGE_FLAGS;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_MESSAGE_HEADER_FIELD;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_MESSAGE_TYPE;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_METHOD_INFO;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_METHOD_INVOCATION;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_NODE_INFO;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_OBJECT;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_OBJECT_MANAGER;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_OBJECT_MANAGER_CLIENT;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_OBJECT_MANAGER_CLIENT_FLAGS;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_OBJECT_MANAGER_SERVER;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_OBJECT_PROXY;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_OBJECT_SKELETON;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_PROPERTY_INFO;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_PROPERTY_INFO_FLAGS;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_PROXY;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_PROXY_FLAGS;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_SEND_MESSAGE_FLAGS;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_SERVER;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_SERVER_FLAGS;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_SIGNAL_FLAGS;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_SIGNAL_INFO;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = G_TYPE_DBUS_SUBTREE_FLAGS;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = JSON_TYPE_NODE;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = JSON_TYPE_OBJECT;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = JSON_TYPE_ARRAY;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = JSON_TYPE_ARRAY;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = JSON_TYPE_SERIALIZABLE;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = JSON_TYPE_PARSER;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
-       type = JSON_TYPE_GENERATOR;
-       if (type != G_TYPE_OBJECT) {
-               DbgPrint("initialized\n");
-       }
+    GType type;
+
+    type = G_TYPE_DBUS_ACTION_GROUP;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_ANNOTATION_INFO;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_ARG_INFO;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_AUTH_OBSERVER;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_CALL_FLAGS;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_CAPABILITY_FLAGS;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_CONNECTION;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_CONNECTION_FLAGS;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_ERROR;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_INTERFACE;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_INTERFACE_INFO;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_INTERFACE_SKELETON;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_INTERFACE_SKELETON_FLAGS;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_MENU_MODEL;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_MESSAGE;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_MESSAGE_BYTE_ORDER;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_MESSAGE_FLAGS;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_MESSAGE_HEADER_FIELD;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_MESSAGE_TYPE;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_METHOD_INFO;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_METHOD_INVOCATION;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_NODE_INFO;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_OBJECT;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_OBJECT_MANAGER;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_OBJECT_MANAGER_CLIENT;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_OBJECT_MANAGER_CLIENT_FLAGS;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_OBJECT_MANAGER_SERVER;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_OBJECT_PROXY;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_OBJECT_SKELETON;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_PROPERTY_INFO;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_PROPERTY_INFO_FLAGS;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_PROXY;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_PROXY_FLAGS;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_SEND_MESSAGE_FLAGS;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_SERVER;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_SERVER_FLAGS;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_SIGNAL_FLAGS;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_SIGNAL_INFO;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = G_TYPE_DBUS_SUBTREE_FLAGS;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = JSON_TYPE_NODE;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = JSON_TYPE_OBJECT;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = JSON_TYPE_ARRAY;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = JSON_TYPE_ARRAY;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = JSON_TYPE_SERIALIZABLE;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = JSON_TYPE_PARSER;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
+    type = JSON_TYPE_GENERATOR;
+    if (type != G_TYPE_OBJECT) {
+       DbgPrint("initialized\n");
+    }
 }
 
 static bool app_create(void *argv)
 {
-       int ret;
-
-       /*!
-        * Touch the glib type system
-        */
-       initialize_glib_type_system();
+    int ret;
 
-       conf_update_size();
+    elm_app_base_scale_set(WVGA_DEFAULT_SCALE);
+    //elm_config_preferred_engine_set("opengl_x11");
 
-       DbgPrint("Scale factor: %lf\n", elm_config_scale_get());
-
-       if (COM_CORE_THREAD) {
-               if (setenv("PROVIDER_COM_CORE_THREAD", "true", 0) < 0) {
-                       ErrPrint("setenv: %s\n", strerror(errno));
-               }
-       } else {
-               if (setenv("PROVIDER_COM_CORE_THREAD", "false", 0) < 0){
-                       ErrPrint("setenv: %s\n", strerror(errno));
-               }
-       }
-
-       ret = livebox_service_init();
+    dynamicbox_conf_init();
+    if (!dynamicbox_conf_is_loaded()) {
+       ret = dynamicbox_conf_load();
        if (ret < 0) {
-               DbgPrint("Livebox service init: %d\n", ret);
-       }
+           DbgPrint("Configureation manager is initiated: %d\n", ret);
+       }
+    }
+
+    critical_log_init(util_basename(((char **)argv)[0]));
+
+    /*!
+     * Touch the glib type system
+     */
+    initialize_glib_type_system();
+
+    DbgPrint("Scale factor: %lf\n", elm_config_scale_get());
+
+    if (DYNAMICBOX_CONF_COM_CORE_THREAD) {
+       if (setenv("PROVIDER_COM_CORE_THREAD", "true", 0) < 0) {
+           ErrPrint("setenv: %s\n", strerror(errno));
+       }
+    } else {
+       if (setenv("PROVIDER_COM_CORE_THREAD", "false", 0) < 0){
+           ErrPrint("setenv: %s\n", strerror(errno));
+       }
+    }
+
+    ret = dynamicbox_service_init();
+    if (ret < 0) {
+       DbgPrint("Livebox service init: %d\n", ret);
+    }
+
+    /**
+     * @note
+     * Slave is not able to initiate system, before
+     * receive its name from the master
+     *
+     * So create callback doesn't do anything.
+     */
+    ret = fault_init(argv);
+    if (ret < 0) {
+       DbgPrint("Crash recover is initiated: %d\n", ret);
+    }
+
+    ret = update_monitor_init();
+    if (ret < 0) {
+       DbgPrint("Content update monitor is initiated: %d\n", ret);
+    }
+
+    s_info.table = ea_theme_font_table_new("/usr/share/themes/FontInfoTable.xml");
+    if (s_info.table) {
+       DbgPrint("FONT TABLE Prepared");
+       ea_theme_fonts_set(s_info.table);
+    }
+    ea_theme_event_callback_add(EA_THEME_CALLBACK_TYPE_FONT, font_changed_cb, NULL);
+
+    ret = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_FONT_SIZE, font_size_cb, NULL);
+    if (ret < 0) {
+       DbgPrint("System font size changed callback is added: %d\n", ret);
+    }
+
+    ret = vconf_notify_key_changed(VCONFKEY_SYSTEM_TIME_CHANGED, time_changed_cb, NULL);
+    if (ret < 0) {
+       DbgPrint("System time changed event callback added: %d\n", ret);
+    }
+
+    ret = vconf_notify_key_changed(VCONFKEY_SYSMAN_MMC_STATUS, mmc_changed_cb, NULL);
+    if (ret < 0) {
+       DbgPrint("MMC status changed event callback added: %d\n", ret);
+    }
+
+    ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, tts_changed_cb, NULL);
+    if (ret < 0) {
+       DbgPrint("TTS changed callback is added: %s\n", ret);
+    }
+
+    font_changed_cb(NULL);
+    font_size_cb(SYSTEM_SETTINGS_KEY_FONT_SIZE, NULL);
+    theme_loader_load(THEME_DIR);
+
+    dbox_init();
+
+    return TRUE;
+}
 
-       /*
-        * \note
-        * Slave is not able to initiate system, before
-        * receive its name from the master
-        *
-        * So create callback doesn't do anything.
-        */
-       ret = fault_init(argv);
-       if (ret < 0) {
-               DbgPrint("Crash recover is initiated: %d\n", ret);
-       }
+static void app_terminate(void *data)
+{
+    int ret;
 
-       ret = update_monitor_init();
-       if (ret < 0) {
-               DbgPrint("Content update monitor is initiated: %d\n", ret);
-       }
+    DbgPrint("Terminating provider\n");
 
-       ret = vconf_notify_key_changed("db/setting/accessibility/font_name", font_changed_cb, NULL);
-       if (ret < 0) {
-               DbgPrint("System font changed callback is added: %d\n", ret);
-       }
-       
-       ret = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_FONT_SIZE, font_size_cb, NULL);
-       if (ret < 0) {
-               DbgPrint("System font size changed callback is added: %d\n", ret);
-       }
+    dbox_fini();
 
-       ret = vconf_notify_key_changed(VCONFKEY_SYSMAN_STIME, time_changed_cb, NULL);
-       if (ret < 0) {
-               DbgPrint("System time changed event callback added: %d\n", ret);
-       }
+    theme_loader_unload();
 
-       ret = vconf_notify_key_changed(VCONFKEY_SYSMAN_MMC_STATUS, mmc_changed_cb, NULL);
-       if (ret < 0) {
-               DbgPrint("MMC status changed event callback added: %d\n", ret);
-       }
+    if (s_info.table) {
+       DbgPrint("FONT TABLE Destroyed");
+       ea_theme_font_table_free(s_info.table);
+       s_info.table = NULL;
+    }
 
-       font_changed_cb(NULL, NULL);
-       font_size_cb(SYSTEM_SETTINGS_KEY_FONT_SIZE, NULL);
+    ret = vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, tts_changed_cb);
+    if (ret < 0) {
+       DbgPrint("TTS changed callback is added: %s\n", ret);
+    }
 
-       return TRUE;
-}
+    ret = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_FONT_SIZE);
+    if (ret < 0) {
+       DbgPrint("unset fontsize: %d\n", ret);
+    }
 
-static void app_terminate(void *data)
-{
-       int ret;
+    ea_theme_event_callback_del(EA_THEME_CALLBACK_TYPE_FONT, font_changed_cb);
 
-       DbgPrint("Terminating provider\n");
+    ret = vconf_ignore_key_changed(VCONFKEY_SYSTEM_TIME_CHANGED, time_changed_cb);
+    if (ret < 0) {
+       DbgPrint("Remove time changed callback: %d\n", ret);
+    }
 
-       ret = lb_delete_all_deleteme();
-       if (ret < 0) {
-               DbgPrint("Delete all deleteme: %d\n", ret);
-       }
+    ret = vconf_ignore_key_changed(VCONFKEY_SYSMAN_MMC_STATUS, mmc_changed_cb);
+    if (ret < 0) {
+       DbgPrint("Remove MMC status changed callback: %d\n", ret);
+    }
 
-       ret = lb_delete_all();
-       if (ret < 0) {
-               DbgPrint("Delete all: %d\n", ret);
-       }
+    ret = update_monitor_fini();
+    if (ret < 0) {
+       DbgPrint("Content update monitor is finalized: %d\n", ret);
+    }
 
-       ret = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_FONT_SIZE);
-       if (ret < 0) {
-               DbgPrint("unset fontsize: %d\n", ret);
-       }
+    ret = fault_fini();
+    if (ret < 0) {
+       DbgPrint("Crash recover is finalized: %d\n", ret);
+    }
 
-       ret = vconf_ignore_key_changed("db/setting/accessibility/font_name", font_changed_cb);
-       if (ret < 0) {
-               DbgPrint("Remove font change callback: %d\n", ret);
-       }
+    ret = client_fini();
+    if (ret < 0) {
+       DbgPrint("client finalized: %d\n", ret); 
+    }
 
-       ret = vconf_ignore_key_changed(VCONFKEY_SYSMAN_STIME, time_changed_cb);
-       if (ret < 0) {
-               DbgPrint("Remove time changed callback: %d\n", ret);
-       }
+    ret = dynamicbox_service_fini();
+    if (ret < 0) {
+       DbgPrint("dynamicbox service fini: %d\n", ret);
+    }
 
-       ret = vconf_ignore_key_changed(VCONFKEY_SYSMAN_MMC_STATUS, mmc_changed_cb);
-       if (ret < 0) {
-               DbgPrint("Remove MMC status changed callback: %d\n", ret);
-       }
+    free(s_info.font_name);
+    s_info.font_name = NULL;
 
-       ret = update_monitor_fini();
-       if (ret < 0) {
-               DbgPrint("Content update monitor is finalized: %d\n", ret);
-       }
-
-       ret = fault_fini();
-       if (ret < 0) {
-               DbgPrint("Crash recover is finalized: %d\n", ret);
-       }
-
-       ret = client_fini();
-       if (ret < 0) {
-               DbgPrint("client finalized: %d\n", ret); 
-       }
-
-       ret = livebox_service_fini();
-       if (ret < 0) {
-               DbgPrint("livebox service fini: %d\n", ret);
-       }
+    critical_log_fini();
 
-       free(s_info.font_name);
-       s_info.font_name = NULL;
-       return;
+    exit(0);
+    return;
 }
 
 static void app_pause(void *data)
 {
-       /* Will not be invoked */
-       return;
+    /* Will not be invoked */
+    return;
 }
 
 static void app_resume(void *data)
 {
-       /* Will not be invoked */
-       return;
+    /* Will not be invoked */
+    return;
 }
 
-static void app_region_changed(void *data)
+static void app_region_changed(app_event_info_h event_info, void *data)
 {
-       lb_system_event_all(LB_SYS_EVENT_REGION_CHANGED);
+    // char *region;
+    // app_event_get_region_format(event_info, &region);
+    dbox_system_event_all(DBOX_SYS_EVENT_REGION_CHANGED);
 }
 
-static void app_language_changed(void *data)
+static void app_language_changed(app_event_info_h event_info, void *data)
 {
-       lb_system_event_all(LB_SYS_EVENT_LANG_CHANGED);
+    // char *lang;
+    // app_event_get_language(event_info, &lang);
+    dbox_system_event_all(DBOX_SYS_EVENT_LANG_CHANGED);
 }
 
-static void app_service(service_h service, void *data)
+static void app_control(app_control_h service, void *data)
 {
-       int ret;
-       char *name;
-       char *secured;
-       static int initialized = 0;
+    int ret;
+    char *name;
+    char *secured;
+    static int initialized = 0;
 
-       if (initialized) {
-               ErrPrint("Already initialized\n");
-               return;
-       }
+    if (initialized) {
+       ErrPrint("Already initialized\n");
+       return;
+    }
 
-       ret = service_get_extra_data(service, "name", &name);
-       if (ret != SERVICE_ERROR_NONE) {
-               ErrPrint("Name is not valid\n");
-               return;
-       }
+    ret = app_control_get_extra_data(service, "name", &name);
+    if (ret != APP_CONTROL_ERROR_NONE) {
+       ErrPrint("Name is not valid\n");
+       return;
+    }
 
-       ret = service_get_extra_data(service, "secured", &secured);
-       if (ret != SERVICE_ERROR_NONE) {
-               free(name);
-               ErrPrint("Secured is not valid\n");
-               return;
-       }
+    ret = app_control_get_extra_data(service, "secured", &secured);
+    if (ret != APP_CONTROL_ERROR_NONE) {
+       free(name);
+       ErrPrint("Secured is not valid\n");
+       return;
+    }
 
-       if (!strcasecmp(secured, "true")) {
-               /* Don't use the update timer */
-               lb_turn_secured_on();
-       }
+    if (!strcasecmp(secured, "true")) {
+       /* Don't use the update timer */
+       dbox_turn_secured_on();
+    }
 
-       DbgPrint("Name assigned: %s\n", name);
-       DbgPrint("Secured: %s\n", secured);
-       ret = client_init(name);
-       free(name);
-       free(secured);
+    DbgPrint("Name assigned: %s\n", name);
+    DbgPrint("Secured: %s\n", secured);
+    ret = client_init(name);
+    free(name);
+    free(secured);
 
-       initialized = 1;
-       return;
+    initialized = 1;
+    return;
 }
 
 #if defined(_ENABLE_MCHECK)
 static inline void mcheck_cb(enum mcheck_status status)
 {
-       char *ptr;
+    char *ptr;
 
-       ptr = util_get_current_module(NULL);
+    ptr = util_get_current_module(NULL);
 
-       switch (status) {
+    switch (status) {
        case MCHECK_DISABLED:
-               ErrPrint("[DISABLED] Heap incosistency detected: %s\n", ptr);
-               break;
+           ErrPrint("[DISABLED] Heap incosistency detected: %s\n", ptr);
+           break;
        case MCHECK_OK:
-               ErrPrint("[OK] Heap incosistency detected: %s\n", ptr);
-               break;
+           ErrPrint("[OK] Heap incosistency detected: %s\n", ptr);
+           break;
        case MCHECK_HEAD:
-               ErrPrint("[HEAD] Heap incosistency detected: %s\n", ptr);
-               break;
+           ErrPrint("[HEAD] Heap incosistency detected: %s\n", ptr);
+           break;
        case MCHECK_TAIL:
-               ErrPrint("[TAIL] Heap incosistency detected: %s\n", ptr);
-               break;
+           ErrPrint("[TAIL] Heap incosistency detected: %s\n", ptr);
+           break;
        case MCHECK_FREE:
-               ErrPrint("[FREE] Heap incosistency detected: %s\n", ptr);
-               break;
+           ErrPrint("[FREE] Heap incosistency detected: %s\n", ptr);
+           break;
        default:
-               break;
-       }
+           break;
+    }
 }
 #endif
 
+#define HEAP_MONITOR_PATH "/usr/lib/libheap-monitor.so"
 #define BIN_PATH "/usr/apps/org.tizen.data-provider-slave/bin/"
 int main(int argc, char *argv[])
 {
-       int ret;
-       app_event_callback_s event_callback;
-       const char *option;
+    int ret;
+    ui_app_lifecycle_callback_s event_callback;
 
-       memset(argv[0], 0, strlen(argv[0]));
-       strcpy(argv[0], BIN_PATH "data-provider-slave");
-       DbgPrint("Replace argv[0] with %s\n", argv[0]);
+    const char *option;
+
+    memset(argv[0], 0, strlen(argv[0]));
+    strcpy(argv[0], BIN_PATH "data-provider-slave");
+    DbgPrint("Replace argv[0] with %s\n", argv[0]);
 
 #if defined(_ENABLE_MCHECK)
-       mcheck(mcheck_cb);
+    mcheck(mcheck_cb);
 #endif
-       option = getenv("PROVIDER_DISABLE_CALL_OPTION");
-       if (option && !strcasecmp(option, "true")) {
-               fault_disable_call_option();
+    option = getenv("PROVIDER_DISABLE_CALL_OPTION");
+    if (option && !strcasecmp(option, "true")) {
+       fault_disable_call_option();
+    }
+
+    option = getenv("PROVIDER_HEAP_MONITOR_START");
+    if (option && !strcasecmp(option, "true")) {
+       s_info.heap_monitor = dlopen(HEAP_MONITOR_PATH, RTLD_NOW);
+       if (s_info.heap_monitor) {
+           s_info.heap_monitor_initialized = dlsym(s_info.heap_monitor, "heap_monitor_initialized");
+           s_info.heap_monitor_target_usage = dlsym(s_info.heap_monitor, "heap_monitor_target_usage");
+           s_info.heap_monitor_add_target = dlsym(s_info.heap_monitor, "heap_monitor_add_target");
+           s_info.heap_monitor_del_target = dlsym(s_info.heap_monitor, "heap_monitor_del_target");
        }
+    }
 
-       option = getenv("PROVIDER_HEAP_MONITOR_START");
-       if (option && !strcasecmp(option, "true")) {
-               s_info.heap_monitor = dlopen("/usr/lib/libheap-monitor.so", RTLD_NOW);
-               if (s_info.heap_monitor) {
-                       s_info.heap_monitor_initialized = dlsym(s_info.heap_monitor, "heap_monitor_initialized");
-                       s_info.heap_monitor_target_usage = dlsym(s_info.heap_monitor, "heap_monitor_target_usage");
-                       s_info.heap_monitor_add_target = dlsym(s_info.heap_monitor, "heap_monitor_add_target");
-                       s_info.heap_monitor_del_target = dlsym(s_info.heap_monitor, "heap_monitor_del_target");
-               }
-       }
+    if (setenv("BUFMGR_LOCK_TYPE", "once", 0) < 0) {
+       ErrPrint("setenv: %s\n", strerror(errno));
+    }
 
-       setenv("BUFMGR_LOCK_TYPE", "once", 0);
-       setenv("BUFMGR_MAP_CACHE", "true", 0);
+    if (setenv("BUFMGR_MAP_CACHE", "true", 0) < 0) {
+       ErrPrint("setenv: %s\n", strerror(errno));
+    }
 
-       ret = conf_loader();
-       if (ret < 0) {
-               DbgPrint("Configureation manager is initiated: %d\n", ret);
-       }
+    event_callback.create = app_create;
+    event_callback.terminate = app_terminate;
+    event_callback.pause = app_pause;
+    event_callback.resume = app_resume;
+    event_callback.app_control = app_control;
 
-       critical_log_init(util_basename(argv[0]));
-
-       event_callback.create = app_create;
-       event_callback.terminate = app_terminate;
-       event_callback.pause = app_pause;
-       event_callback.resume = app_resume;
-       event_callback.service = app_service;
-       event_callback.low_memory = NULL;
-       event_callback.low_battery = NULL;
-       event_callback.device_orientation = NULL;
-       event_callback.language_changed = app_language_changed;
-       event_callback.region_format_changed = app_region_changed;
-       ret = app_efl_main(&argc, &argv, &event_callback, argv);
-       critical_log_fini();
-       ErrPrint("Failed to init: %d\n", ret);
-       if (s_info.heap_monitor) {
-               if (dlclose(s_info.heap_monitor) < 0) {
-                       ErrPrint("dlclose: %s\n", strerror(errno));
-               }
+    ui_app_add_event_handler(&s_info.lang_changed_handler, APP_EVENT_LANGUAGE_CHANGED, app_language_changed, argv);
+    ui_app_add_event_handler(&s_info.region_changed_handler, APP_EVENT_REGION_FORMAT_CHANGED, app_region_changed, argv);
+    // APP_EVENT_DEVICE_ORIENTATION_CHANGED
+    // APP_EVENT_LOW_MEMORY
+    // APP_EVENT_LOW_BATTERY
+
+    ret = ui_app_main(argc, argv, &event_callback, (void *)argv);
+    ErrPrint("app_efl_main: %d\n", ret);
+
+    if (s_info.heap_monitor) {
+       if (dlclose(s_info.heap_monitor) < 0) {
+           ErrPrint("dlclose: %s\n", strerror(errno));
        }
+    }
 
-       return ret;
+    return ret;
 }
 
 HAPI int main_heap_monitor_is_enabled(void)
 {
-       return s_info.heap_monitor_initialized ? s_info.heap_monitor_initialized() : 0;
+    return s_info.heap_monitor_initialized ? s_info.heap_monitor_initialized() : 0;
 }
 
 HAPI size_t main_heap_monitor_target_usage(const char *name)
 {
-       return s_info.heap_monitor_target_usage ? s_info.heap_monitor_target_usage(name) : 0;
+    return s_info.heap_monitor_target_usage ? s_info.heap_monitor_target_usage(name) : 0;
 }
 
 HAPI int main_heap_monitor_add_target(const char *name)
 {
-       return s_info.heap_monitor_add_target ? s_info.heap_monitor_add_target(name) : 0;
+    return s_info.heap_monitor_add_target ? s_info.heap_monitor_add_target(name) : 0;
 }
 
 HAPI int main_heap_monitor_del_target(const char *name)
 {
-       return s_info.heap_monitor_del_target ? s_info.heap_monitor_del_target(name) : 0;
+    return s_info.heap_monitor_del_target ? s_info.heap_monitor_del_target(name) : 0;
 }
 
 /* End of a file */
index ce487ab..f789c87 100644 (file)
 
 #include <dlog.h>
 #include <Eina.h>
-#include <provider.h>
-#include <livebox-service.h>
-#include <livebox-errno.h>
+#include <dynamicbox_provider.h>
+#include <dynamicbox_service.h>
+#include <dynamicbox_errno.h>
+#include <dynamicbox_script.h>
+#include <dynamicbox_conf.h>
 
 #include "main.h"
 #include "critical_log.h"
 #include "debug.h"
 #include "so_handler.h"
 #include "fault.h"
-#include "conf.h"
 #include "util.h"
+#include "conf.h"
 
 int errno;
 
 static struct info {
-       Eina_List *livebox_list;
-       enum current_operations current_op;
+    Eina_List *dynamicbox_list;
+    enum current_operations current_op;
 } s_info = {
-       .livebox_list = NULL,
-       .current_op = LIVEBOX_OP_UNKNOWN,
+    .dynamicbox_list = NULL,
+    .current_op = DBOX_OP_UNKNOWN,
 };
 
-static inline struct so_item *find_livebox(const char *pkgname)
+static inline struct so_item *find_dynamicbox(const char *pkgname)
 {
-       Eina_List *l;
-       struct so_item *item;
+    Eina_List *l;
+    struct so_item *item;
 
-       EINA_LIST_FOREACH(s_info.livebox_list, l, item) {
-               if (!strcmp(item->pkgname, pkgname)) {
-                       return item;
-               }
+    EINA_LIST_FOREACH(s_info.dynamicbox_list, l, item) {
+       if (!strcmp(item->pkgname, pkgname)) {
+           return item;
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
 static inline char *so_adaptor_alloc(const char *abi)
 {
-       /* TODO: Implement me */
-       DbgPrint("ABI[%s] loads %s\n", abi, "/usr/lib/liblivebox-cpp.so");
-       return strdup("/usr/lib/liblivebox-cpp.so");
-}
-
-static inline char *old_style_path(const char *pkgname)
-{
-       char *path;
-       int path_len;
-       int ret;
-
-       path_len = (strlen(pkgname) * 2) + strlen(MODULE_PATH);
-       path = malloc(path_len);
-       if (!path) {
-               ErrPrint("Memory: %s\n", strerror(errno));
-               return NULL;
-       }
-
-       ret = snprintf(path, path_len, MODULE_PATH, pkgname, pkgname);
-       if (ret < 0) {
-               ErrPrint("Fault: %s\n", strerror(errno));
-               free(path);
-               return NULL;
-       }
-
-       DbgPrint("Fallback to old style libexec path (%s)\n", path);
-       return path;
+    /* TODO: Implement me */
+    DbgPrint("ABI[%s] loads %s\n", abi, "/usr/lib/libdynamicbox-cpp.so");
+    return strdup("/usr/lib/libdynamicbox-cpp.so");
 }
 
 static inline char *so_path_alloc(const char *pkgname)
 {
-       char *lb_pkgname;
-       char *path;
+    char *dbox_id;
+    char *path;
 
-       lb_pkgname = livebox_service_pkgname(pkgname);
-       if (!lb_pkgname) {
-               path = old_style_path(pkgname);
-       } else {
-               path = livebox_service_libexec(lb_pkgname);
-               free(lb_pkgname);
-       }
+    dbox_id = dynamicbox_service_dbox_id(pkgname);
+    if (!dbox_id) {
+       ErrPrint("Failed to get package name\n");
+       return NULL;
+    } else {
+       path = dynamicbox_service_libexec(dbox_id);
+       free(dbox_id);
+    }
 
-       DbgPrint("so path: %s\n", path);
-       return path;
+    DbgPrint("so path: %s\n", path);
+    return path;
 }
 
-static void delete_livebox(struct so_item *item)
+static void delete_dynamicbox(struct so_item *item)
 {
-       int ret;
+    int ret;
 
-       fault_mark_call(item->pkgname, "finalize", __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+    fault_mark_call(item->pkgname, "finalize", __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
-       if (item->adaptor.finalize) {
-               ret = item->adaptor.finalize(item->pkgname);
-       } else if (item->livebox.finalize) {
-               ret = item->livebox.finalize();
-       } else {
-               ErrPrint("%s has no finalize\n", item->pkgname);
-               ret = -ENOSYS;
-       }
+    if (item->adaptor.finalize) {
+       ret = item->adaptor.finalize(item->pkgname);
+    } else if (item->dynamicbox.finalize) {
+       ret = item->dynamicbox.finalize();
+    } else {
+       ErrPrint("%s has no finalize\n", item->pkgname);
+       ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+    }
 
-       fault_unmark_call(item->pkgname, "finalize", __func__, USE_ALARM);
+    fault_unmark_call(item->pkgname, "finalize", __func__, USE_ALARM);
+
+    if (ret == DBOX_STATUS_ERROR_BUSY) {
+       DbgPrint("Keep SO in a process space (%s)\n", item->so_fname);
+    } else {
        if (ret < 0) {
-               ErrPrint("Package %s, finalize returns %d\n", item->pkgname, ret);
+           ErrPrint("Package %s, finalize returns %d\n", item->pkgname, ret);
        }
-
+       DbgPrint("Unload SO from process space (%s)\n", item->so_fname);
+       s_info.dynamicbox_list = eina_list_remove(s_info.dynamicbox_list, item);
        main_heap_monitor_del_target(item->so_fname);
+       util_dump_current_so_info(item->so_fname);
        if (dlclose(item->handle) != 0) {
-               ErrPrint("dlclose: %s\n", dlerror());
+           ErrPrint("dlclose: %s\n", dlerror());
        }
        free(item->so_fname);
        free(item->pkgname);
        free(item);
+    }
 }
 
 static struct so_item *new_adaptor(const char *pkgname, const char *abi)
 {
-       struct so_item *item;
-       char *errmsg;
+    struct so_item *item;
+    char *errmsg;
 
-       item = calloc(1, sizeof(*item));
-       if (!item) {
-               ErrPrint("Memory: %s\n", strerror(errno));
-               return NULL;
-       }
+    item = calloc(1, sizeof(*item));
+    if (!item) {
+       ErrPrint("Memory: %s\n", strerror(errno));
+       return NULL;
+    }
 
-       item->pkgname = strdup(pkgname);
-       if (!item->pkgname) {
-               ErrPrint("Memory: %s\n", strerror(errno));
-               free(item);
-               return NULL;
-       }
+    item->pkgname = strdup(pkgname);
+    if (!item->pkgname) {
+       ErrPrint("Memory: %s\n", strerror(errno));
+       free(item);
+       return NULL;
+    }
 
-       /*! \TODO:
-        * item->timeout
-        */
+    /*! \TODO:
+     * item->timeout
+     */
 
-       /*! \TODO
-        * item->has_livbox_script
-        */
+    /*! \TODO
+     * item->has_dynamicbox_script
+     */
 
-       item->inst_list = NULL;
+    item->inst_list = NULL;
 
-       item->so_fname = so_adaptor_alloc(abi);
-       if (!item->so_fname) {
-               free(item->pkgname);
-               free(item);
-               return NULL;
-       }
+    item->so_fname = so_adaptor_alloc(abi);
+    if (!item->so_fname) {
+       free(item->pkgname);
+       free(item);
+       return NULL;
+    }
 
-       fault_mark_call(pkgname, __func__, __func__, USE_ALARM, DEFAULT_LOAD_TIMER);
-       item->handle = dlopen(item->so_fname, RTLD_LOCAL | RTLD_NOW | RTLD_DEEPBIND);
-       if (!item->handle) {
-               fault_unmark_call(pkgname, __func__, __func__, USE_ALARM);
-               ErrPrint("dlopen: %s - %s\n", dlerror(), item->so_fname);
-               free(item->so_fname);
-               free(item->pkgname);
-               free(item);
-               return NULL;
-       }
+    fault_mark_call(pkgname, __func__, __func__, USE_ALARM, DEFAULT_LOAD_TIMER);
+    item->handle = dlopen(item->so_fname, RTLD_LOCAL | RTLD_NOW | RTLD_DEEPBIND);
+    if (!item->handle) {
        fault_unmark_call(pkgname, __func__, __func__, USE_ALARM);
+       ErrPrint("dlopen: %s - %s\n", dlerror(), item->so_fname);
+       free(item->so_fname);
+       free(item->pkgname);
+       free(item);
+       return NULL;
+    }
+    fault_unmark_call(pkgname, __func__, __func__, USE_ALARM);
+
+    errmsg = dlerror();
+    if (errmsg) {
+       DbgPrint("dlerror(can be ignored): %s\n", errmsg);
+    }
+
+    item->adaptor.create = (adaptor_create_t)dlsym(item->handle, "dynamicbox_create");
+    if (!item->adaptor.create) {
+       ErrPrint("symbol: dynamicbox_create - %s\n", dlerror());
+       delete_dynamicbox(item);
+       return NULL;
+    }
 
-       errmsg = dlerror();
-       if (errmsg) {
-               DbgPrint("dlerror(can be ignored): %s\n", errmsg);
-       }
-
-       item->adaptor.create = (adaptor_create_t)dlsym(item->handle, "livebox_create");
-       if (!item->adaptor.create) {
-               ErrPrint("symbol: livebox_create - %s\n", dlerror());
-               delete_livebox(item);
-               return NULL;
-       }
-
-       item->adaptor.destroy = (adaptor_destroy_t)dlsym(item->handle, "livebox_destroy");
-       if (!item->adaptor.destroy) {
-               ErrPrint("symbol: livebox_destroy - %s\n", dlerror());
-               delete_livebox(item);
-               return NULL;
-       }
-
-       item->adaptor.pinup = (adaptor_pinup_t)dlsym(item->handle, "livebox_pinup");
-       if (!item->adaptor.pinup) {
-               ErrPrint("symbol: livebox_pinup - %s\n", dlerror());
-       }
-
-       item->adaptor.is_updated = (adaptor_is_updated_t)dlsym(item->handle, "livebox_need_to_update");
-       if (!item->adaptor.is_updated) {
-               ErrPrint("symbol: livebox_need_to_update - %s\n", dlerror());
-       }
-
-       item->adaptor.update_content = (adaptor_update_content_t)dlsym(item->handle, "livebox_update_content");
-       if (!item->adaptor.update_content) {
-               ErrPrint("symbol: livebox_update_content - %s\n", dlerror());
-       }
-
-       item->adaptor.clicked = (adaptor_clicked_t)dlsym(item->handle, "livebox_clicked");
-       if (!item->adaptor.clicked) {
-               ErrPrint("symbol: livebox_clicked - %s\n", dlerror());
-       }
-
-       item->adaptor.script_event = (adaptor_script_t)dlsym(item->handle, "livebox_content_event");
-       if (!item->adaptor.script_event) {
-               ErrPrint("symbol: livebox_content_event - %s\n", dlerror());
-       }
-
-       item->adaptor.resize = (adaptor_resize_t)dlsym(item->handle, "livebox_resize");
-       if (!item->adaptor.resize) {
-               ErrPrint("symbol: livebox_resize - %s\n", dlerror());
-       }
-
-       item->adaptor.create_needed = (adaptor_create_needed_t)dlsym(item->handle, "livebox_need_to_create");
-       if (!item->adaptor.create_needed) {
-               ErrPrint("symbol: livebox_need_to_create - %s\n", dlerror());
-       }
-
-       item->adaptor.change_group = (adaptor_change_group_t)dlsym(item->handle, "livebox_change_group");
-       if (!item->adaptor.change_group) {
-               ErrPrint("symbol: livebox_change_group - %s\n", dlerror());
-       }
-
-       item->adaptor.get_output_info = (adaptor_get_output_info_t)dlsym(item->handle, "livebox_get_info");
-       if (!item->adaptor.get_output_info) {
-               ErrPrint("symbol: livebox_get_info - %s\n", dlerror());
-       }
-
-       item->adaptor.initialize = (adaptor_initialize_t)dlsym(item->handle, "livebox_initialize");
-       if (!item->adaptor.initialize) {
-               ErrPrint("symbol: livebox_initialize - %s\n", dlerror());
-       }
-
-       item->adaptor.finalize = (adaptor_finalize_t)dlsym(item->handle, "livebox_finalize");
-       if (!item->adaptor.finalize) {
-               ErrPrint("symbol: livebox_finalize - %s\n", dlerror());
-       }
-
-       item->adaptor.need_to_destroy = (adaptor_need_to_destroy_t)dlsym(item->handle, "livebox_need_to_destroy");
-       if (!item->adaptor.need_to_destroy) {
-               ErrPrint("symbol: livebox_need_to_destroy - %s\n", dlerror());
-       }
-
-       item->adaptor.sys_event = (adaptor_system_event_t)dlsym(item->handle, "livebox_system_event");
-       if (!item->adaptor.sys_event) {
-               ErrPrint("symbol: lievbox_system_event - %s\n", dlerror());
-       }
-
-       item->adaptor.is_pinned_up = (adaptor_is_pinned_up_t)dlsym(item->handle, "livebox_is_pinned_up");
-       if (!item->adaptor.is_pinned_up) {
-               ErrPrint("symbol: livebox_is_pinned_up - %s\n", dlerror());
-       }
-
-       item->adaptor.get_alt_info = (adaptor_get_alt_info_t)dlsym(item->handle, "livebox_get_alt_info");
-       if (!item->adaptor.get_alt_info) {
-               ErrPrint("symbol: livebox_get_alt_info - %s\n", dlerror());
-       }
-
-       if (item->adaptor.initialize) {
-               int ret;
-               fault_mark_call(pkgname, "initialize", __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+    item->adaptor.destroy = (adaptor_destroy_t)dlsym(item->handle, "dynamicbox_destroy");
+    if (!item->adaptor.destroy) {
+       ErrPrint("symbol: dynamicbox_destroy - %s\n", dlerror());
+       delete_dynamicbox(item);
+       return NULL;
+    }
+
+    item->adaptor.pinup = (adaptor_pinup_t)dlsym(item->handle, "dynamicbox_pinup");
+    if (!item->adaptor.pinup) {
+       ErrPrint("symbol: dynamicbox_pinup - %s\n", dlerror());
+    }
+
+    item->adaptor.is_updated = (adaptor_is_updated_t)dlsym(item->handle, "dynamicbox_need_to_update");
+    if (!item->adaptor.is_updated) {
+       ErrPrint("symbol: dynamicbox_need_to_update - %s\n", dlerror());
+    }
+
+    item->adaptor.update_content = (adaptor_update_content_t)dlsym(item->handle, "dynamicbox_update_content");
+    if (!item->adaptor.update_content) {
+       ErrPrint("symbol: dynamicbox_update_content - %s\n", dlerror());
+    }
+
+    item->adaptor.clicked = (adaptor_clicked_t)dlsym(item->handle, "dynamicbox_clicked");
+    if (!item->adaptor.clicked) {
+       ErrPrint("symbol: dynamicbox_clicked - %s\n", dlerror());
+    }
+
+    item->adaptor.script_event = (adaptor_script_t)dlsym(item->handle, "dynamicbox_content_event");
+    if (!item->adaptor.script_event) {
+       ErrPrint("symbol: dynamicbox_content_event - %s\n", dlerror());
+    }
+
+    item->adaptor.resize = (adaptor_resize_t)dlsym(item->handle, "dynamicbox_resize");
+    if (!item->adaptor.resize) {
+       ErrPrint("symbol: dynamicbox_resize - %s\n", dlerror());
+    }
+
+    item->adaptor.create_needed = (adaptor_create_needed_t)dlsym(item->handle, "dynamicbox_need_to_create");
+    if (!item->adaptor.create_needed) {
+       ErrPrint("symbol: dynamicbox_need_to_create - %s\n", dlerror());
+    }
+
+    item->adaptor.change_group = (adaptor_change_group_t)dlsym(item->handle, "dynamicbox_change_group");
+    if (!item->adaptor.change_group) {
+       ErrPrint("symbol: dynamicbox_change_group - %s\n", dlerror());
+    }
+
+    item->adaptor.get_output_info = (adaptor_get_output_info_t)dlsym(item->handle, "dynamicbox_get_info");
+    if (!item->adaptor.get_output_info) {
+       ErrPrint("symbol: dynamicbox_get_info - %s\n", dlerror());
+    }
+
+    item->adaptor.initialize = (adaptor_initialize_t)dlsym(item->handle, "dynamicbox_initialize");
+    if (!item->adaptor.initialize) {
+       ErrPrint("symbol: dynamicbox_initialize - %s\n", dlerror());
+    }
+
+    item->adaptor.finalize = (adaptor_finalize_t)dlsym(item->handle, "dynamicbox_finalize");
+    if (!item->adaptor.finalize) {
+       ErrPrint("symbol: dynamicbox_finalize - %s\n", dlerror());
+    }
+
+    item->adaptor.need_to_destroy = (adaptor_need_to_destroy_t)dlsym(item->handle, "dynamicbox_need_to_destroy");
+    if (!item->adaptor.need_to_destroy) {
+       ErrPrint("symbol: dynamicbox_need_to_destroy - %s\n", dlerror());
+    }
+
+    item->adaptor.sys_event = (adaptor_system_event_t)dlsym(item->handle, "dynamicbox_system_event");
+    if (!item->adaptor.sys_event) {
+       ErrPrint("symbol: lievbox_system_event - %s\n", dlerror());
+    }
+
+    item->adaptor.is_pinned_up = (adaptor_is_pinned_up_t)dlsym(item->handle, "dynamicbox_is_pinned_up");
+    if (!item->adaptor.is_pinned_up) {
+       ErrPrint("symbol: dynamicbox_is_pinned_up - %s\n", dlerror());
+    }
+
+    item->adaptor.get_alt_info = (adaptor_get_alt_info_t)dlsym(item->handle, "dynamicbox_get_alt_info");
+    if (!item->adaptor.get_alt_info) {
+       ErrPrint("symbol: dynamicbox_get_alt_info - %s\n", dlerror());
+    }
+
+    item->adaptor.set_content_info = (adaptor_set_content_info_t)dlsym(item->handle, "dynamicbox_set_content_info");
+    if (!item->adaptor.set_content_info) {
+       ErrPrint("symbol: dynamicbox_set_content_info - %s\n", dlerror());
+    }
+
+    if (item->adaptor.initialize) {
+       int ret;
+       fault_mark_call(pkgname, "initialize", __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
-               ret = item->adaptor.initialize(pkgname);
+       ret = item->adaptor.initialize(pkgname);
 
-               fault_unmark_call(pkgname, "initialize", __func__, USE_ALARM);
-               if (ret < 0) {
-                       ErrPrint("Failed to initialize package %s\n", pkgname);
-                       main_heap_monitor_del_target(item->so_fname);
-                       delete_livebox(item);
-                       return NULL;
-               }
+       fault_unmark_call(pkgname, "initialize", __func__, USE_ALARM);
+       if (ret < 0) {
+           ErrPrint("Failed to initialize package %s\n", pkgname);
+           delete_dynamicbox(item);
+           return NULL;
        }
+    }
 
-       s_info.livebox_list = eina_list_append(s_info.livebox_list, item);
-       return item;
+    s_info.dynamicbox_list = eina_list_append(s_info.dynamicbox_list, item);
+    return item;
 }
 
-static struct so_item *new_livebox(const char *pkgname)
+static struct so_item *new_dynamicbox(const char *pkgname)
 {
-       struct so_item *item;
-       char *errmsg;
+    struct so_item *item;
+    char *errmsg;
 
-       item = calloc(1, sizeof(*item));
-       if (!item) {
-               ErrPrint("Memory: %s\n", strerror(errno));
-               return NULL;
-       }
+    item = calloc(1, sizeof(*item));
+    if (!item) {
+       ErrPrint("Memory: %s\n", strerror(errno));
+       return NULL;
+    }
 
-       item->pkgname = strdup(pkgname);
-       if (!item->pkgname) {
-               ErrPrint("Memory: %s\n", strerror(errno));
-               free(item);
-               return NULL;
-       }
+    item->pkgname = strdup(pkgname);
+    if (!item->pkgname) {
+       ErrPrint("Memory: %s\n", strerror(errno));
+       free(item);
+       return NULL;
+    }
 
-       /*! \TODO:
-        * item->timeout
-        */
+    /*! \TODO:
+     * item->timeout
+     */
 
-       /*! \TODO
-        * item->has_livbox_script
-        */
+    /*! \TODO
+     * item->has_dynamicbox_script
+     */
 
-       item->inst_list = NULL;
+    item->inst_list = NULL;
 
-       item->so_fname = so_path_alloc(pkgname);
-       if (!item->so_fname) {
-               free(item->pkgname);
-               free(item);
-               return NULL;
-       }
+    item->so_fname = so_path_alloc(pkgname);
+    if (!item->so_fname) {
+       free(item->pkgname);
+       free(item);
+       return NULL;
+    }
 
-       fault_mark_call(pkgname, __func__, __func__, USE_ALARM, DEFAULT_LOAD_TIMER);
-       item->handle = dlopen(item->so_fname, RTLD_LOCAL | RTLD_NOW | RTLD_DEEPBIND);
-       if (!item->handle) {
-               fault_unmark_call(pkgname, __func__, __func__, USE_ALARM);
-               ErrPrint("dlopen: %s - %s\n", dlerror(), item->so_fname);
-               free(item->so_fname);
-               free(item->pkgname);
-               free(item);
-               return NULL;
-       }
+    fault_mark_call(pkgname, __func__, __func__, USE_ALARM, DEFAULT_LOAD_TIMER);
+    item->handle = dlopen(item->so_fname, RTLD_LOCAL | RTLD_NOW | RTLD_DEEPBIND);
+    if (!item->handle) {
        fault_unmark_call(pkgname, __func__, __func__, USE_ALARM);
+       ErrPrint("dlopen: %s - %s\n", dlerror(), item->so_fname);
+       free(item->so_fname);
+       free(item->pkgname);
+       free(item);
+       return NULL;
+    }
+    fault_unmark_call(pkgname, __func__, __func__, USE_ALARM);
+
+    errmsg = dlerror();
+    if (errmsg) {
+       DbgPrint("dlerror(can be ignored): %s\n", errmsg);
+    }
+
+    item->dynamicbox.create = (create_t)dlsym(item->handle, "dynamicbox_create");
+    if (!item->dynamicbox.create) {
+       ErrPrint("symbol: dynamicbox_create - %s\n", dlerror());
+       delete_dynamicbox(item);
+       return NULL;
+    }
 
-       errmsg = dlerror();
-       if (errmsg) {
-               DbgPrint("dlerror(can be ignored): %s\n", errmsg);
-       }
-
-       item->livebox.create = (create_t)dlsym(item->handle, "livebox_create");
-       if (!item->livebox.create) {
-               ErrPrint("symbol: livebox_create - %s\n", dlerror());
-               delete_livebox(item);
-               return NULL;
-       }
-
-       item->livebox.destroy = (destroy_t)dlsym(item->handle, "livebox_destroy");
-       if (!item->livebox.destroy) {
-               ErrPrint("symbol: livebox_destroy - %s\n", dlerror());
-               delete_livebox(item);
-               return NULL;
-       }
-
-       item->livebox.pinup = (pinup_t)dlsym(item->handle, "livebox_pinup");
-       if (!item->livebox.pinup) {
-               ErrPrint("symbol: livebox_pinup - %s\n", dlerror());
-       }
-
-       item->livebox.is_updated = (is_updated_t)dlsym(item->handle, "livebox_need_to_update");
-       if (!item->livebox.is_updated) {
-               ErrPrint("symbol: livebox_need_to_update - %s\n", dlerror());
-       }
-
-       item->livebox.update_content = (update_content_t)dlsym(item->handle, "livebox_update_content");
-       if (!item->livebox.update_content) {
-               ErrPrint("symbol: livebox_update_content - %s\n", dlerror());
-       }
-
-       item->livebox.clicked = (clicked_t)dlsym(item->handle, "livebox_clicked");
-       if (!item->livebox.clicked) {
-               ErrPrint("symbol: livebox_clicked - %s\n", dlerror());
-       }
-
-       item->livebox.script_event = (script_t)dlsym(item->handle, "livebox_content_event");
-       if (!item->livebox.script_event) {
-               ErrPrint("symbol: livebox_content_event - %s\n", dlerror());
-       }
-
-       item->livebox.resize = (resize_t)dlsym(item->handle, "livebox_resize");
-       if (!item->livebox.resize) {
-               ErrPrint("symbol: livebox_resize - %s\n", dlerror());
-       }
-
-       item->livebox.create_needed = (create_needed_t)dlsym(item->handle, "livebox_need_to_create");
-       if (!item->livebox.create_needed) {
-               ErrPrint("symbol: livebox_need_to_create - %s\n", dlerror());
-       }
-
-       item->livebox.change_group = (change_group_t)dlsym(item->handle, "livebox_change_group");
-       if (!item->livebox.change_group) {
-               ErrPrint("symbol: livebox_change_group - %s\n", dlerror());
-       }
-
-       item->livebox.get_output_info = (get_output_info_t)dlsym(item->handle, "livebox_get_info");
-       if (!item->livebox.get_output_info) {
-               ErrPrint("symbol: livebox_get_info - %s\n", dlerror());
-       }
-
-       item->livebox.initialize = (initialize_t)dlsym(item->handle, "livebox_initialize");
-       if (!item->livebox.initialize) {
-               ErrPrint("symbol: livebox_initialize - %s\n", dlerror());
-       }
-
-       item->livebox.finalize = (finalize_t)dlsym(item->handle, "livebox_finalize");
-       if (!item->livebox.finalize) {
-               ErrPrint("symbol: livebox_finalize - %s\n", dlerror());
-       }
-
-       item->livebox.need_to_destroy = (need_to_destroy_t)dlsym(item->handle, "livebox_need_to_destroy");
-       if (!item->livebox.need_to_destroy) {
-               ErrPrint("symbol: livebox_need_to_destroy - %s\n", dlerror());
-       }
-
-       item->livebox.sys_event = (system_event_t)dlsym(item->handle, "livebox_system_event");
-       if (!item->livebox.sys_event) {
-               ErrPrint("symbol: livebox_system_event - %s\n", dlerror());
-       }
-
-       item->livebox.is_pinned_up = (is_pinned_up_t)dlsym(item->handle, "livebox_is_pinned_up");
-       if (!item->livebox.is_pinned_up) {
-               ErrPrint("symbol: livebox_is_pinned_up - %s\n", dlerror());
-       }
-
-       item->livebox.get_alt_info = (get_alt_info_t)dlsym(item->handle, "livebox_get_alt_info");
-       if (!item->livebox.get_alt_info) {
-               ErrPrint("symbol: livebox_get_alt_info - %s\n", dlerror());
-       }
-
-       main_heap_monitor_add_target(item->so_fname);
-
-       if (item->livebox.initialize) {
-               int ret;
-               fault_mark_call(pkgname, "initialize", __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+    item->dynamicbox.destroy = (destroy_t)dlsym(item->handle, "dynamicbox_destroy");
+    if (!item->dynamicbox.destroy) {
+       ErrPrint("symbol: dynamicbox_destroy - %s\n", dlerror());
+       delete_dynamicbox(item);
+       return NULL;
+    }
+
+    item->dynamicbox.pinup = (pinup_t)dlsym(item->handle, "dynamicbox_pinup");
+    if (!item->dynamicbox.pinup) {
+       ErrPrint("symbol: dynamicbox_pinup - %s\n", dlerror());
+    }
+
+    item->dynamicbox.is_updated = (is_updated_t)dlsym(item->handle, "dynamicbox_need_to_update");
+    if (!item->dynamicbox.is_updated) {
+       ErrPrint("symbol: dynamicbox_need_to_update - %s\n", dlerror());
+    }
+
+    item->dynamicbox.update_content = (update_content_t)dlsym(item->handle, "dynamicbox_update_content");
+    if (!item->dynamicbox.update_content) {
+       ErrPrint("symbol: dynamicbox_update_content - %s\n", dlerror());
+    }
+
+    item->dynamicbox.clicked = (clicked_t)dlsym(item->handle, "dynamicbox_clicked");
+    if (!item->dynamicbox.clicked) {
+       ErrPrint("symbol: dynamicbox_clicked - %s\n", dlerror());
+    }
+
+    item->dynamicbox.script_event = (script_t)dlsym(item->handle, "dynamicbox_content_event");
+    if (!item->dynamicbox.script_event) {
+       ErrPrint("symbol: dynamicbox_content_event - %s\n", dlerror());
+    }
+
+    item->dynamicbox.resize = (resize_t)dlsym(item->handle, "dynamicbox_resize");
+    if (!item->dynamicbox.resize) {
+       ErrPrint("symbol: dynamicbox_resize - %s\n", dlerror());
+    }
+
+    item->dynamicbox.create_needed = (create_needed_t)dlsym(item->handle, "dynamicbox_need_to_create");
+    if (!item->dynamicbox.create_needed) {
+       ErrPrint("symbol: dynamicbox_need_to_create - %s\n", dlerror());
+    }
+
+    item->dynamicbox.change_group = (change_group_t)dlsym(item->handle, "dynamicbox_change_group");
+    if (!item->dynamicbox.change_group) {
+       ErrPrint("symbol: dynamicbox_change_group - %s\n", dlerror());
+    }
+
+    item->dynamicbox.get_output_info = (get_output_info_t)dlsym(item->handle, "dynamicbox_get_info");
+    if (!item->dynamicbox.get_output_info) {
+       ErrPrint("symbol: dynamicbox_get_info - %s\n", dlerror());
+    }
+
+    item->dynamicbox.initialize = (initialize_t)dlsym(item->handle, "dynamicbox_initialize");
+    if (!item->dynamicbox.initialize) {
+       ErrPrint("symbol: dynamicbox_initialize - %s\n", dlerror());
+    }
+
+    item->dynamicbox.finalize = (finalize_t)dlsym(item->handle, "dynamicbox_finalize");
+    if (!item->dynamicbox.finalize) {
+       ErrPrint("symbol: dynamicbox_finalize - %s\n", dlerror());
+    }
+
+    item->dynamicbox.need_to_destroy = (need_to_destroy_t)dlsym(item->handle, "dynamicbox_need_to_destroy");
+    if (!item->dynamicbox.need_to_destroy) {
+       ErrPrint("symbol: dynamicbox_need_to_destroy - %s\n", dlerror());
+    }
+
+    item->dynamicbox.sys_event = (system_event_t)dlsym(item->handle, "dynamicbox_system_event");
+    if (!item->dynamicbox.sys_event) {
+       ErrPrint("symbol: dynamicbox_system_event - %s\n", dlerror());
+    }
+
+    item->dynamicbox.is_pinned_up = (is_pinned_up_t)dlsym(item->handle, "dynamicbox_is_pinned_up");
+    if (!item->dynamicbox.is_pinned_up) {
+       ErrPrint("symbol: dynamicbox_is_pinned_up - %s\n", dlerror());
+    }
+
+    item->dynamicbox.get_alt_info = (get_alt_info_t)dlsym(item->handle, "dynamicbox_get_alt_info");
+    if (!item->dynamicbox.get_alt_info) {
+       ErrPrint("symbol: dynamicbox_get_alt_info - %s\n", dlerror());
+    }
+
+    item->dynamicbox.set_content_info = (set_content_info_t)dlsym(item->handle, "dynamicbox_set_content_info");
+    if (!item->dynamicbox.set_content_info) {
+       ErrPrint("symbol: dynamicbox_set_content_info - %s\n", dlerror());
+    }
+
+    main_heap_monitor_add_target(item->so_fname);
+
+    if (item->dynamicbox.initialize) {
+       int ret;
+       fault_mark_call(pkgname, "initialize", __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
-               ret = item->livebox.initialize(pkgname);
+       ret = item->dynamicbox.initialize(pkgname);
 
-               fault_unmark_call(pkgname, "initialize", __func__, USE_ALARM);
-               if (ret < 0) {
-                       ErrPrint("Failed to initialize package %s\n", pkgname);
-                       main_heap_monitor_del_target(item->so_fname);
-                       delete_livebox(item);
-                       return NULL;
-               }
+       fault_unmark_call(pkgname, "initialize", __func__, USE_ALARM);
+       if (ret < 0) {
+           ErrPrint("Failed to initialize package %s\n", pkgname);
+           delete_dynamicbox(item);
+           return NULL;
        }
+    }
 
-       s_info.livebox_list = eina_list_append(s_info.livebox_list, item);
-       return item;
+    s_info.dynamicbox_list = eina_list_append(s_info.dynamicbox_list, item);
+    return item;
 }
 
 static inline struct instance *new_instance(const char *id, const char *content, const char *cluster, const char *category)
 {
-       struct instance *inst;
-
-       inst = calloc(1, sizeof(*inst));
-       if (!inst) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return NULL;
-       }
-
-       inst->id = strdup(id);
-       if (!inst->id) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               free(inst);
-               return NULL;
-       }
+    struct instance *inst;
 
-       DbgPrint("Default content: [%s]\n", content);
-       if (content) {
-               inst->content = strdup(content);
-               if (!inst->content) {
-                       ErrPrint("memory: %s\n", strerror(errno));
-                       free(inst->id);
-                       free(inst);
-                       return NULL;
-               }
-       }
-
-       if (cluster) {
-               inst->cluster = strdup(cluster);
-               if (!inst->cluster) {
-                       ErrPrint("memory: %s\n", strerror(errno));
-                       free(inst->id);
-                       free(inst->content);
-                       free(inst);
-                       return NULL;
-               }
-       }
-
-       if (category) {
-               inst->category = strdup(category);
-               if (!inst->category) {
-                       ErrPrint("memory: %s\n", strerror(errno));
-                       free(inst->cluster);
-                       free(inst->id);
-                       free(inst->content);
-                       free(inst);
-                       return NULL;
-               }
-       }
+    inst = calloc(1, sizeof(*inst));
+    if (!inst) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return NULL;
+    }
 
-       return inst;
+    inst->id = strdup(id);
+    if (!inst->id) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       free(inst);
+       return NULL;
+    }
+
+    DbgPrint("Default content: [%s]\n", content);
+    if (content) {
+       inst->content = strdup(content);
+       if (!inst->content) {
+           ErrPrint("memory: %s\n", strerror(errno));
+           free(inst->id);
+           free(inst);
+           return NULL;
+       }
+    }
+
+    if (cluster) {
+       inst->cluster = strdup(cluster);
+       if (!inst->cluster) {
+           ErrPrint("memory: %s\n", strerror(errno));
+           free(inst->id);
+           free(inst->content);
+           free(inst);
+           return NULL;
+       }
+    }
+
+    if (category) {
+       inst->category = strdup(category);
+       if (!inst->category) {
+           ErrPrint("memory: %s\n", strerror(errno));
+           free(inst->cluster);
+           free(inst->id);
+           free(inst->content);
+           free(inst);
+           return NULL;
+       }
+    }
+
+    return inst;
 }
 
 static inline int delete_instance(struct instance *inst)
 {
-       free(inst->icon);
-       free(inst->name);
-       free(inst->cluster);
-       free(inst->category);
-       free(inst->id);
-       free(inst->content);
-       free(inst->title);
-       free(inst);
-       return LB_STATUS_SUCCESS;
+    free(inst->icon);
+    free(inst->name);
+    free(inst->cluster);
+    free(inst->category);
+    free(inst->id);
+    free(inst->content);
+    free(inst->title);
+    free(inst);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static inline struct instance *find_instance(struct so_item *item, const char *id)
 {
-       struct instance *inst;
-       Eina_List *l;
+    struct instance *inst;
+    Eina_List *l;
 
-       EINA_LIST_FOREACH(item->inst_list, l, inst) {
-               if (!strcmp(inst->id, id)) {
-                       return inst;
-               }
+    EINA_LIST_FOREACH(item->inst_list, l, inst) {
+       if (!strcmp(inst->id, id)) {
+           return inst;
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
 HAPI struct instance *so_find_instance(const char *pkgname, const char *id)
 {
-       struct so_item *item;
+    struct so_item *item;
 
-       item = find_livebox(pkgname);
-       if (!item) {
-               return NULL;
-       }
+    item = find_dynamicbox(pkgname);
+    if (!item) {
+       return NULL;
+    }
 
-       return find_instance(item, id);
+    return find_instance(item, id);
 }
 
-HAPI int so_create(const char *pkgname, const char *id, const char *content_info, int timeout, int has_livebox_script, const char *cluster, const char *category, const char *abi, struct instance **out)
+HAPI int so_create(const char *pkgname, const char *id, const char *content_info, int timeout, int has_dynamicbox_script, const char *cluster, const char *category, const char *abi, struct instance **out)
 {
-       struct so_item *item;
-       struct instance *inst;
-       int ret;
-
-       item = find_livebox(pkgname);
-       if (item) {
-               inst = find_instance(item, id);
-               if (inst) {
-                       ErrPrint("Instance: %s - %s is already exists\n", pkgname, id);
-                       return LB_STATUS_ERROR_EXIST;
-               }
+    struct so_item *item;
+    struct instance *inst;
+    int ret;
+
+    item = find_dynamicbox(pkgname);
+    if (item) {
+       inst = find_instance(item, id);
+       if (inst) {
+           ErrPrint("Instance: %s - %s is already exists\n", pkgname, id);
+           return DBOX_STATUS_ERROR_EXIST;
+       }
+    } else {
+       if (!strcasecmp(abi, "c")) {
+           item = new_dynamicbox(pkgname);
        } else {
-               if (!strcasecmp(abi, "c")) {
-                       item = new_livebox(pkgname);
-               } else {
-                       item = new_adaptor(pkgname, abi);
-               }
-
-               if (!item) {
-                       return LB_STATUS_ERROR_FAULT;
-               }
+           item = new_adaptor(pkgname, abi);
        }
 
-       inst = new_instance(id, content_info, cluster, category);
-       if (!inst) {
-               if (!item->inst_list) {
-                       delete_livebox(item);
-               }
+       if (!item) {
+           return DBOX_STATUS_ERROR_FAULT;
+       }
+    }
 
-               return LB_STATUS_ERROR_FAULT;
+    inst = new_instance(id, content_info, cluster, category);
+    if (!inst) {
+       if (!item->inst_list) {
+           delete_dynamicbox(item);
        }
 
-       item->inst_list = eina_list_append(item->inst_list, inst);
-       item->has_livebox_script = has_livebox_script;
-       item->timeout = timeout;
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       fault_mark_call(pkgname, id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+    item->inst_list = eina_list_append(item->inst_list, inst);
+    item->has_dynamicbox_script = has_dynamicbox_script;
+    item->timeout = timeout;
 
-       s_info.current_op = LIVEBOX_OP_CREATE;
-       if (item->adaptor.create) {
-               ret = item->adaptor.create(pkgname, util_uri_to_path(id), content_info, cluster, category);
-       } else if (item->livebox.create) {
-               ret = item->livebox.create(util_uri_to_path(id), content_info, cluster, category);
-       } else { /*! \NOTE: This is not possible, but for the exceptional handling */
-               ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
-       }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
+    fault_mark_call(pkgname, id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
-       fault_unmark_call(pkgname, id, __func__, USE_ALARM);
+    s_info.current_op = DBOX_OP_CREATE;
+    if (item->adaptor.create) {
+       ret = item->adaptor.create(pkgname, util_uri_to_path(id), content_info, cluster, category);
+    } else if (item->dynamicbox.create) {
+       ret = item->dynamicbox.create(util_uri_to_path(id), content_info, cluster, category);
+    } else { /*! \NOTE: This is not possible, but for the exceptional handling */
+       ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+    }
+    s_info.current_op = DBOX_OP_UNKNOWN;
 
-       if (ret < 0) {
-               item->inst_list = eina_list_remove(item->inst_list, inst);
-               delete_instance(inst);
-
-               if (!item->inst_list) {
-                       /* There is no instances, unload this livebox */
-                       s_info.livebox_list = eina_list_remove(s_info.livebox_list, item);
-                       delete_livebox(item);
-               }
-               return ret;
-       }
+    fault_unmark_call(pkgname, id, __func__, USE_ALARM);
 
-       inst->item = item;
-       *out = inst;
+    if (ret < 0) {
+       item->inst_list = eina_list_remove(item->inst_list, inst);
+       delete_instance(inst);
+
+       if (!item->inst_list) {
+           /* There is no instances, unload this dynamicbox */
+           delete_dynamicbox(item);
+       }
        return ret;
+    }
+
+    inst->item = item;
+    *out = inst;
+    return ret;
 }
 
-HAPI int so_destroy(struct instance *inst)
+HAPI int so_destroy(struct instance *inst, int unload)
 {
-       struct so_item *item;
-       int ret;
+    struct so_item *item;
+    int ret;
 
-       item = inst->item;
-       if (!item) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    item = inst->item;
+    if (!item) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+    fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
-       s_info.current_op = LIVEBOX_OP_DESTROY;
-       if (item->adaptor.destroy) {
-               ret = item->adaptor.destroy(item->pkgname, util_uri_to_path(inst->id));
-       } else if (item->livebox.destroy) {
-               ret = item->livebox.destroy(util_uri_to_path(inst->id));
-       } else {
-               ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
-       }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
+    s_info.current_op = DBOX_OP_DESTROY;
+    if (item->adaptor.destroy) {
+       ret = item->adaptor.destroy(item->pkgname, util_uri_to_path(inst->id));
+    } else if (item->dynamicbox.destroy) {
+       ret = item->dynamicbox.destroy(util_uri_to_path(inst->id));
+    } else {
+       ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+    }
+    s_info.current_op = DBOX_OP_UNKNOWN;
 
-       fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+    fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
 
-       item->inst_list = eina_list_remove(item->inst_list, inst);
-       delete_instance(inst);
+    item->inst_list = eina_list_remove(item->inst_list, inst);
+    delete_instance(inst);
 
-       if (!item->inst_list) {
-               s_info.livebox_list = eina_list_remove(s_info.livebox_list, item);
-               delete_livebox(item);
-       }
+    if (unload && !item->inst_list) {
+       delete_dynamicbox(item);
+    }
 
-       return ret;
+    return ret;
 }
 
 HAPI char *so_pinup(struct instance *inst, int pinup)
 {
-       struct so_item *item;
-       char *ret;
-
-       item = inst->item;
-       if (!item) {
-               return NULL;
-       }
+    struct so_item *item;
+    char *ret;
 
-       fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
-
-       s_info.current_op = LIVEBOX_OP_PINUP;
-       if (item->adaptor.pinup) {
-               ret = item->adaptor.pinup(item->pkgname, util_uri_to_path(inst->id), pinup);
-       } else if (item->livebox.pinup) {
-               ret = item->livebox.pinup(util_uri_to_path(inst->id), pinup);
-       } else {
-               ret = NULL;
-       }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
-       
-       fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
-       return ret;
+    item = inst->item;
+    if (!item) {
+       return NULL;
+    }
+
+    fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+
+    s_info.current_op = DBOX_OP_PINUP;
+    if (item->adaptor.pinup) {
+       ret = item->adaptor.pinup(item->pkgname, util_uri_to_path(inst->id), pinup);
+    } else if (item->dynamicbox.pinup) {
+       ret = item->dynamicbox.pinup(util_uri_to_path(inst->id), pinup);
+    } else {
+       ret = NULL;
+    }
+    s_info.current_op = DBOX_OP_UNKNOWN;
+
+    fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+    return ret;
 }
 
 HAPI int so_is_pinned_up(struct instance *inst)
 {
-       struct so_item *item;
-       int ret;
-
-       item = inst->item;
-       if (!item) {
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
-
-       s_info.current_op = LIVEBOX_OP_IS_PINNED_UP;
-       if (item->adaptor.is_pinned_up) {
-               ret = item->adaptor.is_pinned_up(item->pkgname, util_uri_to_path(inst->id));
-       } else if (item->livebox.is_pinned_up) {
-               ret = item->livebox.is_pinned_up(util_uri_to_path(inst->id));
-       } else {
-               ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
-       }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
-
-       fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
-       return ret;
+    struct so_item *item;
+    int ret;
+
+    item = inst->item;
+    if (!item) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+
+    s_info.current_op = DBOX_OP_IS_PINNED_UP;
+    if (item->adaptor.is_pinned_up) {
+       ret = item->adaptor.is_pinned_up(item->pkgname, util_uri_to_path(inst->id));
+    } else if (item->dynamicbox.is_pinned_up) {
+       ret = item->dynamicbox.is_pinned_up(util_uri_to_path(inst->id));
+    } else {
+       ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+    }
+    s_info.current_op = DBOX_OP_UNKNOWN;
+
+    fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+    return ret;
 }
 
 HAPI int so_is_updated(struct instance *inst)
 {
-       struct so_item *item;
-       int ret;
+    struct so_item *item;
+    int ret;
 
-       item = inst->item;
-       if (!item) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    item = inst->item;
+    if (!item) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+    fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
-       s_info.current_op = LIVEBOX_OP_NEED_TO_UPDATE;
-       if (item->adaptor.is_updated) {
-               ret = item->adaptor.is_updated(item->pkgname, util_uri_to_path(inst->id));
-       } else if (item->livebox.is_updated) {
-               ret = item->livebox.is_updated(util_uri_to_path(inst->id));
-       } else {
-               ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
-       }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
+    s_info.current_op = DBOX_OP_NEED_TO_UPDATE;
+    if (item->adaptor.is_updated) {
+       ret = item->adaptor.is_updated(item->pkgname, util_uri_to_path(inst->id));
+    } else if (item->dynamicbox.is_updated) {
+       ret = item->dynamicbox.is_updated(util_uri_to_path(inst->id));
+    } else {
+       ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+    }
+    s_info.current_op = DBOX_OP_UNKNOWN;
 
-       fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+    fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
 
-       return ret;
+    return ret;
 }
 
 HAPI int so_need_to_destroy(struct instance *inst)
 {
-       struct so_item *item;
-       int ret;
+    struct so_item *item;
+    int ret;
 
-       item = inst->item;
-       if (!item) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    item = inst->item;
+    if (!item) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+    fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
-       s_info.current_op = LIVEBOX_OP_NEED_TO_DESTROY;
-       if (item->adaptor.need_to_destroy) {
-               ret = item->adaptor.need_to_destroy(item->pkgname, util_uri_to_path(inst->id));
-       } else if (item->livebox.need_to_destroy) {
-               ret = item->livebox.need_to_destroy(util_uri_to_path(inst->id));
-       } else {
-               ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
-       }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
+    s_info.current_op = DBOX_OP_NEED_TO_DESTROY;
+    if (item->adaptor.need_to_destroy) {
+       ret = item->adaptor.need_to_destroy(item->pkgname, util_uri_to_path(inst->id));
+    } else if (item->dynamicbox.need_to_destroy) {
+       ret = item->dynamicbox.need_to_destroy(util_uri_to_path(inst->id));
+    } else {
+       ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+    }
+    s_info.current_op = DBOX_OP_UNKNOWN;
 
-       fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+    fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
 
-       return ret;
+    return ret;
 }
 
 HAPI int so_update(struct instance *inst)
 {
-       struct so_item *item;
-       int ret;
-
-       item = inst->item;
-       if (!item) {
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
-
-       s_info.current_op = LIVEBOX_OP_UPDATE_CONTENT;
-       if (item->adaptor.update_content) {
-               ret = item->adaptor.update_content(item->pkgname, util_uri_to_path(inst->id));
-       } else if (item->livebox.update_content) {
-               ret = item->livebox.update_content(util_uri_to_path(inst->id));
-       } else {
-               ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
-       }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
-
-       fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
-       return ret;
+    struct so_item *item;
+    int ret;
+
+    item = inst->item;
+    if (!item) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+
+    s_info.current_op = DBOX_OP_UPDATE_CONTENT;
+    if (item->adaptor.update_content) {
+       ret = item->adaptor.update_content(item->pkgname, util_uri_to_path(inst->id));
+    } else if (item->dynamicbox.update_content) {
+       ret = item->dynamicbox.update_content(util_uri_to_path(inst->id));
+    } else {
+       ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+    }
+    s_info.current_op = DBOX_OP_UNKNOWN;
+
+    fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+    return ret;
 }
 
 HAPI int so_clicked(struct instance *inst, const char *event, double timestamp, double x, double y)
 {
-       struct so_item *item;
-       int ret;
+    struct so_item *item;
+    int ret;
 
-       item = inst->item;
-       if (!item) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    item = inst->item;
+    if (!item) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+    fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
-       DbgPrint("PERF_DBOX\n");
+    DbgPrint("PERF_DBOX\n");
 
-       s_info.current_op = LIVEBOX_OP_CLICKED;
-       if (item->adaptor.clicked) {
-               ret = item->adaptor.clicked(item->pkgname, util_uri_to_path(inst->id), event, timestamp, x, y);
-       } else if (item->livebox.clicked) {
-               ret = item->livebox.clicked(util_uri_to_path(inst->id), event, timestamp, x, y);
-       } else {
-               ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
-       }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
+    s_info.current_op = DBOX_OP_CLICKED;
+    if (item->adaptor.clicked) {
+       ret = item->adaptor.clicked(item->pkgname, util_uri_to_path(inst->id), event, timestamp, x, y);
+    } else if (item->dynamicbox.clicked) {
+       ret = item->dynamicbox.clicked(util_uri_to_path(inst->id), event, timestamp, x, y);
+    } else {
+       ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+    }
+    s_info.current_op = DBOX_OP_UNKNOWN;
 
-       fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+    fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
 
-       return ret;
+    return ret;
 }
 
-HAPI int so_script_event(struct instance *inst, const char *emission, const char *source, struct event_info *event_info)
+HAPI int so_script_event(struct instance *inst, const char *emission, const char *source, dynamicbox_event_info_t event_info)
 {
-       struct so_item *item;
-       int ret;
+    struct so_item *item;
+    int ret;
 
-       item = inst->item;
-       if (!item) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    item = inst->item;
+    if (!item) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+    fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
-       s_info.current_op = LIVEBOX_OP_CONTENT_EVENT;
-       if (item->adaptor.script_event) {
-               ret = item->adaptor.script_event(item->pkgname, util_uri_to_path(inst->id), emission, source, event_info);
-       } else if (item->livebox.script_event) {
-               ret = item->livebox.script_event(util_uri_to_path(inst->id), emission, source, event_info);
-       } else {
-               ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
-       }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
+    s_info.current_op = DBOX_OP_CONTENT_EVENT;
+    if (item->adaptor.script_event) {
+       ret = item->adaptor.script_event(item->pkgname, util_uri_to_path(inst->id), emission, source, event_info);
+    } else if (item->dynamicbox.script_event) {
+       ret = item->dynamicbox.script_event(util_uri_to_path(inst->id), emission, source, event_info);
+    } else {
+       ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+    }
+    s_info.current_op = DBOX_OP_UNKNOWN;
 
-       fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+    fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
 
-       return ret;
+    return ret;
 }
 
 HAPI int so_resize(struct instance *inst, int w, int h)
 {
-       struct so_item *item;
-       int ret;
-       int type;
-
-       item = inst->item;
-       if (!item) {
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       type = livebox_service_size_type(w, h);
-       if (type == LB_SIZE_TYPE_UNKNOWN) {
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
-
-       s_info.current_op = LIVEBOX_OP_RESIZE;
-       if (item->adaptor.resize) {
-               ret = item->adaptor.resize(item->pkgname, util_uri_to_path(inst->id), type);
-       } else if (item->livebox.resize) {
-               ret = item->livebox.resize(util_uri_to_path(inst->id), type);
-       } else {
-               ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
-       }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
-
-       fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+    struct so_item *item;
+    int ret;
+    int type;
+
+    item = inst->item;
+    if (!item) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    type = dynamicbox_service_size_type(w, h);
+    if (type == DBOX_SIZE_TYPE_UNKNOWN) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+
+    s_info.current_op = DBOX_OP_RESIZE;
+    if (item->adaptor.resize) {
+       ret = item->adaptor.resize(item->pkgname, util_uri_to_path(inst->id), type);
+    } else if (item->dynamicbox.resize) {
+       ret = item->dynamicbox.resize(util_uri_to_path(inst->id), type);
+    } else {
+       ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+    }
+    s_info.current_op = DBOX_OP_UNKNOWN;
+
+    fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+
+    return ret;
+}
 
-       return ret;
+HAPI int so_set_content_info(struct instance *inst, const char *content_info)
+{
+    struct so_item *item;
+    int ret;
+
+    item = inst->item;
+    if (!item) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+    s_info.current_op = DBOX_OP_SET_CONTENT_INFO;
+    if (item->adaptor.set_content_info) {
+       ret = item->adaptor.set_content_info(item->pkgname, util_uri_to_path(inst->id), content_info);
+    } else if (item->dynamicbox.set_content_info) {
+       ret = item->dynamicbox.set_content_info(util_uri_to_path(inst->id), content_info);
+    } else {
+       ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+    }
+    s_info.current_op = DBOX_OP_UNKNOWN;
+    fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+
+    return ret;
 }
 
 HAPI int so_create_needed(const char *pkgname, const char *cluster, const char *category, const char *abi)
 {
-       struct so_item *item;
-       int ret;
+    struct so_item *item;
+    int ret;
 
-       item = find_livebox(pkgname);
-       if (!item) {
-               if (!strcasecmp(abi, "c")) {
-                       item = new_livebox(pkgname);
-               } else {
-                       item = new_adaptor(pkgname, abi);
-               }
-
-               if (!item) {
-                       return LB_STATUS_ERROR_FAULT;
-               }
-       }
-
-       fault_mark_call(item->pkgname, __func__, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
-
-       s_info.current_op = LIVEBOX_OP_NEED_TO_CREATE;
-       if (item->adaptor.create_needed) {
-               ret = item->adaptor.create_needed(pkgname, cluster, category);
-       } else if (item->livebox.create_needed) {
-               ret = item->livebox.create_needed(cluster, category);
+    item = find_dynamicbox(pkgname);
+    if (!item) {
+       if (!strcasecmp(abi, "c")) {
+           item = new_dynamicbox(pkgname);
        } else {
-               ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+           item = new_adaptor(pkgname, abi);
        }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
-
-       fault_unmark_call(item->pkgname, __func__, __func__, USE_ALARM);
 
-       DbgPrint("[%s] returns %d\n", pkgname, ret);
-       return ret;
-}
-
-HAPI int so_change_group(struct instance *inst, const char *cluster, const char *category)
-{
-       struct so_item *item;
-       int ret;
-       char *tmp_cluster;
-       char *tmp_category;
-
-       item = inst->item;
        if (!item) {
-               return LB_STATUS_ERROR_INVALID;
+           return DBOX_STATUS_ERROR_FAULT;
        }
+    }
 
-       tmp_cluster = strdup(cluster);
-       if (!tmp_cluster) {
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    fault_mark_call(item->pkgname, __func__, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
-       tmp_category = strdup(category);
-       if (!tmp_category) {
-               free(tmp_cluster);
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    s_info.current_op = DBOX_OP_NEED_TO_CREATE;
+    if (item->adaptor.create_needed) {
+       ret = item->adaptor.create_needed(pkgname, cluster, category);
+    } else if (item->dynamicbox.create_needed) {
+       ret = item->dynamicbox.create_needed(cluster, category);
+    } else {
+       ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+    }
+    s_info.current_op = DBOX_OP_UNKNOWN;
 
-       fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+    fault_unmark_call(item->pkgname, __func__, __func__, USE_ALARM);
 
-       s_info.current_op = LIVEBOX_OP_CHANGE_GROUP;
-       if (item->adaptor.change_group) {
-               ret = item->adaptor.change_group(item->pkgname, util_uri_to_path(inst->id), cluster, category);
-       } else if (item->livebox.change_group) {
-               ret = item->livebox.change_group(util_uri_to_path(inst->id), cluster, category);
-       } else {
-               ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
-       }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
+    DbgPrint("[%s] returns %d\n", pkgname, ret);
+    return ret;
+}
 
-       fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
-       if (ret >= 0) {
-               free(inst->cluster);
-               free(inst->category);
+HAPI int so_change_group(struct instance *inst, const char *cluster, const char *category)
+{
+    struct so_item *item;
+    int ret;
+    char *tmp_cluster;
+    char *tmp_category;
+
+    item = inst->item;
+    if (!item) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    tmp_cluster = strdup(cluster);
+    if (!tmp_cluster) {
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    tmp_category = strdup(category);
+    if (!tmp_category) {
+       free(tmp_cluster);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+
+    s_info.current_op = DBOX_OP_CHANGE_GROUP;
+    if (item->adaptor.change_group) {
+       ret = item->adaptor.change_group(item->pkgname, util_uri_to_path(inst->id), cluster, category);
+    } else if (item->dynamicbox.change_group) {
+       ret = item->dynamicbox.change_group(util_uri_to_path(inst->id), cluster, category);
+    } else {
+       ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+    }
+    s_info.current_op = DBOX_OP_UNKNOWN;
+
+    fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+    if (ret >= 0) {
+       free(inst->cluster);
+       free(inst->category);
 
-               inst->cluster = tmp_cluster;
-               inst->category = tmp_category;
-       } else {
-               free(tmp_cluster);
-               free(tmp_category);
-       }
+       inst->cluster = tmp_cluster;
+       inst->category = tmp_category;
+    } else {
+       free(tmp_cluster);
+       free(tmp_category);
+    }
 
-       return ret;
+    return ret;
 }
 
 HAPI int so_get_alt_info(struct instance *inst, char **icon, char **name)
 {
-       struct so_item *item;
-       int ret;
+    struct so_item *item;
+    int ret;
 
-       item = inst->item;
-       if (!item) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    item = inst->item;
+    if (!item) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       *icon = NULL;
-       *name = NULL;
+    *icon = NULL;
+    *name = NULL;
 
-       fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+    fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
-       s_info.current_op = LIVEBOX_OP_GET_ALT_INFO;
-       if (item->adaptor.get_alt_info) {
-               ret = item->adaptor.get_alt_info(item->pkgname, util_uri_to_path(inst->id), icon, name);
-       } else if (item->livebox.get_alt_info) {
-               ret = item->livebox.get_alt_info(util_uri_to_path(inst->id), icon, name);
-       } else {
-               ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
-       }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
-
-       fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
-       if (ret >= 0) {
-               if (*icon) {
-                       free(inst->icon);
-                       inst->icon = *icon;
-               }
-
-               if (*name) {
-                       free(inst->name);
-                       inst->name = *name;
-               }
+    s_info.current_op = DBOX_OP_GET_ALT_INFO;
+    if (item->adaptor.get_alt_info) {
+       ret = item->adaptor.get_alt_info(item->pkgname, util_uri_to_path(inst->id), icon, name);
+    } else if (item->dynamicbox.get_alt_info) {
+       ret = item->dynamicbox.get_alt_info(util_uri_to_path(inst->id), icon, name);
+    } else {
+       ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+    }
+    s_info.current_op = DBOX_OP_UNKNOWN;
+
+    fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+    if (ret >= 0) {
+       if (*icon) {
+           free(inst->icon);
+           inst->icon = *icon;
        }
 
-       if (main_heap_monitor_is_enabled()) {
-               DbgPrint("%s allocates %d bytes\n", item->pkgname, main_heap_monitor_target_usage(item->so_fname));
+       if (*name) {
+           free(inst->name);
+           inst->name = *name;
        }
+    }
 
-       return ret;
+    if (main_heap_monitor_is_enabled()) {
+       DbgPrint("%s allocates %d bytes\n", item->pkgname, main_heap_monitor_target_usage(item->so_fname));
+    }
+
+    return ret;
 }
 
 HAPI int so_get_output_info(struct instance *inst, int *w, int *h, double *priority, char **content, char **title)
 {
-       struct so_item *item;
-       int ret;
+    struct so_item *item;
+    int ret;
+
+    item = inst->item;
+    if (!item) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    *content = NULL;
+    *title = NULL;
+
+    fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+
+    s_info.current_op = DBOX_OP_GET_INFO;
+    if (item->adaptor.get_output_info) {
+       ret = item->adaptor.get_output_info(item->pkgname, util_uri_to_path(inst->id), w, h, priority, content, title);
+    } else if (item->dynamicbox.get_output_info) {
+       ret = item->dynamicbox.get_output_info(util_uri_to_path(inst->id), w, h, priority, content, title);
+    } else {
+       ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+    }
+    s_info.current_op = DBOX_OP_UNKNOWN;
+
+    fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+    if (ret >= 0) {
+       inst->w = *w;
+       inst->h = *h;
+       inst->priority = *priority;
+
+       /*!
+        * \todo
+        * Add "*content" "*title" address validation code.
+        * using mcheck?
+        */
 
-       item = inst->item;
-       if (!item) {
-               return LB_STATUS_ERROR_INVALID;
+       if (*content) {
+           free(inst->content);
+           inst->content = *content;
        }
 
-       *content = NULL;
-       *title = NULL;
-
-       fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
-
-       s_info.current_op = LIVEBOX_OP_GET_INFO;
-       if (item->adaptor.get_output_info) {
-               ret = item->adaptor.get_output_info(item->pkgname, util_uri_to_path(inst->id), w, h, priority, content, title);
-       } else if (item->livebox.get_output_info) {
-               ret = item->livebox.get_output_info(util_uri_to_path(inst->id), w, h, priority, content, title);
-       } else {
-               ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
-       }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
-
-       fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
-       if (ret >= 0) {
-               inst->w = *w;
-               inst->h = *h;
-               inst->priority = *priority;
-
-               /*!
-                * \todo
-                * Add "*content" "*title" address validation code.
-                * using mcheck?
-                */
-
-               if (*content) {
-                       free(inst->content);
-                       inst->content = *content;
-               }
-
-               if (*title) {
-                       free(inst->title);
-                       inst->title = *title;
-               }
+       if (*title) {
+           free(inst->title);
+           inst->title = *title;
        }
+    }
 
-       if (main_heap_monitor_is_enabled()) {
-               DbgPrint("%s allocates %d bytes\n", item->pkgname, main_heap_monitor_target_usage(item->so_fname));
-       }
+    if (main_heap_monitor_is_enabled()) {
+       DbgPrint("%s allocates %d bytes\n", item->pkgname, main_heap_monitor_target_usage(item->so_fname));
+    }
 
-       return ret;
+    return ret;
 }
 
 HAPI int so_sys_event(struct instance *inst, int event)
 {
-       struct so_item *item;
-       int ret;
-
-       item = inst->item;
-       if (!item) {
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
-
-       s_info.current_op = LIVEBOX_OP_SYSTEM_EVENT;
-       if (item->adaptor.sys_event) {
-               ret = item->adaptor.sys_event(item->pkgname, util_uri_to_path(inst->id), event);
-       } else if (item->livebox.sys_event) {
-               ret = item->livebox.sys_event(util_uri_to_path(inst->id), event);
-       } else {
-               ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
-       }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
-
-       fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
-       return ret;
+    struct so_item *item;
+    int ret;
+
+    item = inst->item;
+    if (!item) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+
+    s_info.current_op = DBOX_OP_SYSTEM_EVENT;
+    if (item->adaptor.sys_event) {
+       ret = item->adaptor.sys_event(item->pkgname, util_uri_to_path(inst->id), event);
+    } else if (item->dynamicbox.sys_event) {
+       ret = item->dynamicbox.sys_event(util_uri_to_path(inst->id), event);
+    } else {
+       ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+    }
+    s_info.current_op = DBOX_OP_UNKNOWN;
+
+    fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+    return ret;
 }
 
 HAPI enum current_operations so_current_op(void)
 {
-       return s_info.current_op;
+    return s_info.current_op;
 }
 
 /* End of a file */
diff --git a/src/theme_loader.c b/src/theme_loader.c
new file mode 100644 (file)
index 0000000..60aabce
--- /dev/null
@@ -0,0 +1,146 @@
+#include <stdio.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <dirent.h>
+
+#include <Elementary.h>
+#include <efl_assist.h>
+#include <dlog.h>
+
+#include <dynamicbox_errno.h>
+
+#include "conf.h"
+#include "debug.h"
+
+static struct info {
+    Eina_List *color_list;
+    Eina_List *font_list;
+} s_info = {
+    .color_list = NULL,
+    .font_list = NULL,
+};
+
+static int load_files(const char *path, int (*cb)(const char *fname, void *data), void *data)
+{
+    DIR *handle;
+    struct dirent *ent;
+    char *fname;
+    int plen;
+    int len;
+    int ret;
+
+    handle = opendir(path);
+    if (!handle) {
+       ErrPrint("opendir: %s (%s)\n", strerror(errno), path);
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
+
+    plen = strlen(path);
+
+    while ((ent = readdir(handle))) {
+       if (ent->d_name[0] == '.') {
+           continue;
+       }
+
+       len = strlen(ent->d_name);
+       DbgPrint("File: %s\n", ent->d_name);
+       if (len <= 4 || strcasecmp(ent->d_name + len - 4, ".xml")) {
+           DbgPrint("Skip: %s\n", ent->d_name);
+           continue;
+       }
+
+       len = plen + len + 2;
+
+       fname = malloc(len);
+       if (!fname) {
+           if (closedir(handle) < 0) {
+               ErrPrint("closedir: %s\n", strerror(errno));
+           }
+           return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+       }
+
+       snprintf(fname, len, "%s/%s", path, ent->d_name);
+       ret = cb(fname, data);
+        free(fname);
+       if (ret < 0) {
+           break;
+       }
+    }
+
+    if (closedir(handle) < 0) {
+       ErrPrint("closedir: %s\n", strerror(errno));
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+static int color_loader_cb(const char *fname, void *data)
+{
+    Ea_Theme_Color_Table *color;
+
+    DbgPrint("Load color theme: %s\n", fname);
+    color = ea_theme_color_table_new(fname);
+    if (!color) {
+        ErrPrint("Failed to load theme table: %s\n", fname);
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    ea_theme_colors_set(color, EA_THEME_STYLE_DEFAULT);
+
+    s_info.color_list = eina_list_append(s_info.color_list, color);
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+static int font_loader_cb(const char *fname, void *data)
+{
+    Eina_List *list;
+
+    DbgPrint("Load font theme: %s\n", fname);
+    list = ea_theme_font_table_new(fname);
+    if (!list) {
+       ErrPrint("Failed to load font table: %s\n", fname);
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    ea_theme_fonts_set(list);
+    s_info.font_list = eina_list_append(s_info.font_list, list);
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+HAPI int theme_loader_load(const char *path)
+{
+    char *folder;
+    int len;
+
+    len = strlen(path) + strlen("color") + 2;
+    folder = malloc(len);
+    if (!folder) {
+       ErrPrint("malloc: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    snprintf(folder, len, "%s/color", path);
+    (void)load_files(folder, color_loader_cb, NULL);
+
+    snprintf(folder, len, "%s/font", path);
+    (void)load_files(folder, font_loader_cb, NULL);
+
+    free(folder);
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+HAPI void theme_loader_unload(void)
+{
+    Ea_Theme_Color_Table *color_item;
+    Eina_List *font_item;
+
+    EINA_LIST_FREE(s_info.color_list, color_item) {
+       ea_theme_color_table_free(color_item);
+    }
+
+    EINA_LIST_FREE(s_info.font_list, font_item) {
+       ea_theme_font_table_free(font_item);
+    }
+}
+
+/* End of a file */
index f848fa1..4203ad4 100644 (file)
@@ -26,7 +26,8 @@
 #include <Eina.h>
 
 #include <dlog.h>
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
+#include <dynamicbox_conf.h>
 
 #include "critical_log.h"
 #include "update_monitor.h"
 int errno;
 
 struct cb_item {
-       char *filename;
-       int (*cb)(const char *filename, void *data, int over);
-       void *data;
-       int deleted;
+    char *filename;
+    int (*cb)(const char *filename, void *data, int over);
+    void *data;
+    int deleted;
 };
 
 static struct info {
-       int ifd;
-       int iwd;
-       Ecore_Fd_Handler *handler;
-       Eina_List *update_list;
-       Eina_List *delete_list;
-       unsigned int update_list_in_use;
-       unsigned int delete_list_in_use;
+    int ifd;
+    int iwd;
+    Ecore_Fd_Handler *handler;
+    Eina_List *update_list;
+    Eina_List *delete_list;
+    unsigned int update_list_in_use;
+    unsigned int delete_list_in_use;
 } s_info = {
-       .ifd = -EINVAL,
-       .iwd = -EINVAL,
-       .handler = NULL,
-       .update_list = NULL,
-       .delete_list = NULL,
-       .update_list_in_use = 0,
-       .delete_list_in_use = 0,
+    .ifd = -EINVAL,
+    .iwd = -EINVAL,
+    .handler = NULL,
+    .update_list = NULL,
+    .delete_list = NULL,
+    .update_list_in_use = 0,
+    .delete_list_in_use = 0,
 };
 
 static void *update_item_destroy(struct cb_item *item, Eina_List *l)
 {
-       void *data;
-
-       if (s_info.update_list_in_use) {
-               item->deleted = 1;
-               data = item->data;
-       } else {
-               s_info.update_list = eina_list_remove_list(s_info.update_list, l);
-               data = item->data;
-               free(item->filename);
-               free(item);
-       }
-
-       return data;
+    void *data;
+
+    if (s_info.update_list_in_use) {
+       item->deleted = 1;
+       data = item->data;
+    } else {
+       s_info.update_list = eina_list_remove_list(s_info.update_list, l);
+       data = item->data;
+       free(item->filename);
+       free(item);
+    }
+
+    return data;
 }
 
 static void *delete_item_destroy(struct cb_item *item, Eina_List *l)
 {
-       void *data;
-
-       if (s_info.delete_list_in_use == 1) {
-               item->deleted = 1;
-               data = item->data;
-       } else {
-               s_info.delete_list = eina_list_remove_list(s_info.delete_list, l);
-               data = item->data;
-               free(item->filename);
-               free(item);
-       }
-
-       return data;
+    void *data;
+
+    if (s_info.delete_list_in_use == 1) {
+       item->deleted = 1;
+       data = item->data;
+    } else {
+       s_info.delete_list = eina_list_remove_list(s_info.delete_list, l);
+       data = item->data;
+       free(item->filename);
+       free(item);
+    }
+
+    return data;
 }
 
 static Eina_Bool monitor_cb(void *data, Ecore_Fd_Handler *handler)
 {
-       int fd;
-       int read_size;
-       char *buffer;
-       register int i;
-       struct inotify_event *evt;
-       char *filename;
-       int len;
-       int ret;
-
-       fd = ecore_main_fd_handler_fd_get(handler);
-       if (fd < 0) {
-               ErrPrint("Failed to get file handler\n");
-               return ECORE_CALLBACK_CANCEL;
-       }
+    int fd;
+    int read_size;
+    char *buffer;
+    register int i;
+    struct inotify_event *evt;
+    char *filename;
+    int len;
+    int ret;
+
+    fd = ecore_main_fd_handler_fd_get(handler);
+    if (fd < 0) {
+       ErrPrint("Failed to get file handler\n");
+       return ECORE_CALLBACK_CANCEL;
+    }
+
+    if (ioctl(fd, FIONREAD, &read_size) < 0) {
+       ErrPrint("Failed to get q size (%s)\n", strerror(errno));
+       return ECORE_CALLBACK_CANCEL;
+    }
+
+    if (read_size <= 0) {
+       ErrPrint("Buffer is not ready!!!\n");
+       return ECORE_CALLBACK_RENEW;
+    }
 
-       if (ioctl(fd, FIONREAD, &read_size) < 0) {
-               ErrPrint("Failed to get q size (%s)\n", strerror(errno));
-               return ECORE_CALLBACK_CANCEL;
-       }
+    buffer = calloc(read_size+1, sizeof(char));
+    if (!buffer) {
+       ErrPrint("Error: %s\n", strerror(errno));
+       return ECORE_CALLBACK_CANCEL;
+    }
 
-       if (read_size <= 0) {
-               ErrPrint("Buffer is not ready!!!\n");
-               return ECORE_CALLBACK_RENEW;
+    if (read(fd, buffer, read_size) != read_size) {
+       ErrPrint("Could not get entire events (%s)\n", strerror(errno));
+       free(buffer);
+       return ECORE_CALLBACK_CANCEL;
+    }
+
+    i = 0;
+    while (i < read_size) {
+       evt = (struct inotify_event *)(buffer + i);
+       i += sizeof(*evt) + evt->len;
+
+       if (util_check_ext(evt->name, "gnp.") == 0
+               && util_check_ext(evt->name, "csed.") == 0)
+       {
+           continue;
        }
 
-       buffer = calloc(read_size+1, sizeof(char));
-       if (!buffer) {
-               ErrPrint("Error: %s\n", strerror(errno));
-               return ECORE_CALLBACK_CANCEL;
+       len = strlen(evt->name) + strlen(DYNAMICBOX_CONF_IMAGE_PATH) + 1;
+       filename = malloc(len);
+       if (!filename) {
+           ErrPrint("Error: %s\n", strerror(errno));
+           /* We met error, but keep going,
+            * and care the remained buffer.
+            */
+           continue;
        }
 
-       if (read(fd, buffer, read_size) != read_size) {
-               ErrPrint("Could not get entire events (%s)\n", strerror(errno));
-               free(buffer);
-               return ECORE_CALLBACK_CANCEL;
+       ret = snprintf(filename, len, "%s%s", DYNAMICBOX_CONF_IMAGE_PATH, evt->name);
+       if (ret < 0) {
+           ErrPrint("Error: %s\n", strerror(errno));
+           /* We met error, but keep goging.
+            * and care the remained buffer.
+            */
+           free(filename);
+           continue;
        }
 
-       i = 0;
-       while (i < read_size) {
-               evt = (struct inotify_event *)(buffer + i);
-               i += sizeof(*evt) + evt->len;
-
-               if (util_check_ext(evt->name, "gnp.") == 0
-                       && util_check_ext(evt->name, "csed.") == 0)
-               {
-                       continue;
-               }
-
-               len = strlen(evt->name) + strlen(IMAGE_PATH) + 1;
-               filename = malloc(len);
-               if (!filename) {
-                       ErrPrint("Error: %s\n", strerror(errno));
-                       /* We met error, but keep going,
-                        * and care the remained buffer.
-                        */
-                       continue;
-               }
-
-               ret = snprintf(filename, len, "%s%s", IMAGE_PATH, evt->name);
-               if (ret < 0) {
-                       ErrPrint("Error: %s\n", strerror(errno));
-                       /* We met error, but keep goging.
-                        * and care the remained buffer.
-                        */
-                       free(filename);
-                       continue;
-               }
-
-               if (evt->mask & (IN_DELETE | IN_MOVED_FROM)) {
-                       update_monitor_trigger_delete_cb(filename, !!(evt->mask & IN_Q_OVERFLOW));
-               } else if (evt->mask & (IN_CLOSE_WRITE | IN_MOVED_TO)) {
-                       update_monitor_trigger_update_cb(filename, !!(evt->mask & IN_Q_OVERFLOW));
-               }
-
-               free(filename);
+       if (evt->mask & (IN_DELETE | IN_MOVED_FROM)) {
+           update_monitor_trigger_delete_cb(filename, !!(evt->mask & IN_Q_OVERFLOW));
+       } else if (evt->mask & (IN_CLOSE_WRITE | IN_MOVED_TO)) {
+           update_monitor_trigger_update_cb(filename, !!(evt->mask & IN_Q_OVERFLOW));
        }
 
-       free(buffer);
-       return ECORE_CALLBACK_RENEW;
+       free(filename);
+    }
+
+    free(buffer);
+    return ECORE_CALLBACK_RENEW;
 }
 
 HAPI int update_monitor_init(void)
 {
-       s_info.ifd = inotify_init();
-       if (s_info.ifd < 0) {
-               ErrPrint("Error: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_IO;
+    DbgPrint("Shared folder: %s\n", DYNAMICBOX_CONF_IMAGE_PATH);
+
+    s_info.ifd = inotify_init();
+    if (s_info.ifd < 0) {
+       ErrPrint("Error: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
+
+    if (access(DYNAMICBOX_CONF_IMAGE_PATH, R_OK | X_OK) != 0) {
+       ErrPrint("Image folder is not exists\n");
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
+
+    s_info.iwd = inotify_add_watch(s_info.ifd, DYNAMICBOX_CONF_IMAGE_PATH,
+           IN_DELETE | IN_CLOSE_WRITE | IN_MOVED_TO | IN_MOVED_FROM);
+
+    if (s_info.iwd < 0) {
+       ErrPrint("Error: %s\n", strerror(errno));
+       if (close(s_info.ifd) < 0) {
+           ErrPrint("close: %s\n", strerror(errno));
        }
-
-       if (access(IMAGE_PATH, R_OK | X_OK) != 0) {
-               ErrPrint("Image folder is not exists\n");
-               return LB_STATUS_ERROR_IO;
-       }
-
-       s_info.iwd = inotify_add_watch(s_info.ifd, IMAGE_PATH,
-               IN_DELETE | IN_CLOSE_WRITE | IN_MOVED_TO | IN_MOVED_FROM);
-
-       if (s_info.iwd < 0) {
-               ErrPrint("Error: %s\n", strerror(errno));
-               if (close(s_info.ifd) < 0) {
-                       ErrPrint("close: %s\n", strerror(errno));
-               }
-               s_info.ifd = LB_STATUS_ERROR_INVALID;
-               return LB_STATUS_ERROR_IO;
+       s_info.ifd = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
+
+    s_info.handler = ecore_main_fd_handler_add(s_info.ifd,
+           ECORE_FD_READ, monitor_cb, NULL, NULL, NULL);
+    if (!s_info.handler) {
+       ErrPrint("Failed to add a FD handler\n");
+       if (inotify_rm_watch(s_info.ifd, s_info.iwd) < 0) {
+           ErrPrint("inotify_rm_watch: %s", strerror(errno));
        }
+       s_info.iwd = -EINVAL;
 
-       s_info.handler = ecore_main_fd_handler_add(s_info.ifd,
-                               ECORE_FD_READ, monitor_cb, NULL, NULL, NULL);
-       if (!s_info.handler) {
-               ErrPrint("Failed to add a FD handler\n");
-               if (inotify_rm_watch(s_info.ifd, s_info.iwd) < 0) {
-                       ErrPrint("inotify_rm_watch: %s", strerror(errno));
-               }
-               s_info.iwd = -EINVAL;
-
-               if (close(s_info.ifd) < 0) {
-                       ErrPrint("close: %s\n", strerror(errno));
-               }
-               s_info.ifd = LB_STATUS_ERROR_INVALID;
-               return LB_STATUS_ERROR_FAULT;
+       if (close(s_info.ifd) < 0) {
+           ErrPrint("close: %s\n", strerror(errno));
        }
+       s_info.ifd = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       DbgPrint("Update monitor is successfully initialized\n");
-       return LB_STATUS_SUCCESS;
+    DbgPrint("Update monitor is successfully initialized\n");
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int update_monitor_fini(void)
 {
-       if (!s_info.handler) {
-               ErrPrint("Invalid fd handler\n");
-       } else {
-               ecore_main_fd_handler_del(s_info.handler);
-               s_info.handler = NULL;
+    if (!s_info.handler) {
+       ErrPrint("Invalid fd handler\n");
+    } else {
+       ecore_main_fd_handler_del(s_info.handler);
+       s_info.handler = NULL;
+    }
+
+    if (s_info.ifd >= 0) {
+       if (inotify_rm_watch(s_info.ifd, s_info.iwd) < 0) {
+           ErrPrint("inotify_rm_watch:%s", strerror(errno));
        }
 
-       if (s_info.ifd >= 0) {
-               if (inotify_rm_watch(s_info.ifd, s_info.iwd) < 0) {
-                       ErrPrint("inotify_rm_watch:%s", strerror(errno));
-               }
-
-               s_info.iwd = LB_STATUS_ERROR_INVALID;
+       s_info.iwd = DBOX_STATUS_ERROR_INVALID_PARAMETER;
 
-               if (close(s_info.ifd) < 0) {
-                       ErrPrint("close: %s\n", strerror(errno));
-               }
-               s_info.ifd = LB_STATUS_ERROR_INVALID;
+       if (close(s_info.ifd) < 0) {
+           ErrPrint("close: %s\n", strerror(errno));
        }
+       s_info.ifd = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int update_monitor_trigger_update_cb(const char *filename, int over)
 {
-       Eina_List *l;
-       Eina_List *n;
-       struct cb_item *item;
-       int cnt = 0;
-
-       s_info.update_list_in_use = 1;
-       EINA_LIST_FOREACH_SAFE(s_info.update_list, l, n, item) {
-               if (!strcmp(filename, item->filename)) {
-                       if (item->deleted || item->cb(filename, item->data, over) == EXIT_FAILURE || item->deleted) {
-                               /* Item can be deleted from the callback, so need to check existence */
-                               s_info.update_list = eina_list_remove_list(s_info.update_list, l);
-                               free(item->filename);
-                               free(item);
-                       }
-                       cnt++;
-               }
+    Eina_List *l;
+    Eina_List *n;
+    struct cb_item *item;
+    int cnt = 0;
+
+    s_info.update_list_in_use = 1;
+    EINA_LIST_FOREACH_SAFE(s_info.update_list, l, n, item) {
+       if (!strcmp(filename, item->filename)) {
+           if (item->deleted || item->cb(filename, item->data, over) == EXIT_FAILURE || item->deleted) {
+               /* Item can be deleted from the callback, so need to check existence */
+               s_info.update_list = eina_list_remove_list(s_info.update_list, l);
+               free(item->filename);
+               free(item);
+           }
+           cnt++;
        }
-       s_info.update_list_in_use = 0;
+    }
+    s_info.update_list_in_use = 0;
 
-       return cnt == 0 ? LB_STATUS_ERROR_INVALID : LB_STATUS_SUCCESS;
+    return cnt == 0 ? DBOX_STATUS_ERROR_INVALID_PARAMETER : DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int update_monitor_trigger_delete_cb(const char *filename, int over)
 {
-       Eina_List *l;
-       Eina_List *n;
-       struct cb_item *item;
-       int cnt = 0;
-
-       s_info.delete_list_in_use = 1;
-       EINA_LIST_FOREACH_SAFE(s_info.delete_list, l, n, item) {
-               if (!strcmp(filename, item->filename)) {
-                       /* delete should be checked before call the callback & after call the callback */
-                       if (item->deleted || item->cb(filename, item->data, over) == EXIT_FAILURE || item->deleted) {
-                               s_info.delete_list = eina_list_remove_list(s_info.delete_list, l);
-                               free(item->filename);
-                               free(item);
-                       }
-
-                       cnt++;
-               }
+    Eina_List *l;
+    Eina_List *n;
+    struct cb_item *item;
+    int cnt = 0;
+
+    s_info.delete_list_in_use = 1;
+    EINA_LIST_FOREACH_SAFE(s_info.delete_list, l, n, item) {
+       if (!strcmp(filename, item->filename)) {
+           /* delete should be checked before call the callback & after call the callback */
+           if (item->deleted || item->cb(filename, item->data, over) == EXIT_FAILURE || item->deleted) {
+               s_info.delete_list = eina_list_remove_list(s_info.delete_list, l);
+               free(item->filename);
+               free(item);
+           }
+
+           cnt++;
        }
-       s_info.delete_list_in_use = 0;
+    }
+    s_info.delete_list_in_use = 0;
 
-       return cnt == 0 ? LB_STATUS_ERROR_INVALID : LB_STATUS_SUCCESS;
+    return cnt == 0 ? DBOX_STATUS_ERROR_INVALID_PARAMETER : DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int update_monitor_add_update_cb(const char *filename,
-               int (*cb)(const char *filename, void *data, int over), void *data)
+       int (*cb)(const char *filename, void *data, int over), void *data)
 {
-       struct cb_item *item;
-
-       item = calloc(1, sizeof(*item));
-       if (!item) {
-               ErrPrint("calloc:%s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       item->filename = strdup(filename);
-       if (!item->filename) {
-               ErrPrint("Error: %s\n", strerror(errno));
-               free(item);
-               return LB_STATUS_ERROR_MEMORY;
-       }
-       item->cb = cb;
-       item->data = data;
-
-       s_info.update_list = eina_list_append(s_info.update_list, item);
-       return LB_STATUS_SUCCESS;
+    struct cb_item *item;
+
+    item = calloc(1, sizeof(*item));
+    if (!item) {
+       ErrPrint("calloc:%s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    item->filename = strdup(filename);
+    if (!item->filename) {
+       ErrPrint("Error: %s\n", strerror(errno));
+       free(item);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+    item->cb = cb;
+    item->data = data;
+
+    s_info.update_list = eina_list_append(s_info.update_list, item);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int update_monitor_add_delete_cb(const char *filename,
-               int (*cb)(const char *filename, void *data, int over), void *data)
+       int (*cb)(const char *filename, void *data, int over), void *data)
 {
-       struct cb_item *item;
-
-       item = calloc(1, sizeof(*item));
-       if (!item) {
-               ErrPrint("calloc:%s", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       item->filename = strdup(filename);
-       if (!item->filename) {
-               ErrPrint("Error: %s\n", strerror(errno));
-               free(item);
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       item->cb = cb;
-       item->data = data;
-
-       s_info.delete_list = eina_list_append(s_info.delete_list, item);
-       return LB_STATUS_SUCCESS;
+    struct cb_item *item;
+
+    item = calloc(1, sizeof(*item));
+    if (!item) {
+       ErrPrint("calloc:%s", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    item->filename = strdup(filename);
+    if (!item->filename) {
+       ErrPrint("Error: %s\n", strerror(errno));
+       free(item);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    item->cb = cb;
+    item->data = data;
+
+    s_info.delete_list = eina_list_append(s_info.delete_list, item);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI void *update_monitor_del_update_cb(const char *filename,
-                       int (*cb)(const char *filename, void *data, int over))
+       int (*cb)(const char *filename, void *data, int over))
 {
-       Eina_List *l;
-       struct cb_item *item;
+    Eina_List *l;
+    struct cb_item *item;
 
-       EINA_LIST_FOREACH(s_info.update_list, l, item) {
-               if (item->cb == cb && !strcmp(item->filename, filename)) {
-                       return update_item_destroy(item, l);
-               }
+    EINA_LIST_FOREACH(s_info.update_list, l, item) {
+       if (item->cb == cb && !strcmp(item->filename, filename)) {
+           return update_item_destroy(item, l);
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
 HAPI void *update_monitor_del_delete_cb(const char *filename,
-                       int (*cb)(const char *filename, void *data, int over))
+       int (*cb)(const char *filename, void *data, int over))
 {
-       Eina_List *l;
-       struct cb_item *item;
+    Eina_List *l;
+    struct cb_item *item;
 
-       EINA_LIST_FOREACH(s_info.delete_list, l, item) {
-               if (item->cb == cb && !strcmp(item->filename, filename)) {
-                       return delete_item_destroy(item, l);
-               }
+    EINA_LIST_FOREACH(s_info.delete_list, l, item) {
+       if (item->cb == cb && !strcmp(item->filename, filename)) {
+           return delete_item_destroy(item, l);
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
 /* End of a file */
index 9ecbe25..101128e 100644 (file)
 #include <sys/stat.h>
 #include <dlfcn.h>
 #include <pthread.h>
+#include <link.h>
 
 #include <Eina.h>
 #include <Ecore.h>
 
 #include <dlog.h>
 #include <aul.h>
-#include <livebox-errno.h>
-#include <livebox-service.h>
+#include <dynamicbox_errno.h>
+#include <dynamicbox_conf.h>
+#include <dynamicbox_service.h>
 
 #include "critical_log.h"
 #include "util.h"
-#include "conf.h"
 #include "debug.h"
+#include "conf.h"
 
 HAPI int util_check_ext(const char *icon, const char *ext)
 {
-       int len;
+    int len;
 
-       len = strlen(icon) - 1;
-       while (len >= 0 && *ext && icon[len] == *ext) {
-               len--;
-               ext++;
-       }
+    len = strlen(icon) - 1;
+    while (len >= 0 && *ext && icon[len] == *ext) {
+       len--;
+       ext++;
+    }
 
-       return *ext ? 0 : 1;
+    return *ext ? 0 : 1;
 }
 
 HAPI int util_get_filesize(const char *filename)
 {
-       struct stat buf;
+    struct stat buf;
 
-       if (stat(filename, &buf) < 0) {
-               ErrPrint("error: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_IO;
-       }
+    if (stat(filename, &buf) < 0) {
+       ErrPrint("error: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
 
-       if (!S_ISREG(buf.st_mode)) {
-               ErrPrint("%s is not a file\n", filename);
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!S_ISREG(buf.st_mode)) {
+       ErrPrint("%s is not a file\n", filename);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       return buf.st_size;
+    return buf.st_size;
 }
 
 HAPI double util_timestamp(void)
 {
 #if defined(_USE_ECORE_TIME_GET)
-       return ecore_time_get();
+    return ecore_time_get();
 #else
-       struct timeval tv;
+    struct timeval tv;
 
-       if (gettimeofday(&tv, NULL) < 0) {
-               static unsigned long internal_count = 0;
+    if (gettimeofday(&tv, NULL) < 0) {
+       static unsigned long internal_count = 0;
 
-               ErrPrint("gettimeofday: %s\n", strerror(errno));
-               tv.tv_sec = internal_count++;
-               tv.tv_usec = 0;
-       }
+       ErrPrint("gettimeofday: %s\n", strerror(errno));
+       tv.tv_sec = internal_count++;
+       tv.tv_usec = 0;
+    }
 
-       return (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0f;
+    return (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0f;
 #endif
 }
 
 HAPI const char *util_basename(const char *name)
 {
-       int length;
+    int length;
 
-       length = name ? strlen(name) : 0;
-       if (!length) {
-               return ".";
-       }
+    length = name ? strlen(name) : 0;
+    if (!length) {
+       return ".";
+    }
 
-       while (--length > 0 && name[length] != '/');
+    while (--length > 0 && name[length] != '/');
 
-       return length <= 0 ? name : name + length + (name[length] == '/');
+    return length <= 0 ? name : name + length + (name[length] == '/');
 }
 
 /*!
@@ -107,118 +109,144 @@ HAPI const char *util_basename(const char *name)
  */
 HAPI char *util_get_current_module(char **symbol)
 {
-       int *stack;
-       Dl_info dinfo;
-       char *ret;
-       pthread_attr_t attr;
-       unsigned int stack_boundary = 0;
-       unsigned int stack_size = 0;
-       register int i;
+    int *stack;
+    Dl_info dinfo;
+    char *ret;
+    pthread_attr_t attr;
+    unsigned int stack_boundary = 0;
+    unsigned int stack_size = 0;
+    register int i;
+
+    if (!pthread_getattr_np(pthread_self(), &attr)) {
+       if (!pthread_attr_getstack(&attr, (void *)&stack_boundary, &stack_size)) {
+           stack_boundary += stack_size;
+       }
+       pthread_attr_destroy(&attr);
+    }
 
-       if (!pthread_getattr_np(pthread_self(), &attr)) {
-               if (!pthread_attr_getstack(&attr, (void *)&stack_boundary, &stack_size)) {
-                       stack_boundary += stack_size;
-               }
-               pthread_attr_destroy(&attr);
+    ret = NULL;
+    for (i = 0, stack = (int *)&stack; (unsigned int)stack < stack_boundary ; stack++, i++) {
+       if (!dladdr((void *)*stack, &dinfo)) {
+           continue;
        }
 
-       ret = NULL;
-       for (i = 0, stack = (int *)&stack; (unsigned int)stack < stack_boundary ; stack++, i++) {
-               if (!dladdr((void *)*stack, &dinfo)) {
-                       continue;
-               }
-
-               
-               ret = livebox_service_pkgname_by_libexec(dinfo.dli_fname);
-               if (!ret) {
-                       DbgPrint("[%d] fname[%s] symbol[%s]\n", i, dinfo.dli_fname, dinfo.dli_sname);
-                       continue;
-               }
-
-               free(ret);
-               ret = strdup(dinfo.dli_fname);
-
-               if (symbol) {
-                       if (dinfo.dli_sname) {
-                               *symbol = strdup(dinfo.dli_sname);
-                       } else {
-                               *symbol = NULL;
-                       }
-               }
-               break;
+
+       ret = dynamicbox_service_dbox_id_by_libexec(dinfo.dli_fname);
+       if (!ret) {
+           DbgPrint("[%d] fname[%s] symbol[%s]\n", i, dinfo.dli_fname, dinfo.dli_sname);
+           continue;
        }
 
-       return ret;
+       free(ret);
+       ret = strdup(dinfo.dli_fname);
+
+       if (symbol) {
+           if (dinfo.dli_sname) {
+               *symbol = strdup(dinfo.dli_sname);
+           } else {
+               *symbol = NULL;
+           }
+       }
+       break;
+    }
+
+    return ret;
 }
 
 HAPI const char *util_uri_to_path(const char *uri)
 {
-       int len;
+    int len;
 
-       len = strlen(SCHEMA_FILE);
-       if (strncasecmp(uri, SCHEMA_FILE, len)) {
-               return NULL;
-       }
+    len = strlen(SCHEMA_FILE);
+    if (strncasecmp(uri, SCHEMA_FILE, len)) {
+       return NULL;
+    }
 
-       return uri + len;
+    return uri + len;
 }
 
 HAPI double util_time_delay_for_compensation(double period)
 {
-       unsigned long long curtime;
-       unsigned long long _period;
-       unsigned long long remain;
-       struct timeval tv;
-       double ret;
-
-       if (period == 0.0f) {
-               DbgPrint("Period is ZERO\n");
-               return 0.0f;
-       }
-
-       if (gettimeofday(&tv, NULL) < 0) {
-               ErrPrint("gettimeofday: %s\n", strerror(errno));
-               return period;
-       }
+    unsigned long long curtime;
+    unsigned long long _period;
+    unsigned long long remain;
+    struct timeval tv;
+    double ret;
+
+    if (period == 0.0f) {
+       DbgPrint("Period is ZERO\n");
+       return 0.0f;
+    }
+
+    if (gettimeofday(&tv, NULL) < 0) {
+       ErrPrint("gettimeofday: %s\n", strerror(errno));
+       return period;
+    }
+
+    curtime = (unsigned long long)tv.tv_sec * 1000000llu + (unsigned long long)tv.tv_usec;
+
+    _period = (unsigned long long)(period * (double)1000000);
+    if (_period == 0llu) {
+       ErrPrint("%lf <> %llu\n", period, _period);
+       return period;
+    }
+
+    remain = curtime % _period;
+
+    ret = (double)remain / (double)1000000;
+    return period - ret;
+}
 
-       curtime = (unsigned long long)tv.tv_sec * 1000000llu + (unsigned long long)tv.tv_usec;
+HAPI void *util_timer_add(double interval, Eina_Bool (*cb)(void *data), void *data)
+{
+    Ecore_Timer *timer;
+    double delay;
 
-       _period = (unsigned long long)(period * (double)1000000);
-       if (_period == 0llu) {
-               ErrPrint("%lf <> %llu\n", period, _period);
-               return period;
-       }
+    timer = ecore_timer_add(interval, cb, data);
+    if (!timer) {
+       return NULL;
+    }
 
-       remain = curtime % _period;
+    delay = util_time_delay_for_compensation(interval) - interval;
+    ecore_timer_delay(timer, delay);
 
-       ret = (double)remain / (double)1000000;
-       return period - ret;
+    return timer;
 }
 
-HAPI void *util_timer_add(double interval, Eina_Bool (*cb)(void *data), void *data)
+HAPI void util_timer_interval_set(void *timer, double interval)
 {
-       Ecore_Timer *timer;
-       double delay;
+    double delay;
+    ecore_timer_interval_set(timer, interval);
+    ecore_timer_reset(timer);
 
-       timer = ecore_timer_add(interval, cb, data);
-       if (!timer) {
-               return NULL;
-       }
+    delay = util_time_delay_for_compensation(interval) - interval;
+    ecore_timer_delay(timer, delay);
+}
 
-       delay = util_time_delay_for_compensation(interval) - interval;
-       ecore_timer_delay(timer, delay);
+static int dump_so_info_cb(struct dl_phdr_info *info, size_t size, void *data)
+{
+    if (data && info->dlpi_name && !strcmp(data, info->dlpi_name)) {
+       register int i;
+       ErrPrint("Base Address of %s [%p]\n", util_basename(info->dlpi_name), info->dlpi_addr);
+       for (i = 0; i < info->dlpi_phnum; i++) {
+           ErrPrint("type[%x] off[%x] vaddr[%lx] paddr[%lx] fsz[%x] msz[%x] f[%x] align[%x]\n",
+                   info->dlpi_phdr[i].p_type,
+                   info->dlpi_phdr[i].p_offset,
+                   info->dlpi_phdr[i].p_vaddr,
+                   info->dlpi_phdr[i].p_paddr,
+                   info->dlpi_phdr[i].p_filesz,
+                   info->dlpi_phdr[i].p_memsz,
+                   info->dlpi_phdr[i].p_flags,
+                   info->dlpi_phdr[i].p_align);
+       }
+    }
 
-       return timer;
+    return 0;
 }
 
-HAPI void util_timer_interval_set(void *timer, double interval)
+HAPI void util_dump_current_so_info(const char *path)
 {
-       double delay;
-       ecore_timer_interval_set(timer, interval);
-       ecore_timer_reset(timer);
-
-       delay = util_time_delay_for_compensation(interval) - interval;
-       ecore_timer_delay(timer, delay);
+    (void)dl_iterate_phdr(dump_so_info_cb, (void *)path);
 }
 
 /* End of a file */
diff --git a/src/util_wayland.c b/src/util_wayland.c
new file mode 100644 (file)
index 0000000..6e5b713
--- /dev/null
@@ -0,0 +1,27 @@
+#include "util.h"
+
+#include <dynamicbox_errno.h>
+
+void *util_screen_get(void)
+{
+    return NULL;
+}
+
+int util_screen_size_get(int *width, int *height)
+{
+    *width = 0;
+    *height = 0;
+    return DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+}
+
+int util_screen_init(void)
+{
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+int util_screen_fini(void)
+{
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+/* End of a file */
diff --git a/src/util_x11.c b/src/util_x11.c
new file mode 100644 (file)
index 0000000..8ff9566
--- /dev/null
@@ -0,0 +1,30 @@
+#include <Ecore_X.h>
+#include <dlog.h>
+
+#include <dynamicbox_errno.h>
+#include "util.h"
+#include "debug.h"
+
+void *util_screen_get(void)
+{
+    return ecore_x_display_get();
+}
+
+int util_screen_size_get(int *width, int *height)
+{
+    ecore_x_window_size_get(0, width, height);
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+int util_screen_init(void)
+{
+    return ecore_x_init(NULL);
+}
+
+int util_screen_fini(void)
+{
+    return ecore_x_shutdown();
+}
+
+/* End of a file */
+
index 3a72eb8..22042ba 100644 (file)
 
 int errno;
 
-const char *livebox_find_pkgname(const char *filename)
+const char *dynamicbox_find_pkgname(const char *filename)
 {
        return NULL;
 }
 
-int livebox_request_update_by_id(const char *filename)
+int dynamicbox_request_update_by_id(const char *filename)
 {
        return 0;
 }
 
-int livebox_trigger_update_monitor(const char *filename, int is_pd)
+int dynamicbox_trigger_update_monitor(const char *filename, int is_pd)
 {
        return 0;
 }