Show and hide window (code w/ g_timeout_add)



Here's the code that I came up with. It's giving me back a few errors during compile time. I would like to show and hide(delete) a window for a predetermined amount of time, and continue on with the program. I inserted the "g_timeout_add" function in the source but I'm not able to implement it correctly. I'm somewhat new to GTK+. If someone could help me on where in the code the function needs to be placed and how the signal handler should look using the short example that I've included. Thanks. Any help would be appreciated.

/* basicgtk.c */

#include <gtk/gtk.h>

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

  gint timer = gtk_timeout_add( 1000, (GtkFunction) show_window_function,
           (gpointer) data );

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 */
  show_window_function ( GtkWidget * timer, gpointer data )

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

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

_________________________________________________________________
Take advantage of our best MSN Dial-up offer of the year — six months @$9.95/month. Sign up now! http://join.msn.com/?page=dept/dialup




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