Index: gdk-pixbuf-animation.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk-pixbuf/gdk-pixbuf-animation.c,v
retrieving revision 1.41
diff -u2 -r1.41 gdk-pixbuf-animation.c
--- gdk-pixbuf-animation.c
+++ gdk-pixbuf-animation.c
@@ -53,10 +53,10 @@
 struct _GdkPixbufNonAnimClass {
         GdkPixbufAnimationClass parent_class;
-        
+
 };
 
 static GType gdk_pixbuf_non_anim_get_type (void) G_GNUC_CONST;
 
-
+
 
 typedef struct _GdkPixbufNonAnimIter GdkPixbufNonAnimIter;
@@ -85,5 +85,5 @@
 static GType gdk_pixbuf_non_anim_iter_get_type (void) G_GNUC_CONST;
 
-
+
 
 GType
@@ -104,14 +104,14 @@
                         (GInstanceInitFunc) NULL,
                 };
-                
+
                 object_type = g_type_register_static (G_TYPE_OBJECT,
                                                       g_intern_static_string ("GdkPixbufAnimation"),
                                                       &object_info, 0);
         }
-  
+
         return object_type;
 }
 
-
+
 
 /**
@@ -201,5 +201,5 @@
                          * the invariant that error gets set if NULL is returned.
                          */
-                        
+
                         g_warning ("Bug! gdk-pixbuf loader '%s' didn't set an error on failure.",
                                    image_module->module_name);
@@ -210,5 +210,5 @@
                                      display_name);
                 }
-                
+
 		if (pixbuf == NULL) {
                         g_free (display_name);
@@ -234,5 +234,5 @@
                          * is returned.
                          */
-                        
+
                         g_warning ("Bug! gdk-pixbuf loader '%s' didn't set an error on failure.",
                                    image_module->module_name);
@@ -243,5 +243,5 @@
                                      display_name);
                 }
-                
+
 		fclose (f);
 	}
@@ -283,9 +283,9 @@
  * @animation: An animation.
  *
- * Adds a reference to an animation. 
+ * Adds a reference to an animation.
  *
  * Return value: The same as the @animation argument.
  *
- * Deprecated: Use g_object_ref(). 
+ * Deprecated: Use g_object_ref().
  **/
 GdkPixbufAnimation *
@@ -298,6 +298,6 @@
  * gdk_pixbuf_animation_unref:
  * @animation: An animation.
- * 
- * Removes a reference from an animation. 
+ *
+ * Removes a reference from an animation.
  *
  * Deprecated: Use g_object_unref().
@@ -309,13 +309,33 @@
 }
 
+
+/**
+ * gdk_pixbuf_animation_get_frame_count:
+ * @animation: a #GdkPixbufAnimation
+ *
+ * Queries the number of frames which compose the animation.
+ *
+ * Return value: the frame count for given animation
+ *
+ * Since: 2.11
+ **/
+int
+gdk_pixbuf_animation_get_frame_count (GdkPixbufAnimation *animation)
+{
+        g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION (animation), 0);
+
+        return GDK_PIXBUF_ANIMATION_GET_CLASS (animation)->get_frame_count (animation);
+}
+
+
 /**
  * gdk_pixbuf_animation_is_static_image:
  * @animation: a #GdkPixbufAnimation
- * 
+ *
  * If you load a file with gdk_pixbuf_animation_new_from_file() and it turns
  * out to be a plain, unanimated image, then this function will return
  * %TRUE. Use gdk_pixbuf_animation_get_static_image() to retrieve
  * the image.
- * 
+ *
  * Return value: %TRUE if the "animation" was really just an image
  **/
@@ -331,5 +351,5 @@
  * gdk_pixbuf_animation_get_static_image:
  * @animation: a #GdkPixbufAnimation
- * 
+ *
  * If an animation is really just a plain image (has only one frame),
  * this function returns that image. If the animation is an animation,
@@ -338,5 +358,5 @@
  * sophisticated. If an animation hasn't loaded any frames yet, this
  * function will return %NULL.
- * 
+ *
  * Return value: unanimated image representing the animation
  **/
@@ -345,5 +365,5 @@
 {
 	g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION (animation), NULL);
-        
+
         return GDK_PIXBUF_ANIMATION_GET_CLASS (animation)->get_static_image (animation);
 }
@@ -354,5 +374,5 @@
  *
  * Queries the width of the bounding box of a pixbuf animation.
- * 
+ *
  * Return value: Width of the bounding box of the animation.
  **/
@@ -361,5 +381,5 @@
 {
         int width;
-        
+
 	g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION (animation), 0);
 
@@ -367,5 +387,5 @@
         GDK_PIXBUF_ANIMATION_GET_CLASS (animation)->get_size (animation,
                                                               &width, NULL);
-        
+
 
 	return width;
@@ -377,5 +397,5 @@
  *
  * Queries the height of the bounding box of a pixbuf animation.
- * 
+ *
  * Return value: Height of the bounding box of the animation.
  **/
@@ -384,5 +404,5 @@
 {
         int height;
-        
+
 	g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION (animation), 0);
 
@@ -390,5 +410,5 @@
         GDK_PIXBUF_ANIMATION_GET_CLASS (animation)->get_size (animation,
                                                               NULL, &height);
-        
+
 
 	return height;
@@ -400,9 +420,9 @@
  * @animation: a #GdkPixbufAnimation
  * @start_time: time when the animation starts playing
- * 
+ *
  * Get an iterator for displaying an animation. The iterator provides
  * the frames that should be displayed at a given time.
  * It should be freed after use with g_object_unref().
- * 
+ *
  * @start_time would normally come from g_get_current_time(), and
  * marks the beginning of animation playback. After creating an
@@ -434,5 +454,5 @@
  *
  * A delay time of -1 is possible, indicating "infinite."
- * 
+ *
  * Return value: an iterator to move over the animation
  **/
