[Xfce4-commits] <ristretto:master> Refresh clock every 15 seconds.

Stephan Arts noreply at xfce.org
Mon Apr 16 18:54:11 CEST 2012


Updating branch refs/heads/master
         to 0d891e6f7918a00900d567b3f05d757f66e78786 (commit)
       from c1532d2e4e810e64207a1bfbe18f25624d9bff02 (commit)

commit 0d891e6f7918a00900d567b3f05d757f66e78786
Author: Stephan Arts <stephan at xfce.org>
Date:   Mon Apr 16 18:41:16 2012 +0200

    Refresh clock every 15 seconds.

 src/image_viewer.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/src/image_viewer.c b/src/image_viewer.c
index 3ee066d..a73b7d1 100644
--- a/src/image_viewer.c
+++ b/src/image_viewer.c
@@ -107,6 +107,8 @@ struct _RsttoImageViewerPriv
     GdkPixbufAnimationIter *iter;
     gint                    animation_timeout_id;
 
+    gint                    refresh_timeout_id;
+
     gdouble                 scale;
     gboolean                auto_scale;
 
@@ -2817,10 +2819,35 @@ rstto_image_viewer_get_property (
     }
 }
 
+static gboolean
+cb_rstto_image_viewer_refresh (RsttoImageViewer *viewer)
+{
+    GtkWidget *widget = GTK_WIDGET (viewer);
+
+    gdk_window_invalidate_rect (
+            widget->window,
+            NULL,
+            FALSE);
+
+    return TRUE;
+}
+
 void
 rstto_image_viewer_set_show_clock (
         RsttoImageViewer *viewer,
         gboolean value)
 {
     viewer->priv->props.show_clock = value;
+    if ( viewer->priv->props.show_clock )
+    {
+        viewer->priv->refresh_timeout_id = g_timeout_add(
+                15000,
+                (GSourceFunc)cb_rstto_image_viewer_refresh, viewer);
+    }
+    else
+    {
+        g_source_remove (
+                viewer->priv->refresh_timeout_id );
+    }
 }
+


More information about the Xfce4-commits mailing list