[Xfce4-commits] <ristretto:master> Make sure the slideshow does not stop
Stephan Arts
noreply at xfce.org
Sun Nov 13 23:18:01 CET 2011
Updating branch refs/heads/master
to 9a72aee4ce0554bdab99ecf4e331fc93d6144d41 (commit)
from 68da9d38b7c2e3d7377525559b4b1db689b408c0 (commit)
commit 9a72aee4ce0554bdab99ecf4e331fc93d6144d41
Author: Stephan Arts <stephan at xfce.org>
Date: Thu Nov 3 23:22:57 2011 +0100
Make sure the slideshow does not stop
- Make sure the slideshow does not stop if
'wrap around images' is disabled
src/image_list.c | 22 ++++++++++++++++++++--
src/image_list.h | 6 ++++--
src/main_window.c | 8 +++++++-
3 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/src/image_list.c b/src/image_list.c
index ac1f291..dabac2d 100644
--- a/src/image_list.c
+++ b/src/image_list.c
@@ -471,12 +471,13 @@ rstto_image_list_iter_set_position (RsttoImageListIter *iter, gint pos)
g_signal_emit (G_OBJECT (iter), rstto_image_list_iter_signals[RSTTO_IMAGE_LIST_ITER_SIGNAL_CHANGED], 0, NULL);
}
-void
+gboolean
rstto_image_list_iter_next (RsttoImageListIter *iter)
{
GList *position = NULL;
RsttoSettings *settings = NULL;
RsttoFile *file = iter->priv->file;
+ gboolean ret_val = FALSE;
g_signal_emit (G_OBJECT (iter), rstto_image_list_iter_signals[RSTTO_IMAGE_LIST_ITER_SIGNAL_PREPARE_CHANGE], 0, NULL);
@@ -488,13 +489,25 @@ rstto_image_list_iter_next (RsttoImageListIter *iter)
position = g_list_next (position);
if (position)
+ {
iter->priv->file = position->data;
+
+ /* We could move forward, set ret_val to TRUE */
+ ret_val = TRUE;
+ }
else
{
settings = rstto_settings_new();
if (rstto_settings_get_boolean_property (settings, "wrap-images"))
+ {
position = g_list_first (iter->priv->image_list->priv->images);
+
+ /* We could move forward, wrapped back to the start of the
+ * list, set ret_val to TRUE
+ */
+ ret_val = TRUE;
+ }
else
position = g_list_last (iter->priv->image_list->priv->images);
@@ -510,14 +523,17 @@ rstto_image_list_iter_next (RsttoImageListIter *iter)
{
g_signal_emit (G_OBJECT (iter), rstto_image_list_iter_signals[RSTTO_IMAGE_LIST_ITER_SIGNAL_CHANGED], 0, NULL);
}
+
+ return ret_val;
}
-void
+gboolean
rstto_image_list_iter_previous (RsttoImageListIter *iter)
{
GList *position = NULL;
RsttoSettings *settings = NULL;
RsttoFile *file = iter->priv->file;
+ gboolean ret_val = FALSE;
g_signal_emit (G_OBJECT (iter), rstto_image_list_iter_signals[RSTTO_IMAGE_LIST_ITER_SIGNAL_PREPARE_CHANGE], 0, NULL);
@@ -553,6 +569,8 @@ rstto_image_list_iter_previous (RsttoImageListIter *iter)
{
g_signal_emit (G_OBJECT (iter), rstto_image_list_iter_signals[RSTTO_IMAGE_LIST_ITER_SIGNAL_CHANGED], 0, NULL);
}
+
+ return ret_val;
}
RsttoImageListIter *
diff --git a/src/image_list.h b/src/image_list.h
index dac307d..5af86e5 100644
--- a/src/image_list.h
+++ b/src/image_list.h
@@ -115,8 +115,10 @@ GType rstto_image_list_iter_get_type ();
RsttoFile *
rstto_image_list_iter_get_file ( RsttoImageListIter *iter );
-void rstto_image_list_iter_previous (RsttoImageListIter *iter);
-void rstto_image_list_iter_next (RsttoImageListIter *iter);
+gboolean
+rstto_image_list_iter_previous (RsttoImageListIter *iter);
+gboolean
+rstto_image_list_iter_next (RsttoImageListIter *iter);
gint rstto_image_list_iter_get_position (RsttoImageListIter *iter);
void rstto_image_list_iter_set_position (RsttoImageListIter *iter, gint pos);
diff --git a/src/main_window.c b/src/main_window.c
index bc82518..13abc6e 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -2140,7 +2140,13 @@ cb_rstto_main_window_play_slideshow (RsttoMainWindow *window)
{
if (window->priv->playing)
{
- rstto_image_list_iter_next (window->priv->iter);
+ /* Check if we could navigate forward, if not, wrapping is
+ * disabled and we should force the iter to position 0
+ */
+ if (rstto_image_list_iter_next (window->priv->iter) == FALSE)
+ {
+ rstto_image_list_iter_set_position (window->priv->iter, 0);
+ }
}
else
{
More information about the Xfce4-commits
mailing list