diff options
-rw-r--r-- | data/view/channelnumber.edc | 5 | ||||
-rw-r--r-- | src/main.c | 60 |
2 files changed, 55 insertions, 10 deletions
diff --git a/data/view/channelnumber.edc b/data/view/channelnumber.edc index 387b8f7..48d9e02 100644 --- a/data/view/channelnumber.edc +++ b/data/view/channelnumber.edc @@ -174,6 +174,7 @@ group { } min, 216 224; align, 0.0 0.0; + fixed, 1 1; } } } @@ -281,6 +282,7 @@ group { color, COLOR_OPTION_BORDER; min, 0 1; align, 0.0 0.0; + fixed, 0 1; visible, 0; } description { @@ -306,6 +308,7 @@ group { color, COLOR_OPTION_BORDER; min, 1 0; align, 0.0 0.0; + fixed, 1 0; } } part { @@ -325,6 +328,7 @@ group { color, COLOR_OPTION_BORDER; min, 0 1; align, 0.0 1.0; + fixed, 0 1; visible, 0; } description { @@ -350,6 +354,7 @@ group { color, COLOR_OPTION_BORDER; min, 1 0; align, 1.0 0.0; + fixed, 1 0; } } } @@ -36,6 +36,7 @@ struct _appdata { Ecore_Event_Handler *key_up; int is_signal; + int is_channel; }; struct key_map { @@ -64,9 +65,19 @@ static struct key_map g_kmap[] = { static Eina_Bool _key_down_cb(void *data, int type, void *ei) { + struct _appdata *ad; Evas_Event_Key_Down *ev = ei; size_t i, j; + if (!data) { + _ERR("failed to get data"); + return false; + } + + ad = data; + if (!ad->is_channel) + return ECORE_CALLBACK_DONE; + if (!strcmp(ev->keyname, KEY_ENTER) || !strcmp(ev->keyname, KEY_ENTER_REMOTE)) { if (viewmgr_active_view_count() > 0) @@ -90,9 +101,19 @@ static Eina_Bool _key_down_cb(void *data, int type, void *ei) static Eina_Bool _key_up_cb(void *data, int type, void *ei) { + struct _appdata *ad; Evas_Event_Key_Up *ev = ei; size_t i, j; + if (!data) { + _ERR("failed to get data"); + return false; + } + + ad = data; + if (!ad->is_channel) + return ECORE_CALLBACK_DONE; + if (!strcmp(ev->keyname, KEY_ENTER) || !strcmp(ev->keyname, KEY_ENTER_REMOTE)) { if (viewmgr_active_view_count() > 0) @@ -116,7 +137,7 @@ static Eina_Bool _key_up_cb(void *data, int type, void *ei) static Evas_Object *_add_win(const char *name) { - Evas_Object *win, *trans; + Evas_Object *win; win = elm_win_add(NULL, name, ELM_WIN_BASIC); if (!win) { @@ -147,6 +168,13 @@ static void _tv_signal_cb(void *data, int is_signal) return; ad->is_signal = is_signal; + + if (is_signal) { + viewmgr_hide_view(VIEW_ERROR); + } else { + viewmgr_show_view(VIEW_ERROR); + viewmgr_update_view(VIEW_ERROR, UPDATE_TYPE_NOSIGNAL, NULL); + } } static void _pause(void *data) @@ -155,7 +183,6 @@ static void _pause(void *data) static void _resume(void *data) { - struct _appdata *ad; int r; if (!data) { @@ -163,8 +190,6 @@ static void _resume(void *data) return; } - ad = data; - r = tv_resume(); if (r < 0) { _ERR("Resume tv service failed"); @@ -220,9 +245,9 @@ static bool _create(void *data) tv_signal_cb_set(_tv_signal_cb, ad); ad->key_down = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, - _key_down_cb, NULL); + _key_down_cb, ad); ad->key_up = ecore_event_handler_add(ECORE_EVENT_KEY_UP, - _key_up_cb, NULL); + _key_up_cb, ad); elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_IN); @@ -260,6 +285,7 @@ static void _terminate(void *data) static void _control(app_control_h control, void *data) { + struct _appdata *ad; char *svcid; int r; @@ -268,15 +294,29 @@ static void _control(app_control_h control, void *data) return; } + ad = data; + r = app_control_get_extra_data(control, KEY_SVCID, &svcid); if (r == SERVICE_ERROR_NONE) { - tv_channel_tune_with_service_id(atoll(svcid)); + r = tv_channel_tune_with_service_id(atoll(svcid)); free(svcid); - } else { - tv_channel_tune(); + if (!r) { + ad->is_channel = true; + viewmgr_show_view(VIEW_CHANNELINFO); + return; + } } - viewmgr_show_view(VIEW_CHANNELINFO); + r = tv_channel_tune(); + + if (r < 0) { + ad->is_channel = false; + viewmgr_show_view(VIEW_ERROR); + viewmgr_update_view(VIEW_ERROR, UPDATE_TYPE_NOCHANNEL, NULL); + } else { + ad->is_channel = true; + viewmgr_show_view(VIEW_CHANNELINFO); + } } int main(int argc, char *argv[]) |