@@ -442,5 +462,5 @@
 {
         GTimeVal val;
-        
+
         g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION (animation), NULL);
 
@@ -450,9 +470,9 @@
         else
                 g_get_current_time (&val);
-        
+
         return GDK_PIXBUF_ANIMATION_GET_CLASS (animation)->get_iter (animation, &val);
 }
 
-
+
 
 GType
@@ -473,17 +493,36 @@
                         (GInstanceInitFunc) NULL,
                 };
-                
+
                 object_type = g_type_register_static (G_TYPE_OBJECT,
                                                       "GdkPixbufAnimationIter",
                                                       &object_info, 0);
         }
-  
+
         return object_type;
 }
 
 /**
+ * gdk_pixbuf_animation_iter_get_current_frame:
+ * @iter: an animation iterator
+ *
+ * Queries the zero-based index of the frame currently associated with the
+ * given animation iterator.
+ *
+ * Return value: the frame index associated with given iterator
+ *
+ * Since: 2.11
+ **/
+int
+gdk_pixbuf_animation_iter_get_current_frame (GdkPixbufAnimationIter *iter)
+{
+        g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION_ITER (iter), -1);
+
+        return GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->get_current_frame (iter);
+}
+
+/**
  * gdk_pixbuf_animation_iter_get_delay_time:
  * @iter: an animation iterator
- * 
+ *
  * Gets the number of milliseconds the current pixbuf should be displayed,
  * or -1 if the current pixbuf should be displayed forever. g_timeout_add()
@@ -497,5 +536,5 @@
 {
         g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION_ITER (iter), -1);
-  
+
         return GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->get_delay_time (iter);
 }
@@ -504,9 +543,9 @@
  * gdk_pixbuf_animation_iter_get_pixbuf:
  * @iter: an animation iterator
- * 
+ *
  * Gets the current pixbuf which should be displayed; the pixbuf will
  * be the same size as the animation itself
- * (gdk_pixbuf_animation_get_width(), gdk_pixbuf_animation_get_height()). 
- * This pixbuf should be displayed for 
+ * (gdk_pixbuf_animation_get_width(), gdk_pixbuf_animation_get_height()).
+ * This pixbuf should be displayed for
  * gdk_pixbuf_animation_iter_get_delay_time() milliseconds.  The caller
  * of this function does not own a reference to the returned pixbuf;
@@ -523,5 +562,5 @@
 {
         g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION_ITER (iter), NULL);
-  
+
         return GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->get_pixbuf (iter);
 }
@@ -536,5 +575,5 @@
  * you're on the currently loading frame, you need to redraw the screen for
  * the updated area.
- * 
+ *
  * Return value: %TRUE if the frame we're on is partially loaded, or the last frame
  **/
@@ -543,5 +582,5 @@
 {
         g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION_ITER (iter), FALSE);
-        
+
         return GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->on_currently_loading_frame (iter);
 }
@@ -554,5 +593,5 @@
  * Possibly advances an animation to a new frame. Chooses the frame based
  * on the start time passed to gdk_pixbuf_animation_get_iter().
- * 
+ *
  * @current_time would normally come from g_get_current_time(), and
  * must be greater than or equal to the time passed to
@@ -573,5 +612,5 @@
  *
  * Returns: %TRUE if the image may need updating
- * 
+ *
  **/
 gboolean
@@ -580,5 +619,5 @@
 {
         GTimeVal val;
-        
+
         g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION_ITER (iter), FALSE);
 
@@ -587,13 +626,14 @@
         else
                 g_get_current_time (&val);
-        
+
         return GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->advance (iter, &val);
 }
 
-
+
 
 static void gdk_pixbuf_non_anim_class_init (GdkPixbufNonAnimClass *klass);
 static void gdk_pixbuf_non_anim_finalize   (GObject        *object);
 
+static int                     gdk_pixbuf_non_anim_get_frame_count  (GdkPixbufAnimation *animation);
 static gboolean                gdk_pixbuf_non_anim_is_static_image  (GdkPixbufAnimation *animation);
 static GdkPixbuf*              gdk_pixbuf_non_anim_get_static_image (GdkPixbufAnimation *animation);
@@ -606,5 +646,5 @@
 
 
-
+
 
 static gpointer non_parent_class;
@@ -627,10 +667,10 @@
                         (GInstanceInitFunc) NULL,
                 };
-                
+
                 object_type = g_type_register_static (GDK_TYPE_PIXBUF_ANIMATION,
                                                       "GdkPixbufNonAnim",
                                                       &object_info, 0);
         }
-        
+
         return object_type;
 }
@@ -641,9 +681,10 @@
         GObjectClass *object_class = G_OBJECT_CLASS (klass);
         GdkPixbufAnimationClass *anim_class = GDK_PIXBUF_ANIMATION_CLASS (klass);
-        
+
         non_parent_class = g_type_class_peek_parent (klass);
-        
+
         object_class->finalize = gdk_pixbuf_non_anim_finalize;
 
+        anim_class->get_frame_count = gdk_pixbuf_non_anim_get_frame_count;
         anim_class->is_static_image = gdk_pixbuf_non_anim_is_static_image;
         anim_class->get_static_image = gdk_pixbuf_non_anim_get_static_image;
@@ -659,5 +700,5 @@
         if (non_anim->pixbuf)
                 g_object_unref (non_anim->pixbuf);
-        
+
         G_OBJECT_CLASS (non_parent_class)->finalize (object);
 }
@@ -678,4 +719,10 @@
 }
 
+static int
+gdk_pixbuf_non_anim_get_frame_count  (GdkPixbufAnimation *animation)
+{
+        return 1;
+}
+
 static gboolean
 gdk_pixbuf_non_anim_is_static_image  (GdkPixbufAnimation *animation)
@@ -723,12 +770,13 @@
 
         g_object_ref (iter->non_anim);
