[gtk+] Drop all uses of GdkPixbufAnimation in the gtk APIs



commit 96b04836d81d855999abafdd6a2b7e0cdf0660cc
Author: Alexander Larsson <alexl redhat com>
Date:   Mon Oct 23 16:39:44 2017 +0200

    Drop all uses of GdkPixbufAnimation in the gtk APIs
    
    These are basically animated gifs, and don't fit well in how
    modern things animate.

 demos/gtk-demo/main.c                |    3 +-
 demos/gtk-demo/textview.c            |    6 -
 docs/reference/gtk/gtk4-sections.txt |    3 -
 gtk/a11y/gtkimageaccessible.c        |    9 -
 gtk/gtkcellrendererpixbuf.c          |    1 -
 gtk/gtkentry.c                       |    1 -
 gtk/gtkiconhelper.c                  |   44 ----
 gtk/gtkiconhelperprivate.h           |    5 -
 gtk/gtkimage.c                       |  269 ++--------------------
 gtk/gtkimage.h                       |    9 -
 gtk/gtkimagedefinition.c             |   41 ----
 gtk/gtkimagedefinitionprivate.h      |    3 -
 tests/meson.build                    |    1 -
 tests/testanimation.c                |  431 ----------------------------------
 14 files changed, 18 insertions(+), 808 deletions(-)
---
diff --git a/demos/gtk-demo/main.c b/demos/gtk-demo/main.c
index 49f368b..d7b29e1 100644
--- a/demos/gtk-demo/main.c
+++ b/demos/gtk-demo/main.c
@@ -556,8 +556,7 @@ add_data_tab (const gchar *demoname)
       resource_name = g_strconcat (resource_dir, "/", resources[i], NULL);
 
       widget = gtk_image_new_from_resource (resource_name);
-      if (gtk_image_get_surface (GTK_IMAGE (widget)) == NULL &&
-          gtk_image_get_animation (GTK_IMAGE (widget)) == NULL)
+      if (gtk_image_get_surface (GTK_IMAGE (widget)) == NULL)
         {
           GBytes *bytes;
 
diff --git a/demos/gtk-demo/textview.c b/demos/gtk-demo/textview.c
index 49cba65..1e7b726 100644
--- a/demos/gtk-demo/textview.c
+++ b/demos/gtk-demo/textview.c
@@ -363,8 +363,6 @@ insert_text (GtkTextBuffer *buffer)
   gtk_text_buffer_create_child_anchor (buffer, &iter);
   gtk_text_buffer_insert (buffer, &iter, " and a scale: ", -1);
   gtk_text_buffer_create_child_anchor (buffer, &iter);
-  gtk_text_buffer_insert (buffer, &iter, " and an animation: ", -1);
-  gtk_text_buffer_create_child_anchor (buffer, &iter);
   gtk_text_buffer_insert (buffer, &iter, " finally a text entry: ", -1);
   gtk_text_buffer_create_child_anchor (buffer, &iter);
   gtk_text_buffer_insert (buffer, &iter, ".\n", -1);
@@ -436,10 +434,6 @@ attach_widgets (GtkTextView *text_view)
         }
       else if (i == 3)
         {
-          widget = gtk_image_new_from_resource ("/textview/floppybuddy.gif");
-        }
-      else if (i == 4)
-        {
           widget = gtk_entry_new ();
         }
       else
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 683f3b3..5951c46 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -1487,20 +1487,17 @@ GtkIconViewPrivate
 GtkImage
 GtkImageType
 gtk_image_get_surface
-gtk_image_get_animation
 gtk_image_get_icon_name
 gtk_image_get_gicon
 gtk_image_get_storage_type
 gtk_image_new_from_file
 gtk_image_new_from_pixbuf
-gtk_image_new_from_animation
 gtk_image_new_from_icon_name
 gtk_image_new_from_gicon
 gtk_image_new_from_resource
 gtk_image_new_from_surface
 gtk_image_set_from_file
 gtk_image_set_from_pixbuf
-gtk_image_set_from_animation
 gtk_image_set_from_icon_name
 gtk_image_set_from_gicon
 gtk_image_set_from_resource
diff --git a/gtk/a11y/gtkimageaccessible.c b/gtk/a11y/gtkimageaccessible.c
index 3d60388..be2a3c5 100644
--- a/gtk/a11y/gtkimageaccessible.c
+++ b/gtk/a11y/gtkimageaccessible.c
@@ -288,15 +288,6 @@ gtk_image_accessible_get_image_size (AtkImage *image,
         gtk_icon_size_lookup (size, width, height);
         break;
       }
