/*
 * XfceIconTheme test/demo.  copyright (c) 2004 brian tarricone
 * feel free to do with this file as you please.
 *
 * compile with:
 * gcc -g -Wall -o xit xit.c `pkg-config libxfcegui4-1.0 --cflags --libs`
 */

#include <stdlib.h>
#include <gtk/gtk.h>
#include <libxfcegui4/libxfcegui4.h>

int
main(int argc, char **argv)
{
	XfceIconTheme *icon_theme;
	gchar *filename;
	XfceIconThemeCategory cat;
	GList *icons = NULL;
	
	gtk_init(&argc, &argv);
	
	/* pass NULL for default screen */
	icon_theme = xfce_icon_theme_get_for_screen(NULL);
	
	/* test normal lookup */
	filename = xfce_icon_theme_lookup(icon_theme, "gnome-fs-directory", 48);
	if(filename) {
		g_print("found path: '%s'\n", filename);
		g_free(filename);
	} else
		g_print("path not found\n");
	
	/* test category lookup */
	filename = xfce_icon_theme_lookup_category(icon_theme,
			XFCE_ICON_CATEGORY_MULTIMEDIA, 48);
	if(filename) {
		g_print("found path: '%s'\n", filename);
		g_free(filename);
	} else
		g_print("path not found\n");
	
	/* test register category, followed by lookup */
	icons = g_list_append(icons, "xfce-testicon");
	cat = xfce_icon_theme_register_category(icon_theme, icons);
	filename = xfce_icon_theme_lookup_category(icon_theme, cat, 48);
	if(filename) {
		g_print("found path: '%s'\n", filename);
		g_free(filename);
	} else
		g_print("path not found\n");
	xfce_icon_theme_unregister_category(icon_theme, cat);
	
	/* test fallback lookup */
	filename = xfce_icon_theme_lookup(icon_theme, "xine_16x16", 48);
	if(filename) {
		g_print("found path: '%s'\n", filename);
		g_free(filename);
	} else
		g_print("path not found\n");
	
	g_object_unref(G_OBJECT(icon_theme));
	
	return 0;
}