-        
+
         return GDK_PIXBUF_ANIMATION_ITER (iter);
 }
 
-
+
 
 static void gdk_pixbuf_non_anim_iter_class_init (GdkPixbufNonAnimIterClass *klass);
 static void gdk_pixbuf_non_anim_iter_finalize   (GObject                   *object);
+static int        gdk_pixbuf_non_anim_iter_get_current_frame          (GdkPixbufAnimationIter *iter);
 static int        gdk_pixbuf_non_anim_iter_get_delay_time             (GdkPixbufAnimationIter *iter);
 static GdkPixbuf* gdk_pixbuf_non_anim_iter_get_pixbuf                 (GdkPixbufAnimationIter *iter);
@@ -739,5 +787,5 @@
 
 
-
+
 
 static gpointer non_iter_parent_class;
@@ -760,10 +808,10 @@
                         (GInstanceInitFunc) NULL,
                 };
-                
+
                 object_type = g_type_register_static (GDK_TYPE_PIXBUF_ANIMATION_ITER,
                                                       "GdkPixbufNonAnimIter",
                                                       &object_info, 0);
         }
-        
+
         return object_type;
 }
@@ -775,9 +823,10 @@
         GdkPixbufAnimationIterClass *anim_iter_class =
                 GDK_PIXBUF_ANIMATION_ITER_CLASS (klass);
-        
+
         non_iter_parent_class = g_type_class_peek_parent (klass);
-        
+
         object_class->finalize = gdk_pixbuf_non_anim_iter_finalize;
 
+        anim_iter_class->get_current_frame = gdk_pixbuf_non_anim_iter_get_current_frame;
         anim_iter_class->get_delay_time = gdk_pixbuf_non_anim_iter_get_delay_time;
         anim_iter_class->get_pixbuf = gdk_pixbuf_non_anim_iter_get_pixbuf;
@@ -792,9 +841,15 @@
 
         g_object_unref (iter->non_anim);
-        
+
         G_OBJECT_CLASS (non_iter_parent_class)->finalize (object);
 }
 
 static int
+gdk_pixbuf_non_anim_iter_get_current_frame (GdkPixbufAnimationIter *iter)
+{
+        return 0; /* show first frame forever */
+}
+
+static int
 gdk_pixbuf_non_anim_iter_get_delay_time (GdkPixbufAnimationIter *iter)
 {
@@ -814,5 +869,5 @@
         return TRUE;
 }
-        
+
 static gboolean
 gdk_pixbuf_non_anim_iter_advance (GdkPixbufAnimationIter *iter,
Index: gdk-pixbuf-animation.h
===================================================================
RCS file: /cvs/gnome/gtk+/gdk-pixbuf/gdk-pixbuf-animation.h,v
retrieving revision 1.4
diff -u2 -r1.4 gdk-pixbuf-animation.h
--- gdk-pixbuf-animation.h
+++ gdk-pixbuf-animation.h
@@ -61,4 +61,5 @@
 #endif
 
+int                 gdk_pixbuf_animation_get_frame_count (GdkPixbufAnimation *animation);
 int                 gdk_pixbuf_animation_get_width       (GdkPixbufAnimation *animation);
 int                 gdk_pixbuf_animation_get_height      (GdkPixbufAnimation *animation);
@@ -69,4 +70,5 @@
                                                                               const GTimeVal         *start_time);
 GType                   gdk_pixbuf_animation_iter_get_type                   (void) G_GNUC_CONST;
+int                     gdk_pixbuf_animation_iter_get_current_frame          (GdkPixbufAnimationIter *iter);
 int                     gdk_pixbuf_animation_iter_get_delay_time             (GdkPixbufAnimationIter *iter);
 GdkPixbuf              *gdk_pixbuf_animation_iter_get_pixbuf                 (GdkPixbufAnimationIter *iter);
@@ -78,5 +80,5 @@
 #ifdef GDK_PIXBUF_ENABLE_BACKEND
 
-
+
 
 typedef struct _GdkPixbufAnimationClass GdkPixbufAnimationClass;
@@ -97,12 +99,14 @@
         /*< public >*/
 
+        int                     (*get_frame_count)  (GdkPixbufAnimation *anim);
+
         gboolean                (*is_static_image)  (GdkPixbufAnimation *anim);
 
         GdkPixbuf*              (*get_static_image) (GdkPixbufAnimation *anim);
-        
+
         void                    (*get_size) (GdkPixbufAnimation *anim,
                                              int                 *width,
                                              int                 *height);
-        
+
         GdkPixbufAnimationIter* (*get_iter) (GdkPixbufAnimation *anim,
                                              const GTimeVal     *start_time);
@@ -110,5 +114,5 @@
 };
 
-
+
 
 typedef struct _GdkPixbufAnimationIterClass GdkPixbufAnimationIterClass;
@@ -128,4 +132,6 @@
         /*< public >*/
 
+        int        (*get_current_frame)   (GdkPixbufAnimationIter *iter);
+
         int        (*get_delay_time)   (GdkPixbufAnimationIter *iter);
 
@@ -137,5 +143,5 @@
                                         const GTimeVal         *current_time);
 };
-      
+
 
 GdkPixbufAnimation* gdk_pixbuf_non_anim_new (GdkPixbuf *pixbuf);
Index: gdk-pixbuf-simple-anim.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk-pixbuf/gdk-pixbuf-simple-anim.c,v
retrieving revision 1.3
diff -u2 -r1.3 gdk-pixbuf-simple-anim.c
--- gdk-pixbuf-simple-anim.c
+++ gdk-pixbuf-simple-anim.c
@@ -42,15 +42,15 @@
 {
         GdkPixbufAnimation parent_instance;
-        
+
         gint n_frames;
-        
+
         gfloat rate;
         gint total_time;
-        
+
         GList *frames;
-        
+
         gint width;
         gint height;
-        
+
         gboolean loop;
 };
