#include <gtk/gtk.h>

static void
on_activate (GApplication *application)
{
  GtkWidget *entry = gtk_entry_new ();
  gtk_entry_set_has_frame ((GtkEntry *)entry, FALSE);
  g_object_set (entry, "margin", 24, NULL);

  GtkWidget *button = gtk_button_new_with_label ("Button");

  GtkWidget *box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
  gtk_container_add ((GtkContainer *)box, entry);
  gtk_container_add ((GtkContainer *)box, button);

  GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_container_add ((GtkContainer *)window, box);
  gtk_widget_show_all (window);

  gtk_application_add_window ((GtkApplication *)application, (GtkWindow *)window);
}

int
main (int    argc,
      char **argv)
{
  GtkApplication *application = gtk_application_new ("org.gtk.test", G_APPLICATION_FLAGS_NONE);
  g_signal_connect (application, "activate", (GCallback)on_activate, NULL);

  int result = g_application_run ((GApplication *)application, argc, argv);
  g_object_unref (application);
  return result;
}
