Test program:
#include <gtk/gtk.h>
#include <stdio.h>
#include <glib.h>
int main(int argc, char *argv)
{
gtk_init(&argc, &argv);
GtkIconTheme theme = gtk_icon_theme_get_default();
if ( theme == NULL )
{
puts("no theme set");
return 0;
}
gchar **path;
gint n;
gtk_icon_theme_get_search_path(theme, &path, &n);
printf("%u %u
",
gtk_icon_theme_has_icon(theme, “fonts-package”),
gtk_icon_theme_has_icon(theme, argv[1])
);
gint *l = gtk_icon_theme_get_icon_sizes(theme, argv[1]);
gint *p;
for ( p = l; *p; p++ )
printf("*l = %d
", *p );
GtkIconInfo *info = gtk_icon_theme_lookup_icon(theme, argv[1], -1, GTK_ICON_LOOKUP_USE_BUILTIN );
printf("info = %p
", info);
if ( info )
{
GError *error = NULL;
GdkPixbuf *buf = gtk_icon_info_load_icon(info, &error);
printf("buf = %p
", buf);
if ( buf )
g_object_unref(buf);
if ( error )
g_error_free(error);
gtk_icon_info_free( info );
}
GError *error = NULL;
GdkPixbuf *pbuf = gtk_icon_theme_load_icon(theme, argv[1], -1, GTK_ICON_LOOKUP_USE_BUILTIN, &error );
printf("pbuf = %p
", pbuf);
if ( pbuf )
g_object_unref( pbuf );
if ( error )
g_error_free(error);
gint i;
for ( i = 0; i < n; i++ )
printf("path = %s
", path*);
g_strfreev(path);
g_free(l);
return 0;
}
$ cc -W -Wall -Wextra -g 20.c pkg-config --cflags --libs gtk+-2.0
$ gdb -q --args ./a.out application-x-vnc --g-fatal-warnings
(gdb) (gdb) r
Starting program: /home/user/a.out application-x-vnc --g-fatal-warnings
0 1
*l = 22
*l = 24
*l = -1
*l = 48
*l = 16
l = 32
info = 0x806e098
[Thread debugging using libthread_db enabled]
Error while reading shared library symbols:
Cannot find new threads: generic error
Cannot find new threads: generic error
(gdb) c
Continuing.
Cannot execute this command while the selected thread is running.
(gdb)