Say you want to get pixbuf from stock_item .
There are two ways:
First (simple):
pixbuf = gtk_widget_render_icon ( widget, stock_item, size )
Second (hard):
You need to find it in the list of default icon factories:
icon_set = gtk_style_lookup_icon_set ( style, stock_item )
OR
icon_set = gtk_icon_factory_lookup_default ( $stock_item )
then check the available sizes with get_sizes . Check if the size you want is available or get the largest size that will be the last in the returned list. Then you need to display it to get pixbuf:
pixbuf = gtk_icon_set_render_icon ( icon_set, style, direction, state, size, widget )
Then scale it to whatever size you want to use:
gdk_pixbuf_scale_simple ( pixbuf, width, height, GdkInterpType )
Hope you got it
source share