--- helloworld2.c	2008/06/15 10:32:29	1.1
+++ helloworld2.c	2008/06/15 11:59:22
@@ -18,6 +18,31 @@
     return FALSE;
 }
 
+static gboolean query_tooltip(GtkWidget *widget,
+                                       gint x, gint y,
+                                       gboolean keyboard_mode,
+                                       GtkTooltip *tooltip,
+                                       gpointer *data)
+{
+  static gint n;  
+  GTimeVal timeval;
+  char str[256];
+
+  g_get_current_time(&timeval);
+  n += 1;
+  g_print("%d: %ld.%06ld  (%d,%d) (%d)\n", n, timeval.tv_sec, timeval.tv_usec, x, y, keyboard_mode);
+  sprintf(str, "%d", n);
+  gtk_tooltip_set_text(tooltip, str);
+
+  return TRUE;
+}
+
+static gboolean tooltip_timer(GtkWidget *button)
+{
+  gtk_widget_trigger_tooltip_query(button);
+  return TRUE;
+}
+
 int main( int   argc,
           char *argv[] )
 {
@@ -67,6 +92,9 @@
 
     /* Always remember this step, this tells GTK that our preparation for
      * this button is complete, and it can now be displayed. */
+    gtk_widget_set_has_tooltip(button, TRUE);
+    g_signal_connect(button, "query-tooltip", G_CALLBACK(query_tooltip), NULL);
+    g_timeout_add(1000, (GSourceFunc) tooltip_timer, button);
     gtk_widget_show (button);
 
     /* Do these same steps again to create a second button */
