summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinkyu Kang <mk7.kang@samsung.com>2015-12-30 11:37:23 +0900
committerMinkyu Kang <mk7.kang@samsung.com>2015-12-30 11:37:23 +0900
commitfa32cb0408b4739e73ca81926a3a8b7cb5f39a90 (patch)
treec008d26e0cd0ce28c75ad73358931306d1079cee
parent469328b25c14c47f0e2d8c98ca10b7942ea0e8f3 (diff)
downloadair_mediahub-fa32cb0408b4739e73ca81926a3a8b7cb5f39a90.tar.gz
air_mediahub-fa32cb0408b4739e73ca81926a3a8b7cb5f39a90.tar.bz2
air_mediahub-fa32cb0408b4739e73ca81926a3a8b7cb5f39a90.zip
timeout_handler: add pause/resume function
Change-Id: I50a58a5234e7894aad9f86c234fc5b64efc91a4b Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
-rw-r--r--include/util/timeout_handler.h2
-rw-r--r--src/util/timeout_handler.c21
-rw-r--r--src/view/viewer.c7
3 files changed, 21 insertions, 9 deletions
diff --git a/include/util/timeout_handler.h b/include/util/timeout_handler.h
index 2a4c2ff..0f5ede3 100644
--- a/include/util/timeout_handler.h
+++ b/include/util/timeout_handler.h
@@ -28,5 +28,7 @@ struct timeout_handler *timeout_handler_init(double timeout,
void timeout_handler_fini(struct timeout_handler *handle);
void timeout_handler_enable(struct timeout_handler *handle, bool enable);
+void timeout_handler_pause(struct timeout_handler *handle);
+void timeout_handler_resume(struct timeout_handler *handle);
#endif
diff --git a/src/util/timeout_handler.c b/src/util/timeout_handler.c
index 411666b..244b24a 100644
--- a/src/util/timeout_handler.c
+++ b/src/util/timeout_handler.c
@@ -101,16 +101,25 @@ static Eina_Bool _event_occured(void *data, int type, void *event)
return r;
}
+void timeout_handler_pause(struct timeout_handler *handle)
+{
+ ecore_timer_del(handle->timer);
+ handle->timer = NULL;
+}
+
+void timeout_handler_resume(struct timeout_handler *handle)
+{
+ _timer_reset(handle);
+}
+
void timeout_handler_enable(struct timeout_handler *handle, bool enable)
{
handle->enable = enable;
- if (enable) {
- _timer_reset(handle);
- } else {
- ecore_timer_del(handle->timer);
- handle->timer = NULL;
- }
+ if (enable)
+ timeout_handler_resume(handle);
+ else
+ timeout_handler_pause(handle);
}
struct timeout_handler *timeout_handler_init(double timeout,
diff --git a/src/view/viewer.c b/src/view/viewer.c
index 707643d..cb51621 100644
--- a/src/view/viewer.c
+++ b/src/view/viewer.c
@@ -1068,7 +1068,7 @@ static void _player_set_wind(struct _priv *priv, int wind)
case WIND_FF:
elm_object_signal_emit(priv->base, SIG_VIEWER_SHOW_FF, "");
playermgr_set_ff(priv->player);
- timeout_handler_enable(priv->timeout, false);
+ timeout_handler_pause(priv->timeout);
progressbar_resume(priv->progress);
ctl = priv->viewer.ctl[priv->viewer.cur];
@@ -1077,7 +1077,7 @@ static void _player_set_wind(struct _priv *priv, int wind)
case WIND_REW:
elm_object_signal_emit(priv->base, SIG_VIEWER_SHOW_REW, "");
playermgr_set_rew(priv->player);
- timeout_handler_enable(priv->timeout, false);
+ timeout_handler_pause(priv->timeout);
progressbar_resume(priv->progress);
ctl = priv->viewer.ctl[priv->viewer.cur];
@@ -1087,7 +1087,7 @@ static void _player_set_wind(struct _priv *priv, int wind)
default:
elm_object_signal_emit(priv->base, SIG_VIEWER_HIDE_WIND, "");
playermgr_stop_wind(priv->player);
- timeout_handler_enable(priv->timeout, true);
+ timeout_handler_resume(priv->timeout);
break;
}
@@ -1450,6 +1450,7 @@ static void _hide(void *view_data)
_slideshow_disable(priv);
_viewer_hide(priv);
+ _player_set_wind(priv, WIND_NONE);
progressbar_stop(priv->progress);
playermgr_stop(priv->player);
_image_unload(priv);