[libgd] GdStack/GdRevealer: Rename duration to transition-duration



commit 75a4776fc066849c724816484cc2a8fe05c67e1a
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Feb 20 16:12:34 2013 -0500

    GdStack/GdRevealer: Rename duration to transition-duration
    
    This makes it clear what the transition is for.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=694388

 libgd/gd-revealer.c |   32 ++++++++++++++++----------------
 libgd/gd-revealer.h |   25 +++++++++++++------------
 libgd/gd-stack.c    |   33 +++++++++++++++++----------------
 libgd/gd-stack.h    |    6 +++---
 4 files changed, 49 insertions(+), 47 deletions(-)
---
diff --git a/libgd/gd-revealer.c b/libgd/gd-revealer.c
index 8b2abbb..fc521b9 100644
--- a/libgd/gd-revealer.c
+++ b/libgd/gd-revealer.c
@@ -27,7 +27,7 @@
 enum  {
   PROP_0,
   PROP_ORIENTATION,
-  PROP_DURATION,
+  PROP_TRANSITION_DURATION,
   PROP_REVEAL_CHILD,
   PROP_CHILD_REVEALED
 };
@@ -36,7 +36,7 @@ enum  {
 
 struct _GdRevealerPrivate {
   GtkOrientation orientation;
-  gint duration;
+  gint transition_duration;
 
   GdkWindow* bin_window;
   GdkWindow* view_window;
@@ -90,7 +90,7 @@ gd_revealer_init (GdRevealer *revealer)
   revealer->priv = priv;
 
   priv->orientation = GTK_ORIENTATION_HORIZONTAL;
-  priv->duration = 250;
+  priv->transition_duration = 250;
   priv->current_pos = 0.0;
   priv->target_pos = 0.0;
 
@@ -123,8 +123,8 @@ gd_revealer_get_property (GObject *object,
   case PROP_ORIENTATION:
     g_value_set_enum (value, gd_revealer_get_orientation (revealer));
     break;
-  case PROP_DURATION:
-    g_value_set_int (value, gd_revealer_get_duration (revealer));
+  case PROP_TRANSITION_DURATION:
+    g_value_set_int (value, gd_revealer_get_transition_duration (revealer));
     break;
   case PROP_REVEAL_CHILD:
     g_value_set_boolean (value, gd_revealer_get_reveal_child (revealer));
@@ -150,8 +150,8 @@ gd_revealer_set_property (GObject *object,
   case PROP_ORIENTATION:
     gd_revealer_set_orientation (revealer, g_value_get_enum (value));
     break;
-  case PROP_DURATION:
-    gd_revealer_set_duration (revealer, g_value_get_int (value));
+  case PROP_TRANSITION_DURATION:
+    gd_revealer_set_transition_duration (revealer, g_value_get_int (value));
     break;
   case PROP_REVEAL_CHILD:
     gd_revealer_set_reveal_child (revealer, g_value_get_boolean (value));
@@ -195,8 +195,8 @@ gd_revealer_class_init (GdRevealerClass * klass)
                                                       GTK_ORIENTATION_HORIZONTAL,
                                                       GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT));
   g_object_class_install_property (object_class,
-                                   PROP_DURATION,
-                                   g_param_spec_int ("duration", "duration",
+                                   PROP_TRANSITION_DURATION,
+                                   g_param_spec_int ("transition-duration", "Transition duration",
                                                      "The animation duration, in milliseconds",
                                                      G_MININT, G_MAXINT,
                                                      250,
@@ -505,7 +505,7 @@ gd_revealer_start_animation (GdRevealer *revealer,
     {
       priv->source_pos = priv->current_pos;
       priv->start_time = gdk_frame_clock_get_frame_time (gtk_widget_get_frame_clock (widget));
-      priv->end_time = priv->start_time + (priv->duration * 1000);
+      priv->end_time = priv->start_time + (priv->transition_duration * 1000);
       if (priv->tick_id == 0)
         priv->tick_id =
           gtk_widget_add_tick_callback (widget, (GtkTickCallback)gd_revealer_animate_cb, revealer, NULL);
@@ -726,19 +726,19 @@ gd_revealer_set_orientation (GdRevealer *revealer,
 }
 
 gint
-gd_revealer_get_duration (GdRevealer *revealer)
+gd_revealer_get_transition_duration (GdRevealer *revealer)
 {
   g_return_val_if_fail (revealer != NULL, 0);
 
-  return revealer->priv->duration;
+  return revealer->priv->transition_duration;
 }
 
 void
-gd_revealer_set_duration (GdRevealer *revealer,
-                          gint value)
+gd_revealer_set_transition_duration (GdRevealer *revealer,
+                                     gint value)
 {
   g_return_if_fail (revealer != NULL);
 
-  revealer->priv->duration = value;
-  g_object_notify (G_OBJECT (revealer), "duration");
+  revealer->priv->transition_duration = value;
+  g_object_notify (G_OBJECT (revealer), "transition-duration");
 }
diff --git a/libgd/gd-revealer.h b/libgd/gd-revealer.h
index 5fbfc22..5a3e3cc 100644
--- a/libgd/gd-revealer.h
+++ b/libgd/gd-revealer.h
@@ -48,19 +48,20 @@ struct _GdRevealerClass {
 };
 
 
-GType          gd_revealer_get_type           (void) G_GNUC_CONST;
-GtkWidget*     gd_revealer_new                (void);
-gboolean       gd_revealer_get_reveal_child   (GdRevealer     *revealer);
-void           gd_revealer_set_reveal_child   (GdRevealer     *revealer,
-                                               gboolean        setting);
-GtkOrientation gd_revealer_get_orientation    (GdRevealer     *revealer);
-void           gd_revealer_set_orientation    (GdRevealer     *revealer,
-                                              GtkOrientation  value);
-gint           gd_revealer_get_duration       (GdRevealer     *revealer);
-void           gd_revealer_set_duration       (GdRevealer     *revealer,
-                                              gint            duration_msec);
+GType          gd_revealer_get_type                (void) G_GNUC_CONST;
+GtkWidget*     gd_revealer_new                     (void);
+gboolean       gd_revealer_get_reveal_child        (GdRevealer     *revealer);
+void           gd_revealer_set_reveal_child        (GdRevealer     *revealer,
+                                                   gboolean        setting);
+GtkOrientation gd_revealer_get_orientation         (GdRevealer     *revealer);
+void           gd_revealer_set_orientation         (GdRevealer     *revealer,
+                                                   GtkOrientation  value);
+gint           gd_revealer_get_transition_duration (GdRevealer     *revealer);
+void           gd_revealer_set_transition_duration (GdRevealer     *revealer,
+                                                   gint            duration_msec);
+
+gboolean       gd_revealer_get_child_revealed      (GdRevealer     *revealer);
 
-gboolean       gd_revealer_get_child_revealed (GdRevealer     *revealer);
 
 G_END_DECLS
 
diff --git a/libgd/gd-stack.c b/libgd/gd-stack.c
index be2cc87..6fcaf3a 100644
--- a/libgd/gd-stack.c
+++ b/libgd/gd-stack.c
@@ -36,7 +36,7 @@ enum  {
   PROP_HOMOGENEOUS,
   PROP_VISIBLE_CHILD,
   PROP_VISIBLE_CHILD_NAME,
-  PROP_DURATION
+  PROP_TRANSITION_DURATION,
 };
 
 enum
@@ -62,7 +62,7 @@ struct _GdStackPrivate {
   GdStackChildInfo *visible_child;
 
   gboolean homogeneous;
-  gint duration;
+  gint transition_duration;
 
   GdStackChildInfo *last_visible_child;
   cairo_pattern_t *last_visible_pattern;
@@ -137,7 +137,7 @@ gd_stack_init (GdStack *stack)
 
   priv = GD_STACK_GET_PRIVATE (stack);
   stack->priv = priv;
-  priv->duration = 200;
+  priv->transition_duration = 200;
   priv->homogeneous = TRUE;
 
   gtk_widget_set_has_window ((GtkWidget*) stack, FALSE);
@@ -178,8 +178,8 @@ gd_stack_get_property (GObject *object,
     case PROP_VISIBLE_CHILD_NAME:
       g_value_set_string (value, gd_stack_get_visible_child_name (stack));
       break;
-    case PROP_DURATION:
-      g_value_set_int (value, gd_stack_get_duration (stack));
+    case PROP_TRANSITION_DURATION:
+      g_value_set_int (value, gd_stack_get_transition_duration (stack));
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -206,8 +206,8 @@ gd_stack_set_property (GObject *object,
     case PROP_VISIBLE_CHILD_NAME:
       gd_stack_set_visible_child_name (stack, g_value_get_string (value));
       break;
-    case PROP_DURATION:
-      gd_stack_set_duration (stack, g_value_get_int (value));
+    case PROP_TRANSITION_DURATION:
+      gd_stack_set_transition_duration (stack, g_value_get_int (value));
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -264,8 +264,9 @@ gd_stack_class_init (GdStackClass * klass)
                                                        NULL,
                                                        GTK_PARAM_READWRITE));
   g_object_class_install_property (object_class,
-                                   PROP_DURATION,
-                                   g_param_spec_int ("duration", "duration",
+                                   PROP_TRANSITION_DURATION,
+                                   g_param_spec_int ("transition-duration",
+                                                     "Transition duration",
                                                      "The animation duration, in milliseconds",
                                                      G_MININT, G_MAXINT,
                                                      200,
@@ -508,7 +509,7 @@ gd_stack_start_transition (GdStack *stack)
 
       priv->transition_pos = 0.0;
       priv->start_time = gdk_frame_clock_get_frame_time (gtk_widget_get_frame_clock (widget));
-      priv->end_time = priv->start_time + (priv->duration * 1000);
+      priv->end_time = priv->start_time + (priv->transition_duration * 1000);
       gd_stack_schedule_ticks (stack);
     }
   else
@@ -729,21 +730,21 @@ gd_stack_get_homogeneous (GdStack *stack)
 }
 
 gint
-gd_stack_get_duration (GdStack *stack)
+gd_stack_get_transition_duration (GdStack *stack)
 {
   g_return_val_if_fail (stack != NULL, 0);
 
-  return stack->priv->duration;
+  return stack->priv->transition_duration;
 }
 
 void
-gd_stack_set_duration (GdStack *stack,
-                       gint value)
+gd_stack_set_transition_duration (GdStack *stack,
+                                  gint value)
 {
   g_return_if_fail (stack != NULL);
 
-  stack->priv->duration = value;
-  g_object_notify (G_OBJECT (stack), "duration");
+  stack->priv->transition_duration = value;
+  g_object_notify (G_OBJECT (stack), "transition-duration");
 }
 
 /**
diff --git a/libgd/gd-stack.h b/libgd/gd-stack.h
index 8d49e51..4997e9f 100644
--- a/libgd/gd-stack.h
+++ b/libgd/gd-stack.h
@@ -66,9 +66,9 @@ const char *gd_stack_get_visible_child_name (GdStack    *stack);
 void        gd_stack_set_homogeneous        (GdStack    *stack,
                                             gboolean    homogeneous);
 gboolean    gd_stack_get_homogeneous        (GdStack    *stack);
-void        gd_stack_set_duration           (GdStack    *stack,
-                                            gint        duration);
-gint        gd_stack_get_duration           (GdStack    *stack);
+void        gd_stack_set_transition_duration(GdStack    *stack,
+                                            gint        transition_duration);
+gint        gd_stack_get_transition_duration(GdStack    *stack);
 
 
 G_END_DECLS


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