#include <gtk/gtk.h>

gboolean show_hide_window (GtkWidget * window)
{
    if (gtk_widget_get_visible (window))
        gtk_widget_hide (window);
    else
        gtk_widget_show (window);

    return TRUE;
}

int main (void)
{
    gtk_init (NULL, NULL);

    GtkWidget * window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_widget_show (window);

    g_timeout_add_seconds (3, (GSourceFunc) show_hide_window, window);

    gtk_main ();

    return 0;
}
