Re: Closing a gtk app from a menu



On Sat, 5 Aug 2000, Ian Thompson-Bell wrote:

> In a simple App it is easy to exit a programme either via the window
> close button or a menu option named quit which is connected to
> gtk-main-quit().  However, in most apps it is desirable to check the
> user actually wants to exit before shutting down the programme.  Via the
> window close button this is straightforward - you just connect a
> callback to the delete event and return true or false as appropriate.
> gtk_main_quit can then be connected to the destroy event which I
> understand is sent if the delete event callback returns FALSE.  The
> question I have is how to achieve the same behaviour from a menu
> selection.  I cannot connect it directly to the dlelete event callback
> because the event has not happened and the subsequent destroy event does
> not occur.

 I just don't get your problem - connect a handler for activation of menuitem
that will call the function you connected to be invoked for "delete-event",
check return value and invoke gtk_main_quit() if it returned FALSE.
 
> Ian

 Best regards,
  -Vlad





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