Commit 9a72aee4 authored by Stephan Arts's avatar Stephan Arts

Make sure the slideshow does not stop

- Make sure the slideshow does not stop if
  'wrap around images' is disabled
parent 68da9d38
......@@ -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 *
......
......@@ -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);
......
......@@ -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
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment