Re: Newbie message-wait window

Thanks for the demo. When I tried to build this I needed to make small change because
in order to avoid following error: (compiled with gnome 2.6)

   main.c: In function `main':
main.c:13: warning: passing arg 2 of `g_timeout_add' from incompatible pointer type

The fix was to cast gtk_widget_destroy to GtkFunction...

   g_timeout_add(10000, (GtkFunction)gtk_widget_destroy, win);


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]