Re: Closing an application



Thanks, but my question is still unanswered.
Should we use gtk_exit() or gtk_main_quit  to
terminate an application?
bye

shiraz


--- Alejandro_García_Rodríguez <agarcia die upm es>
wrote:
> 	Hi, Shiraz!
> 
> 	The way i have learnt to exit an application is the
> following. I
> will show you in another little code application.
> For further information
> i would read the gtk+2.0 tutorial because you have a
> lot of posibilities
> for doing this according to your requirements.
> 
> #include <gtk/gtk.h>
> int main( int argc,
>           char* argv[] )
> {
>   GtkWidget *window;
>   GtkWidget *button;
> 
>   gtk_init( &argc, &argv );
> 
>   window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
>   g_signal_connect( G_OBJECT (window),
> "delete_event",
>                     G_CALLBACK (gtk_main_quit), NULL
> );
>   g_signal_connect_swapped( G_OBJECT (window),
> "destroy",
>                             G_CALLBACK
> (gtk_main_quit), NULL );
>   gtk_widget_set_size_request (GTK_WIDGET (window),
> 200, 100);
> 
>   button = gtk_button_new_with_label( "quit" );
>   g_signal_connect( G_OBJECT (button), "clicked",
>                     G_CALLBACK (gtk_main_quit), NULL
> );
>   gtk_container_add (GTK_CONTAINER(window), button);
>   gtk_widget_show( button );
> 
>   gtk_widget_show( window );
> 
>   gtk_main( ) ;
>   return 0;
> }
> 
> 
> 						 Yesterday
> 				   ----------------------------------------
> 				   --     Alejandro García Rodríguez     --
> 				   -- e.mail.         agarcia die upm es --
> 				   ----------------------------------------
> 
> On Sun, 6 Apr 2003, Shiraz Baig wrote:
> 
> > Sir,
> > I am trying to ascertain the "exit" method  from
> an
> > application.In the following application, I have
> > defined an event for the button and connected it
> with
> > signal gtk_main_quit. I have not defined this
> > function, separately. I am relying on the
> > system_provided function for this.
> >
> > I have two questions.
> >
> > 1) Is it a proper method of exiting an
> application?
> > 2) Which function call should I use in the button
> > event, out of the two choices avilable, namely
> > "gtk_exit" and "gtk_main_quit"?
> >
> > Here is the code, that I am using.
> >
> > #include <gtk/gtk.h>
> > int main(int argc, char *argv[])
> > {
> >  GtkWidget *window;
> >  GtkWidget *button;
> >
> >  gtk_init(&argc, &argv);
> >  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
> >
> >  button = gtk_button_new_with_label("Quit");
> >  gtk_signal_connect(GTK_OBJECT(button), "clicked",
> >                    GTK_SIGNAL_FUNC
> (gtk_main_quit),
> > NULL);
> >  gtk_container_add (GTK_CONTAINER(window),
> button);
> >  gtk_widget_show(button);
> >
> >  gtk_widget_show(window);
> >  gtk_main();
> >  return 0;
> > }
> > bye
> > shiraz
> >
> >
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! Tax Center - File online, calculators,
> forms, and more
> > http://tax.yahoo.com
> > _______________________________________________
> > gtk-list mailing list
> > gtk-list gnome org
> > http://mail.gnome.org/mailman/listinfo/gtk-list
> >
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com



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