is it possible to show GIFs in an iconview?
I am using GTK rust and have an iconview with a string and a Pixbuf column, this works for displaying an image and some text.
is it possible to replace the Image Pixbuf with a PixbufAnimation to display a gif?
when i drop that straight into my code I get this error:
Gtk-CRITICAL **: 20:04:29.359: gtk_icon_view_set_pixbuf_column: assertion 'column_type == GDK_TYPE_PIXBUF' failed
but i could not find a column type for an animation.
i am working with gtk rust so this is my code section for that, working off the iconview example:
// SNIP //
// And finally set text column and pixbuf column using enum
icon_view.set_text_column(0);
icon_view.set_pixbuf_column(1);
icon_view.set_pixbuf_column(2);}
// enum so we can have gifs and static images be stored
enum PixBuffer {
Pix(Pixbuf),
Anim(PixbufAnimation),
}
fn create_list_store_model() -> gtk::ListStore {
// Initialize an array of column types for ListStore object. Here we say that the first item
let col_types: [glib::Type; 3] = [glib::Type::String, gdk_pixbuf::Pixbuf::static_type(), gdk_pixbuf::PixbufAnimation::static_type()]; //gdk_pixbuf::PixbufAnimation::static_type()
let view_model = gtk::ListStore::new(&col_types);
let titles = vec!("Update", "icon");
let gifs = vec!(PixBuffer::Anim(PixbufAnimation::from_file("pathtogif.gif").unwrap()), PixBuffer::Pix(Pixbuf::from_file("pathtoimage.png").unwrap()));
// let col_indices: [u32; 3] = [0, 1, 2];
for (title, buffer) in titles.iter().zip(gifs) {
match buffer {
PixBuffer::Pix(pic) => {
view_model.insert_with_values(
None, &[0, 1],
&[&title, &pic]);
},
PixBuffer::Anim(gif) => {
view_model.insert_with_values(
None, &[0, 2],
&[&title, &Image::from_animation(&gif)]);
},
}
// view_model.set(&view_model.append(), &col_indices, &[&title, &gif, &otr]);
}
for that code 2 items appear in the iconview Labeled "update" and "icon", Update has only displays the text and "icon" shows the image.
i cant see any column types for an animation so perhaps it is not possible