Replace livebox with dynamicbox
authorSung-jae Park <nicesj.park@samsung.com>
Thu, 30 Oct 2014 01:41:52 +0000 (10:41 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Thu, 30 Oct 2014 01:41:52 +0000 (10:41 +0900)
[model] Redwood,Kiran,B3(Wearable)
[binary_type] AP
[customer] Docomo/Orange/ATT/Open
[issue#] N/A
[problem]
[cause]
[solution]
[team] HomeTF
[request]
[horizontal_expansion]

Change-Id: I35bacf5fee379caab38c0b19345e3698c4fc9ff3

25 files changed:
CMakeLists.txt
com.samsung.data-provider-slave.rule
com.samsung.data-provider-slave.xml
icon_src/main.c
icon_src/script_handler.c
include/conf.h
include/dbox.h [new file with mode: 0644]
include/lb.h [deleted file]
include/so_handler.h
packaging/com.samsung.data-provider-slave.manifest
packaging/com.samsung.data-provider-slave.spec
src/client.c
src/conf.c [deleted file]
src/connection.c
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/update_monitor.c
src/util.c
src/util_wayland.c
src/util_x11.c
stub/main.c

index 2836ffa..a887b38 100644 (file)
@@ -15,11 +15,11 @@ pkg_check_modules(pkg REQUIRED
        gio-2.0
        bundle
        ecore
-       provider
-       livebox-service
+       dynamicbox_provider
+       dynamicbox_service
        edje
        evas
-       livebox
+       dynamicbox
        elementary
        capi-system-system-settings
        com-core
@@ -79,9 +79,8 @@ SET(BUILD_SOURCE
        src/so_handler.c
        src/fault.c
        src/update_monitor.c
-       src/conf.c
        src/util.c
-       src/lb.c
+       src/dbox.c
        src/client.c
        src/critical_log.c
        src/connection.c
index 50883f9..ddfb534 100644 (file)
@@ -19,5 +19,5 @@ com.samsung.data-provider-slave sound_server rw
 com.samsung.data-provider-slave tts-server rwx
 com.samsung.data-provider-slave aul::launch x
 com.samsung.data-provider-slave security-server::api-cookie-check w
+com.samsung.data-provider-slave ug-setting-call-efl::vconf r
 com.samsung.data-provider-slave deviced::haptic rw
-com.samsung.data-provider-slave com.samsung.homescreen rw
index d34fe2a..8e43bf5 100644 (file)
@@ -7,7 +7,7 @@
 
        <ui-application appid="com.samsung.data-provider-slave" exec="/usr/apps/com.samsung.data-provider-slave/bin/data-provider-slave" nodisplay="true" multiple="true" type="capp" taskmanage="false">
                <icon>com.samsung.data-provider-slave.png</icon>
-               <label>Dynamic Box Provider (Default)</label>
+               <label>Dynamic Box Provider (slave)</label>
                <label xml:lang="en-us">Dynamic Box Provider (slave)</label>
        </ui-application>
        <privileges>
@@ -19,7 +19,4 @@
                <label>Icon Provider (Default)</label>
                <label xml:lang="en-us">Icon Provider (Default)</label>
        </ui-application>
-       <privileges>
-               <privilege>http://tizen.org/privilege/contact.read</privilege>
-       </privileges>
 </manifest>
index 1402a7e..d077949 100755 (executable)
@@ -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/com.samsung.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)
@@ -210,43 +216,43 @@ static inline int convert_shortcut_type_to_lb_type(int shortcut_type, char **str
        switch (shortcut_type) {
        case DYNAMICBOX_TYPE_1x1:
                *str = "1x1";
-               return LB_SIZE_TYPE_1x1;
+               return DBOX_SIZE_TYPE_1x1;
        case DYNAMICBOX_TYPE_2x1:
                *str = "2x1";
-               return LB_SIZE_TYPE_2x1;
+               return DBOX_SIZE_TYPE_2x1;
        case DYNAMICBOX_TYPE_2x2:
                *str = "2x2";
-               return LB_SIZE_TYPE_2x2;
+               return DBOX_SIZE_TYPE_2x2;
        case DYNAMICBOX_TYPE_4x1:
                *str = "4x1";
-               return LB_SIZE_TYPE_4x1;
+               return DBOX_SIZE_TYPE_4x1;
        case DYNAMICBOX_TYPE_4x2:
                *str = "4x2";
-               return LB_SIZE_TYPE_4x2;
+               return DBOX_SIZE_TYPE_4x2;
        case DYNAMICBOX_TYPE_4x3:
                *str = "4x3";
-               return LB_SIZE_TYPE_4x3;
+               return DBOX_SIZE_TYPE_4x3;
        case DYNAMICBOX_TYPE_4x4:
                *str = "4x4";
-               return LB_SIZE_TYPE_4x4;
+               return DBOX_SIZE_TYPE_4x4;
        case DYNAMICBOX_TYPE_4x5:
                *str = "4x5";
-               return LB_SIZE_TYPE_4x5;
+               return DBOX_SIZE_TYPE_4x5;
        case DYNAMICBOX_TYPE_4x6:
                *str = "4x6";
-               return LB_SIZE_TYPE_4x6;
+               return DBOX_SIZE_TYPE_4x6;
        case DYNAMICBOX_TYPE_EASY_1x1:
                *str = "easy,1x1";
-               return LB_SIZE_TYPE_EASY_1x1;
+               return DBOX_SIZE_TYPE_EASY_1x1;
        case DYNAMICBOX_TYPE_EASY_3x1:
                *str = "easy,3x1";
-               return LB_SIZE_TYPE_EASY_3x1;
+               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);
        }
 
index 05140a1..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);
@@ -727,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)
@@ -796,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);
@@ -834,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)) {
@@ -851,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);
@@ -860,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);
@@ -868,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));
@@ -877,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);
@@ -887,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;
@@ -899,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)
@@ -1035,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;
        }
 
        /*!
@@ -1054,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;
@@ -1085,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;
 
@@ -1105,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;
@@ -1420,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));
@@ -1430,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 218683f..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;
-               int pixels;
-       } 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 *input;
-       } path;
-
-       int max_size_type;
-
-       int slave_max_load;
-
-       double ping_time;
-
-       char *vconf_sys_cluster;
-       int max_pended_ctx_events;
-
-       int use_sw_backend;
-       char *provider_method;
-       int debug_mode;
-       int overwrite_content;
-       int com_core_thread;
-       int use_xmonitor;
-       int premultiplied;
-
-       double scale_width_factor;
-       double scale_height_factor;
-
-       double pd_request_timeout;
-
-       char *emergency_disk;
-       char *services;
-       int auto_align;
-       int use_event_time;
-       int check_lcd;
-};
-
-extern struct conf g_conf;
-
-extern int conf_loader(void);
-extern void conf_update_size(void);
-extern struct conf *livebox_conf_get_conf(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/dbox.h b/include/dbox.h
new file mode 100644 (file)
index 0000000..db7cc53
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * 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);
+
+/* End of a file */
diff --git a/include/lb.h b/include/lb.h
deleted file mode 100644 (file)
index 7101edc..0000000
+++ /dev/null
@@ -1,76 +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 void lb_init(void);
-extern void lb_fini(void);
-
-struct lb_create_arg {
-       double period;
-       int timeout;
-       int has_livebox_script;
-       int skip_need_to_create;
-       const char *content;
-       const char *cluster;
-       const char *category;
-       const char *abi;
-       const char *direct_addr;
-};
-
-extern int lb_create(const char *pkgname, const char *id, struct lb_create_arg *arg, int *w, int *h, double *priority, char **content, char **title);
-extern int lb_destroy(const char *pkgname, const char *id, int type);
-
-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_set_content_info(const char *pkgname, const char *id, const char *content_info);
-extern int lb_set_content_info_all(const char *pkgname, const char *content);
-
-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);
-extern int livebox_send_updated(const char *pkgname, const char *id, int w, int h);
-extern int livebox_send_desc_updated(const char *pkgname, const char *id, const char *descfile);
-
-/* End of a file */
index 1817c7a..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);
@@ -39,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);
@@ -71,7 +71,7 @@ struct so_item {
        char *pkgname;
        void *handle;
        int timeout;
-       int has_livebox_script;
+       int has_dynamicbox_script;
 
        Eina_List *inst_list;
 
@@ -94,7 +94,7 @@ struct so_item {
                system_event_t sys_event;
                get_alt_info_t get_alt_info;
                set_content_info_t set_content_info;
-       } livebox;
+       } dynamicbox;
 
        struct {
                adaptor_initialize_t initialize;
@@ -119,33 +119,33 @@ struct so_item {
 };
 
 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,
-       LIVEBOX_OP_SET_CONTENT_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, 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);
index 75841b6..5942d0a 100644 (file)
@@ -1,18 +1,12 @@
 <manifest>
        <!-- Provider slave label -->
        <define>
