Skip to content

Instantly share code, notes, and snippets.

@alexxcons
Forked from andreldm/icon_tester.c
Created June 29, 2020 22:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexxcons/49fadbf6afdea7ce0cbac1953d3c896f to your computer and use it in GitHub Desktop.
Save alexxcons/49fadbf6afdea7ce0cbac1953d3c896f to your computer and use it in GitHub Desktop.
Icon lookup tester
/*
* Build:
* gcc $(pkg-config --cflags gtk+-3.0) icon_tester.c -o icon_tester $(pkg-config --libs gtk+-3.0)
*/
#include <gtk/gtk.h>
int main (int argc, char *argv[])
{
gtk_init (&argc, &argv);
if (argc <= 1) {
g_print ("Please inform the icon name\n");
return 1;
}
GtkIconTheme *theme = gtk_icon_theme_get_default ();
GtkIconInfo *info = gtk_icon_theme_lookup_icon (theme, argv[1], 32, 0);
if (info == NULL) {
g_print ("Icon '%s' not found\n", argv[1]);
} else {
g_print ("%s\n", gtk_icon_info_get_filename (info));
g_object_unref (info);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment