Re: Newbie message-wait window

On Thu, 2004-10-21 at 08:23 -0400, Rodolfo Alc�r wrote: 
> Hi, Im a newbie developer. I just want a window which raises, wait 10
> seconds, closes and finishes cleanly. I copied this code, but it neither
> finishes cleanly. Could somebody help me? 

Try this (compile with "gcc `pkg-config --libs --cflags gtk+-2.0` main.c"):

--- main.c ---

#include <gtk/gtk.h>

int main(int argc, char *argv[]) {
	GtkWidget *win;

	gtk_init(&argc, &argv);

	win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	g_signal_connect(win, "destroy", gtk_main_quit, NULL);
	g_timeout_add(10000, gtk_widget_destroy, win);


--- main.c ---

here we connect gtk_main_quit on "destroy" signal of window widget and
add a timeout to destroy the window widget after 10000 millisecs.

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