diff options
Diffstat (limited to 'client/ug-client.c')
-rw-r--r-- | client/ug-client.c | 108 |
1 files changed, 95 insertions, 13 deletions
diff --git a/client/ug-client.c b/client/ug-client.c index ecaf16b..0c79d1e 100644 --- a/client/ug-client.c +++ b/client/ug-client.c @@ -29,9 +29,8 @@ #include <dlog.h> #include <aul.h> -#include <appsvc.h> #include <app.h> -#include <runtime_info.h> +#include <vconf.h> #include "ug-client.h" @@ -151,26 +150,61 @@ void _ug_client_layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv) } } -void _ug_client_result_cb(ui_gadget_h ug, service_h result, void *priv) +void _ug_client_result_cb(ui_gadget_h ug, service_h reply, void *priv) { - struct appdata *ad; + struct appdata *ad = NULL; int ret; + char* value = NULL; + int result; if (!ug || !priv) return; + + ret = service_get_extra_data (reply, UG_SERVICE_DATA_RESULT, &value); + if((ret == SERVICE_ERROR_NONE) && (value)) { + result = atoi(value); + LOGD("reply result is %d", result); + } else { + LOGW("get reply result error(%d) . result will be SERVICE_RESULT_SUCCEEDED", ret); + result = SERVICE_RESULT_SUCCEEDED; + } + ad = priv; + if (!ad) { + LOGE("appdata is null"); + return; + } - ret = service_reply_to_launch_request(result, ad->request, SERVICE_RESULT_SUCCEEDED); + ret = service_reply_to_launch_request(reply, ad->request, (service_result_e)result); if (ret != SERVICE_ERROR_NONE) LOGE("service_reply_to_launch_request failed, %d", ret); } void _ug_client_destroy_cb(ui_gadget_h ug, void *priv) { + struct appdata *ad = NULL; + if (!ug) return; - ug_destroy(ug); + ad = priv; + if (!ad) { + LOGE("appdata is null. win lower is fail"); + } else { + LOGD("window lower"); + elm_win_lower(ad->win); + } + + elm_exit(); +} + +void _ug_client_end_cb(ui_gadget_h ug, void *priv) +{ + if (!ug) + return; + + LOGD("_ug_client_end_cb invoked"); + elm_exit(); } @@ -181,7 +215,7 @@ static void profile_changed_cb(void *data, Evas_Object * obj, void *event) LOGE("!!! profile_changed_cb(%s) !!!", profile); if (strcmp(profile, "desktop") == 0) - elm_win_indicator_mode_set (obj, ELM_WIN_INDICATOR_HIDE); + elm_win_indicator_mode_set(obj, ELM_WIN_INDICATOR_HIDE); } static Evas_Object *create_win(const char *name) @@ -201,6 +235,8 @@ static Evas_Object *create_win(const char *name) ee = ecore_evas_ecore_evas_get(evas_object_evas_get(eo)); evas_output_size_get(ee, &w, &h); evas_object_resize(eo, w, h); + + elm_win_indicator_mode_set(eo,ELM_WIN_INDICATOR_SHOW); } return eo; @@ -237,13 +273,43 @@ static int low_battery(void *data) static int lang_changed(void *data) { + char* lang = NULL; + + lang = vconf_get_str(VCONFKEY_LANGSET); + if(lang) { + LOGD("lang : %s", lang); + elm_language_set((const char*)lang); + free(lang); + } else { + LOGW("language get error"); + } + return ug_send_event(UG_EVENT_LANG_CHANGE); } +static int region_changed(void *data) +{ + return ug_send_event(UG_EVENT_REGION_CHANGE); +} + +static void _home_screen_top_cb(keynode_t* node, void *data) +{ + struct appdata *ad = data; + + if (!node) { + LOGE("home screen top cb node value is null"); + return; + } + + if ((node->value.i == VCONFKEY_IDLE_SCREEN_TOP_TRUE) && (!ad->is_transient)) { + LOGW("home key pressed. window is not transient. ug client will be terminated"); + elm_exit(); + } +} + static int app_create(void *data) { struct appdata *ad = data; - enum appcore_rm rm; Evas_Object *win; Evas_Object *ly; Evas_Object *conform; @@ -279,7 +345,6 @@ static int app_create(void *data) edje_object_signal_callback_add(elm_layout_edje_get(ly), "EXIT", "*", main_quit_cb, NULL); ad->ly_main = ly; - elm_win_indicator_mode_set(win, ELM_WIN_INDICATOR_SHOW); lang_changed(ad); /* rotate notice */ @@ -305,6 +370,7 @@ static int app_create(void *data) appcore_set_event_callback(APPCORE_EVENT_LOW_MEMORY, low_memory, ad); appcore_set_event_callback(APPCORE_EVENT_LOW_BATTERY, low_battery, ad); appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE, lang_changed, ad); + appcore_set_event_callback(APPCORE_EVENT_REGION_CHANGE, region_changed, ad); return 0; } @@ -329,6 +395,14 @@ static int app_terminate(void *data) ad->win = NULL; } + service_destroy(ad->request); + + if (ad->name) { + free(ad->name); + } + + LOGD("app_terminate end"); + return 0; } @@ -339,10 +413,14 @@ static int app_pause(void *data) LOGD("app_pause called"); ug_pause(); + +#if ENABLE_TRANSIENT_SUB_MODE if (!ad->is_transient) { LOGD("app_pause received. close ug service"); elm_exit(); } +#endif + return 0; } @@ -369,10 +447,15 @@ static int app_reset(bundle *b, void *data) ret = appsvc_request_transient_app(b, id2, svc_cb, "svc test"); - if (ret) + if (ret) { LOGD("fail to request transient app: return value(%d)", ret); - else + if(vconf_notify_key_changed(VCONFKEY_IDLE_SCREEN_TOP, _home_screen_top_cb, ad) != 0) { + LOGW("home screen vconf key changed cb error"); + } + } else { + /* check home screen raise */ ad->is_transient = 1; + } if (ad->win) { elm_win_activate(ad->win); @@ -392,6 +475,7 @@ static int app_reset(bundle *b, void *data) cbs.layout_cb = _ug_client_layout_cb; cbs.destroy_cb = _ug_client_destroy_cb; cbs.result_cb = _ug_client_result_cb; + cbs.end_cb = _ug_client_end_cb; cbs.priv = ad; mode = ad->is_frameview ? UG_MODE_FRAMEVIEW : UG_MODE_FULLVIEW; @@ -414,8 +498,6 @@ static int update_argument(const char *optarg, struct appdata *ad) return -1; val = optarg + strlen(key) + 1; - if (!val) - return -1; if (!ad->data) ad->data = bundle_create(); |