-               <domain name="com.samsung.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" />
-                       <smack request="key-storage::db" type="rl" />
-                       <smack request="media-data::db" type="rw" />
-               </request>
+               <domain name="com.samsung.data-provider-slave" policy="restricted" />
        </define>
-       
+       <request>
+               <domain name="com.samsung.data-provider-slave" />
+       </request>
+
        <assign>
                <!-- Application folder -->
                <filesystem path="/usr/apps/com.samsung.data-provider-slave" label="com.samsung.data-provider-slave" />
index 4c00eed..f5de055 100644 (file)
@@ -2,8 +2,8 @@
 %define app_data /opt/usr/apps/com.samsung.data-provider-slave/data
 
 Name: com.samsung.data-provider-slave
-Summary: Plugin type livebox service provider
-Version: 0.17.13
+Summary: Plugin type dynamicbox service provider
+Version: 1.0.0
 Release: 1
 Group: HomeTF/Livebox
 License: Flora
@@ -20,14 +20,14 @@ BuildRequires: pkgconfig(db-util)
 BuildRequires: pkgconfig(glib-2.0)
 BuildRequires: pkgconfig(gio-2.0)
 BuildRequires: pkgconfig(bundle)
-BuildRequires: pkgconfig(provider)
-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)
@@ -47,9 +47,9 @@ 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
index 60728d0..05f227e 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_product.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;
@@ -46,168 +49,168 @@ static struct info {
        .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;
-       struct lb_create_arg _arg;
+       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.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;
+               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.lb_create.content;
-       _arg.timeout = arg->info.lb_create.timeout;
-       _arg.has_livebox_script = arg->info.lb_create.has_script;
-       _arg.period = arg->info.lb_create.period;
-       _arg.cluster = arg->info.lb_create.cluster;
-       _arg.category = arg->info.lb_create.category;
-       _arg.abi = arg->info.lb_create.abi;
-       _arg.skip_need_to_create = arg->info.lb_create.skip_need_to_create;
-       _arg.direct_addr = arg->info.lb_create.direct_addr;
-
-       ret = lb_create(arg->pkgname, arg->id,
+       _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.lb_create.out_content,
-                       &arg->info.lb_create.out_title);
+                       &arg->info.dbox_create.out_content,
+                       &arg->info.dbox_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) {
+               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 = 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) {
+                               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.lb_create.width;
-                                       *height = arg->info.lb_create.height;
+                                       *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);
+               arg->info.dbox_create.out_is_pinned_up = (dbox_is_pinned_up(arg->pkgname, arg->id) == 1);
        } else {
-               ErrPrint("lb_create returns %d\n", ret);
+               ErrPrint("dbox_create returns %d\n", ret);
        }
 
-       if (lb_is_all_paused()) {
+       if (dbox_is_all_paused()) {
                DbgPrint("Box is paused\n");
-               (void)lb_system_event(arg->pkgname, arg->id, LB_SYS_EVENT_PAUSED);
+               (void)dbox_system_event(arg->pkgname, arg->id, DBOX_SYS_EVENT_PAUSED);
        }
 
        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;
-       struct lb_create_arg _arg;
+       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.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;
+               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.lb_recreate.content;
-       _arg.timeout = arg->info.lb_recreate.timeout;
-       _arg.has_livebox_script = arg->info.lb_recreate.has_script;
-       _arg.period = arg->info.lb_recreate.period;
-       _arg.cluster = arg->info.lb_recreate.cluster;
-       _arg.category = arg->info.lb_recreate.category;
-       _arg.abi = arg->info.lb_recreate.abi;
+       _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.lb_recreate.direct_addr;
+       _arg.direct_addr = arg->info.dbox_recreate.direct_addr;
 
-       ret = lb_create(arg->pkgname, arg->id,
+       ret = dbox_create(arg->pkgname, arg->id,
                        &_arg,
                        &w, &h, &priority,
-                       &arg->info.lb_recreate.out_content,
-                       &arg->info.lb_recreate.out_title);
+                       &arg->info.dbox_recreate.out_content,
+                       &arg->info.dbox_recreate.out_title);
        if (ret == 0) {
-               if (w != arg->info.lb_recreate.width || h != arg->info.lb_recreate.height) {
+               if (w != arg->info.dbox_recreate.width || h != arg->info.dbox_recreate.height) {
                        int tmp;
-                       tmp = lb_resize(arg->pkgname, arg->id, arg->info.lb_recreate.width, arg->info.lb_recreate.height);
+                       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.lb_recreate.width, arg->info.lb_recreate.height, tmp);
+                               DbgPrint("Resize[%dx%d] returns: %d\n", arg->info.dbox_recreate.width, arg->info.dbox_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);
+               arg->info.dbox_recreate.out_is_pinned_up = (dbox_is_pinned_up(arg->pkgname, arg->id) == 1);
        } else {
-               ErrPrint("lb_create returns %d\n", ret);
+               ErrPrint("dbox_create returns %d\n", ret);
        }
 
-       if (lb_is_all_paused()) {
+       if (dbox_is_all_paused()) {
                DbgPrint("Box is paused\n");
-               (void)lb_system_event(arg->pkgname, arg->id, LB_SYS_EVENT_PAUSED);
+               (void)dbox_system_event(arg->pkgname, arg->id, DBOX_SYS_EVENT_PAUSED);
        }
 
        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);
 
-       if (arg->info.lb_destroy.type == INSTANCE_DESTROY_DEFAULT || arg->info.lb_destroy.type == INSTANCE_DESTROY_UNINSTALL) {
+       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)lb_system_event(arg->pkgname, arg->id, LB_SYS_EVENT_DELETED);
+               (void)dbox_system_event(arg->pkgname, arg->id, DBOX_SYS_EVENT_DELETED);
        }
 
-       ret = lb_destroy(arg->pkgname, arg->id, 0);
+       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;
+       struct dynamicbox_event_info info;
 
        info = arg->info.content_event.info;
 
-       ret = lb_script_event(arg->pkgname, arg->id,
+       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;
 
@@ -215,203 +218,203 @@ static int method_clicked(struct event_arg *arg, void *data)
                                                                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,
+       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;
 }
 
-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;
+       struct dynamicbox_event_info 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,
+       ret = dbox_script_event(arg->pkgname, arg->id,
                                arg->info.text_signal.emission, arg->info.text_signal.source,
                                &info);
 
        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;
 
        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);
+       ret = dbox_resize(arg->pkgname, arg->id, arg->info.resize.w, arg->info.resize.h);
 
        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);
+       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);
+       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;
+       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;
 
        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 = lb_set_content_info_all(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 = lb_update_all(arg->pkgname, arg->info.update_content.cluster, arg->info.update_content.category, arg->info.update_content.force);
+                       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 = lb_set_content_info(arg->pkgname, 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);
+                       ret = dbox_update(arg->pkgname, arg->id, arg->info.update_content.force);
                }
        }
 
        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();
+       dbox_pause_all();
        if (s_info.ping_timer) {
                ecore_timer_freeze(s_info.ping_timer);
        }
 
-       sqlite3_release_memory(SQLITE_FLUSH_MAX);
+       sqlite3_release_memory(DYNAMICBOX_CONF_SQLITE_FLUSH_MAX);
        elm_cache_all_flush();
        malloc_trim(0);
 
-       return LB_STATUS_SUCCESS;
+       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();
+       dbox_resume_all();
        if (s_info.ping_timer) {
                ecore_timer_thaw(s_info.ping_timer);
        }
-       return LB_STATUS_SUCCESS;
+       return DBOX_STATUS_ERROR_NONE;
 }
 
 static Eina_Bool send_ping_cb(void *data)
 {
-       provider_send_ping();
+       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;
        }
 
-       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();
+       ret = dynamicbox_provider_send_hello();
        if (ret == 0) {
-               s_info.ping_timer = ecore_timer_add(DEFAULT_PING_TIME, send_ping_cb, NULL);
+               s_info.ping_timer = ecore_timer_add(DYNAMICBOX_CONF_DEFAULT_PING_TIME, 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;
 
-       ret = lb_open_pd(arg->pkgname, arg->id);
+       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;
 
-       ret = lb_close_pd(arg->pkgname, arg->id);
+       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;
+       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.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);
+       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)
 {
        int ret;
 
-       ret = lb_pause(arg->pkgname, arg->id);
+       ret = dbox_pause(arg->pkgname, arg->id);
 
-       sqlite3_release_memory(SQLITE_FLUSH_MAX);
+       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,
+       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,
@@ -424,20 +427,20 @@ HAPI int client_init(const char *name)
                .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,
+               .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 provider_init(util_screen_get(), name, &table, NULL);
+       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 27e5c9b..0000000
+++ /dev/null
@@ -1,807 +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 <unistd.h>
-
-#include <dlog.h>
-#include <Eina.h>
-
-#include <livebox-errno.h>
-
-#include "conf.h"
-#include "util.h"
-#include "debug.h"
-
-#define CONF_PATH_FORMAT "/usr/share/data-provider-master/%dx%d/conf.ini"
-
-HAPI 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",
-               .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,
-       .auto_align = 1,
-       .use_event_time = 1,
-       .check_lcd = 1,
-};
-
-HAPI void conf_update_size(void)
-{
-       util_screen_size_get(&g_conf.width, &g_conf.height);
-
-       if (g_conf.base_width < 0) {
-               g_conf.base_width = g_conf.width;
-               DbgPrint("Base width: %d\n", g_conf.base_width);
-       }
-       if (g_conf.base_height < 0) {
-               g_conf.base_height = g_conf.height;
-               DbgPrint("Base height: %d\n", g_conf.base_height);
-       }
-}
-
-struct conf *livebox_conf_get_conf(void)
-{
-       return &g_conf;
-}
-
-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) {
-               if (!strncasecmp(buffer, "screen", strlen("screen"))) {
-                       g_conf.base_width = -1;
-               } else {
-                       ErrPrint("Failed to parse the base_width\n");
-               }
-       }
-}
-
-static void base_height_handler(char *buffer)
-{
-       if (sscanf(buffer, "%d", &g_conf.base_height) != 1) {
-               if (!strncasecmp(buffer, "screen", strlen("screen"))) {
-                       g_conf.base_height = -1;
-               } else {
-                       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);
-}
-
-static void auto_align_handler(char *buffer)
-{
-       g_conf.auto_align = !strcasecmp(buffer, "true");
-}
-
-static void check_lcd_handler(char *buffer)
-{
-       g_conf.check_lcd = !strcasecmp(buffer, "true");
-}
-
-static void use_event_time_handler(char *buffer)
-{
-       g_conf.use_event_time = !strcasecmp(buffer, "true");
-}
-
-/*
- * Find proper configuration and install(link) it to conf path.
- */
-static char *conf_path(void)
-{
-       char *path;
-       int length;
-       int w;
-       int h;
-
-       length = strlen(CONF_PATH_FORMAT) + 12; // 10 == RESERVED SPACE
-       path = calloc(1, length);
-       if (!path) {
-               ErrPrint("calloc: %s\n", strerror(errno));
-               return NULL;
-       }
-
-       util_screen_size_get(&w, &h);
-       snprintf(path, length, CONF_PATH_FORMAT, w, h);
-       DbgPrint("Selected conf file: %s\n", path);
-       if (access(path, F_OK) != 0) {
-               ErrPrint("Fallback to default, access: %s\n", strerror(errno));
-               strncpy(path, CONF_FILE, length);
-               if (access(path, F_OK) != 0) {
-                       ErrPrint("Serious error - there is no conf file, use default setting: %s\n", strerror(errno));
-                       DbgFree(path);
-                       path = NULL;
-               }
-       }
-
-       return path;
-}
-
-HAPI int conf_loader(void)
-{
-       char *conf_file;
-       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 = "auto_align",
-                       .handler = auto_align_handler,
-               },
-               {
-                       .name = "use_event_time",
-                       .handler = use_event_time_handler,
-               },
-               {
-                       .name = "check_lcd",
-                       .handler = check_lcd_handler,
-               },
-               {
-                       .name = NULL,
-                       .handler = NULL,
-               },
-       };
-
-       conf_file = conf_path();
-       if (!conf_file) {
-               return LB_STATUS_ERROR_IO;
-       }
-
-       fp = fopen(conf_file, "rt");
-       DbgFree(conf_file);
-       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 */
index b6f2aa6..2d6b76f 100644 (file)
@@ -9,7 +9,7 @@
 #include <packet.h>
 #include <secure_socket.h>
 #include <com-core_packet.h>
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
 
 #include <dlog.h>
 
@@ -61,7 +61,7 @@ static int connected_cb(int handle, void *data)
        struct event_item *item;
 
        EINA_LIST_FOREACH_SAFE(s_info.connected_list, l, n, item) {
-               s_info.process = CONNECTION;
+               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);
@@ -100,7 +100,7 @@ int connection_init(void)
                ErrPrint("Unable to register the disconnected callback\n");
        }
 
-       return LB_STATUS_SUCCESS;
+       return DBOX_STATUS_ERROR_NONE;
 }
 
 int connection_fini(void)
@@ -108,7 +108,7 @@ 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 LB_STATUS_SUCCESS;
+       return DBOX_STATUS_ERROR_NONE;
 }
 
 struct connection *connection_create(const char *addr, void *table)
@@ -217,7 +217,7 @@ int connection_add_event_handler(enum connection_event_type type, int (*event_cb
        item = malloc(sizeof(*item));
        if (!item) {
                ErrPrint("malloc: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
+               return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
        }
 
        item->event_cb = event_cb;
@@ -232,10 +232,10 @@ int connection_add_event_handler(enum connection_event_type type, int (*event_cb
                break;
        default:
                free(item);
-               return LB_STATUS_ERROR_INVALID;
+               return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       return LB_STATUS_SUCCESS;
+       return DBOX_STATUS_ERROR_NONE;
 }
 
 void *connection_del_event_handler(enum connection_event_type type, int (*event_cb)(int handle, void *data))
index cf5a94e..3e13b92 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;
@@ -52,16 +53,16 @@ static inline void rotate_log(void)
        char *filename;
        int namelen;
 
-       if (s_info.nr_of_lines < MAX_LOG_LINE) {
+       if (s_info.nr_of_lines < DYNAMICBOX_CONF_MAX_LOG_LINE) {
                return;
        }
 
-       s_info.file_id = (s_info.file_id + 1) % MAX_LOG_FILE;
+       s_info.file_id = (s_info.file_id + 1) % DYNAMICBOX_CONF_MAX_LOG_FILE;
 
-       namelen = strlen(s_info.filename) + strlen(SLAVE_LOG_PATH) + 30;
+       namelen = strlen(s_info.filename) + strlen(DYNAMICBOX_CONF_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());
+               snprintf(filename, namelen, "%s/%d_%s.%d", DYNAMICBOX_CONF_LOG_PATH, s_info.file_id, s_info.filename, getpid());
 
                if (s_info.fp) {
                        if (fclose(s_info.fp) != 0) {
@@ -88,7 +89,7 @@ HAPI int critical_log(const char *func, int line, const char *fmt, ...)
        int ret;
 
        if (!s_info.fp) {
-               return LB_STATUS_ERROR_IO;
+               return DBOX_STATUS_ERROR_IO_ERROR;
        }
 
        fprintf(s_info.fp, "%lf [%s:%d] ", util_timestamp(), util_basename((char *)func), line);
@@ -114,26 +115,26 @@ HAPI int critical_log_init(const char *name)
        char *filename;
 
        if (s_info.fp) {
-               return LB_STATUS_SUCCESS;
+               return DBOX_STATUS_ERROR_NONE;
        }
 
        s_info.filename = strdup(name);
        if (!s_info.filename) {
                ErrPrint("Failed to create a log file\n");
-               return LB_STATUS_ERROR_MEMORY;
+               return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
        }
 
-       namelen = strlen(name) + strlen(SLAVE_LOG_PATH) + 30;
+       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 LB_STATUS_ERROR_MEMORY;
+               return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
        }
 
-       snprintf(filename, namelen, "%s/%d_%s.%d", SLAVE_LOG_PATH, s_info.file_id, name, getpid());
+       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) {
@@ -141,11 +142,11 @@ HAPI int critical_log_init(const char *name)
                free(s_info.filename);
                s_info.filename = NULL;
                free(filename);
-               return LB_STATUS_ERROR_IO;
+               return DBOX_STATUS_ERROR_IO_ERROR;
        }
 
        free(filename);
-       return LB_STATUS_SUCCESS;
+       return DBOX_STATUS_ERROR_NONE;
 }
 
 
@@ -164,7 +165,7 @@ HAPI int critical_log_fini(void)
                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..c21c7d4
--- /dev/null
@@ -0,0 +1,2501 @@
+/*
+ * 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.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;
+}
+
+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..60912e4 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)
@@ -112,7 +113,7 @@ static void signal_handler(int signum, siginfo_t *info, void *unused)
                int fd;
                char log_fname[256];
 
-               snprintf(log_fname, sizeof(log_fname), "%s/slave.%d", SLAVE_LOG_PATH, getpid());
+               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)) {
@@ -233,11 +234,11 @@ HAPI int fault_fini(void)
 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);
+               dynamicbox_provider_send_call(pkgname, filename, funcname);
        }
        /*!
         * \NOTE
-        *   To use this "alarm", the livebox have to do not use the 'sleep' series functions.
+        *   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
         *
@@ -272,7 +273,7 @@ HAPI int fault_unmark_call(const char *pkgname, const char *filename, const char
        }
 
        if (!s_info.disable_checker) {
-               provider_send_ret(pkgname, filename, funcname);
+               dynamicbox_provider_send_ret(pkgname, filename, funcname);
        }
        return 0;
 }
diff --git a/src/lb.c b/src/lb.c
deleted file mode 100644 (file)
index 341cf8a..0000000
--- a/src/lb.c
+++ /dev/null
@@ -1,2497 +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_product.h>
-#include <livebox-errno.h>
-#include <com-core_packet.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"
-#include "connection.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;
-       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 *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, INSTANCE_DESTROY_DEFAULT);
-                       /*!
-                        * \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, 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("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)) {
-               /**
-                * If the content is not written on shared buffer (pixmap, shm, raw file, ...)
-                * We cannot use the direct path for sending updated event.
-                */
-               provider_send_extra_info(item->inst->item->pkgname, item->inst->id, item->inst->priority,
-                                               content, title, item->inst->icon, item->inst->name);
-               provider_send_updated(item->inst->item->pkgname, item->inst->id, item->inst->w, item->inst->h);
-       } 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);
-
-       /**
-        * If the content is not written on shared buffer (pixmap, shm, raw file, ...)
-        * We cannot use the direct path for sending updated event.
-        */
-       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);
-       provider_send_updated(item->inst->item->pkgname, item->inst->id, item->inst->w, item->inst->h);
-
-       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, INSTANCE_DESTROY_DEFAULT);
-                       /*!
-                        * \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;
-}
-
-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 lb_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 lb_fini(void)
-{
-       int ret;
-
-       ret = lb_delete_all_deleteme();
-       if (ret < 0) {
-               DbgPrint("Delete all deleteme: %d\n", ret);
-       }
-
-       ret = lb_delete_all();
-       if (ret < 0) {
-               DbgPrint("Delete all: %d\n", ret);
-       }
-
-       /* Just for in case of ... */
-       deactivate_pending_consumer();
-       deactivate_pd_open_pending_consumer();
-
-       eina_list_free(s_info.pd_open_pending_list);
-       s_info.pd_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 liveboxes.
- */
-int livebox_send_updated(const char *pkgname, const char *id, int w, int h)
-{
-       Eina_List *l;
-       struct item *item;
-       int ret = LB_STATUS_ERROR_NOT_EXIST;
-
-       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 = provider_send_direct_updated(connection_handle(item->direct_path), pkgname, id, w, h);
-               } else {
-                       ret = provider_send_updated(pkgname, id, w, h);
-               }
-
-               break;
-       }
-
-       return ret;
-}
-
-int livebox_send_desc_updated(const char *pkgname, const char *id, const char *descfile)
-{
-       Eina_List *l;
-       struct item *item;
-       int ret = LB_STATUS_ERROR_NOT_EXIST;
-
-       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 = provider_send_direct_desc_updated(connection_handle(item->direct_path), pkgname, id, descfile);
-               } else {
-                       ret = provider_send_desc_updated(pkgname, id, descfile);
-               }
-
-               break;
-       }
-
-       return ret;
-}
-
-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;
-}
-
-static struct method s_table[] = {
-       {
-               .cmd = NULL,
-               .handler = NULL,
-       },
-};
-
-HAPI int lb_create(const char *pkgname, const char *id, struct lb_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 LB_STATUS_SUCCESS;
-       }
-
-       if (!arg->skip_need_to_create) {
-               ret = so_create_needed(pkgname, arg->cluster, arg->category, arg->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, arg->content, arg->cluster, arg->category, arg->abi);
-               return LB_STATUS_ERROR_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_livebox_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 LB_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 & 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, content, title) == (int)LB_STATUS_SUCCESS) {
-                       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 lb_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 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);
-       (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 == INSTANCE_DESTROY_UNINSTALL));
-
-       if (item->monitor) {
-               item->deleteme = 1;
-       } else {
-               update_monitor_del(id, item);
-               (void)so_destroy(inst, item->unload_so);
-               free(item);
-       }
-
-       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_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 LB_STATUS_ERROR_INVALID;
-       }
-
-       l = find_item(inst);
-       if (!l) {
-               ErrPrint("Instance is not found (%s - %s, %s)\n", pkgname, id, content_info);
-               return LB_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 & 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_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_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)) {
-                               lb_set_content_info(item->inst->item->pkgname, item->inst->id, content);
-                               cnt++;
-                       }
-               } else {
-                       lb_set_content_info(item->inst->item->pkgname, item->inst->id, content);
-                       cnt++;
-               }
-       }
-       DbgPrint("Update content for %s - %d\n", pkgname ? pkgname : "(all)", cnt);
-
-       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, item->unload_so);
-               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, item->unload_so);
-               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 9e60134..7dd001d 100644 (file)
 
 #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_product.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"
 
+#define TEXT_CLASS         "tizen"
+#define DEFAULT_FONT_SIZE  -100
 #define WVGA_DEFAULT_SCALE 1.8f
-#define TEXT_CLASS     "tizen"
-#define DEFAULT_FONT_SIZE      -100
 
 #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;
-       Ea_Theme_Font_Table *table;
+    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,
-       .table = 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,
 };
 
