/*
 *  gcc -Wall -g gtk-about.c -o gtk-about `pkg-config --cflags gtk+-3.0` `pkg-config --libs gtk+-3.0`
 */
#include <gtk/gtk.h>

extern char **environ;

static void
print_environ (void)
{
  int i = 0;

  while(environ[i])
  {
    printf("%s\n", environ[i++]);
  }
}
static void
activate (GtkApplication *app,
          gpointer        user_data)
{
  const gchar *authors[] = {
    "The GTK+ Team",
    NULL
  };
  GtkWidget *window;

  window = gtk_application_window_new (app);
  gtk_window_set_title (GTK_WINDOW (window), "Window");
  gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);

  print_environ();
  gtk_show_about_dialog (GTK_WINDOW (window),
                         "program-name", "GTK+ About Dialog",
                         "version", g_strdup_printf ("Running against GTK+ %d.%d.%d",
                                                     gtk_get_major_version (),
                                                     gtk_get_minor_version (),
                                                     gtk_get_micro_version ()),
                         "copyright", "(C) 2015 The GTK+ Team",
                         "license-type", GTK_LICENSE_LGPL_2_1,
                         "website", "http://www.gtk.org",
                         "comments", "GTK+ about",
                         "authors", authors,
                         "title", "About Dialog",
                         NULL);

  gtk_widget_show_all (window);
}

int
main (int    argc,
      char **argv)
{
  GtkApplication *app;
  int status;

  app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
  g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
  status = g_application_run (G_APPLICATION (app), argc, argv);
  g_object_unref (app);

  return status;
}