@@ -79,12 +79,12 @@
 {
         GdkPixbufAnimationIter parent_instance;
-        
+
         GdkPixbufSimpleAnim *simple_anim;
-        
+
         GTimeVal start_time;
         GTimeVal current_time;
-        
+
         gint position;
-        
+
         GList *current_frame;
 };
@@ -100,9 +100,10 @@
 static void gdk_pixbuf_simple_anim_finalize (GObject *object);
 
+static int        get_frame_count  (GdkPixbufAnimation *animation);
 static gboolean   is_static_image  (GdkPixbufAnimation *animation);
 static GdkPixbuf *get_static_image (GdkPixbufAnimation *animation);
 
 static void       get_size         (GdkPixbufAnimation *anim,
-                                    gint               *width, 
+                                    gint               *width,
                                     gint               *height);
 static GdkPixbufAnimationIter *get_iter (GdkPixbufAnimation *anim,
@@ -125,7 +126,8 @@
         object_class = G_OBJECT_CLASS (klass);
         anim_class = GDK_PIXBUF_ANIMATION_CLASS (klass);
-        
+
         object_class->finalize = gdk_pixbuf_simple_anim_finalize;
-        
+
+        anim_class->get_frame_count = get_frame_count;
         anim_class->is_static_image = is_static_image;
         anim_class->get_static_image = get_static_image;
@@ -140,7 +142,7 @@
         GList *l;
         GdkPixbufFrame *frame;
-        
-        anim = GDK_PIXBUF_SIMPLE_ANIM (object);        
-        
+
+        anim = GDK_PIXBUF_SIMPLE_ANIM (object);
+
         for (l = anim->frames; l; l = l->next) {
                 frame = l->data;
@@ -148,15 +150,25 @@
                 g_free (frame);
         }
-        
+
         g_list_free (anim->frames);
-        
+
         G_OBJECT_CLASS (gdk_pixbuf_simple_anim_parent_class)->finalize (object);
 }
 
