diff options
author | jinwoo.shin <jw0227.shin@samsung.com> | 2015-08-07 17:23:52 +0900 |
---|---|---|
committer | jinwoo.shin <jw0227.shin@samsung.com> | 2015-08-07 17:31:16 +0900 |
commit | 7fdb859322266c712bfcda78b7cf2572aaa3d3e5 (patch) | |
tree | 11e98d5d6d8bc7dd0488a55d1e4755a10458ce0b /src | |
parent | 2eb91fd05d920c1ef4eb0f310f1cafef71559824 (diff) | |
download | air_livetv-7fdb859322266c712bfcda78b7cf2572aaa3d3e5.tar.gz air_livetv-7fdb859322266c712bfcda78b7cf2572aaa3d3e5.tar.bz2 air_livetv-7fdb859322266c712bfcda78b7cf2572aaa3d3e5.zip |
Update channel number to handle minor channel
Change-Id: Ib10babb5dfd89d887cbc3fb1da4b4b166a5102a2
Signed-off-by: jinwoo.shin <jw0227.shin@samsung.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/tv.c | 4 | ||||
-rw-r--r-- | src/view_channelnumber.c | 48 |
2 files changed, 40 insertions, 12 deletions
@@ -21,12 +21,14 @@ #include <app_debug.h> #include <app_contents.h> +#include <tv_service_proxy.h> +#include <tv_service_proxy_epg.h> + #include <glib.h> #include <glib-object.h> #include "define.h" #include "tv.h" -#include "tv_service.h" #define DEFAULT_SERVICE 1 diff --git a/src/view_channelnumber.c b/src/view_channelnumber.c index 89048ca..6a63655 100644 --- a/src/view_channelnumber.c +++ b/src/view_channelnumber.c @@ -26,7 +26,8 @@ #define HIDE_DUR 3.0 #define BUF_MAX 128 -#define NUMBER_MAX 3 +#define INPUT_MAX 4 +#define NUMBER_MAX 2 struct _priv { Evas_Object *base; @@ -35,7 +36,7 @@ struct _priv { int major; int minor; - char number[NUMBER_MAX+1]; + char number[INPUT_MAX+1]; }; static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj, @@ -184,9 +185,17 @@ static void _update_channel_list(struct _priv *priv) elm_object_focus_allow_set(ly, EINA_TRUE); - snprintf(buf, sizeof(buf), "%ld %s", - channel_info->channel_major, - channel_info->channel_name); + if (channel_info->channel_minor > 0 && + channel_info->channel_minor < MINOR_MAX) + snprintf(buf, sizeof(buf), "%lu-%lu %s", + channel_info->channel_major, + channel_info->channel_minor, + channel_info->channel_name); + else + snprintf(buf, sizeof(buf), "%lu %s", + channel_info->channel_major, + channel_info->channel_name); + elm_object_text_set(ly, buf); inputmgr_add_callback(ly, 0, &channel_handler, @@ -213,13 +222,23 @@ static void _update_channel_list(struct _priv *priv) static void _update_number_info(struct _priv *priv) { + char buf[BUF_MAX] = "\0"; + if (!priv->number) { _ERR("Wrong channel number"); return; } - elm_object_part_text_set(priv->base, - PART_CHANNELNUMBER_NUMBER, priv->number); + if (strlen(priv->number) > NUMBER_MAX) { + strncpy(buf, priv->number, NUMBER_MAX); + strncat(buf, "-", 1); + strncat(buf, priv->number + NUMBER_MAX, NUMBER_MAX); + elm_object_part_text_set(priv->base, + PART_CHANNELNUMBER_NUMBER, buf); + } else { + elm_object_part_text_set(priv->base, + PART_CHANNELNUMBER_NUMBER, priv->number); + } _update_channel_list(priv); } @@ -248,8 +267,9 @@ static int _get_number(const char *keyname) static void _number_reset(struct _priv *priv) { - memset(priv->number, '\0', sizeof(char) * NUMBER_MAX + 1); - priv->major = -1; + memset(priv->number, '\0', sizeof(char) * INPUT_MAX + 1); + priv->major = 0; + priv->minor = 0; _release_channel_handler(priv->list); elm_box_clear(priv->list); @@ -257,17 +277,23 @@ static void _number_reset(struct _priv *priv) static void _number_tuning(struct _priv *priv, const char *keyname) { + char buf[BUF_MAX] = "\0"; + if (!keyname) { _ERR("failed to get keyname"); return; } strncat(priv->number, keyname, 1); - priv->major = atoi(priv->number); + strncpy(buf, priv->number, INPUT_MAX); + + priv->minor = atoi(buf + NUMBER_MAX); + buf[NUMBER_MAX] = '\0'; + priv->major = atoi(buf); _update_number_info(priv); - if (strlen(priv->number) == NUMBER_MAX) + if (strlen(priv->number) >= INPUT_MAX) _done_input(priv); } |