[143] in The GTK GIMP ToolKit mailing list archive

home help back first fref pref prev next nref lref last post

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

daemon@ATHENA.MIT.EDU (Tim Janik)
Wed May 14 10:15:22 1997

Date: Wed, 14 May 1997 14:18:25 +0200 (CEST)
From: Tim Janik <Tim.Janik@Hamburg.Netsurf.DE>
To: gtk-list@redhat.com
In-Reply-To: <19970513110905.51527@redhat.com>
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com

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>]

--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null


home help back first fref pref prev next nref lref last post