diff options
author | Minkyu Kang <mk7.kang@samsung.com> | 2015-07-22 21:44:14 +0900 |
---|---|---|
committer | Minkyu Kang <mk7.kang@samsung.com> | 2015-07-22 21:44:14 +0900 |
commit | 1bc0c17a8ac78f2d9fc0a19f70e16449d3e55736 (patch) | |
tree | 15abb5fdf307dc524bb1cfde9ef24fce23f8d96f /src/util/progressbar.c | |
parent | 449d32ceb112eac1b8d9cbc1343b5e61a5b40eee (diff) | |
download | air_mediahub-resf/for/tizen.tar.gz air_mediahub-resf/for/tizen.tar.bz2 air_mediahub-resf/for/tizen.zip |
musicplayer: implement the complete callback at progressbar (workaround)resf/for/tizen
Since the complete callback of player have bug, we implemented it on progressbar
Change-Id: I69f1afd6751b49a3523daf6fe80e5301a2049523
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
Diffstat (limited to 'src/util/progressbar.c')
-rw-r--r-- | src/util/progressbar.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/util/progressbar.c b/src/util/progressbar.c index ed0a28f..3623016 100644 --- a/src/util/progressbar.c +++ b/src/util/progressbar.c @@ -26,6 +26,8 @@ #define SLIDER_STEP 0.03 #define PROGRESSBAR_INTERVAL 0.1 +#define COMPLETE_INTERVAL 1.0 +#define COMPLETE_BUFFER 500 struct progressbar { Evas_Object *base; @@ -41,6 +43,7 @@ struct progressbar { char *str_separator; enum progressbar_time_format fmt; + int duration; }; static void _update_progress_info(struct progressbar *m, int position) @@ -64,6 +67,21 @@ static void _update_time_info(struct progressbar *m, int position, int duration) _update_progress_info(m, position); } +static Eina_Bool _complete_cb(void *data) +{ + struct progressbar *m; + + if (!data) + return ECORE_CALLBACK_CANCEL; + + m = data; + + if (m->ops->complete_cb) + m->ops->complete_cb(m->ops_data); + + return ECORE_CALLBACK_CANCEL; +} + static Eina_Bool _timer_cb(void *data) { struct progressbar *m; @@ -79,6 +97,13 @@ static Eina_Bool _timer_cb(void *data) elm_slider_value_set(m->slider, position); _update_progress_info(m, position); + if (position + COMPLETE_BUFFER > m->duration) { + ecore_timer_add(COMPLETE_INTERVAL, _complete_cb, m); + m->timer = NULL; + + return ECORE_CALLBACK_CANCEL; + } + return ECORE_CALLBACK_RENEW; } @@ -167,6 +192,8 @@ void progressbar_reset(struct progressbar *m, int position, int duration) return; } + m->duration = duration; + elm_slider_min_max_set(m->slider, 0, duration); elm_slider_step_set(m->slider, SLIDER_STEP); elm_slider_value_set(m->slider, position); |