diff options
author | jinwoo.shin <jw0227.shin@samsung.com> | 2015-09-21 19:20:22 +0900 |
---|---|---|
committer | jinwoo.shin <jw0227.shin@samsung.com> | 2015-09-21 19:20:22 +0900 |
commit | a535d1d699ebe7d72f760dde3b4c11f97b969117 (patch) | |
tree | 900ffcdf6f0e8cda75ceb4b037e3584afdb748a3 | |
parent | a73bb7a2bb3d14225df86c329038008ba08f107e (diff) | |
download | air_livetv-a535d1d699ebe7d72f760dde3b4c11f97b969117.tar.gz air_livetv-a535d1d699ebe7d72f760dde3b4c11f97b969117.tar.bz2 air_livetv-a535d1d699ebe7d72f760dde3b4c11f97b969117.zip |
Update action menusubmit/tizen/20150921.123936accepted/tizen/tv/20150922.001349
- Launch favorite when user press more button
- Set tag on action menu input callbacks to delete them
Change-Id: I3e9a768418db8d7949935aeb03290d05dd793abc
Signed-off-by: jinwoo.shin <jw0227.shin@samsung.com>
-rw-r--r-- | org.tizen.live-tv.xml.in | 3 | ||||
-rw-r--r-- | src/view_action_menu.c | 86 |
2 files changed, 69 insertions, 20 deletions
diff --git a/org.tizen.live-tv.xml.in b/org.tizen.live-tv.xml.in index 5c8c0fa..7727803 100644 --- a/org.tizen.live-tv.xml.in +++ b/org.tizen.live-tv.xml.in @@ -7,4 +7,7 @@ <label>Live TV</label> <icon>@DESKTOP_ICON@</icon> </ui-application> + <privileges> + <privilege>http://tizen.org/privilege/appmanager.launch</privilege> + </privileges> </manifest> diff --git a/src/view_action_menu.c b/src/view_action_menu.c index 76265fe..c998f29 100644 --- a/src/view_action_menu.c +++ b/src/view_action_menu.c @@ -17,7 +17,9 @@ #include <Elementary.h> #include <viewmgr.h> #include <inputmgr.h> +#include <app_control.h> #include <app_debug.h> +#include <app_define.h> #include "define.h" #include "util.h" @@ -32,6 +34,7 @@ #define SCROLLER_STEP_SIZE 334 #define TAG_FAVORITE "TAG_FAVORITE" +#define KEY_BUTTON "KEY_BUTTON" #define STYLE_LIVETV_BTN "style.livetv.button" #define STYLE_ACTION_MENU_BTN "style.action.menu.button" @@ -320,21 +323,67 @@ static void _update_button_state(Evas_Object *obj, struct _button *button) } } -static void _button_clicked(Evas_Object *obj, int id, void *data) +static void _launch_favorite(void) { - struct _button *button; + app_control_h app_ctrl; + int r; - if (!data) { - _ERR("failed to get data"); + r = app_control_create(&app_ctrl); + if (r != APP_CONTROL_ERROR_NONE) { + _ERR("failed to create app control handle"); return; } - button = data; + r = app_control_set_operation(app_ctrl, APP_CONTROL_OPERATION_DEFAULT); + if (r != APP_CONTROL_ERROR_NONE) { + _ERR("failed to set app control operation"); + app_control_destroy(app_ctrl); + return; + } + + r = app_control_set_app_id(app_ctrl, APP_ID_FAVORITE); + if (r != APP_CONTROL_ERROR_NONE) { + _ERR("failed to set app control app id"); + app_control_destroy(app_ctrl); + return; + } - if (button->clicked) - button->clicked(); + r = app_control_send_launch_request(app_ctrl, NULL, NULL); + if (r != APP_CONTROL_ERROR_NONE) { + _ERR("failed to send app control launch request"); + app_control_destroy(app_ctrl); + return; + } - _update_button_state(obj, button); + app_control_destroy(app_ctrl); +} + +static void _button_clicked(Evas_Object *obj, int id, void *data) +{ + struct _button *button; + + switch (id) { + case BUTTON_MORE: + _launch_favorite(); + + viewmgr_hide_view(VIEW_ACTION_MENU); + break; + case BUTTON_FAV: + case BUTTON_LOCK: + case BUTTON_CHANNEL: + button = evas_object_data_get(obj, KEY_BUTTON); + if (!button) { + _ERR("failed to get button"); + return; + } + + if (button->clicked) + button->clicked(); + + _update_button_state(obj, button); + + break; + } } static void _button_key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, @@ -441,7 +490,7 @@ static void _update_favorite(struct _priv *priv) util_add_icon(btn, IMAGE_FAVORITE_DEFAULT, PART_CONTENT); inputmgr_add_callback(btn, channel_info->service_id, &favorite_handler, NULL); - inputmgr_set_tags(btn, TAG_FAVORITE); + inputmgr_set_tags(btn, TAG_FAVORITE, VIEW_ACTION_MENU); elm_box_pack_end(priv->favorite, btn); @@ -523,8 +572,10 @@ static bool _draw_action_area(struct _priv *priv) PART_ICON_1_SELECTED); util_add_icon(btn, buttons[i].data[TOGGLE].disabled, PART_ICON_1_DISABLED); + evas_object_data_set(btn, KEY_BUTTON, &buttons[i]); inputmgr_add_callback(btn, buttons[i].id, - &button_handler, &buttons[i]); + &button_handler, priv); + inputmgr_set_tags(btn, VIEW_ACTION_MENU); col = i % ITEMS_IN_ROW; row = i / ITEMS_IN_ROW; @@ -616,6 +667,9 @@ static bool _draw_bottom_area(struct _priv *priv) _ERR("failed to create more button"); return false; } + inputmgr_add_callback(btn, BUTTON_MORE, + &button_handler, priv); + inputmgr_set_tags(btn, VIEW_ACTION_MENU); return true; } @@ -696,6 +750,7 @@ static Evas_Object *_create(Evas_Object *win, void *data) viewmgr_set_view_data(VIEW_ACTION_MENU, priv); inputmgr_add_callback(priv->base, 0, &key_handler, priv); + inputmgr_set_tags(priv->base, VIEW_ACTION_MENU); elm_layout_signal_callback_add(priv->base, SIGNAL_HIDE_FINISHED, SOURCE_ELM, _hide_finished_cb, priv); @@ -739,7 +794,6 @@ static void _hide(void *data) static void _destroy(void *data) { struct _priv *priv; - int i; if (!data) { _ERR("failed to get data"); @@ -747,15 +801,7 @@ static void _destroy(void *data) } priv = data; - inputmgr_remove_callback(priv->base, &key_handler); - - i = 0; - while (i < BUTTON_MAX && priv->menu_btn[i]) { - inputmgr_remove_callback(priv->menu_btn[i], &button_handler); - i++; - } - - inputmgr_remove_all_by_tag(TAG_FAVORITE); + inputmgr_remove_all_by_tag(VIEW_ACTION_MENU); evas_object_del(priv->base); |