+static int
+get_frame_count (GdkPixbufAnimation *animation)
+{
+        GdkPixbufSimpleAnim *anim;
+
+        anim = GDK_PIXBUF_SIMPLE_ANIM (animation);
+
+        return anim->n_frames;
+}
+
 static gboolean
 is_static_image (GdkPixbufAnimation *animation)
 {
         GdkPixbufSimpleAnim *anim;
-        
+
         anim = GDK_PIXBUF_SIMPLE_ANIM (animation);
 
@@ -168,7 +180,7 @@
 {
         GdkPixbufSimpleAnim *anim;
-        
+
         anim = GDK_PIXBUF_SIMPLE_ANIM (animation);
-        
+
         if (anim->frames == NULL)
                 return NULL;
@@ -179,5 +191,5 @@
 static void
 get_size (GdkPixbufAnimation *animation,
-          gint               *width, 
+          gint               *width,
           gint               *height)
 {
@@ -185,8 +197,8 @@
 
         anim = GDK_PIXBUF_SIMPLE_ANIM (animation);
-        
+
         if (width)
                 *width = anim->width;
-        
+
         if (height)
                 *height = anim->height;
@@ -203,5 +215,5 @@
 {
         iter_clear (iter);
-        
+
         iter->current_frame = iter->simple_anim->frames;
 }
@@ -212,5 +224,5 @@
 {
         GdkPixbufSimpleAnimIter *iter;
-        
+
         iter = g_object_new (GDK_TYPE_PIXBUF_SIMPLE_ANIM_ITER, NULL);
 
@@ -218,10 +230,10 @@
 
         g_object_ref (iter->simple_anim);
-        
+
         iter_restart (iter);
-        
+
         iter->start_time = *start_time;
         iter->current_time = *start_time;
-        
+
         return GDK_PIXBUF_ANIMATION_ITER (iter);
 }
@@ -229,4 +241,5 @@
 static void gdk_pixbuf_simple_anim_iter_finalize (GObject *object);
 
+static gint       get_current_frame          (GdkPixbufAnimationIter *iter);
 static gint       get_delay_time             (GdkPixbufAnimationIter *iter);
 static GdkPixbuf *get_pixbuf                 (GdkPixbufAnimationIter *iter);
@@ -250,7 +263,8 @@
         object_class = G_OBJECT_CLASS (klass);
         anim_iter_class = GDK_PIXBUF_ANIMATION_ITER_CLASS (klass);
-        
+
         object_class->finalize = gdk_pixbuf_simple_anim_iter_finalize;
-        
+
+        anim_iter_class->get_current_frame = get_current_frame;
         anim_iter_class->get_delay_time = get_delay_time;
         anim_iter_class->get_pixbuf = get_pixbuf;
@@ -263,10 +277,10 @@
 {
         GdkPixbufSimpleAnimIter *iter;
-        
+
         iter = GDK_PIXBUF_SIMPLE_ANIM_ITER (object);
         iter_clear (iter);
-        
+
         g_object_unref (iter->simple_anim);
-        
+
         G_OBJECT_CLASS (gdk_pixbuf_simple_anim_iter_parent_class)->finalize (object);
 }
@@ -281,13 +295,13 @@
         GList *tmp;
         GList *old;
-        
+
         iter = GDK_PIXBUF_SIMPLE_ANIM_ITER (anim_iter);
-        
+
         iter->current_time = *current_time;
-        
+
         /* We use milliseconds for all times */
         elapsed = (((iter->current_time.tv_sec - iter->start_time.tv_sec) * G_USEC_PER_SEC +
                     iter->current_time.tv_usec - iter->start_time.tv_usec)) / 1000;
-        
+
         if (elapsed < 0) {
                 /* Try to compensate; probably the system clock
@@ -297,7 +311,7 @@
                 elapsed = 0;
         }
-        
+
         g_assert (iter->simple_anim->total_time > 0);
-        
+
         /* See how many times we've already played the full animation,
          * and subtract time for that.
@@ -305,7 +319,7 @@
         loop = elapsed / iter->simple_anim->total_time;
         elapsed = elapsed % iter->simple_anim->total_time;
-        
+
         iter->position = elapsed;
-        
+
         /* Now move to the proper frame */
         if (loop < 1)
@@ -313,23 +327,37 @@
         else
                 tmp = NULL;
-        
+
         while (tmp != NULL) {
                 GdkPixbufFrame *frame = tmp->data;
-                
+
                 if (iter->position >= frame->elapsed &&
                     iter->position < (frame->elapsed + frame->delay_time))
                         break;
-                
+
                 tmp = tmp->next;
         }
-        
+
         old = iter->current_frame;
-        
+
         iter->current_frame = tmp;
-        
+
         return iter->current_frame != old;
 }
 
 static gint
+get_current_frame (GdkPixbufAnimationIter *anim_iter)
+{
+        GdkPixbufSimpleAnimIter *iter;
+
+        iter = GDK_PIXBUF_SIMPLE_ANIM_ITER (anim_iter);
+
+        if (iter->simple_anim->frames == NULL ||
+            iter->current_frame == NULL)
+            return 0;
+
+        return g_list_position(iter->simple_anim->frames, iter->current_frame);
+}
+
+static gint
 get_delay_time (GdkPixbufAnimationIter *anim_iter)
 {
@@ -338,5 +366,5 @@
 
         iter = GDK_PIXBUF_SIMPLE_ANIM_ITER (anim_iter);
-        
+
         if (iter->current_frame) {
                 frame = iter->current_frame->data;
@@ -353,7 +381,7 @@
         GdkPixbufSimpleAnimIter *iter;
         GdkPixbufFrame *frame;
-        
+
         iter = GDK_PIXBUF_SIMPLE_ANIM_ITER (anim_iter);
-        
+
         if (iter->current_frame)
                 frame = iter->current_frame->data;
@@ -365,5 +393,5 @@
         if (frame == NULL)
                 return NULL;
-        
+
         return frame->pixbuf;
 }
@@ -387,11 +415,11 @@
  * Creates a new, empty animation.
  *
- * Returns: a newly allocated #GdkPixbufSimpleAnim 
+ * Returns: a newly allocated #GdkPixbufSimpleAnim
  *
  * Since: 2.8
  */
 GdkPixbufSimpleAnim *
-gdk_pixbuf_simple_anim_new (gint   width, 
-                            gint   height, 
+gdk_pixbuf_simple_anim_new (gint   width,
+                            gint   height,
                             gfloat rate)
 {
@@ -409,8 +437,8 @@
  * gdk_pixbuf_simple_anim_add_frame:
  * @animation: a #GdkPixbufSimpleAnim
- * @pixbuf: the pixbuf to add 
+ * @pixbuf: the pixbuf to add
  *
  * Adds a new frame to @animation. The @pixbuf must
- * have the dimensions specified when the animation 
+ * have the dimensions specified when the animation
  * was constructed.
  *
@@ -423,10 +451,10 @@
   GdkPixbufFrame *frame;
   int nframe = 0;
-  
+
   g_return_if_fail (animation != NULL);
   g_return_if_fail (pixbuf != NULL);
-  
+
   nframe = g_list_length (animation->frames) + 1;
-  
+
   frame = g_new0 (GdkPixbufFrame, 1);
   frame->delay_time = (gint) (1000 / animation->rate);
Index: io-ani-animation.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk-pixbuf/io-ani-animation.c,v
retrieving revision 1.2
diff -u2 -r1.2 io-ani-animation.c
--- io-ani-animation.c
+++ io-ani-animation.c
@@ -31,4 +31,5 @@
 static void gdk_pixbuf_ani_anim_finalize   (GObject        *object);
 
+static int                     gdk_pixbuf_ani_anim_get_frame_count  (GdkPixbufAnimation *animation);
 static gboolean                gdk_pixbuf_ani_anim_is_static_image  (GdkPixbufAnimation *animation);
 static GdkPixbuf*              gdk_pixbuf_ani_anim_get_static_image (GdkPixbufAnimation *animation);
@@ -40,5 +41,5 @@
 
 
-
+
 
 static gpointer parent_class;
@@ -61,10 +62,10 @@
                         (GInstanceInitFunc) NULL,
                 };
-                
+
                 object_type = g_type_register_static (GDK_TYPE_PIXBUF_ANIMATION,
                                                       g_intern_static_string ("GdkPixbufAniAnim"),
                                                       &object_info, 0);
         }
-        
+
         return object_type;
 }
@@ -75,9 +76,10 @@
         GObjectClass *object_class = G_OBJECT_CLASS (klass);
         GdkPixbufAnimationClass *anim_class = GDK_PIXBUF_ANIMATION_CLASS (klass);
-        
+
         parent_class = g_type_class_peek_parent (klass);
-        
+
         object_class->finalize = gdk_pixbuf_ani_anim_finalize;
 
+        anim_class->get_frame_count = gdk_pixbuf_ani_anim_get_frame_count;
         anim_class->is_static_image = gdk_pixbuf_ani_anim_is_static_image;
         anim_class->get_static_image = gdk_pixbuf_ani_anim_get_static_image;
@@ -99,8 +101,19 @@
         g_free (ani_anim->sequence);
         g_free (ani_anim->delay);
-        
+
         G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
+static int
+gdk_pixbuf_ani_anim_get_frame_count  (GdkPixbufAnimation *animation)
+{
+        GdkPixbufAniAnim *ani_anim;
+
+        ani_anim = GDK_PIXBUF_ANI_ANIM (animation);
+
+        return ani_anim->n_frames;
+}
+
+
 static gboolean
 gdk_pixbuf_ani_anim_is_static_image  (GdkPixbufAnimation *animation)
@@ -123,5 +136,5 @@
                 return NULL;
         else
-                return ani_anim->pixbufs[0];        
+                return ani_anim->pixbufs[0];
 }
 
@@ -146,5 +159,5 @@
 iter_restart (GdkPixbufAniAnimIter *iter)
 {
-        iter->current_frame = 0;        
+        iter->current_frame = 0;
         iter->position = 0;
         iter->elapsed = 0;
@@ -162,18 +175,19 @@
 
         g_object_ref (iter->ani_anim);
-        
+
         iter_restart (iter);
 
         iter->start_time = *start_time;
         iter->current_time = *start_time;
-        
+
         return GDK_PIXBUF_ANIMATION_ITER (iter);
 }
 
-
+
 
 static void gdk_pixbuf_ani_anim_iter_class_init (GdkPixbufAniAnimIterClass *klass);
 static void gdk_pixbuf_ani_anim_iter_finalize   (GObject                   *object);
 
+static int        gdk_pixbuf_ani_anim_iter_get_current_frame          (GdkPixbufAnimationIter *iter);
 static int        gdk_pixbuf_ani_anim_iter_get_delay_time             (GdkPixbufAnimationIter *iter);
 static GdkPixbuf* gdk_pixbuf_ani_anim_iter_get_pixbuf                 (GdkPixbufAnimationIter *iter);
@@ -182,5 +196,5 @@
                                                                        const GTimeVal         *current_time);
 
-
+
 
 static gpointer iter_parent_class;
@@ -203,10 +217,10 @@
                         (GInstanceInitFunc) NULL,
                 };
