How do I show window for for just a few seconds(see code)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Below is an example from "GTK+/GNOME PROGRAMMING". I've placed a "for loop" in the program because I would like to show the window for a few seconds, destroy it and have another function called. When I placed it in the program it managed to create the window 5 times instead of showing the window for 5 seconds. I suppose I want to allow "main" to run for 5 seconds and then call "gtk_widget_destroy(window)" but I'm not sure how to go about it. Any ideas?

/* basicgtk.c */

#include <gtk/gtk.h>

  /* Function which stops the program */
  void CloseTheApp(GtkWidget * window, gpointer data )
  {
     gtk_main_quit ();
  }

gint main ( gint argc, gchar * argv[] )
{

  /* Declare a GtkWidget to use as the main window */
  GtkWidget * window ;

  /* Start GTK+ up, and let it process any arguments that were */
  /* passed in on the command line */
  gtk_init ( &argc, &argv );

  /* Create the window itself */
  window = gtk_window_new ( GTK_WINDOW_TOPLEVEL ) ;
  gtk_signal_connect(GTK_OBJECT(window),
    "destroy",
     GTK_SIGNAL_FUNC(CloseTheApp),
     NULL);

  /* Show the window, as far as GTK+ is concerned though we just want */
  /* to make a widget visible */
  gtk_widget_show (window);

  /* Start GTK+ running so that it can catch any signals */
  gtk_main () ;

  /* This line will never be reached in this app */
  return 0;
}

_________________________________________________________________
Don?t worry if your Inbox will max out while you are enjoying the holidays. Get MSN Extra Storage! http://join.msn.com/?PAGE=features/es


_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux