Update finalize function
[apps/livebox/livebox-edje.git] / src / script_port.c
index 38451e5..bd8d71b 100644 (file)
@@ -85,9 +85,13 @@ struct obj_info {
 static struct {
        char *font_name;
        int font_size;
+
+       Eina_List *handle_list;
 } s_info = {
        .font_name = NULL,
        .font_size = -100,
+
+       .handle_list = NULL,
 };
 
 static inline double scale_get(void)
@@ -1358,6 +1362,8 @@ PUBLIC void *script_create(const char *file, const char *group)
                return NULL;
        }
 
+       s_info.handle_list = eina_list_append(s_info.handle_list, handle);
+
        return handle;
 }
 
@@ -1368,6 +1374,13 @@ PUBLIC int script_destroy(void *_handle)
 
        handle = _handle;
 
+       if (!eina_list_data_find(s_info.handle_list, handle)) {
+               DbgPrint("Not found (already deleted?)\n");
+               return LB_STATUS_ERROR_NOT_EXIST;
+       }
+
+       s_info.handle_list = eina_list_remove(s_info.handle_list, handle);
+
        edje = eina_list_nth(handle->obj_list, 0);
        if (edje)
                evas_object_del(edje);
@@ -1603,8 +1616,16 @@ PUBLIC int script_init(void)
 PUBLIC int script_fini(void)
 {
        int ret;
+       Eina_List *l;
+       Eina_List *n;
+       struct info *handle;
+
+       EINA_LIST_FOREACH_SAFE(s_info.handle_list, l, n, handle) {
+               script_destroy(handle);
+       }
+
        ret = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_FONT_SIZE);
-       ret = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_FONT_TYPE);
+       ret = vconf_ignore_key_changed("db/setting/accessibility/font_name", font_changed_cb);
        ret = vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, access_cb);
        elm_shutdown();
        return LB_STATUS_SUCCESS;