Re: [Gtk-osx-users] How to handle the standard menuitem 'quit'?

On Sep 20, 2010, at 2:51 AM, Zbigniew Diaczyszyn wrote:

> I am using ige-mac-integration 0.9.2 but to my opinion there is no 
> change in in 0.9.5 regarding the 'quit' menu.
> a)
> Because the Mac application menu is managed by my Tcl extension I need 
> to have control over the quit process (there is still a tcl loop besides 
> the gtk loop  ...)
> For the 'quit' action I took the example in the file test-integrate.c 
> refering to object 'GtkOSXApplication *GtkOSXMacmenu':
> // --- begin ---
> static gboolean
> app_should_quit_cb (GtkOSXApplication *app, gpointer data)
> {
>   // do my exit stuff
>   return FALSE;
> }
> g_signal_connect(GtkOSXMacmenu, "NSApplicationBlockTermination",
> 		     G_CALLBACK(app_should_quit_cb), NULL);
> // --- end
> It works fine though I would like to ask if this is the (only) correct 
> way to catch the quit action in regard to Aqua?
> b)
> How can I change the *labeltext* 'quit', e.g. to a 'quit my_app' or a 
> translation?

a: Quit is handled directly by OSX, so you have to do it their way. The signals that gtkosxapplication provides make the OSX notification and response available to Gtk+ code. If you'd rather, you can write your own cocoa application delegate and register it -- but you'd better know what you're doing.

b: The "Quit" menu label is at present hard-coded. The easy way to change it is to just edit that string in ige-mac-integration/src/gtkosxapplication_quartz.c at line 208 and the corresponding translations in the message files in ige-mac-integration/strings. It would be better, I suppose, to get the application name from the bundle and insert it, as OSX does with the built-in menu. Perhaps I'll add that at some point when time permits.

John Ralls

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