[Goodies-commits] r6685 - ristretto/branches/ristretto-gio/src

Stephan Arts stephan at xfce.org
Sun Feb 15 00:34:26 CET 2009


Author: stephan
Date: 2009-02-14 23:34:26 +0000 (Sat, 14 Feb 2009)
New Revision: 6685

Modified:
   ristretto/branches/ristretto-gio/src/main_window.c
   ristretto/branches/ristretto-gio/src/settings.c
Log:
Implement Slideshow



Modified: ristretto/branches/ristretto-gio/src/main_window.c
===================================================================
--- ristretto/branches/ristretto-gio/src/main_window.c	2009-02-14 18:00:12 UTC (rev 6684)
+++ ristretto/branches/ristretto-gio/src/main_window.c	2009-02-14 23:34:26 UTC (rev 6685)
@@ -75,6 +75,9 @@
     GtkAction *play_action;
     guint pause_merge_id;
     GtkAction *pause_action;
+
+    gboolean playing;
+    gint play_timeout_id;
 };
 
 enum
@@ -151,7 +154,10 @@
 cb_rstto_main_window_play (GtkWidget *widget, RsttoMainWindow *window);
 static void
 cb_rstto_main_window_pause(GtkWidget *widget, RsttoMainWindow *window);
+static gboolean
+cb_rstto_main_window_play_slideshow (RsttoMainWindow *window);
 
+
 static void
 cb_rstto_main_window_toggle_show_toolbar (GtkWidget *widget, RsttoMainWindow *window);
 static void
@@ -901,6 +907,9 @@
 cb_rstto_main_window_play (GtkWidget *widget, RsttoMainWindow *window)
 {
     g_debug ("%s", __FUNCTION__);
+
+    GValue timeout = {0, };
+
     gtk_ui_manager_add_ui (window->priv->ui_manager,
                            window->priv->pause_merge_id,
                            "/main-menu/go-menu/placeholder-slideshow",
@@ -910,6 +919,12 @@
                            FALSE);
     gtk_ui_manager_remove_ui (window->priv->ui_manager,
                               window->priv->play_merge_id);
+
+    g_value_init (&timeout, G_TYPE_UINT);
+    g_object_get_property (G_OBJECT(window->priv->settings_manager), "slideshow-timeout", &timeout);
+
+    window->priv->playing = TRUE;
+    window->priv->play_timeout_id = g_timeout_add (g_value_get_uint (&timeout), (GSourceFunc)cb_rstto_main_window_play_slideshow, window);
 }
 
 /**
@@ -933,9 +948,31 @@
                            FALSE);
     gtk_ui_manager_remove_ui (window->priv->ui_manager,
                               window->priv->pause_merge_id);
+
+    window->priv->playing = FALSE;
 }
 
 /**
+ * cb_rstto_main_window_play_slideshow:
+ * @window:
+ *
+ */
+static gboolean
+cb_rstto_main_window_play_slideshow (RsttoMainWindow *window)
+{
+    if (window->priv->playing)
+    {
+        rstto_navigator_iter_next (window->priv->iter);
+        rstto_main_window_navigator_iter_changed (window);
+    }
+    else
+    {
+        window->priv->play_timeout_id  = 0;
+    }
+    return window->priv->playing;
+}
+
+/**
  * cb_rstto_main_window_fullscreen:
  * @widget:
  * @window:

Modified: ristretto/branches/ristretto-gio/src/settings.c
===================================================================
--- ristretto/branches/ristretto-gio/src/settings.c	2009-02-14 18:00:12 UTC (rev 6684)
+++ ristretto/branches/ristretto-gio/src/settings.c	2009-02-14 23:34:26 UTC (rev 6685)
@@ -57,6 +57,7 @@
     PROP_WINDOW_WIDTH,
     PROP_WINDOW_HEIGHT,
     PROP_CURRENT_URI,
+    PROP_SLIDESHOW_TIMEOUT,
 };
 
 GType
@@ -93,6 +94,7 @@
     guint    window_width;
     guint    window_height;
     gchar   *last_file_path;
+    guint    slideshow_timeout;
 };
 
 
@@ -113,11 +115,14 @@
         g_free (accelmap_path);
         accelmap_path = NULL;
     }
+    
+    settings->priv->slideshow_timeout = 5000;
 
     xfconf_g_property_bind (settings->priv->channel, "/window/width", G_TYPE_UINT, settings, "window-width");
     xfconf_g_property_bind (settings->priv->channel, "/window/height", G_TYPE_UINT, settings, "window-height");
     xfconf_g_property_bind (settings->priv->channel, "/window/show-toolbar", G_TYPE_BOOLEAN, settings, "show-toolbar");
     xfconf_g_property_bind (settings->priv->channel, "/file/current-uri", G_TYPE_STRING, settings, "current-uri");
+    xfconf_g_property_bind (settings->priv->channel, "/slideshow/timeout", G_TYPE_UINT, settings, "slideshow-timeout");
 }
 
 
@@ -175,6 +180,17 @@
     g_object_class_install_property (object_class,
                                      PROP_CURRENT_URI,
                                      pspec);
+
+    pspec = g_param_spec_uint    ("slideshow-timeout",
+                                  "",
+                                  "",
+                                  1000,
+                                  G_MAXUINT,
+                                  5000,
+                                  G_PARAM_READWRITE);
+    g_object_class_install_property (object_class,
+                                     PROP_SLIDESHOW_TIMEOUT,
+                                     pspec);
 }
 
 /**
@@ -263,6 +279,9 @@
                 g_free (settings->priv->last_file_path);
             settings->priv->last_file_path = g_value_dup_string (value);
             break;
+        case PROP_SLIDESHOW_TIMEOUT:
+            settings->priv->slideshow_timeout = g_value_get_uint (value);
+            break;
         default:
             break;
     }
@@ -291,6 +310,9 @@
         case PROP_CURRENT_URI:
             g_value_set_string (value, settings->priv->last_file_path);
             break;
+        case PROP_SLIDESHOW_TIMEOUT:
+            g_value_set_uint (value, settings->priv->slideshow_timeout);
+            break;
         default:
             break;
 




More information about the Goodies-commits mailing list