Re: [gtk-list] Re: Notebook and listbox problems.



On Tue, 13 May 1997, Otto Hammersmith wrote:

> [snipage]
> >   /* This doesn't seem to work either..... must have typed wrong  */
> >   gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc)
> >	               gtk_widget_destroy, GTK_OBJECT(window)); 
> 
> Replace that bit with,
> 
> gtk_signal_connect(GTK_OBJECT(button), "clicked", 
> 	           (GtkSignalFunc) gtk_exit, NULL);
> 
> The problem is that functions called from the signal handler have
> conform to a specific prototype.  I'm not entirely sure what that
> is.. but I have managed to get things working using a function like
> this...

actualy, if you connect it like this:

gtk_signal_connect_object(GTK_OBJECT(button),
			  "clicked",
			  GTK_SIGNAL_FUNC(gtk_widget_destroy),
			  GTK_OBJECT(window));
gtk_signal_connect(GTK_OBJECT(window),
		   "destroy",
		   GTK_SIGNAL_FUNC(gtk_main_quit),
		   NULL);

the application exits also if you destroy the window through the
window manager, because this just breaks the main loop in main().
so main should look something like this:


int
main    (int    argc,
         char   *argv[])
{
	... some initialization stuff
	
	/* gtk's main loop
	*/
	gtk_main();
	
	
        /* exit program (optional call to gtk_exit() )
        */
        /* gtk_exit(0); */
        
        
        /* exit point if gtk_exit() has not been called,
         * suppress compiler warnings otherwise
        */
        return 0;
}



---
ciaoTJ

Tim.Janik@Hamburg.Netsurf.DE	[signature: <CENS||ED>]



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