On Thu, 16 Aug 2012 19:43:26 +0200 Andreas Rönnquist <mailingli...@gusnan.se> wrote:
> On Fri, 17 Aug 2012 00:01:08 +0800 > Just Fill Bugs <mozbug...@yahoo.com.au> wrote: > > > 于 08/16/2012 11:24 PM, Andreas Rönnquist 写道: > > > > > Sorry, I mean loading the Pixbuf of the file-type / mime-type of a > > > file - Not simply loading a file into a pixbuf. That is a bit more > > > complicated getting... > > > > > > > Maybe this: > > <http://git.gnome.org/browse/gedit/tree/plugins/filebrowser/gedit-file-browser-utils.c> > > > > > > GIcon *g_file_info_get_icon(GFileInfo *info); > > > > That indeed did the trick! (See attached file for the functions I > used.) > Oh, the attachment didn't get to the list - This is how I did it: /** * */ GdkPixbuf *get_pixbuf_from_icon(GIcon *icon, GtkIconSize size) { GdkPixbuf *result=NULL; GtkIconTheme *theme; GtkIconInfo *info; gint width; if (!icon) return NULL; theme=gtk_icon_theme_get_default(); gtk_icon_size_lookup(size,&width,NULL); info=gtk_icon_theme_lookup_by_gicon(theme, icon, width, GTK_ICON_LOOKUP_USE_BUILTIN); if (!info) return NULL; result=gtk_icon_info_load_icon(info,NULL); gtk_icon_info_free(info); return result; } /** * */ GdkPixbuf *get_pixbuf_from_file(GFile *file, GtkIconSize size) { GIcon *icon; GFileInfo *info; GdkPixbuf *result=NULL; info=g_file_query_info(file, G_FILE_ATTRIBUTE_STANDARD_ICON, G_FILE_QUERY_INFO_NONE, NULL, NULL); if (!info) return NULL; icon=g_file_info_get_icon(info); if (icon!=NULL) { result=get_pixbuf_from_icon(icon,size); } g_object_unref(info); return result; } Again - thanks guys! /Andreas _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list