[gtk+] GtkTickCallback: document use of G_SOURCE_CONTINUE/REMOVE for return value



commit 7bb07317f303d204305f6fdac72020dd257025e6
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Thu Feb 14 16:24:27 2013 -0500

    GtkTickCallback: document use of G_SOURCE_CONTINUE/REMOVE for return value
    
    Document that G_SOURCE_CONTINUE and G_SOURCE_REMOVE are the preferred
    return values from a tick callback.

 gtk/gtkwidget.c           |    6 +++---
 gtk/gtkwidget.h           |    4 ++--
 tests/animated-resizing.c |    2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 4b46066..79cf9e2 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -4584,9 +4584,9 @@ gtk_widget_on_frame_clock_update (GdkFrameClock *frame_clock,
       ref_tick_callback_info (info);
       if (!info->destroyed)
         {
-          if (!info->callback (widget,
-                               frame_clock,
-                               info->user_data))
+          if (info->callback (widget,
+                              frame_clock,
+                              info->user_data) == G_SOURCE_REMOVE)
             {
               destroy_tick_callback_info (widget, info, l);
             }
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index c082c13..064fb07 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -94,8 +94,8 @@ typedef void    (*GtkCallback)     (GtkWidget        *widget,
  *
  * Callback type for adding a function to update animations. See gtk_widget_add_tick_callback().
  *
- * Returns: %TRUE if the tick callback should continue to be called,
- *  %FALSE if the tick callback should be removed.
+ * Returns: %G_SOURCE_CONTINUE if the tick callback should continue to be called,
+ *  %G_SOURCE_REMOVE if the tick callback should be removed.
  */
 typedef gboolean (*GtkTickCallback) (GtkWidget     *widget,
                                      GdkFrameClock *frame_clock,
diff --git a/tests/animated-resizing.c b/tests/animated-resizing.c
index df2fe48..8a34d9f 100644
--- a/tests/animated-resizing.c
+++ b/tests/animated-resizing.c
@@ -251,7 +251,7 @@ tick_callback (GtkWidget     *widget,
   scaled_time = (frame_time - start_frame_time) / (CYCLE_TIME * 1000000);
   on_frame (scaled_time - floor (scaled_time));
 
-  return TRUE;
+  return G_SOURCE_CONTINUE;
 }
 
 static gboolean


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]