+
+static void animation_async_ready_cb(GObject *source_object, GAsyncResult *res, gpointer data)
+{
+ GError *error = NULL;
+ AnimationData *animation = data;
+
+ if (animation)
+ {
+ if (g_cancellable_is_cancelled(animation->cancellable))
+ {
+ gdk_pixbuf_animation_new_from_stream_finish(res, NULL);
+ g_object_unref(animation->in_file);
+ g_object_unref(animation->gfstream);
+ image_animation_data_free(animation);
+ return;
+ }
+
+ animation->gpa = gdk_pixbuf_animation_new_from_stream_finish(res, &error);
+ if (animation->gpa)
+ {
+ if (!gdk_pixbuf_animation_is_static_image(animation->gpa))
+ {
+ if (animation->iter = gdk_pixbuf_animation_get_iter(animation->gpa,NULL))
+ {
+ animation->iter = gdk_pixbuf_animation_get_iter(animation->gpa, NULL);
+ animation->data_adr = animation->lw->image->image_fd;
+ animation->delay = gdk_pixbuf_animation_iter_get_delay_time(animation->iter);
+ animation->valid = TRUE;
+
+ layout_image_animate_update_image(animation->lw);
+
+ g_timeout_add(animation->delay, show_next_frame, animation);
+ }
+ }
+ }
+ else
+ {
+ log_printf("Error reading GIF file: %s\n", error->message);
+ }
+
+ g_object_unref(animation->in_file);
+ g_object_unref(animation->gfstream);
+ }
+}
+