GdkPixbuf * _g_icon_get_pixbuf (GIcon *icon, int size, GtkIconTheme *theme) { GdkPixbuf *pixbuf; int w, h; if (icon == NULL) return NULL; pixbuf = NULL; if (G_IS_THEMED_ICON (icon)) pixbuf = get_themed_icon_pixbuf (G_THEMED_ICON (icon), size, theme); if (G_IS_FILE_ICON (icon)) pixbuf = get_file_icon_pixbuf (G_FILE_ICON (icon), size); if (pixbuf == NULL) return NULL; w = gdk_pixbuf_get_width (pixbuf); h = gdk_pixbuf_get_height (pixbuf); if (scale_keeping_ratio (&w, &h, size, size, FALSE)) { GdkPixbuf *scaled; scaled = gdk_pixbuf_scale_simple (pixbuf, w, h, GDK_INTERP_BILINEAR); g_object_unref (pixbuf); pixbuf = scaled; } return pixbuf; }
static GdkPixbuf * _get_icon_pixbuf (GIcon * icon, int size, GtkIconTheme * theme) { if (icon == NULL) return NULL; if (G_IS_THEMED_ICON (icon)) return get_themed_icon_pixbuf (G_THEMED_ICON (icon), size, theme); if (G_IS_FILE_ICON (icon)) return get_file_icon_pixbuf (G_FILE_ICON (icon), size); return NULL; }