/* * Compile with: * gcc $(pkg-config --cflags gtk+-3.0) *.c $(pkg-config --libs gtk+-3.0) -lm * * When Gtk is initialized through option group, launching the interactive * debugger doesn't work. * To test, just comment/uncomment the `#define USE_GTK_INIT`, rebuild, run: * * GTK_DEBUG=interactive ./a.out */ #include #include #include //#define USE_GTK_INIT int main(int argc, char *argv[]) { #ifdef USE_GTK_INIT /* Initialize using gtk_init() */ gtk_init(&argc, &argv); #else /* Initialize through option group */ GOptionContext *context = g_option_context_new("context"); GOptionGroup *option_group = gtk_get_option_group(TRUE); g_option_context_add_group(context, option_group); if (!g_option_context_parse(context, &argc, &argv, NULL)) { g_print("Failed to parse options\n"); exit(EXIT_FAILURE); } #endif /* Print Gtk version */ printf("Running against GTK+ %u.%u.%u\n", gtk_get_major_version(), gtk_get_minor_version(), gtk_get_micro_version()); /* Run */ gtk_main(); return EXIT_SUCCESS; }