Skip to content

Instantly share code, notes, and snippets.

@andreldm
Last active June 29, 2020 22:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save andreldm/b971fa0d671a90ae133650f85ce2836a to your computer and use it in GitHub Desktop.
Save andreldm/b971fa0d671a90ae133650f85ce2836a 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