#include <gtk/gtk.h>

GtkWidget *label;

gboolean update(gpointer data)
{
  static int cnt;
  char stng[32];  
  
  snprintf(stng,31,"Hello %5d",cnt++);  
  gtk_label_set_text(GTK_LABEL(label),stng);
  return 1;
}

G_MODULE_EXPORT void my_exit(GtkWidget *widget, gpointer user_data) 
{
  printf ("I ran through my_exit!!\n");
  gtk_main_quit();
  printf ("This is after gtk_main_quit!!\n");
}


int main (int argc, char *argv[])
{
  GtkWidget *window1;
  GtkWidget *toolbar1;
  GtkWidget *vbox1;
  GtkWidget *eventbox;
  GtkWidget *statusbar;

  GdkColor color;

  gtk_init (&argc, &argv);

  window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  vbox1 = gtk_vbox_new (FALSE, 0);

  gtk_widget_show (vbox1);
  gtk_container_add (GTK_CONTAINER (window1), vbox1);

  label = gtk_label_new("Hello");
  gtk_widget_show (label);
  gtk_box_pack_start (GTK_BOX (vbox1), label, TRUE, TRUE, 0);  
  
  g_timeout_add (100,update,NULL);
  
  g_signal_connect ((gpointer) window1, "destroy",   G_CALLBACK (my_exit),   NULL);

  gtk_widget_show (window1);
  
  gtk_main ();
}