-                
+
                 object_type = g_type_register_static (GDK_TYPE_PIXBUF_ANIMATION_ITER,
                                                       g_intern_static_string ("GdkPixbufAniAnimIter"),
                                                       &object_info, 0);
         }
-        
+
         return object_type;
 }
@@ -218,9 +232,10 @@
         GdkPixbufAnimationIterClass *anim_iter_class =
                 GDK_PIXBUF_ANIMATION_ITER_CLASS (klass);
-        
+
         iter_parent_class = g_type_class_peek_parent (klass);
-        
+
         object_class->finalize = gdk_pixbuf_ani_anim_iter_finalize;
 
+        anim_iter_class->get_current_frame = gdk_pixbuf_ani_anim_iter_get_current_frame;
         anim_iter_class->get_delay_time = gdk_pixbuf_ani_anim_iter_get_delay_time;
         anim_iter_class->get_pixbuf = gdk_pixbuf_ani_anim_iter_get_pixbuf;
@@ -235,5 +250,5 @@
 
         g_object_unref (iter->ani_anim);
-        
+
         G_OBJECT_CLASS (iter_parent_class)->finalize (object);
 }
@@ -249,5 +264,5 @@
 
         iter = GDK_PIXBUF_ANI_ANIM_ITER (anim_iter);
-        
+
         iter->current_time = *current_time;
 
@@ -266,5 +281,5 @@
 
         g_assert (iter->ani_anim->total_time > 0);
-        
+
         /* See how many times we've already played the full animation,
          * and subtract time for that.
@@ -273,7 +288,7 @@
 
         iter->position = elapsed;
-        
+
         /* Now move to the proper frame */
-        
+
         iter->elapsed = 0;
         for (tmp = 0; tmp < iter->ani_anim->n_frames; tmp++) {
@@ -285,5 +300,5 @@
 
         old = iter->current_frame;
-        
+
         iter->current_frame = tmp;
 
@@ -291,9 +306,19 @@
 }
 
+static int
+gdk_pixbuf_ani_anim_iter_get_current_frame (GdkPixbufAnimationIter *anim_iter)
+{
+        GdkPixbufAniAnimIter *iter;
+
+        iter = GDK_PIXBUF_ANI_ANIM_ITER (anim_iter);
+
+        return iter->current_frame;
+}
+
 int
 gdk_pixbuf_ani_anim_iter_get_delay_time (GdkPixbufAnimationIter *anim_iter)
 {
         GdkPixbufAniAnimIter *iter;
-  
+
         iter = GDK_PIXBUF_ANI_ANIM_ITER (anim_iter);
 
@@ -325,11 +350,11 @@
 
         iter = GDK_PIXBUF_ANI_ANIM_ITER (anim_iter);
-      
+
         if (iter->current_frame >= iter->ani_anim->n_frames - 1)
                 return TRUE;
-        
+
         frame = iter->ani_anim->sequence[iter->current_frame + 1];
 
-        if (!iter->ani_anim->pixbufs[frame]) 
+        if (!iter->ani_anim->pixbufs[frame])
                 return TRUE;
 
Index: io-gif-animation.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk-pixbuf/io-gif-animation.c,v
retrieving revision 1.12
diff -u2 -r1.12 io-gif-animation.c
--- io-gif-animation.c
+++ io-gif-animation.c
@@ -31,4 +31,5 @@
 static void gdk_pixbuf_gif_anim_finalize   (GObject        *object);
 
+static int                     gdk_pixbuf_gif_anim_get_frame_count  (GdkPixbufAnimation *animation);
 static gboolean                gdk_pixbuf_gif_anim_is_static_image  (GdkPixbufAnimation *animation);
 static GdkPixbuf*              gdk_pixbuf_gif_anim_get_static_image (GdkPixbufAnimation *animation);
@@ -41,5 +42,5 @@
 
 
-
+
 
 static gpointer parent_class;
@@ -62,10 +63,10 @@
                         (GInstanceInitFunc) NULL,
                 };
-                
+
                 object_type = g_type_register_static (GDK_TYPE_PIXBUF_ANIMATION,
                                                       g_intern_static_string ("GdkPixbufGifAnim"),
                                                       &object_info, 0);
         }
-        
+
         return object_type;
 }
@@ -76,9 +77,10 @@
         GObjectClass *object_class = G_OBJECT_CLASS (klass);
         GdkPixbufAnimationClass *anim_class = GDK_PIXBUF_ANIMATION_CLASS (klass);
