2

I am using webkitgtk+ to get the .ico favicon from a website :

const gchar *uri = webkit_web_view_get_icon_uri(web_view);

as you can see that is a character variable with the .ico image.How can i show it as a pixbuf?Doest gtk support ico images?

Thanks

Rrjrjtlokrthjji
  • 602
  • 2
  • 10
  • 26

2 Answers2

2

Using the new GIO API makes this quite easy:

GFile *file;
GFileInputStream *stream;
GdkPixbuf *pb;

/* TODO: Make async, handle errors, etc */
file = g_file_new_for_uri (uri);
stream = g_file_read (file, NULL, NULL);
pb = gdk_pixbuf_new_from_stream ((GInputStream *)stream, NULL, NULL); 
Rob Bradford
  • 1,440
  • 12
  • 17
0
GtkImage *image = gtk_image_new();     
GdkPixbuf *pixbuf = webkit_web_view_get_icon_pixbuf (WEBKIT_WEB_VIEW(webview));
gtk_image_set_from_pixbuf(image,pixbuf);

enter image description here

sonichy
  • 1,370
  • 2
  • 14
  • 17