]> Pileus Git - ~andy/gtk/commitdiff
stylecontext: Add public API to stop animations
authorBenjamin Otte <otte@redhat.com>
Tue, 10 Apr 2012 13:50:00 +0000 (15:50 +0200)
committerBenjamin Otte <otte@redhat.com>
Tue, 17 Apr 2012 06:59:22 +0000 (08:59 +0200)
... and use it.

Of course, there still are no animations, so we don't turn anything off
yet.

gtk/gtkstylecontext.c
gtk/gtkstylecontextprivate.h
gtk/gtkwidget.c

index 8375328f94b91d6e10bfebe80a0375fef2d8d15d..065107cd176723b845cf612a510ac9aa5196fa3a 100644 (file)
@@ -765,7 +765,7 @@ gtk_style_context_finalize (GObject *object)
   style_context = GTK_STYLE_CONTEXT (object);
   priv = style_context->priv;
 
-  gtk_style_context_stop_animating (style_context);
+  _gtk_style_context_stop_animations (style_context);
 
   /* children hold a reference to us */
   g_assert (priv->children == NULL);
@@ -1023,6 +1023,8 @@ _gtk_style_context_set_widget (GtkStyleContext *context,
 
   context->priv->widget = widget;
 
+  _gtk_style_context_stop_animations (context);
+
   _gtk_style_context_queue_invalidate (context, GTK_CSS_CHANGE_ANY_SELF);
 }
 
@@ -2915,6 +2917,17 @@ gtk_style_context_do_invalidate (GtkStyleContext *context)
   priv->invalidating_context = FALSE;
 }
 
+void
+_gtk_style_context_stop_animations (GtkStyleContext *context)
+{
+  g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
+
+  if (!gtk_style_context_is_animating (context))
+    return;
+
+  gtk_style_context_stop_animating (context);
+}
+
 void
 _gtk_style_context_validate (GtkStyleContext *context,
                              gint64           timestamp,
index c6ab2cc0c8b97360ccffd32a38583cda15a6b370..a62b4675f4b1f2a27d15049cae0ae8013f8991cf 100644 (file)
@@ -52,6 +52,8 @@ void           _gtk_style_context_get_cursor_color           (GtkStyleContext *c
                                                               GdkRGBA         *primary_color,
                                                               GdkRGBA         *secondary_color);
 
+void           _gtk_style_context_stop_animations            (GtkStyleContext  *context);
+
 G_END_DECLS
 
 #endif /* __GTK_STYLE_CONTEXT_PRIVATE_H__ */
index 3c709ca0520f9e015663000fa1c939627a9b2d42..5b2aa3f7195e93576335e5f38bf49f1ef844b1c7 100644 (file)
@@ -4126,6 +4126,9 @@ gtk_widget_real_hide (GtkWidget *widget)
 
       if (gtk_widget_get_mapped (widget))
        gtk_widget_unmap (widget);
+
+      if (widget->priv->context)
+        _gtk_style_context_stop_animations (widget->priv->context);
     }
 }