+#define SLAVE_VCONFKEY_FONT_NAME "db/setting/accessibility/font_name"
+
 static void font_changed_cb(void *user_data)
 {
        char *font_name;
@@ -92,7 +101,7 @@ static void font_changed_cb(void *user_data)
        evas_font_reinit();
 
        if (s_info.font_name) {
-               font_name = vconf_get_str("db/setting/accessibility/font_name");
+               font_name = vconf_get_str(SLAVE_VCONFKEY_FONT_NAME);
                if (!font_name) {
                        ErrPrint("Invalid font name (NULL)\n");
                        return;
@@ -120,14 +129,14 @@ static void font_changed_cb(void *user_data)
        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
+       /**
+        * @NOTE
+        * Try to update all dynamicboxes
         */
        edje_text_class_set(TEXT_CLASS, s_info.font_name, DEFAULT_FONT_SIZE);
 
        DbgPrint("Call system event\n");
-       lb_system_event_all(LB_SYS_EVENT_FONT_CHANGED);
+       dbox_system_event_all(DBOX_SYS_EVENT_FONT_CHANGED);
 }
 
 static inline int convert_font_size(int size)
@@ -179,19 +188,19 @@ static void font_size_cb(system_settings_key_e key, void *user_data)
 static void tts_changed_cb(keynode_t *node, void *user_data)
 {
        DbgPrint("TTS status is changed\n");
-       lb_system_event_all(LB_SYS_EVENT_TTS_CHANGED);
+       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);
+       dbox_system_event_all(DBOX_SYS_EVENT_MMC_STATUS_CHANGED);
 }
 
 static void time_changed_cb(keynode_t *node, void *user_data)
 {
        DbgPrint("Time is changed\n");
-       lb_system_event_all(LB_SYS_EVENT_TIME_CHANGED);
+       dbox_system_event_all(DBOX_SYS_EVENT_TIME_CHANGED);
 }
 
 static void initialize_glib_type_system(void)
@@ -390,9 +399,12 @@ static bool app_create(void *argv)
 
        elm_app_base_scale_set(WVGA_DEFAULT_SCALE);
 
-       ret = conf_loader();
-       if (ret < 0) {
-               DbgPrint("Configureation manager is initiated: %d\n", ret);
+       dynamicbox_conf_init();
+       if (!dynamicbox_conf_is_loaded()) {
+               ret = dynamicbox_conf_load();
+               if (ret < 0) {
+                       DbgPrint("Configureation manager is initiated: %d\n", ret);
+               }
        }
 
        critical_log_init(util_basename(((char **)argv)[0]));
@@ -402,11 +414,9 @@ static bool app_create(void *argv)
         */
        initialize_glib_type_system();
 
-       conf_update_size();
-
        DbgPrint("Scale factor: %lf\n", elm_config_scale_get());
 
-       if (COM_CORE_THREAD) {
+       if (DYNAMICBOX_CONF_COM_CORE_THREAD) {
                if (setenv("PROVIDER_COM_CORE_THREAD", "true", 0) < 0) {
                        ErrPrint("setenv: %s\n", strerror(errno));
                }
@@ -416,13 +426,13 @@ static bool app_create(void *argv)
                }
        }
 
-       ret = livebox_service_init();
+       ret = dynamicbox_service_init();
        if (ret < 0) {
                DbgPrint("Livebox service init: %d\n", ret);
        }
 
-       /*
-        * \note
+       /**
+        * @note
         * Slave is not able to initiate system, before
         * receive its name from the master
         *
@@ -468,7 +478,7 @@ static bool app_create(void *argv)
        font_changed_cb(NULL);
        font_size_cb(SYSTEM_SETTINGS_KEY_FONT_SIZE, NULL);
 
-       lb_init();
+       dbox_init();
 
        return TRUE;
 }
@@ -479,7 +489,7 @@ static void app_terminate(void *data)
 
        DbgPrint("Terminating provider\n");
 
-       lb_fini();
+       dbox_fini();
 
        if (s_info.table) {
                DbgPrint("FONT TABLE Destroyed");
@@ -524,9 +534,9 @@ static void app_terminate(void *data)
                DbgPrint("client finalized: %d\n", ret); 
        }
 
-       ret = livebox_service_fini();
+       ret = dynamicbox_service_fini();
        if (ret < 0) {
-               DbgPrint("livebox service fini: %d\n", ret);
+               DbgPrint("dynamicbox service fini: %d\n", ret);
        }
 
        free(s_info.font_name);
@@ -550,14 +560,18 @@ static void app_resume(void *data)
        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_control(app_control_h service, void *data)
@@ -587,7 +601,7 @@ static void app_control(app_control_h service, void *data)
 
        if (!strcasecmp(secured, "true")) {
                /* Don't use the update timer */
-               lb_turn_secured_on();
+               dbox_turn_secured_on();
        }
 
        DbgPrint("Name assigned: %s\n", name);
@@ -633,61 +647,64 @@ static inline void mcheck_cb(enum mcheck_status status)
 #define BIN_PATH "/usr/apps/com.samsung.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_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_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");
        }
+    }
 
-       if (setenv("BUFMGR_LOCK_TYPE", "once", 0) < 0) {
-               ErrPrint("setenv: %s\n", strerror(errno));
-       }
+    if (setenv("BUFMGR_LOCK_TYPE", "once", 0) < 0) {
+       ErrPrint("setenv: %s\n", strerror(errno));
+    }
 
-       if (setenv("BUFMGR_MAP_CACHE", "true", 0) < 0) {
-               ErrPrint("setenv: %s\n", strerror(errno));
-       }
+    if (setenv("BUFMGR_MAP_CACHE", "true", 0) < 0) {
+       ErrPrint("setenv: %s\n", strerror(errno));
+    }
 
-       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;
-       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);
-       ErrPrint("app_efl_main: %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;
 
-       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)
index aadb3a8..31684a9 100644 (file)
 
 #include <dlog.h>
 #include <Eina.h>
-#include <provider.h>
-#include <livebox-service_product.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;
+       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_FOREACH(s_info.livebox_list, l, item) {
+       EINA_LIST_FOREACH(s_info.dynamicbox_list, l, item) {
                if (!strcmp(item->pkgname, pkgname)) {
                        return item;
                }
@@ -62,29 +63,29 @@ static inline struct so_item *find_livebox(const char *pkgname)
 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");
+       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 *dbox_id;
        char *path;
 
-       lb_pkgname = livebox_service_pkgname(pkgname);
-       if (!lb_pkgname) {
+       dbox_id = dynamicbox_service_dbox_id(pkgname);
+       if (!dbox_id) {
                ErrPrint("Failed to get package name\n");
                return NULL;
        } else {
-               path = livebox_service_libexec(lb_pkgname);
-               free(lb_pkgname);
+               path = dynamicbox_service_libexec(dbox_id);
+               free(dbox_id);
        }
 
        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;
 
@@ -92,23 +93,23 @@ static void delete_livebox(struct so_item *item)
 
        if (item->adaptor.finalize) {
                ret = item->adaptor.finalize(item->pkgname);
-       } else if (item->livebox.finalize) {
-               ret = item->livebox.finalize();
+       } else if (item->dynamicbox.finalize) {
+               ret = item->dynamicbox.finalize();
        } else {
                ErrPrint("%s has no finalize\n", item->pkgname);
-               ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+               ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
        }
 
        fault_unmark_call(item->pkgname, "finalize", __func__, USE_ALARM);
 
-       if (ret == LB_STATUS_ERROR_BUSY) {
+       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);
                }
                DbgPrint("Unload SO from process space (%s)\n", item->so_fname);
-               s_info.livebox_list = eina_list_remove(s_info.livebox_list, item);
+               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) {
@@ -143,7 +144,7 @@ static struct so_item *new_adaptor(const char *pkgname, const char *abi)
         */
 
        /*! \TODO
-        * item->has_livbox_script
+        * item->has_dynamicbox_script
         */
 
        item->inst_list = NULL;
@@ -172,98 +173,98 @@ static struct so_item *new_adaptor(const char *pkgname, const char *abi)
                DbgPrint("dlerror(can be ignored): %s\n", errmsg);
        }
 
-       item->adaptor.create = (adaptor_create_t)dlsym(item->handle, "livebox_create");
+       item->adaptor.create = (adaptor_create_t)dlsym(item->handle, "dynamicbox_create");
        if (!item->adaptor.create) {
-               ErrPrint("symbol: livebox_create - %s\n", dlerror());
-               delete_livebox(item);
+               ErrPrint("symbol: dynamicbox_create - %s\n", dlerror());
+               delete_dynamicbox(item);
                return NULL;
        }
 
-       item->adaptor.destroy = (adaptor_destroy_t)dlsym(item->handle, "livebox_destroy");
+       item->adaptor.destroy = (adaptor_destroy_t)dlsym(item->handle, "dynamicbox_destroy");
        if (!item->adaptor.destroy) {
-               ErrPrint("symbol: livebox_destroy - %s\n", dlerror());
-               delete_livebox(item);
+               ErrPrint("symbol: dynamicbox_destroy - %s\n", dlerror());
+               delete_dynamicbox(item);
                return NULL;
        }
 
-       item->adaptor.pinup = (adaptor_pinup_t)dlsym(item->handle, "livebox_pinup");
+       item->adaptor.pinup = (adaptor_pinup_t)dlsym(item->handle, "dynamicbox_pinup");
        if (!item->adaptor.pinup) {
-               ErrPrint("symbol: livebox_pinup - %s\n", dlerror());
+               ErrPrint("symbol: dynamicbox_pinup - %s\n", dlerror());
        }
 
-       item->adaptor.is_updated = (adaptor_is_updated_t)dlsym(item->handle, "livebox_need_to_update");
+       item->adaptor.is_updated = (adaptor_is_updated_t)dlsym(item->handle, "dynamicbox_need_to_update");
        if (!item->adaptor.is_updated) {
-               ErrPrint("symbol: livebox_need_to_update - %s\n", dlerror());
+               ErrPrint("symbol: dynamicbox_need_to_update - %s\n", dlerror());
        }
 
-       item->adaptor.update_content = (adaptor_update_content_t)dlsym(item->handle, "livebox_update_content");
+       item->adaptor.update_content = (adaptor_update_content_t)dlsym(item->handle, "dynamicbox_update_content");
        if (!item->adaptor.update_content) {
-               ErrPrint("symbol: livebox_update_content - %s\n", dlerror());
+               ErrPrint("symbol: dynamicbox_update_content - %s\n", dlerror());
        }
 
-       item->adaptor.clicked = (adaptor_clicked_t)dlsym(item->handle, "livebox_clicked");
+       item->adaptor.clicked = (adaptor_clicked_t)dlsym(item->handle, "dynamicbox_clicked");
        if (!item->adaptor.clicked) {
-               ErrPrint("symbol: livebox_clicked - %s\n", dlerror());
+               ErrPrint("symbol: dynamicbox_clicked - %s\n", dlerror());
        }
 
-       item->adaptor.script_event = (adaptor_script_t)dlsym(item->handle, "livebox_content_event");
+       item->adaptor.script_event = (adaptor_script_t)dlsym(item->handle, "dynamicbox_content_event");
        if (!item->adaptor.script_event) {
-               ErrPrint("symbol: livebox_content_event - %s\n", dlerror());
+               ErrPrint("symbol: dynamicbox_content_event - %s\n", dlerror());
        }
 
-       item->adaptor.resize = (adaptor_resize_t)dlsym(item->handle, "livebox_resize");
+       item->adaptor.resize = (adaptor_resize_t)dlsym(item->handle, "dynamicbox_resize");
        if (!item->adaptor.resize) {
-               ErrPrint("symbol: livebox_resize - %s\n", dlerror());
+               ErrPrint("symbol: dynamicbox_resize - %s\n", dlerror());
        }
 
-       item->adaptor.create_needed = (adaptor_create_needed_t)dlsym(item->handle, "livebox_need_to_create");
+       item->adaptor.create_needed = (adaptor_create_needed_t)dlsym(item->handle, "dynamicbox_need_to_create");
        if (!item->adaptor.create_needed) {
-               ErrPrint("symbol: livebox_need_to_create - %s\n", dlerror());
+               ErrPrint("symbol: dynamicbox_need_to_create - %s\n", dlerror());
        }
 
-       item->adaptor.change_group = (adaptor_change_group_t)dlsym(item->handle, "livebox_change_group");
+       item->adaptor.change_group = (adaptor_change_group_t)dlsym(item->handle, "dynamicbox_change_group");
        if (!item->adaptor.change_group) {
-               ErrPrint("symbol: livebox_change_group - %s\n", dlerror());
+               ErrPrint("symbol: dynamicbox_change_group - %s\n", dlerror());
        }
 
-       item->adaptor.get_output_info = (adaptor_get_output_info_t)dlsym(item->handle, "livebox_get_info");
+       item->adaptor.get_output_info = (adaptor_get_output_info_t)dlsym(item->handle, "dynamicbox_get_info");
        if (!item->adaptor.get_output_info) {
-               ErrPrint("symbol: livebox_get_info - %s\n", dlerror());
+               ErrPrint("symbol: dynamicbox_get_info - %s\n", dlerror());
        }
 
-       item->adaptor.initialize = (adaptor_initialize_t)dlsym(item->handle, "livebox_initialize");
+       item->adaptor.initialize = (adaptor_initialize_t)dlsym(item->handle, "dynamicbox_initialize");
        if (!item->adaptor.initialize) {
-               ErrPrint("symbol: livebox_initialize - %s\n", dlerror());
+               ErrPrint("symbol: dynamicbox_initialize - %s\n", dlerror());
        }
 
-       item->adaptor.finalize = (adaptor_finalize_t)dlsym(item->handle, "livebox_finalize");
+       item->adaptor.finalize = (adaptor_finalize_t)dlsym(item->handle, "dynamicbox_finalize");
        if (!item->adaptor.finalize) {
-               ErrPrint("symbol: livebox_finalize - %s\n", dlerror());
+               ErrPrint("symbol: dynamicbox_finalize - %s\n", dlerror());
        }
 
-       item->adaptor.need_to_destroy = (adaptor_need_to_destroy_t)dlsym(item->handle, "livebox_need_to_destroy");
+       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: livebox_need_to_destroy - %s\n", dlerror());
+               ErrPrint("symbol: dynamicbox_need_to_destroy - %s\n", dlerror());
        }
 
