Load Pixbuf from Gio::Icon returned by Gio::Volume



Hi,
There's lots of methods to create a Gdk::Pixbuf but none of them from a Gio::Icon.

I have a Gtk::DrawingArea upon which I (need to) draw pixbufs of Gio::Icons returned by Gio::Volumes->get_icon().

This doesn't work: create Gtk::Image myImage, then myImage->set(gioIcon), then myImage.get_pixbuf().
Neither this: use the "to_string()" of the Gio::Icon as the name to load a pixbuf from the default Gtk::IconTheme thru load_icon(..).

Can anyone please suggest a working solution?

PS: The problem with Gio::Icon is that its to_string() method is over-engineered (wacky) whose output varies greatly, basically useless (and/or too complicated) for robust guessing the name or path of the icon. Apparently you're required to guess the type of the Gio::Icon by dynamically casting it, catching casting errors, and then working your way out depending upon its type, what a mess..
I just need to load a Pixbuf of certain size from a Gio::Icon returned by a Gio::Volume, that's it..


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