-        
+
         parent_class = g_type_class_peek_parent (klass);
-        
+
         object_class->finalize = gdk_pixbuf_gif_anim_finalize;
 
+        anim_class->get_frame_count = gdk_pixbuf_gif_anim_get_frame_count;
         anim_class->is_static_image = gdk_pixbuf_gif_anim_is_static_image;
         anim_class->get_static_image = gdk_pixbuf_gif_anim_get_static_image;
@@ -94,5 +96,5 @@
         GList *l;
         GdkPixbufFrame *frame;
-        
+
         for (l = gif_anim->frames; l; l = l->next) {
                 frame = l->data;
@@ -104,10 +106,20 @@
                 g_free (frame);
         }
-        
+
         g_list_free (gif_anim->frames);
-        
+
         G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
+static int
+gdk_pixbuf_gif_anim_get_frame_count  (GdkPixbufAnimation *animation)
+{
+        GdkPixbufGifAnim *gif_anim;
+
+        gif_anim = GDK_PIXBUF_GIF_ANIM (animation);
+
+        return gif_anim->n_frames;
+}
+
 static gboolean
 gdk_pixbuf_gif_anim_is_static_image  (GdkPixbufAnimation *animation)
@@ -131,5 +143,5 @@
                 return NULL;
         else
-                return GDK_PIXBUF (((GdkPixbufFrame*)gif_anim->frames->data)->pixbuf);        
+                return GDK_PIXBUF (((GdkPixbufFrame*)gif_anim->frames->data)->pixbuf);
 }
 
@@ -161,5 +173,5 @@
 {
         iter_clear (iter);
-  
+
         iter->current_frame = iter->gif_anim->frames;
 }
@@ -176,5 +188,5 @@
 
         g_object_ref (iter->gif_anim);
-        
+
         iter_restart (iter);
 
@@ -182,13 +194,14 @@
         iter->current_time = *start_time;
         iter->first_loop_slowness = 0;
-        
+
         return GDK_PIXBUF_ANIMATION_ITER (iter);
 }
 
-
+
 
 static void gdk_pixbuf_gif_anim_iter_class_init (GdkPixbufGifAnimIterClass *klass);
 static void gdk_pixbuf_gif_anim_iter_finalize   (GObject                   *object);
 
+static int        gdk_pixbuf_gif_anim_iter_get_current_frame          (GdkPixbufAnimationIter *iter);
 static int        gdk_pixbuf_gif_anim_iter_get_delay_time             (GdkPixbufAnimationIter *iter);
 static GdkPixbuf* gdk_pixbuf_gif_anim_iter_get_pixbuf                 (GdkPixbufAnimationIter *iter);
@@ -197,5 +210,5 @@
                                                                        const GTimeVal         *current_time);
 
-
+
 
 static gpointer iter_parent_class;
@@ -218,10 +231,10 @@
                         (GInstanceInitFunc) NULL,
                 };
-                
+
                 object_type = g_type_register_static (GDK_TYPE_PIXBUF_ANIMATION_ITER,
                                                       g_intern_static_string ("GdkPixbufGifAnimIter"),
                                                       &object_info, 0);
         }
-        
+
         return object_type;
 }
@@ -233,9 +246,10 @@
         GdkPixbufAnimationIterClass *anim_iter_class =
                 GDK_PIXBUF_ANIMATION_ITER_CLASS (klass);
-        
+
         iter_parent_class = g_type_class_peek_parent (klass);
-        
+
         object_class->finalize = gdk_pixbuf_gif_anim_iter_finalize;
 
+        anim_iter_class->get_current_frame = gdk_pixbuf_gif_anim_iter_get_current_frame;
         anim_iter_class->get_delay_time = gdk_pixbuf_gif_anim_iter_get_delay_time;
         anim_iter_class->get_pixbuf = gdk_pixbuf_gif_anim_iter_get_pixbuf;
@@ -252,5 +266,5 @@
 
         g_object_unref (iter->gif_anim);
-        
+
         G_OBJECT_CLASS (iter_parent_class)->finalize (object);
 }
@@ -265,7 +279,7 @@
         GList *tmp;
         GList *old;
-        
+
         iter = GDK_PIXBUF_GIF_ANIM_ITER (anim_iter);
-        
+
         iter->current_time = *current_time;
 
@@ -284,5 +298,5 @@
 
         g_assert (iter->gif_anim->total_time > 0);
-        
+
         /* See how many times we've already played the full animation,
          * and subtract time for that.
@@ -293,5 +307,5 @@
         else {
                 /* If current_frame is NULL at this point, we have loaded the
-                 * animation from a source which fell behind the speed of the 
+                 * animation from a source which fell behind the speed of the
                  * display. We remember how much slower the first loop was due
                  * to this and correct the position calculation in order to not
@@ -308,20 +322,20 @@
 
         /* Now move to the proper frame */
-        if (iter->gif_anim->loop == 0 || loop < iter->gif_anim->loop) 
+        if (iter->gif_anim->loop == 0 || loop < iter->gif_anim->loop)
                 tmp = iter->gif_anim->frames;
-        else 
+        else
                 tmp = NULL;
         while (tmp != NULL) {
                 GdkPixbufFrame *frame = tmp->data;
-                
+
                 if (iter->position >= frame->elapsed &&
                     iter->position < (frame->elapsed + frame->delay_time))
                         break;
-                
+
                 tmp = tmp->next;
         }
 
         old = iter->current_frame;
-        
+
         iter->current_frame = tmp;
 
@@ -329,4 +343,18 @@
 }
 