-       item->adaptor.sys_event = (adaptor_system_event_t)dlsym(item->handle, "livebox_system_event");
+       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, "livebox_is_pinned_up");
+       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: livebox_is_pinned_up - %s\n", dlerror());
+               ErrPrint("symbol: dynamicbox_is_pinned_up - %s\n", dlerror());
        }
 
-       item->adaptor.get_alt_info = (adaptor_get_alt_info_t)dlsym(item->handle, "livebox_get_alt_info");
+       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: livebox_get_alt_info - %s\n", dlerror());
+               ErrPrint("symbol: dynamicbox_get_alt_info - %s\n", dlerror());
        }
 
-       item->adaptor.set_content_info = (adaptor_set_content_info_t)dlsym(item->handle, "livebox_set_content_info");
+       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: livebox_set_content_info - %s\n", dlerror());
+               ErrPrint("symbol: dynamicbox_set_content_info - %s\n", dlerror());
        }
 
        if (item->adaptor.initialize) {
@@ -275,16 +276,16 @@ static struct so_item *new_adaptor(const char *pkgname, const char *abi)
                fault_unmark_call(pkgname, "initialize", __func__, USE_ALARM);
                if (ret < 0) {
                        ErrPrint("Failed to initialize package %s\n", pkgname);
-                       delete_livebox(item);
+                       delete_dynamicbox(item);
                        return NULL;
                }
        }
 
-       s_info.livebox_list = eina_list_append(s_info.livebox_list, 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;
@@ -307,7 +308,7 @@ static struct so_item *new_livebox(const char *pkgname)
         */
 
        /*! \TODO
-        * item->has_livbox_script
+        * item->has_dynamicbox_script
         */
 
        item->inst_list = NULL;
@@ -336,117 +337,117 @@ static struct so_item *new_livebox(const char *pkgname)
                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);
+       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;
        }
 
