diff options
author | Hyungdeuk Kim <hd3.kim@samsung.com> | 2013-04-19 11:24:50 +0900 |
---|---|---|
committer | Hyungdeuk Kim <hd3.kim@samsung.com> | 2013-04-19 11:24:50 +0900 |
commit | 44325d83063d8a47efdbc6e279d3c3ef16732970 (patch) | |
tree | a3942f4c4c0cc15e4ede59370e91416eabc6380e /src | |
parent | 46b82c6d162cea4d5560c82ae117b6a49b217bf8 (diff) | |
download | ui-gadget-1-44325d83063d8a47efdbc6e279d3c3ef16732970.tar.gz ui-gadget-1-44325d83063d8a47efdbc6e279d3c3ef16732970.tar.bz2 ui-gadget-1-44325d83063d8a47efdbc6e279d3c3ef16732970.zip |
add ug_send_result_full api for appcontrol ug
Diffstat (limited to 'src')
-rwxr-xr-x | src/ug.c | 53 |
1 files changed, 45 insertions, 8 deletions
@@ -219,9 +219,9 @@ UG_API int ug_send_key_event(enum ug_key_event event) return ugman_send_key_event(event); } -UG_API int ug_send_result(ui_gadget_h ug, service_h result) +UG_API int ug_send_result(ui_gadget_h ug, service_h send) { - service_h result_dup = NULL; + service_h send_dup = NULL; if (!ug || !ugman_ug_exist(ug)) { _ERR("ug_send_result() failed: Invalid ug"); @@ -234,18 +234,54 @@ UG_API int ug_send_result(ui_gadget_h ug, service_h result) return -1; } - if (result) { - service_clone(&result_dup, result); - if (!result_dup) { + if (send) { + service_clone(&send_dup, send); + if (!send_dup) { _ERR("ug_send_result() failed: service_destroy failed"); return -1; } } - ug->cbs.result_cb(ug, result_dup, ug->cbs.priv); + ug->cbs.result_cb(ug, send_dup, ug->cbs.priv); - if (result_dup) - service_destroy(result_dup); + if (send_dup) + service_destroy(send_dup); + + return 0; +} + +UG_API int ug_send_result_full(ui_gadget_h ug, service_h send, service_result_e result) +{ + service_h send_dup = NULL; + char tmp_result[4] = {0,}; + + if (!ug || !ugman_ug_exist(ug)) { + _ERR("ug_send_result() failed: Invalid ug"); + errno = EINVAL; + return -1; + } + + if (!ug->cbs.result_cb) { + _ERR("ug_send_result() failed: result callback does not exist"); + return -1; + } + + if (send) { + service_clone(&send_dup, send); + if (!send_dup) { + _ERR("ug_send_result() failed: service_destroy failed"); + return -1; + } + } + + snprintf(tmp_result, 4, "%d", result); + + service_add_extra_data(send_dup, UG_SERVICE_DATA_RESULT, (const char*)tmp_result); + + ug->cbs.result_cb(ug, send_dup, ug->cbs.priv); + + if (send_dup) + service_destroy(send_dup); return 0; } @@ -291,3 +327,4 @@ UG_API int ug_is_installed(const char *name) return ug_exist(name); } + |