[gthumb] [slideshow] allow to pause and resume the slideshow.
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] [slideshow] allow to pause and resume the slideshow.
- Date: Tue, 16 Feb 2010 14:02:09 +0000 (UTC)
commit 2ed9d4b9abeb9e5726c1cf67d14c080a6bf18de9
Author: Paolo Bacchilega <paobac src gnome org>
Date: Tue Feb 16 12:36:18 2010 +0100
[slideshow] allow to pause and resume the slideshow.
extensions/slideshow/gth-slideshow.c | 36 +++++++++++++++++++++++++++++++++-
1 files changed, 35 insertions(+), 1 deletions(-)
---
diff --git a/extensions/slideshow/gth-slideshow.c b/extensions/slideshow/gth-slideshow.c
index e728e4d..1c31c6a 100644
--- a/extensions/slideshow/gth-slideshow.c
+++ b/extensions/slideshow/gth-slideshow.c
@@ -60,6 +60,7 @@ struct _GthSlideshowPrivate {
int current_audio_file;
GstElement *playbin;
#endif
+ gboolean paused;
};
@@ -216,6 +217,9 @@ _gth_slideshow_load_next_image (GthSlideshow *self)
_gth_slideshow_animation_completed (self);
}
+ if (self->priv->paused)
+ return;
+
self->priv->current = self->priv->current->next;
clutter_timeline_set_direction (self->priv->timeline, CLUTTER_TIMELINE_FORWARD);
_gth_slideshow_load_current_image (self);
@@ -399,6 +403,7 @@ gth_slideshow_init (GthSlideshow *self)
self->priv->rand = g_rand_new ();
self->priv->first_show = TRUE;
self->priv->audio_files = NULL;
+ self->priv->paused = FALSE;
self->priv->preloader = gth_image_preloader_new ();
g_signal_connect (self->priv->preloader,
@@ -494,6 +499,29 @@ hide_cursor_cb (gpointer data)
static void
+_gth_slideshow_toggle_pause (GthSlideshow *self)
+{
+ self->priv->paused = ! self->priv->paused;
+ if (self->priv->paused) {
+ clutter_timeline_pause (self->priv->timeline);
+ _gth_slideshow_animation_completed (self);
+#if HAVE_GSTREAMER
+ if (self->priv->playbin != NULL)
+ gst_element_set_state (self->priv->playbin, GST_STATE_PAUSED);
+#endif
+ }
+ else { /* resume */
+ clutter_timeline_rewind (self->priv->timeline);
+ clutter_timeline_start (self->priv->timeline);
+#if HAVE_GSTREAMER
+ if (self->priv->playbin != NULL)
+ gst_element_set_state (self->priv->playbin, GST_STATE_PLAYING);
+#endif
+ }
+}
+
+
+static void
stage_input_cb (ClutterStage *stage,
ClutterEvent *event,
GthSlideshow *self)
@@ -511,10 +539,16 @@ stage_input_cb (ClutterStage *stage,
break;
case CLUTTER_space:
+ _gth_slideshow_toggle_pause (self);
+ break;
+
+ case CLUTTER_Up:
+ case CLUTTER_Right:
_gth_slideshow_load_next_image (self);
break;
- case CLUTTER_BackSpace:
+ case CLUTTER_Down:
+ case CLUTTER_Left:
_gth_slideshow_load_prev_image (self);
break;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]