-       item->livebox.destroy = (destroy_t)dlsym(item->handle, "livebox_destroy");
-       if (!item->livebox.destroy) {
-               ErrPrint("symbol: livebox_destroy - %s\n", dlerror());
-               delete_livebox(item);
+       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->livebox.pinup = (pinup_t)dlsym(item->handle, "livebox_pinup");
-       if (!item->livebox.pinup) {
-               ErrPrint("symbol: livebox_pinup - %s\n", dlerror());
+       item->dynamicbox.pinup = (pinup_t)dlsym(item->handle, "dynamicbox_pinup");
+       if (!item->dynamicbox.pinup) {
+               ErrPrint("symbol: dynamicbox_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->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->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->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->livebox.clicked = (clicked_t)dlsym(item->handle, "livebox_clicked");
-       if (!item->livebox.clicked) {
-               ErrPrint("symbol: livebox_clicked - %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->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->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->livebox.resize = (resize_t)dlsym(item->handle, "livebox_resize");
-       if (!item->livebox.resize) {
-               ErrPrint("symbol: livebox_resize - %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->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->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->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->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->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->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->livebox.initialize = (initialize_t)dlsym(item->handle, "livebox_initialize");
-       if (!item->livebox.initialize) {
-               ErrPrint("symbol: livebox_initialize - %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->livebox.finalize = (finalize_t)dlsym(item->handle, "livebox_finalize");
-       if (!item->livebox.finalize) {
-               ErrPrint("symbol: livebox_finalize - %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->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->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->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->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->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->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->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());
+       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->livebox.set_content_info = (set_content_info_t)dlsym(item->handle, "livebox_set_content_info");
-       if (!item->livebox.set_content_info) {
-               ErrPrint("symbol: livebox_set_content_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->livebox.initialize) {
+       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);
-                       delete_livebox(item);
+                       delete_dynamicbox(item);
                        return NULL;
                }
        }
 
-       s_info.livebox_list = eina_list_append(s_info.livebox_list, item);
+       s_info.dynamicbox_list = eina_list_append(s_info.dynamicbox_list, item);
        return item;
 }
 
@@ -514,7 +515,7 @@ static inline int delete_instance(struct instance *inst)
        free(inst->content);
        free(inst->title);
        free(inst);
-       return LB_STATUS_SUCCESS;
+       return DBOX_STATUS_ERROR_NONE;
 }
 
 static inline struct instance *find_instance(struct so_item *item, const char *id)
@@ -535,7 +536,7 @@ HAPI struct instance *so_find_instance(const char *pkgname, const char *id)
 {
        struct so_item *item;
 
-       item = find_livebox(pkgname);
+       item = find_dynamicbox(pkgname);
        if (!item) {
                return NULL;
        }
@@ -543,55 +544,55 @@ HAPI struct instance *so_find_instance(const char *pkgname, const char *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);
+       item = find_dynamicbox(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;
+                       return DBOX_STATUS_ERROR_EXIST;
                }
        } else {
                if (!strcasecmp(abi, "c")) {
-                       item = new_livebox(pkgname);
+                       item = new_dynamicbox(pkgname);
                } else {
                        item = new_adaptor(pkgname, abi);
                }
 
                if (!item) {
-                       return LB_STATUS_ERROR_FAULT;
+                       return DBOX_STATUS_ERROR_FAULT;
                }
        }
 
        inst = new_instance(id, content_info, cluster, category);
        if (!inst) {
                if (!item->inst_list) {
-                       delete_livebox(item);
+                       delete_dynamicbox(item);
                }
 
-               return LB_STATUS_ERROR_FAULT;
+               return DBOX_STATUS_ERROR_FAULT;
        }
 
        item->inst_list = eina_list_append(item->inst_list, inst);
-       item->has_livebox_script = has_livebox_script;
+       item->has_dynamicbox_script = has_dynamicbox_script;
        item->timeout = timeout;
 
        fault_mark_call(pkgname, id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
-       s_info.current_op = LIVEBOX_OP_CREATE;
+       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->livebox.create) {
-               ret = item->livebox.create(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 = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+               ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
        }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
+       s_info.current_op = DBOX_OP_UNKNOWN;
 
        fault_unmark_call(pkgname, id, __func__, USE_ALARM);
 
@@ -600,8 +601,8 @@ HAPI int so_create(const char *pkgname, const char *id, const char *content_info
                delete_instance(inst);
 
                if (!item->inst_list) {
-                       /* There is no instances, unload this livebox */
-                       delete_livebox(item);
+                       /* There is no instances, unload this dynamicbox */
+                       delete_dynamicbox(item);
                }
                return ret;
        }
@@ -618,20 +619,20 @@ HAPI int so_destroy(struct instance *inst, int unload)
 
        item = inst->item;
        if (!item) {
-               return LB_STATUS_ERROR_INVALID;
+               return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
        fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
-       s_info.current_op = LIVEBOX_OP_DESTROY;
+       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->livebox.destroy) {
-               ret = item->livebox.destroy(util_uri_to_path(inst->id));
+       } else if (item->dynamicbox.destroy) {
+               ret = item->dynamicbox.destroy(util_uri_to_path(inst->id));
        } else {
-               ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+               ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
        }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
+       s_info.current_op = DBOX_OP_UNKNOWN;
 
        fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
 
@@ -639,7 +640,7 @@ HAPI int so_destroy(struct instance *inst, int unload)
        delete_instance(inst);
 
        if (unload && !item->inst_list) {
-               delete_livebox(item);
+               delete_dynamicbox(item);
        }
 
        return ret;
@@ -657,15 +658,15 @@ HAPI char *so_pinup(struct instance *inst, int pinup)
 
        fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
-       s_info.current_op = LIVEBOX_OP_PINUP;
+       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->livebox.pinup) {
-               ret = item->livebox.pinup(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 = LIVEBOX_OP_UNKNOWN;
+       s_info.current_op = DBOX_OP_UNKNOWN;
        
        fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
        return ret;
@@ -678,20 +679,20 @@ HAPI int so_is_pinned_up(struct instance *inst)
 
        item = inst->item;
        if (!item) {
-               return LB_STATUS_ERROR_INVALID;
+               return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
        fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
-       s_info.current_op = LIVEBOX_OP_IS_PINNED_UP;
+       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->livebox.is_pinned_up) {
-               ret = item->livebox.is_pinned_up(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 = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+               ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
        }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
+       s_info.current_op = DBOX_OP_UNKNOWN;
 
        fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
        return ret;
@@ -704,20 +705,20 @@ HAPI int so_is_updated(struct instance *inst)
 
        item = inst->item;
        if (!item) {
-               return LB_STATUS_ERROR_INVALID;
+               return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
        fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
-       s_info.current_op = LIVEBOX_OP_NEED_TO_UPDATE;
+       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->livebox.is_updated) {
-               ret = item->livebox.is_updated(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 = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+               ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
        }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
+       s_info.current_op = DBOX_OP_UNKNOWN;
 
        fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
 
@@ -731,20 +732,20 @@ HAPI int so_need_to_destroy(struct instance *inst)
 
        item = inst->item;
        if (!item) {
-               return LB_STATUS_ERROR_INVALID;
+               return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
        fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
-       s_info.current_op = LIVEBOX_OP_NEED_TO_DESTROY;
+       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->livebox.need_to_destroy) {
-               ret = item->livebox.need_to_destroy(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 = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+               ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
        }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
+       s_info.current_op = DBOX_OP_UNKNOWN;
 
        fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
 
@@ -758,20 +759,20 @@ HAPI int so_update(struct instance *inst)
 
        item = inst->item;
        if (!item) {
-               return LB_STATUS_ERROR_INVALID;
+               return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
        fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
-       s_info.current_op = LIVEBOX_OP_UPDATE_CONTENT;
+       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->livebox.update_content) {
-               ret = item->livebox.update_content(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 = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+               ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
        }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
+       s_info.current_op = DBOX_OP_UNKNOWN;
 
        fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
        return ret;
@@ -784,49 +785,49 @@ HAPI int so_clicked(struct instance *inst, const char *event, double timestamp,
 
        item = inst->item;
        if (!item) {
-               return LB_STATUS_ERROR_INVALID;
+               return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
        fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
        DbgPrint("PERF_DBOX\n");
 
-       s_info.current_op = LIVEBOX_OP_CLICKED;
+       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->livebox.clicked) {
-               ret = item->livebox.clicked(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 = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+               ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
        }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
+       s_info.current_op = DBOX_OP_UNKNOWN;
 
        fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
 
        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;
 
        item = inst->item;
        if (!item) {
-               return LB_STATUS_ERROR_INVALID;
+               return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
        fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
-       s_info.current_op = LIVEBOX_OP_CONTENT_EVENT;
+       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->livebox.script_event) {
-               ret = item->livebox.script_event(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 = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+               ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
        }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
+       s_info.current_op = DBOX_OP_UNKNOWN;
 
        fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
 
@@ -841,25 +842,25 @@ HAPI int so_resize(struct instance *inst, int w, int h)
 
        item = inst->item;
        if (!item) {
-               return LB_STATUS_ERROR_INVALID;
+               return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       type = livebox_service_size_type(w, h);
-       if (type == LB_SIZE_TYPE_UNKNOWN) {
-               return LB_STATUS_ERROR_INVALID;
+       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 = LIVEBOX_OP_RESIZE;
+       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->livebox.resize) {
-               ret = item->livebox.resize(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 = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+               ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
        }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
+       s_info.current_op = DBOX_OP_UNKNOWN;
 
        fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
 
@@ -873,19 +874,19 @@ HAPI int so_set_content_info(struct instance *inst, const char *content_info)
 
        item = inst->item;
        if (!item) {
-               return LB_STATUS_ERROR_INVALID;
+               return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
        fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
-       s_info.current_op = LIVEBOX_OP_SET_CONTENT_INFO;
+       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->livebox.set_content_info) {
-               ret = item->livebox.set_content_info(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 = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+               ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
        }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
+       s_info.current_op = DBOX_OP_UNKNOWN;
        fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
 
        return ret;
@@ -896,30 +897,30 @@ HAPI int so_create_needed(const char *pkgname, const char *cluster, const char *
        struct so_item *item;
        int ret;
 
-       item = find_livebox(pkgname);
+       item = find_dynamicbox(pkgname);
        if (!item) {
                if (!strcasecmp(abi, "c")) {
-                       item = new_livebox(pkgname);
+                       item = new_dynamicbox(pkgname);
                } else {
                        item = new_adaptor(pkgname, abi);
                }
 
                if (!item) {
-                       return LB_STATUS_ERROR_FAULT;
+                       return DBOX_STATUS_ERROR_FAULT;
                }
        }
 
        fault_mark_call(item->pkgname, __func__, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
-       s_info.current_op = LIVEBOX_OP_NEED_TO_CREATE;
+       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->livebox.create_needed) {
-               ret = item->livebox.create_needed(cluster, category);
+       } else if (item->dynamicbox.create_needed) {
+               ret = item->dynamicbox.create_needed(cluster, category);
        } else {
-               ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+               ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
        }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
+       s_info.current_op = DBOX_OP_UNKNOWN;
 
        fault_unmark_call(item->pkgname, __func__, __func__, USE_ALARM);
 
@@ -936,31 +937,31 @@ HAPI int so_change_group(struct instance *inst, const char *cluster, const char
 
        item = inst->item;
        if (!item) {
-               return LB_STATUS_ERROR_INVALID;
+               return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
        tmp_cluster = strdup(cluster);
        if (!tmp_cluster) {
-               return LB_STATUS_ERROR_MEMORY;
+               return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
        }
 
        tmp_category = strdup(category);
        if (!tmp_category) {
                free(tmp_cluster);
-               return LB_STATUS_ERROR_MEMORY;
+               return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
        }
 
        fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
-       s_info.current_op = LIVEBOX_OP_CHANGE_GROUP;
+       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->livebox.change_group) {
-               ret = item->livebox.change_group(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 = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+               ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
        }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
+       s_info.current_op = DBOX_OP_UNKNOWN;
 
        fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
        if (ret >= 0) {
@@ -984,7 +985,7 @@ HAPI int so_get_alt_info(struct instance *inst, char **icon, char **name)
 
        item = inst->item;
        if (!item) {
-               return LB_STATUS_ERROR_INVALID;
+               return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
        *icon = NULL;
@@ -992,15 +993,15 @@ HAPI int so_get_alt_info(struct instance *inst, char **icon, char **name)
 
        fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
-       s_info.current_op = LIVEBOX_OP_GET_ALT_INFO;
+       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->livebox.get_alt_info) {
-               ret = item->livebox.get_alt_info(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 = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+               ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
        }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
+       s_info.current_op = DBOX_OP_UNKNOWN;
 
        fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
        if (ret >= 0) {
@@ -1029,7 +1030,7 @@ HAPI int so_get_output_info(struct instance *inst, int *w, int *h, double *prior
 
        item = inst->item;
        if (!item) {
-               return LB_STATUS_ERROR_INVALID;
+               return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
        *content = NULL;
@@ -1037,15 +1038,15 @@ HAPI int so_get_output_info(struct instance *inst, int *w, int *h, double *prior
 
        fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
-       s_info.current_op = LIVEBOX_OP_GET_INFO;
+       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->livebox.get_output_info) {
-               ret = item->livebox.get_output_info(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 = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+               ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
        }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
+       s_info.current_op = DBOX_OP_UNKNOWN;
 
        fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
        if (ret >= 0) {
@@ -1084,20 +1085,20 @@ HAPI int so_sys_event(struct instance *inst, int event)
 
        item = inst->item;
        if (!item) {
-               return LB_STATUS_ERROR_INVALID;
+               return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
        fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
-       s_info.current_op = LIVEBOX_OP_SYSTEM_EVENT;
+       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->livebox.sys_event) {
-               ret = item->livebox.sys_event(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 = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+               ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
        }
-       s_info.current_op = LIVEBOX_OP_UNKNOWN;
+       s_info.current_op = DBOX_OP_UNKNOWN;
 
        fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
        return ret;
index f848fa1..8d420f9 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"
@@ -145,7 +146,7 @@ static Eina_Bool monitor_cb(void *data, Ecore_Fd_Handler *handler)
                        continue;
                }
 
-               len = strlen(evt->name) + strlen(IMAGE_PATH) + 1;
+               len = strlen(evt->name) + strlen(DYNAMICBOX_CONF_IMAGE_PATH) + 1;
                filename = malloc(len);
                if (!filename) {
                        ErrPrint("Error: %s\n", strerror(errno));
@@ -155,7 +156,7 @@ static Eina_Bool monitor_cb(void *data, Ecore_Fd_Handler *handler)
                        continue;
                }
 
-               ret = snprintf(filename, len, "%s%s", IMAGE_PATH, evt->name);
+               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.
@@ -180,18 +181,20 @@ static Eina_Bool monitor_cb(void *data, Ecore_Fd_Handler *handler)
 
 HAPI int update_monitor_init(void)
 {
+       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 LB_STATUS_ERROR_IO;
+               return DBOX_STATUS_ERROR_IO_ERROR;
        }
 
-       if (access(IMAGE_PATH, R_OK | X_OK) != 0) {
+       if (access(DYNAMICBOX_CONF_IMAGE_PATH, R_OK | X_OK) != 0) {
                ErrPrint("Image folder is not exists\n");
-               return LB_STATUS_ERROR_IO;
+               return DBOX_STATUS_ERROR_IO_ERROR;
        }
 
-       s_info.iwd = inotify_add_watch(s_info.ifd, IMAGE_PATH,
+       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) {
@@ -199,8 +202,8 @@ HAPI int update_monitor_init(void)
                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,
@@ -215,12 +218,12 @@ HAPI int update_monitor_init(void)
                if (close(s_info.ifd) < 0) {
                        ErrPrint("close: %s\n", strerror(errno));
                }
-               s_info.ifd = LB_STATUS_ERROR_INVALID;
-               return LB_STATUS_ERROR_FAULT;
+               s_info.ifd = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+               return DBOX_STATUS_ERROR_FAULT;
        }
 
        DbgPrint("Update monitor is successfully initialized\n");
-       return LB_STATUS_SUCCESS;
+       return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int update_monitor_fini(void)
@@ -237,15 +240,15 @@ HAPI int update_monitor_fini(void)
                        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;
+               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)
@@ -269,7 +272,7 @@ HAPI int update_monitor_trigger_update_cb(const char *filename, int over)
        }
        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)
@@ -294,7 +297,7 @@ HAPI int update_monitor_trigger_delete_cb(const char *filename, int over)
        }
        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,
@@ -305,20 +308,20 @@ HAPI int update_monitor_add_update_cb(const char *filename,
        item = calloc(1, sizeof(*item));
        if (!item) {
                ErrPrint("calloc:%s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
+               return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
        }
 
        item->filename = strdup(filename);
        if (!item->filename) {
                ErrPrint("Error: %s\n", strerror(errno));
                free(item);
-               return LB_STATUS_ERROR_MEMORY;
+               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 LB_STATUS_SUCCESS;
+       return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int update_monitor_add_delete_cb(const char *filename,
@@ -329,21 +332,21 @@ HAPI int update_monitor_add_delete_cb(const char *filename,
        item = calloc(1, sizeof(*item));
        if (!item) {
                ErrPrint("calloc:%s", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
+               return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
        }
 
        item->filename = strdup(filename);
        if (!item->filename) {
                ErrPrint("Error: %s\n", strerror(errno));
                free(item);
-               return LB_STATUS_ERROR_MEMORY;
+               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 LB_STATUS_SUCCESS;
+       return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI void *update_monitor_del_update_cb(const char *filename,
index 62f5e6c..7049312 100644 (file)
 
 #include <dlog.h>
 #include <aul.h>
-#include <livebox-errno.h>
-#include <livebox-service.h>
-#include <livebox-service_product.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)
 {
@@ -58,12 +58,12 @@ HAPI int util_get_filesize(const char *filename)
 
        if (stat(filename, &buf) < 0) {
                ErrPrint("error: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_IO;
+               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;
+               return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
        return buf.st_size;
@@ -131,7 +131,7 @@ HAPI char *util_get_current_module(char **symbol)
                }
 
                
-               ret = livebox_service_pkgname_by_libexec(dinfo.dli_fname);
+               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;
index b2730d0..f2e01f3 100644 (file)
@@ -1,6 +1,6 @@
 #include "util.h"
 
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
 
 void *util_screen_get(void)
 {
@@ -11,17 +11,17 @@ int util_screen_size_get(int *width, int *height)
 {
        *width = 0;
        *height = 0;
-       return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+       return DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
 }
 
 int util_screen_init(void)
 {
-       return LB_STATUS_SUCCESS;
+       return DBOX_STATUS_ERROR_NONE;
 }
 
 int util_screen_fini(void)
 {
-       return LB_STATUS_SUCCESS;
+       return DBOX_STATUS_ERROR_NONE;
 }
 
 /* End of a file */
index 5eb695f..877f10b 100644 (file)
@@ -1,7 +1,7 @@
 #include <Ecore_X.h>
 #include <dlog.h>
 
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
 #include "util.h"
 #include "debug.h"
 
@@ -13,7 +13,7 @@ void *util_screen_get(void)
 int util_screen_size_get(int *width, int *height)
 {
        ecore_x_window_size_get(0, width, height);
-       return LB_STATUS_SUCCESS;
+       return DBOX_STATUS_ERROR_NONE;
 }
 
 int util_screen_init(void)
index 0890c32..2c9cca8 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;
 }