-    case GTK_IMAGE_ANIMATION:
-      {
-        GdkPixbufAnimation *animation;
-
-        animation = gtk_image_get_animation (gtk_image);
-        *height = gdk_pixbuf_animation_get_height (animation);
-        *width = gdk_pixbuf_animation_get_width (animation);
-        break;
-      }
     case GTK_IMAGE_EMPTY:
     default:
       {
diff --git a/gtk/gtkcellrendererpixbuf.c b/gtk/gtkcellrendererpixbuf.c
index 1e64f16..b53fe04 100644
--- a/gtk/gtkcellrendererpixbuf.c
+++ b/gtk/gtkcellrendererpixbuf.c
@@ -302,7 +302,6 @@ notify_storage_type (GtkCellRendererPixbuf *cellpixbuf,
       g_object_notify (G_OBJECT (cellpixbuf), "gicon");
       break;
     default:
-    case GTK_IMAGE_ANIMATION:
       g_assert_not_reached ();
     case GTK_IMAGE_EMPTY:
       break;
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index b55ab58..ff927c9 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -6642,7 +6642,6 @@ gtk_entry_clear_icon (GtkEntry             *entry,
       break;
 
     case GTK_IMAGE_EMPTY:
-    case GTK_IMAGE_ANIMATION:
     default:
       g_assert_not_reached ();
       break;
diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c
index 5918f28..d701e17 100644
--- a/gtk/gtkiconhelper.c
+++ b/gtk/gtkiconhelper.c
@@ -348,7 +348,6 @@ gtk_icon_helper_load_surface (GtkIconHelper   *self,
                                           gtk_image_definition_get_gicon (self->def));
       break;
 
-    case GTK_IMAGE_ANIMATION:
     case GTK_IMAGE_EMPTY:
     default:
       surface = NULL;
@@ -405,7 +404,6 @@ find_cached_texture (GtkIconHelper *self)
         gicon = g_themed_icon_new (gtk_image_definition_get_icon_name (self->def));
       break;
     case GTK_IMAGE_EMPTY:
-    case GTK_IMAGE_ANIMATION:
     case GTK_IMAGE_SURFACE:
     default:
       return NULL;
@@ -495,14 +493,6 @@ _gtk_icon_helper_get_size (GtkIconHelper *self,
                         &height);
       break;
 
-    case GTK_IMAGE_ANIMATION:
-      {
-        GdkPixbufAnimation *animation = gtk_image_definition_get_animation (self->def);
-        width = gdk_pixbuf_animation_get_width (animation);
-        height = gdk_pixbuf_animation_get_height (animation);
-        break;
-      }
-
     case GTK_IMAGE_ICON_NAME:
     case GTK_IMAGE_GICON:
       if (self->pixel_size != -1 || self->force_scale_pixbuf)
@@ -565,13 +555,6 @@ _gtk_icon_helper_set_icon_name (GtkIconHelper *self,
 }
 
 void
-_gtk_icon_helper_set_animation (GtkIconHelper *self,
-                                GdkPixbufAnimation *animation)
-{
-  gtk_icon_helper_take_definition (self, gtk_image_definition_new_animation (animation, 1));
-}
-
-void
 _gtk_icon_helper_set_surface (GtkIconHelper *self,
                              cairo_surface_t *surface)
 {
@@ -653,12 +636,6 @@ _gtk_icon_helper_peek_gicon (GtkIconHelper *self)
   return gtk_image_definition_get_gicon (self->def);
 }
 
-GdkPixbufAnimation *
-_gtk_icon_helper_peek_animation (GtkIconHelper *self)
-{
-  return gtk_image_definition_get_animation (self->def);
-}
-
 cairo_surface_t *
 _gtk_icon_helper_peek_surface (GtkIconHelper *self)
 {
@@ -732,24 +709,3 @@ _gtk_icon_helper_set_force_scale_pixbuf (GtkIconHelper *self,
       gtk_icon_helper_invalidate (self);
     }
 }
-
-void 
-_gtk_icon_helper_set_pixbuf_scale (GtkIconHelper *self,
-                                  int scale)
-{
-  switch (gtk_image_definition_get_storage_type (self->def))
-  {
-    case GTK_IMAGE_ANIMATION:
-      gtk_icon_helper_take_definition (self,
-                                      gtk_image_definition_new_animation (gtk_image_definition_get_animation 
(self->def),
-                                                                          scale));
-      break;
-
-    case GTK_IMAGE_EMPTY:
-    case GTK_IMAGE_ICON_NAME:
-    case GTK_IMAGE_GICON:
-    case GTK_IMAGE_SURFACE:
-    default:
-      break;
-  }
-}
diff --git a/gtk/gtkiconhelperprivate.h b/gtk/gtkiconhelperprivate.h
index d439e36..91ec6d9 100644
--- a/gtk/gtkiconhelperprivate.h
+++ b/gtk/gtkiconhelperprivate.h
@@ -64,10 +64,6 @@ void _gtk_icon_helper_set_definition (GtkIconHelper *self,
 void _gtk_icon_helper_set_gicon (GtkIconHelper *self,
                                  GIcon *gicon,
                                  GtkIconSize icon_size);
-void _gtk_icon_helper_set_pixbuf_scale (GtkIconHelper *self,
-                                       int scale);
-void _gtk_icon_helper_set_animation (GtkIconHelper *self,
-                                     GdkPixbufAnimation *animation);
 
 void _gtk_icon_helper_set_icon_name (GtkIconHelper *self,
                                      const gchar *icon_name,
@@ -88,7 +84,6 @@ gint _gtk_icon_helper_get_pixel_size (GtkIconHelper *self);
 gboolean _gtk_icon_helper_get_use_fallback (GtkIconHelper *self);
 
 GIcon *_gtk_icon_helper_peek_gicon (GtkIconHelper *self);
-GdkPixbufAnimation *_gtk_icon_helper_peek_animation (GtkIconHelper *self);
 cairo_surface_t *_gtk_icon_helper_peek_surface (GtkIconHelper *self);
 
 GtkImageDefinition *gtk_icon_helper_get_definition (GtkIconHelper *self);
diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c
index a5ad986..c76bcb9 100644
--- a/gtk/gtkimage.c
+++ b/gtk/gtkimage.c
@@ -61,9 +61,6 @@
  * gdk_pixbuf_new_from_file(), then create the #GtkImage with
  * gtk_image_new_from_pixbuf().
  *
- * The image file may contain an animation, if so the #GtkImage will
- * display an animation (#GdkPixbufAnimation) instead of a static image.
- *
  * Sometimes an application will want to avoid depending on external data
  * files, such as image files. See the documentation of #GResource for details.
  * In this case, the #GtkImage:resource, gtk_image_new_from_resource() and
@@ -79,12 +76,9 @@ struct _GtkImagePrivate
 {
   GtkIconHelper icon_helper;
 
-  GdkPixbufAnimationIter *animation_iter;
-  gint animation_timeout;
-
   float baseline_align;
 
-  gchar                *filename;       /* Only used with GTK_IMAGE_ANIMATION, GTK_IMAGE_SURFACE */
+  gchar                *filename;       /* Only used with GTK_IMAGE_SURFACE */
   gchar                *resource_path;  /* Only used with GTK_IMAGE_SURFACE */
 };
 
@@ -96,7 +90,6 @@ static void gtk_image_size_allocate        (GtkWidget           *widget,
                                             const GtkAllocation *allocation,
                                             int                  baseline,
                                             GtkAllocation       *out_clip);
-static void gtk_image_unmap                (GtkWidget    *widget);
 static void gtk_image_unrealize            (GtkWidget    *widget);
 static void gtk_image_measure (GtkWidget      *widget,
                                GtkOrientation  orientation,
@@ -125,7 +118,6 @@ enum
   PROP_FILE,
   PROP_ICON_SIZE,
   PROP_PIXEL_SIZE,
-  PROP_PIXBUF_ANIMATION,
   PROP_ICON_NAME,
   PROP_STORAGE_TYPE,
   PROP_GICON,
@@ -154,7 +146,6 @@ gtk_image_class_init (GtkImageClass *class)
   widget_class->snapshot = gtk_image_snapshot;
   widget_class->measure = gtk_image_measure;
   widget_class->size_allocate = gtk_image_size_allocate;
-  widget_class->unmap = gtk_image_unmap;
   widget_class->unrealize = gtk_image_unrealize;
   widget_class->style_updated = gtk_image_style_updated;
 
@@ -197,13 +188,6 @@ gtk_image_class_init (GtkImageClass *class)
                         -1,
                         GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
 
-  image_props[PROP_PIXBUF_ANIMATION] =
-      g_param_spec_object ("pixbuf-animation",
-                           P_("Animation"),
-                           P_("GdkPixbufAnimation to display"),
-                           GDK_TYPE_PIXBUF_ANIMATION,
-                           GTK_PARAM_READWRITE);
-
   /**
    * GtkImage:icon-name:
    *
@@ -338,9 +322,6 @@ gtk_image_set_property (GObject      *object,
     case PROP_PIXEL_SIZE:
       gtk_image_set_pixel_size (image, g_value_get_int (value));
       break;
-    case PROP_PIXBUF_ANIMATION:
-      gtk_image_set_from_animation (image, g_value_get_object (value));
-      break;
     case PROP_ICON_NAME:
       gtk_image_set_from_icon_name (image, g_value_get_string (value), icon_size);
       break;
@@ -385,9 +366,6 @@ gtk_image_get_property (GObject     *object,
     case PROP_PIXEL_SIZE:
       g_value_set_int (value, _gtk_icon_helper_get_pixel_size (&priv->icon_helper));
       break;
-    case PROP_PIXBUF_ANIMATION:
-      g_value_set_object (value, _gtk_icon_helper_peek_animation (&priv->icon_helper));
-      break;
     case PROP_ICON_NAME:
       g_value_set_string (value, _gtk_icon_helper_get_icon_name (&priv->icon_helper));
       break;
@@ -419,13 +397,9 @@ gtk_image_get_property (GObject     *object,
  * display a “broken image” icon. This function never returns %NULL,
  * it always returns a valid #GtkImage widget.
  *
- * If the file contains an animation, the image will contain an
- * animation.
- *
  * If you need to detect failures to load the file, use
  * gdk_pixbuf_new_from_file() to load the file yourself, then create
- * the #GtkImage from the surface. (Or for animations, use
- * gdk_pixbuf_animation_new_from_file()).
+ * the #GtkImage from the surface.
  *
  * The storage type (gtk_image_get_storage_type()) of the returned
  * image is not defined, it will be whatever is appropriate for
@@ -454,13 +428,9 @@ gtk_image_new_from_file   (const gchar *filename)
  * display a “broken image” icon. This function never returns %NULL,
  * it always returns a valid #GtkImage widget.
  *
- * If the file contains an animation, the image will contain an
- * animation.
- *
  * If you need to detect failures to load the file, use
  * gdk_pixbuf_new_from_file() to load the file yourself, then create
- * the #GtkImage from the pixbuf. (Or for animations, use
- * gdk_pixbuf_animation_new_from_file()).
+ * the #GtkImage from the pixbuf.
  *
  * The storage type (gtk_image_get_storage_type()) of the returned
  * image is not defined, it will be whatever is appropriate for
@@ -538,36 +508,6 @@ gtk_image_new_from_surface (cairo_surface_t *surface)
 }
 
 /**
- * gtk_image_new_from_animation:
- * @animation: an animation
- * 
- * Creates a #GtkImage displaying the given animation.
- * The #GtkImage does not assume a reference to the
- * animation; you still need to unref it if you own references.
- * #GtkImage will add its own reference rather than adopting yours.
- *
- * Note that the animation frames are shown using a timeout with
- * #G_PRIORITY_DEFAULT. When using animations to indicate busyness,
- * keep in mind that the animation will only be shown if the main loop
- * is not busy with something that has a higher priority.
- *
- * Returns: a new #GtkImage widget
- **/
-GtkWidget*
-gtk_image_new_from_animation (GdkPixbufAnimation *animation)
-{
-  GtkImage *image;
-
-  g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION (animation), NULL);
-  
-  image = g_object_new (GTK_TYPE_IMAGE, NULL);
-
-  gtk_image_set_from_animation (image, animation);
-
-  return GTK_WIDGET (image);
-}
-
-/**
  * gtk_image_new_from_icon_name:
  * @icon_name: (nullable): an icon name or %NULL
  * @size: (type int): a stock icon size (#GtkIconSize)
@@ -725,7 +665,8 @@ gtk_image_set_from_file   (GtkImage    *image,
   GtkImagePrivate *priv = gtk_image_get_instance_private (image);
   GdkPixbufAnimation *anim;
   gint scale_factor;
-  
+  cairo_surface_t *surface;
+
   g_return_if_fail (GTK_IS_IMAGE (image));
 
   g_object_freeze_notify (G_OBJECT (image));
@@ -750,23 +691,10 @@ gtk_image_set_from_file   (GtkImage    *image,
       return;
     }
 
-  /* We could just unconditionally set_from_animation,
-   * but it's nicer for memory if we toss the animation
-   * if it's just a single pixbuf
-   */
-
-  if (gdk_pixbuf_animation_is_static_image (anim))
-    {
-      cairo_surface_t *surface = gdk_cairo_surface_create_from_pixbuf (gdk_pixbuf_animation_get_static_image 
(anim),
-                                                                       scale_factor, _gtk_widget_get_window 
(GTK_WIDGET (image)));
-      gtk_image_set_from_surface (image, surface);
-      cairo_surface_destroy (surface);
-    }
-  else
-    {
-      gtk_image_set_from_animation (image, anim);
-      _gtk_icon_helper_set_pixbuf_scale (&priv->icon_helper, scale_factor);
-    }
+  surface = gdk_cairo_surface_create_from_pixbuf (gdk_pixbuf_animation_get_static_image (anim),
+                                                  scale_factor, _gtk_widget_get_window (GTK_WIDGET (image)));
+  gtk_image_set_from_surface (image, surface);
+  cairo_surface_destroy (surface);
 
   g_object_unref (anim);
 
@@ -819,6 +747,7 @@ gtk_image_set_from_resource (GtkImage    *image,
   GtkImagePrivate *priv = gtk_image_get_instance_private (image);
   GdkPixbufAnimation *animation;
   gint scale_factor = 1;
+  cairo_surface_t *surface;
 
   g_return_if_fail (GTK_IS_IMAGE (image));
 
@@ -851,18 +780,10 @@ gtk_image_set_from_resource (GtkImage    *image,
       return;
     }
 
-  if (gdk_pixbuf_animation_is_static_image (animation))
-    {
-      cairo_surface_t *surface = gdk_cairo_surface_create_from_pixbuf (gdk_pixbuf_animation_get_static_image 
(animation),
-                                                                       scale_factor, _gtk_widget_get_window 
(GTK_WIDGET (image)));
-      gtk_image_set_from_surface (image, surface);
-      cairo_surface_destroy (surface);
-    }
-  else
-    {
-      gtk_image_set_from_animation (image, animation);
-      _gtk_icon_helper_set_pixbuf_scale (&priv->icon_helper, scale_factor);
-    }
+  surface = gdk_cairo_surface_create_from_pixbuf (gdk_pixbuf_animation_get_static_image (animation),
+                                                  scale_factor, _gtk_widget_get_window (GTK_WIDGET (image)));
+  gtk_image_set_from_surface (image, surface);
+  cairo_surface_destroy (surface);
 
   priv->resource_path = g_strdup (resource_path);
 
@@ -906,42 +827,6 @@ gtk_image_set_from_pixbuf (GtkImage  *image,
 }
 
 /**
- * gtk_image_set_from_animation:
- * @image: a #GtkImage
- * @animation: the #GdkPixbufAnimation
- * 
- * Causes the #GtkImage to display the given animation (or display
- * nothing, if you set the animation to %NULL).
- **/
-void
-gtk_image_set_from_animation (GtkImage           *image,
-                              GdkPixbufAnimation *animation)
-{
-  GtkImagePrivate *priv = gtk_image_get_instance_private (image);
-
-  g_return_if_fail (GTK_IS_IMAGE (image));
-  g_return_if_fail (animation == NULL ||
-                    GDK_IS_PIXBUF_ANIMATION (animation));
-
-  g_object_freeze_notify (G_OBJECT (image));
-  
-  if (animation)
-    g_object_ref (animation);
-
-  gtk_image_clear (image);
-
-  if (animation != NULL)
-    {
-      _gtk_icon_helper_set_animation (&priv->icon_helper, animation);
-      g_object_unref (animation);
-    }
-
-  g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_PIXBUF_ANIMATION]);
-
-  g_object_thaw_notify (G_OBJECT (image));
-}
-
-/**
  * gtk_image_set_from_icon_name:
  * @image: a #GtkImage
  * @icon_name: (nullable): an icon name or %NULL
@@ -1091,29 +976,6 @@ gtk_image_get_surface (GtkImage *image)
 }
 
 /**
- * gtk_image_get_animation:
- * @image: a #GtkImage
- *
- * Gets the #GdkPixbufAnimation being displayed by the #GtkImage.
- * The storage type of the image must be %GTK_IMAGE_EMPTY or
- * %GTK_IMAGE_ANIMATION (see gtk_image_get_storage_type()).
- * The caller of this function does not own a reference to the
- * returned animation.
- * 
- * Returns: (nullable) (transfer none): the displayed animation, or %NULL if
- * the image is empty
- **/
-GdkPixbufAnimation*
-gtk_image_get_animation (GtkImage *image)
-{
-  GtkImagePrivate *priv = gtk_image_get_instance_private (image);
-
-  g_return_val_if_fail (GTK_IS_IMAGE (image), NULL);
-
-  return _gtk_icon_helper_peek_animation (&priv->icon_helper);
-}
-
-/**
  * gtk_image_get_icon_name:
  * @image: a #GtkImage
  * @icon_name: (out) (transfer none) (allow-none): place to store an
@@ -1191,24 +1053,6 @@ gtk_image_new (void)
 }
 
 static void
-gtk_image_reset_anim_iter (GtkImage *image)
-{
-  GtkImagePrivate *priv = gtk_image_get_instance_private (image);
-
-  if (gtk_image_get_storage_type (image) == GTK_IMAGE_ANIMATION)
-    {
-      /* Reset the animation */
-      if (priv->animation_timeout)
-        {
-          g_source_remove (priv->animation_timeout);
-          priv->animation_timeout = 0;
-        }
-
-      g_clear_object (&priv->animation_iter);
-    }
-}
-
-static void
 gtk_image_size_allocate (GtkWidget           *widget,
                          const GtkAllocation *allocation,
                          int                  baseline,
@@ -1223,78 +1067,16 @@ gtk_image_size_allocate (GtkWidget           *widget,
 }
 
 static void
-gtk_image_unmap (GtkWidget *widget)
-{
-  gtk_image_reset_anim_iter (GTK_IMAGE (widget));
-
-  GTK_WIDGET_CLASS (gtk_image_parent_class)->unmap (widget);
-}
-
-static void
 gtk_image_unrealize (GtkWidget *widget)
 {
   GtkImage *image = GTK_IMAGE (widget);
   GtkImagePrivate *priv = gtk_image_get_instance_private (image);
 
-  gtk_image_reset_anim_iter (image);
-
   gtk_icon_helper_invalidate (&priv->icon_helper);
 
   GTK_WIDGET_CLASS (gtk_image_parent_class)->unrealize (widget);
 }
 
-static gint
-animation_timeout (gpointer data)
-{
-  GtkImage *image = GTK_IMAGE (data);
-  GtkImagePrivate *priv = gtk_image_get_instance_private (image);
-  int delay;
-
-  priv->animation_timeout = 0;
-
-  gdk_pixbuf_animation_iter_advance (priv->animation_iter, NULL);
-
-  delay = gdk_pixbuf_animation_iter_get_delay_time (priv->animation_iter);
-  if (delay >= 0)
-    {
-      GtkWidget *widget = GTK_WIDGET (image);
-
-      priv->animation_timeout =
-        gdk_threads_add_timeout (delay, animation_timeout, image);
-      g_source_set_name_by_id (priv->animation_timeout, "[gtk+] animation_timeout");
-
-      gtk_widget_queue_draw (widget);
-    }
-
-  return FALSE;
-}
-
-static GdkPixbuf *
-get_animation_frame (GtkImage *image)
-{
-  GtkImagePrivate *priv = gtk_image_get_instance_private (image);
-
-  if (priv->animation_iter == NULL)
-    {
-      int delay;
-
-      priv->animation_iter = 
-        gdk_pixbuf_animation_get_iter (_gtk_icon_helper_peek_animation (&priv->icon_helper), NULL);
-
-      delay = gdk_pixbuf_animation_iter_get_delay_time (priv->animation_iter);
-      if (delay >= 0) {
-        priv->animation_timeout =
-          gdk_threads_add_timeout (delay, animation_timeout, image);
-        g_source_set_name_by_id (priv->animation_timeout, "[gtk+] animation_timeout");
-      }
-    }
-
-  /* don't advance the anim iter here, or we could get frame changes between two
-   * exposes of different areas.
-   */
-  return g_object_ref (gdk_pixbuf_animation_iter_get_pixbuf (priv->animation_iter));
-}
-
 static float
 gtk_image_get_baseline_align (GtkImage *image)
 {
@@ -1343,21 +1125,9 @@ gtk_image_snapshot (GtkWidget   *widget,
 
   x += (width - w) / 2;
 
-  if (gtk_image_get_storage_type (image) == GTK_IMAGE_ANIMATION)
-    {
-      GtkStyleContext *context = gtk_widget_get_style_context (widget);
-      GdkPixbuf *pixbuf = get_animation_frame (image);
-
-      gtk_snapshot_render_icon (snapshot, context, pixbuf, x, y);
-
-      g_object_unref (pixbuf);
-    }
-  else
-    {
-      gtk_snapshot_offset (snapshot, x, y);
-      gtk_icon_helper_snapshot (&priv->icon_helper, snapshot);
-      gtk_snapshot_offset (snapshot, -x, -y);
-    }
+  gtk_snapshot_offset (snapshot, x, y);
+  gtk_icon_helper_snapshot (&priv->icon_helper, snapshot);
+  gtk_snapshot_offset (snapshot, -x, -y);
 }
 
 static void
@@ -1366,9 +1136,6 @@ gtk_image_notify_for_storage_type (GtkImage     *image,
 {
   switch (storage_type)
     {
-    case GTK_IMAGE_ANIMATION:
-      g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_PIXBUF_ANIMATION]);
-      break;
     case GTK_IMAGE_ICON_NAME:
       g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_ICON_NAME]);
       break;
@@ -1439,8 +1206,6 @@ gtk_image_clear (GtkImage *image)
 
   g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_ICON_SIZE]);
 
-  gtk_image_reset_anim_iter (image);
-
   gtk_image_notify_for_storage_type (image, storage_type);
 
   if (priv->filename)
diff --git a/gtk/gtkimage.h b/gtk/gtkimage.h
index 67bbcb3..de270b1 100644
--- a/gtk/gtkimage.h
+++ b/gtk/gtkimage.h
@@ -51,7 +51,6 @@ typedef struct _GtkImageClass         GtkImageClass;
 /**
  * GtkImageType:
  * @GTK_IMAGE_EMPTY: there is no image displayed by the widget
- * @GTK_IMAGE_ANIMATION: the widget contains a #GdkPixbufAnimation
  * @GTK_IMAGE_ICON_NAME: the widget contains a named icon.
  *  This image type was added in GTK+ 2.6
  * @GTK_IMAGE_GICON: the widget contains a #GIcon.
@@ -70,7 +69,6 @@ typedef struct _GtkImageClass         GtkImageClass;
 typedef enum
 {
   GTK_IMAGE_EMPTY,
-  GTK_IMAGE_ANIMATION,
   GTK_IMAGE_ICON_NAME,
   GTK_IMAGE_GICON,
   GTK_IMAGE_SURFACE
@@ -110,8 +108,6 @@ GtkWidget* gtk_image_new_from_resource  (const gchar     *resource_path);
 GDK_AVAILABLE_IN_ALL
 GtkWidget* gtk_image_new_from_pixbuf    (GdkPixbuf       *pixbuf);
 GDK_AVAILABLE_IN_ALL
-GtkWidget* gtk_image_new_from_animation (GdkPixbufAnimation *animation);
-GDK_AVAILABLE_IN_ALL
 GtkWidget* gtk_image_new_from_icon_name (const gchar     *icon_name,
                                         GtkIconSize      size);
 GDK_AVAILABLE_IN_ALL
@@ -132,9 +128,6 @@ GDK_AVAILABLE_IN_ALL
 void gtk_image_set_from_pixbuf    (GtkImage        *image,
                                    GdkPixbuf       *pixbuf);
 GDK_AVAILABLE_IN_ALL
-void gtk_image_set_from_animation (GtkImage           *image,
-                                   GdkPixbufAnimation *animation);
-GDK_AVAILABLE_IN_ALL
 void gtk_image_set_from_icon_name (GtkImage        *image,
                                   const gchar     *icon_name,
                                   GtkIconSize      size);
@@ -156,8 +149,6 @@ GDK_AVAILABLE_IN_3_94
 cairo_surface_t *gtk_image_get_surface (GtkImage *image);
 
 GDK_AVAILABLE_IN_ALL
-GdkPixbufAnimation* gtk_image_get_animation (GtkImage *image);
-GDK_AVAILABLE_IN_ALL
 void       gtk_image_get_icon_name (GtkImage     *image,
                                    const gchar **icon_name,
                                    GtkIconSize  *size);
diff --git a/gtk/gtkimagedefinition.c b/gtk/gtkimagedefinition.c
index 4cef0d5..f16006c 100644
--- a/gtk/gtkimagedefinition.c
+++ b/gtk/gtkimagedefinition.c
@@ -21,7 +21,6 @@
 
 typedef struct _GtkImageDefinitionEmpty GtkImageDefinitionEmpty;
 typedef struct _GtkImageDefinitionStock GtkImageDefinitionStock;
-typedef struct _GtkImageDefinitionAnimation GtkImageDefinitionAnimation;
 typedef struct _GtkImageDefinitionIconName GtkImageDefinitionIconName;
 typedef struct _GtkImageDefinitionGIcon GtkImageDefinitionGIcon;
 typedef struct _GtkImageDefinitionSurface GtkImageDefinitionSurface;
@@ -38,14 +37,6 @@ struct _GtkImageDefinitionStock {
   char *id;
 };
 
-struct _GtkImageDefinitionAnimation {
-  GtkImageType type;
-  gint ref_count;
-
-  GdkPixbufAnimation *animation;
-  int scale;
-};
-
 struct _GtkImageDefinitionIconName {
   GtkImageType type;
   gint ref_count;
@@ -72,7 +63,6 @@ union _GtkImageDefinition
   GtkImageType type;
   GtkImageDefinitionEmpty empty;
   GtkImageDefinitionStock stock;
-  GtkImageDefinitionAnimation animation;
   GtkImageDefinitionIconName icon_name;
   GtkImageDefinitionGIcon gicon;
   GtkImageDefinitionSurface surface;
@@ -92,7 +82,6 @@ gtk_image_definition_alloc (GtkImageType type)
   static gsize sizes[] = {
     sizeof (GtkImageDefinitionEmpty),
     sizeof (GtkImageDefinitionStock),
-    sizeof (GtkImageDefinitionAnimation),
     sizeof (GtkImageDefinitionIconName),
     sizeof (GtkImageDefinitionGIcon),
     sizeof (GtkImageDefinitionSurface)
@@ -109,22 +98,6 @@ gtk_image_definition_alloc (GtkImageType type)
 }
 
 GtkImageDefinition *
-gtk_image_definition_new_animation (GdkPixbufAnimation *animation,
-                                    int                 scale)
-{
-  GtkImageDefinition *def;
-
-  if (animation == NULL || scale <= 0)
-    return NULL;
-
-  def = gtk_image_definition_alloc (GTK_IMAGE_ANIMATION);
-  def->animation.animation = g_object_ref (animation);
-  def->animation.scale = scale;
-
-  return def;
-}
-
-GtkImageDefinition *
 gtk_image_definition_new_icon_name (const char *icon_name)
 {
   GtkImageDefinition *def;
@@ -188,9 +161,6 @@ gtk_image_definition_unref (GtkImageDefinition *def)
     case GTK_IMAGE_EMPTY:
       g_assert_not_reached ();
       break;
-    case GTK_IMAGE_ANIMATION:
-      g_object_unref (def->animation.animation);
-      break;
     case GTK_IMAGE_SURFACE:
       cairo_surface_destroy (def->surface.surface);
       break;
@@ -223,20 +193,9 @@ gtk_image_definition_get_scale (const GtkImageDefinition *def)
     case GTK_IMAGE_ICON_NAME:
     case GTK_IMAGE_GICON:
       return 1;
-    case GTK_IMAGE_ANIMATION:
-      return def->animation.scale;
     }
 }
 
-GdkPixbufAnimation *
-gtk_image_definition_get_animation (const GtkImageDefinition *def)
-{
-  if (def->type != GTK_IMAGE_ANIMATION)
-    return NULL;
-
-  return def->animation.animation;
-}
-
 const gchar *
 gtk_image_definition_get_icon_name (const GtkImageDefinition *def)
 {
diff --git a/gtk/gtkimagedefinitionprivate.h b/gtk/gtkimagedefinitionprivate.h
index 069da12..9acf7ce 100644
--- a/gtk/gtkimagedefinitionprivate.h
+++ b/gtk/gtkimagedefinitionprivate.h
@@ -26,8 +26,6 @@ G_BEGIN_DECLS
 typedef union _GtkImageDefinition GtkImageDefinition;
 
 GtkImageDefinition *    gtk_image_definition_new_empty          (void);
-GtkImageDefinition *    gtk_image_definition_new_animation      (GdkPixbufAnimation             *animation,
-                                                                 int                             scale);
 GtkImageDefinition *    gtk_image_definition_new_icon_name      (const char                     *icon_name);
 GtkImageDefinition *    gtk_image_definition_new_gicon          (GIcon                          *gicon);
 GtkImageDefinition *    gtk_image_definition_new_surface        (cairo_surface_t                *surface);
@@ -37,7 +35,6 @@ void                    gtk_image_definition_unref              (GtkImageDefinit
 
 GtkImageType            gtk_image_definition_get_storage_type   (const GtkImageDefinition       *def);
 gint                    gtk_image_definition_get_scale          (const GtkImageDefinition       *def);
-GdkPixbufAnimation *    gtk_image_definition_get_animation      (const GtkImageDefinition       *def);
 const gchar *           gtk_image_definition_get_icon_name      (const GtkImageDefinition       *def);
 GIcon *                 gtk_image_definition_get_gicon          (const GtkImageDefinition       *def);
 cairo_surface_t *       gtk_image_definition_get_surface        (const GtkImageDefinition       *def);
diff --git a/tests/meson.build b/tests/meson.build
index b4ae0bb..ba6d090 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -109,7 +109,6 @@ gtk_tests = [
   ['testtreepos'],
   ['testsensitive'],
   ['testtextview'],
-  ['testanimation'],
   ['testpixbuf-scale'],
   ['testgmenu'],
   ['testlogout'],


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