diff options
-rwxr-xr-x | client/ug-client.c | 2 | ||||
-rwxr-xr-x | include/ui-gadget-module.h | 48 | ||||
-rwxr-xr-x | include/ui-gadget.h | 4 | ||||
-rwxr-xr-x | packaging/ui-gadget-1.spec | 2 | ||||
-rwxr-xr-x | src/ug.c | 53 |
5 files changed, 97 insertions, 12 deletions
diff --git a/client/ug-client.c b/client/ug-client.c index 052587f..5d6961c 100755 --- a/client/ug-client.c +++ b/client/ug-client.c @@ -189,7 +189,7 @@ static Evas_Object *create_win(const char *name) elm_win_conformant_set(eo, EINA_TRUE); evas_object_smart_callback_add(eo, "delete,request", win_del, NULL); - /* disable destktop mode + /* disable destktop mode evas_object_smart_callback_add(eo, "profile,changed", profile_changed_cb, NULL); */ ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h); diff --git a/include/ui-gadget-module.h b/include/ui-gadget-module.h index 452827b..d91d4bf 100755 --- a/include/ui-gadget-module.h +++ b/include/ui-gadget-module.h @@ -158,7 +158,53 @@ int ug_destroy_me(ui_gadget_h ug); * ... * \endcode */ -int ug_send_result(ui_gadget_h ug, service_h result); +int ug_send_result(ui_gadget_h ug, service_h send); + + +/** + * \par Description: + * This function sends result to caller of the given UI gadget instance. + * + * \par Purpose: + * This function is used for sending result to caller of the given UI gadget instance. The result have to be composed with service handle. + * + * \par Typical use case: + * UI gadget developer who want to send result to caller of the given UI gadget instance could use the function. + * + * \par Method of function operation: + * Result callback which is registered by caller with ug_create() is invoked. + * + * \par Context of function: + * This function supposed to be called in the created UI gadget. + * + * @param[in] ug the UI gadget + * @param[in] the service handle in which the results of the callee (see \ref service_PG "Tizen managed api reference guide") + * @param[in] The result code of the launch request. (This is valid in case that ug is launched by appcontrol) + * @return 0 on success, -1 on error + * + * \pre None + * \post None + * \see None + * \remarks After send your message, you have to release it using service_destroy() + * + * \par Sample code: + * \code + * #include <ui-gadget-module.h> + * ... + * // make a result with service + * service_h result; + * service_create(&result); + * service_add_extra_data(result, "Content", "Hello"); + * + * // send the result + * ug_send_result_full(ug, result, SERVICE_RESULT_SUCCEEDED); + * + * // release the result + * service_destroy(result); + * ... + * \endcode + */ +int ug_send_result_full(ui_gadget_h ug, service_h send, service_result_e result); #ifdef __cplusplus } diff --git a/include/ui-gadget.h b/include/ui-gadget.h index a570f5a..dfa13b4 100755 --- a/include/ui-gadget.h +++ b/include/ui-gadget.h @@ -136,6 +136,8 @@ enum ug_option { #define GET_OPT_INDICATOR_VAL(opt) opt % UG_OPT_OVERLAP_ENABLE #define GET_OPT_OVERLAP_VAL(opt) opt & UG_OPT_OVERLAP_ENABLE +#define UG_SERVICE_DATA_RESULT "__UG_SEND_REUSLT__" + /** * UI gadget callback type * @see ug_create() @@ -761,7 +763,7 @@ int ug_disable_effect(ui_gadget_h ug); * N/A * * @param[in] ug The UI gadget - * @return 1 - installed, 0 - installed, -1 - error + * @return 1 - installed, 0 - not installed, -1 - error * * \pre None * \post None diff --git a/packaging/ui-gadget-1.spec b/packaging/ui-gadget-1.spec index 8ba67e6..ebe77a7 100755 --- a/packaging/ui-gadget-1.spec +++ b/packaging/ui-gadget-1.spec @@ -1,7 +1,7 @@ Name: ui-gadget-1 Summary: UI Gadget Library -Version: 0.1.21 +Version: 0.1.22 Release: 1 Group: System/Libraries License: Apache License, Version 2.0 @@ -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); } + |