diff options
author | Sung-jae Park <nicesj.park@samsung.com> | 2012-12-27 12:46:50 +0900 |
---|---|---|
committer | Sung-jae Park <nicesj.park@samsung.com> | 2012-12-27 12:46:50 +0900 |
commit | ee5e0c7be0687347e3e0cd5a1b5e6ddd33caf3dd (patch) | |
tree | 53901e554b70b6e1525e0f420aaeb2e0ac5552a2 /src | |
parent | 8be2a90ea2e257a0cbdb45bab0e87a3cf2682c75 (diff) | |
download | data-provider-master-ee5e0c7be0687347e3e0cd5a1b5e6ddd33caf3dd.tar.gz data-provider-master-ee5e0c7be0687347e3e0cd5a1b5e6ddd33caf3dd.tar.bz2 data-provider-master-ee5e0c7be0687347e3e0cd5a1b5e6ddd33caf3dd.zip |
Change the type of auto_launch record to TEXT
To know the exact package name for launching it when a user clicks a box
Change-Id: I0231abf331cd41e8edae807ba5400da09aa0fbb0
Diffstat (limited to 'src')
-rw-r--r-- | src/instance.c | 16 | ||||
-rw-r--r-- | src/io.c | 3 | ||||
-rw-r--r-- | src/package.c | 35 | ||||
-rw-r--r-- | src/parser.c | 13 |
4 files changed, 53 insertions, 14 deletions
diff --git a/src/instance.c b/src/instance.c index 4d9086d..fae978c 100644 --- a/src/instance.c +++ b/src/instance.c @@ -101,7 +101,7 @@ struct inst_info { struct buffer_info *buffer; } canvas; - int auto_launch; + const char *auto_launch; } lb; struct { @@ -284,7 +284,7 @@ HAPI int instance_unicast_created_event(struct inst_info *inst, struct client_no else pd_file = ""; - packet = packet_create_noack("created", "dsssiiiissssidiiiiidsi", + packet = packet_create_noack("created", "dsssiiiisssssdiiiiidsi", inst->timestamp, package_name(inst->info), inst->id, inst->content, inst->lb.width, inst->lb.height, @@ -344,7 +344,7 @@ static int instance_broadcast_created_event(struct inst_info *inst) if (!inst->client) client_browse_list(inst->cluster, inst->category, update_client_list, inst); - packet = packet_create_noack("created", "dsssiiiissssidiiiiidsi", + packet = packet_create_noack("created", "dsssiiiisssssdiiiiidsi", inst->timestamp, package_name(inst->info), inst->id, inst->content, inst->lb.width, inst->lb.height, @@ -471,6 +471,14 @@ static inline void destroy_instance(struct inst_info *inst) if (inst->update_timer) ecore_timer_del(inst->update_timer); + /*! + * \note + * + * inst->lb.auto_launch + * + * will be released by the package object + * it is readonly value for instances + */ DbgFree(inst->category); DbgFree(inst->cluster); DbgFree(inst->content); @@ -2054,7 +2062,7 @@ HAPI int instance_change_group(struct inst_info *inst, const char *cluster, cons return slave_rpc_async_request(package_slave(inst->info), package_name(inst->info), packet, change_group_cb, cbdata, 0); } -HAPI const int const instance_auto_launch(const struct inst_info *inst) +HAPI const char * const instance_auto_launch(const struct inst_info *inst) { return inst->lb.auto_launch; } @@ -241,7 +241,8 @@ static inline int build_client_info(struct pkg_info *info) return -EIO; } - package_set_auto_launch(info, sqlite3_column_int(stmt, 0)); + package_set_auto_launch(info, (const char *)sqlite3_column_text(stmt, 0)); + tmp = (const char *)sqlite3_column_text(stmt, 1); if (tmp && strlen(tmp)) { if (sscanf(tmp, "%dx%d", &width, &height) != 2) { diff --git a/src/package.c b/src/package.c index cecc50e..20cc9a0 100644 --- a/src/package.c +++ b/src/package.c @@ -80,7 +80,7 @@ struct pkg_info { } info; unsigned int size_list; - int auto_launch; + char *auto_launch; int pinup; } lb; @@ -289,6 +289,7 @@ static inline void destroy_package(struct pkg_info *info) DbgFree(info->abi); DbgFree(info->pkgname); DbgFree(info->libexec); + DbgFree(info->lb.auto_launch); DbgFree(info); } @@ -437,7 +438,27 @@ static inline int load_conf(struct pkg_info *info) info->period = MINIMUM_PERIOD; info->lb.size_list = parser_size(parser); - info->lb.auto_launch = parser_auto_launch(parser); + + str = parser_auto_launch(parser); + str = str ? str : ""; + info->lb.auto_launch = strdup(str); + if (!info->lb.auto_launch) { + ErrPrint("Heap: %s\n", strerror(errno)); + DbgFree(info->abi); + DbgFree(info->script); + if (info->pd.type == PD_TYPE_SCRIPT) { + DbgFree(info->pd.info.script.path); + DbgFree(info->pd.info.script.group); + } + + if (info->lb.type == LB_TYPE_SCRIPT) { + DbgFree(info->lb.info.script.path); + DbgFree(info->lb.info.script.group); + } + parser_unload(parser); + return -ENOMEM; + } + info->secured = parser_secured(parser); info->lb.pinup = parser_pinup(parser); @@ -867,14 +888,18 @@ HAPI void package_set_pinup(struct pkg_info *info, int pinup) info->lb.pinup = pinup; } -HAPI const int const package_auto_launch(const struct pkg_info *info) +HAPI const char * const package_auto_launch(const struct pkg_info *info) { return info->lb.auto_launch; } -HAPI void package_set_auto_launch(struct pkg_info *info, int auto_launch) +HAPI void package_set_auto_launch(struct pkg_info *info, const char *auto_launch) { - info->lb.auto_launch = auto_launch; + info->lb.auto_launch = strdup(auto_launch); + if (!info->lb.auto_launch) { + ErrPrint("Heap: %s\n", strerror(errno)); + return; + } } HAPI const unsigned int const package_size_list(const struct pkg_info *info) diff --git a/src/parser.c b/src/parser.c index 4415c67..e7af92e 100644 --- a/src/parser.c +++ b/src/parser.c @@ -45,7 +45,7 @@ struct parser { double period; int timeout; int network; - int auto_launch; + char *auto_launch; unsigned int size; unsigned int pd_width; unsigned int pd_height; @@ -83,7 +83,7 @@ HAPI int parser_timeout(struct parser *handle) return handle->timeout; } -HAPI int parser_auto_launch(struct parser *handle) +HAPI const char *parser_auto_launch(struct parser *handle) { return handle->auto_launch; } @@ -390,7 +390,11 @@ static void auto_launch_handler(struct parser *item, char *buffer) if (!rtrim(buffer)) return; - item->auto_launch = !!atoi(buffer); + item->auto_launch = strdup(buffer); + if (!item->auto_launch) { + ErrPrint("Heap: %s\n", strerror(errno)); + return; + } } static void size_handler(struct parser *item, char *buffer) @@ -647,7 +651,7 @@ HAPI struct parser *parser_load(const char *pkgname) item->lb_group = NULL; item->pd_width = 0; item->pd_height = 0; - item->auto_launch = 1; + item->auto_launch = NULL; item->size = 0x00000001; item->group = NULL; item->secured = 0; @@ -827,6 +831,7 @@ HAPI int parser_unload(struct parser *item) { s_list = eina_list_remove(s_list, item); + DbgFree(item->auto_launch); DbgFree(item->abi); DbgFree(item->script); DbgFree(item->group); |