+static int
+gdk_pixbuf_gif_anim_iter_get_current_frame (GdkPixbufAnimationIter *anim_iter)
+{
+        GdkPixbufGifAnimIter *iter;
+
+        iter = GDK_PIXBUF_GIF_ANIM_ITER (anim_iter);
+
+        if (iter->gif_anim->frames == NULL ||
+            iter->current_frame == NULL)
+            return 0;
+
+        return g_list_position(iter->gif_anim->frames, iter->current_frame);
+}
+
 int
 gdk_pixbuf_gif_anim_iter_get_delay_time (GdkPixbufAnimationIter *anim_iter)
@@ -334,5 +362,5 @@
         GdkPixbufFrame *frame;
         GdkPixbufGifAnimIter *iter;
-  
+
         iter = GDK_PIXBUF_GIF_ANIM_ITER (anim_iter);
 
@@ -347,7 +375,7 @@
                          frame->delay_time - (iter->position - frame->elapsed));
 #endif
-                
+
                 return frame->delay_time - (iter->position - frame->elapsed);
-        } else 
+        } else
                 return -1; /* show last frame forever */
 }
@@ -356,10 +384,10 @@
 gdk_pixbuf_gif_anim_frame_composite (GdkPixbufGifAnim *gif_anim,
                                      GdkPixbufFrame   *frame)
-{  
+{
         GList *link;
         GList *tmp;
-        
+
         link = g_list_find (gif_anim->frames, frame);
-        
+
         if (frame->need_recomposite || frame->composited == NULL) {
                 /* For now, to composite we start with the last
@@ -372,5 +400,5 @@
                 while (tmp != NULL) {
                         GdkPixbufFrame *f = tmp->data;
-                        
+
                         if (f->need_recomposite) {
                                 if (f->composited) {
@@ -382,5 +410,5 @@
                         if (f->composited != NULL)
                                 break;
-                        
+
                         tmp = tmp->prev;
                 }
@@ -389,5 +417,5 @@
                 if (tmp == NULL)
                         tmp = gif_anim->frames;
-                
+
                 while (tmp != NULL) {
                         GdkPixbufFrame *f = tmp->data;
@@ -399,5 +427,5 @@
                         clipped_width = MIN (gif_anim->width - f->x_offset, gdk_pixbuf_get_width (f->pixbuf));
                         clipped_height = MIN (gif_anim->height - f->y_offset, gdk_pixbuf_get_height (f->pixbuf));
-  
+
                         if (f->need_recomposite) {
                                 if (f->composited) {
@@ -406,5 +434,5 @@
                                 }
                         }
-                        
+
                         if (f->composited != NULL)
                                 goto next;
@@ -424,5 +452,5 @@
 
                                 /* alpha gets dumped if f->composited has no alpha */
-                                
+
                                 gdk_pixbuf_fill (f->composited,
                                                  (gif_anim->bg_red << 24) |
@@ -441,5 +469,5 @@
                                                               GDK_INTERP_BILINEAR,
                                                               255);
-                                
+
                                 if (f->action == GDK_PIXBUF_FRAME_REVERT)
                                         g_warning ("First frame of GIF has bad dispose mode, GIF loader should not have loaded this image");
@@ -450,5 +478,5 @@
                                 gint prev_clipped_width;
                                 gint prev_clipped_height;
-                                
+
                                 prev_frame = tmp->prev->data;
 
@@ -459,5 +487,5 @@
                                  * frame
                                  */
-                                
+
                                 if (prev_frame->action == GDK_PIXBUF_FRAME_RETAIN) {
                                         f->composited = gdk_pixbuf_copy (prev_frame->composited);
@@ -465,5 +493,5 @@
                                         if (f->composited == NULL)
                                                 return;
-                                        
+
                                 } else if (prev_frame->action == GDK_PIXBUF_FRAME_DISPOSE) {
                                         f->composited = gdk_pixbuf_copy (prev_frame->composited);
@@ -484,12 +512,12 @@
                                                 if (area == NULL)
                                                         return;
-                                                
+
                                                 gdk_pixbuf_fill (area,
                                                                  (gif_anim->bg_red << 24) |
                                                                  (gif_anim->bg_green << 16) |
                                                                  (gif_anim->bg_blue << 8));
-                                                
+
                                                 g_object_unref (area);
-                                        }                                        
+                                        }
                                 } else if (prev_frame->action == GDK_PIXBUF_FRAME_REVERT) {
                                         f->composited = gdk_pixbuf_copy (prev_frame->composited);
@@ -518,5 +546,5 @@
                                                 /* We need to save the contents before compositing */
                                                 GdkPixbuf *area;
-                                                
+
                                                 area = gdk_pixbuf_new_subpixbuf (f->composited,
                                                                                  f->x_offset,
@@ -524,8 +552,8 @@
                                                                                  clipped_width,
                                                                                  clipped_height);
-                                            
+
                                                 if (area == NULL)
                                                         return;
-                                                
+
                                                 f->revert = gdk_pixbuf_copy (area);
 
@@ -551,12 +579,12 @@
                                                               255);
                                 }
-                        
+
                                 f->need_recomposite = FALSE;
                         }
-                        
+
                 next:
                         if (tmp == link)
                                 break;
-                        
+
                         tmp = tmp->next;
                 }
@@ -569,5 +597,5 @@
         GdkPixbufGifAnimIter *iter;
         GdkPixbufFrame *frame;
-        
+
         iter = GDK_PIXBUF_GIF_ANIM_ITER (anim_iter);
 
@@ -583,10 +611,10 @@
                    gdk_pixbuf_get_height (frame->pixbuf));
 #endif
-        
+
         if (frame == NULL)
                 return NULL;
 
         gdk_pixbuf_gif_anim_frame_composite (iter->gif_anim, frame);
-        
+
         return frame->composited;
 }
@@ -596,7 +624,7 @@
 {
         GdkPixbufGifAnimIter *iter;
-  
+
         iter = GDK_PIXBUF_GIF_ANIM_ITER (anim_iter);
 
-        return iter->current_frame == NULL || iter->current_frame->next == NULL;  
+        return iter->current_frame == NULL || iter->current_frame->next == NULL;
 }
