G_IS_ICON fails in gtk_icon_theme_lookup_by_gicon



Is there anything wrong doing this? I got it from XChat, which causes a bug:

---
#include<gtk/gtk.h>


int
main (void)
{
	GFile *file;
	GFileInfo *info;
	GIcon *mime_icon, *emblemed_icon, *direction_icon;
	GEmblem *direction_emblem;

	gtk_init (NULL, NULL);

	/* Any file would do */
	file = g_file_new_for_path ("/home/kyoushuu/Downloads/Bakuman_166_RHN.zip.1");
	info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_ICON,
	                          0, NULL, NULL);
	g_object_unref (file);

	if (!info) {
	        return;
	}

	mime_icon = g_file_info_get_icon (info);

	direction_icon = g_themed_icon_new ("go-down");

	direction_emblem = g_emblem_new (direction_icon);
	emblemed_icon = g_emblemed_icon_new (mime_icon, direction_emblem);

	gtk_icon_theme_lookup_by_gicon (gtk_icon_theme_get_default (),
	                                emblemed_icon,
	                                16,
	                                GTK_ICON_LOOKUP_USE_BUILTIN);

	g_object_unref (mime_icon);
	g_object_unref (emblemed_icon);
	g_object_unref (direction_emblem);
	g_object_unref (direction_icon);

	g_object_unref (info);

	return 0;
}
---

It fails in gtk_icon_theme_lookup_by_gicon's G_IS_ICON. Is this wrong? If yes, what is the
correct approach of adding emblems to a file type's icon?
(the gtk_icon_theme_lookup_by_gicon line is from GTK+ Tree View widget)




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