From ee7b666609837673e936da3a1c7bd176bc19894e Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 1 Dec 2016 11:46:10 +0900 Subject: [PATCH] Implement the update requested event Change-Id: Ib264210abbc6e0852e596a2e4a4ae9ea23ee4423 Signed-off-by: Hwankyu Jhun --- src/app_main.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/app_main.c b/src/app_main.c index 8037e32..9862ba8 100755 --- a/src/app_main.c +++ b/src/app_main.c @@ -42,7 +42,7 @@ #define LOG_TAG "CAPI_APPFW_APPLICATION" -#define UI_APP_EVENT_MAX 6 +#define UI_APP_EVENT_MAX 7 typedef enum { APP_STATE_NOT_RUNNING, /* The application has been launched or was running but was terminated */ @@ -491,6 +491,24 @@ static int _ui_app_appcore_suspended_state_changed(void *event_info, void *data) } /* LCOV_EXCL_STOP */ +static int _ui_app_appcore_update_requested(void *event_info, void *data) +{ + Eina_List *l; + app_event_handler_h handler; + struct app_event_info event; + + LOGI("_ui_app_appcore_update_requested"); + + event.type = APP_EVENT_UPDATE_REQUESTED; + event.value = event_info; + + EINA_LIST_FOREACH(handler_list[APP_EVENT_UPDATE_REQUESTED], l, handler) { + handler->cb(&event, handler->data); + } + + return APP_ERROR_NONE; +} + static void _ui_app_appcore_set_event_cb(app_event_type_e event_type) { switch (event_type) { @@ -513,6 +531,9 @@ static void _ui_app_appcore_set_event_cb(app_event_type_e event_type) LOGI("[__SUSPEND__]"); appcore_set_event_callback(APPCORE_EVENT_SUSPENDED_STATE_CHANGE, _ui_app_appcore_suspended_state_changed, NULL); break; + case APP_EVENT_UPDATE_REQUESTED: + appcore_set_event_callback(APPCORE_EVENT_UPDATE_REQUESTED, _ui_app_appcore_update_requested, NULL); + break; default: break; } @@ -540,6 +561,9 @@ static void _ui_app_appcore_unset_event_cb(app_event_type_e event_type) LOGI("[__SUSPEND__]"); appcore_set_event_callback(APPCORE_EVENT_SUSPENDED_STATE_CHANGE, NULL, NULL); break; + case APP_EVENT_UPDATE_REQUESTED: + appcore_set_event_callback(APPCORE_EVENT_UPDATE_REQUESTED, NULL, NULL); + break; default: break; } @@ -557,6 +581,8 @@ static void _ui_app_set_appcore_event_cb(void) _ui_app_appcore_set_event_cb(APP_EVENT_DEVICE_ORIENTATION_CHANGED); if (eina_list_count(handler_list[APP_EVENT_SUSPENDED_STATE_CHANGED]) > 0) _ui_app_appcore_set_event_cb(APP_EVENT_SUSPENDED_STATE_CHANGED); + if (eina_list_count(handler_list[APP_EVENT_UPDATE_REQUESTED]) > 0) + _ui_app_appcore_set_event_cb(APP_EVENT_UPDATE_REQUESTED); } static void _ui_app_unset_appcore_event_cb(void) @@ -571,6 +597,8 @@ static void _ui_app_unset_appcore_event_cb(void) _ui_app_appcore_unset_event_cb(APP_EVENT_DEVICE_ORIENTATION_CHANGED); if (eina_list_count(handler_list[APP_EVENT_SUSPENDED_STATE_CHANGED]) > 0) _ui_app_appcore_unset_event_cb(APP_EVENT_SUSPENDED_STATE_CHANGED); + if (eina_list_count(handler_list[APP_EVENT_UPDATE_REQUESTED]) > 0) + _ui_app_appcore_unset_event_cb(APP_EVENT_UPDATE_REQUESTED); } static int _ui_app_appcore_create(void *data) -- 2.7.4