diff options
Diffstat (limited to 'src/ui-callback.c')
-rwxr-xr-x | src/ui-callback.c | 194 |
1 files changed, 194 insertions, 0 deletions
diff --git a/src/ui-callback.c b/src/ui-callback.c new file mode 100755 index 0000000..d9cb517 --- /dev/null +++ b/src/ui-callback.c @@ -0,0 +1,194 @@ +/* + * pwlock + * + * Copyright 2012 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include <Ecore_X.h> +#include <ui-gadget.h> +#include <vconf.h> + +#include "pwlock.h" +#include "util.h" +#include "ui-callback.h" + +void pwlock_greeting_next_cb(void *data, Evas_Object *obj, void *e) { + _DBG("%s,%d", __func__, __LINE__); + struct appdata *ad = data; + + if (!ad) + return; + + ad->btn_evt_state = BUTTON_STATE_NEXT_CLICKED; + + if (ad->is_no_sim == 1) { + do_state_directly(_ST_NOSIM, ad); + } else { + do_state_directly(_ST_TIME, ad); + } +} + +void pwlock_nosim_prev_cb(void *data, Evas_Object * obj, void *e) { + _DBG("%s,%d", __func__, __LINE__); + struct appdata *ad = data; + + if (!ad) + return; + + ad->btn_evt_state = BUTTON_STATE_PREV_CLICKED; + do_state_directly(_ST_GREETING, ad); +} + +void pwlock_nosim_skip_cb(void *data, Evas_Object * obj, void *e) { + _DBG("%s,%d", __func__, __LINE__); + struct appdata *ad = data; + + if (!ad) + return; + + ad->btn_evt_state = BUTTON_STATE_NEXT_CLICKED; + do_state_directly(_ST_TIME, ad); +} + +void pwlock_tutorial_prev_cb(void *data, Evas_Object *obj, void *e) { + _DBG("%s,%d", __func__, __LINE__); + struct appdata *ad = data; + + if (!ad) + return; + + ad->btn_evt_state = BUTTON_STATE_PREV_CLICKED; + do_state_directly(_ST_CONNECTION, ad); +} + +void pwlock_tutorial_next_cb(void *data, Evas_Object *obj, void *e) { + _DBG("%s,%d", __func__, __LINE__); + struct appdata *ad = data; + + if (!ad) + return; + + ad->btn_evt_state = BUTTON_STATE_NEXT_CLICKED; + do_state_directly(_ST_EXIT, ad); +} + +void pwlock_ug_connection_layout_cb(ui_gadget_h ug, enum ug_mode mode, + void *priv) { + struct appdata *ad = (struct appdata *) priv; + Evas_Object *base; + _DBG("%s begin", __func__); + if (!ug || !priv) + return; + + base = (Evas_Object *) ug_get_layout(ug); + if (!base) { + _DBG("base layout null!\n"); + return; + } + + _DBG("%s,%d", __func__, __LINE__); + //ad->btn_evt_state = BUTTON_STATE_NONE; + switch (mode) { + case UG_MODE_FULLVIEW: + evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + elm_win_resize_object_add(ug_get_window(), base); + //ug_disable_effect(ug); + evas_object_show(base); + ad->wifi_ug_layout = base; + break; + default: + break; + } + _DBG("%s end", __func__); +} + +void pwlock_ug_connection_result_cb(ui_gadget_h ug, service_h service, + void *priv) { + _DBG("function=%s", __func__); + struct appdata *ad = NULL; + + if (!ug || !priv || !service) { + return; + } + char *retv = NULL; + ad = (struct appdata *) priv; + _DBG("ad->state=%d", ad->state); + + service_get_extra_data(service, "result", &retv); + + if (retv && !strcmp(retv, "lbutton_click")) { + ad->btn_evt_state = BUTTON_STATE_PREV_CLICKED; + } + if (retv && !strcmp(retv, "rbutton_click")) { + ad->btn_evt_state = BUTTON_STATE_NEXT_CLICKED; + } +} + +void pwlock_ug_connection_destroy_cb(ui_gadget_h ug, void *priv) { + _DBG("%s, %d begin", __func__, __LINE__); + + struct appdata *ad = NULL; + + if (!ug || !priv) { + return; + } + ad = (struct appdata *) priv; + + if (ug) { + ug_destroy(ug); + ug = NULL; + } + + _DBG("ad->btn_evt_state=%d", ad->btn_evt_state); + + switch (ad->btn_evt_state) { + case BUTTON_STATE_NEXT_CLICKED: + do_state_directly(_ST_FINISH, ad); + break; + case BUTTON_STATE_PREV_CLICKED: + do_state_directly(_ST_TIME, ad); + break; + case BUTTON_STATE_NONE: + break; + } + //ad->btn_evt_state = BUTTON_STATE_NONE; +} + +void pwlock_finish_prev_cb(void *data, Evas_Object *obj, void *e) +{ + _DBG("%s,%d", __func__, __LINE__); + struct appdata *ad = data; + + if (!ad) + return; + + ad->btn_evt_state = BUTTON_STATE_PREV_CLICKED; + do_state_directly(_ST_CONNECTION, ad); +} + +void pwlock_finish_cb(void *data, Evas_Object *obj, void *e) { + _DBG("%s,%d", __func__, __LINE__); + struct appdata *ad = data; + + if (!ad) + return; + + vconf_set_bool(VCONFKEY_PWLOCK_FIRST_BOOT, 0); + + ad->btn_evt_state = BUTTON_STATE_NEXT_CLICKED; + do_state_directly(_ST_EXIT, ad); +} |