Re: [Gtk-osx-users] How to change the application's menubar entry?



On Sep 13, 2010, at 12:59 PM, Zbigniew Diaczyszyn wrote:

> My project is to write Gtk+ bindings to Tcl. 
> 
> Using the gtkosxapplication functions it is possible to create a Mac like menubar and to modify the appmenus menuitems like About, Preferences and so on. This works fine. But:
> 
> As the Gtk functions are called by Tcl the name of the application in the appmenu is always "tclsh".
> 
> In the file gtkosxapplication_quartz.c I studied the lines which are creating the apple menu to see how the apple menu is created:
> 
> -----------------------------
> static GNSMenuItem*
> create_apple_menu (GtkOSXApplication *self)
> {
>  NSMenuItem *menuitem;
>  // Create the application (Apple) menu.
>  NSMenu *app_menu = [[NSMenu alloc] initWithTitle: @"Apple Menu"];
> 
>  NSMenu *menuServices = [[NSMenu alloc] initWithTitle: @"Services"];
>  [NSApp setServicesMenu:menuServices];
> 
> ...
> 
> -----------------------------
> 
> I thought to change the code to something like
> 
> NSMenu *app_menu = [[NSMenu alloc] initWithTitle: applicationname];
> 
> where applicationname could be given by the Tcl commandline but I hesitate to change the source code.
> 
> Is there any 'official' way to set the applicationname?
> 

AFAIK there's no way to do that at runtime: The application name in the menubar is set from outside of the application. The best approach is to bundle your application. The CFBundleName in the bundle's Info.plist will be displayed on the menubar.

Regards,
John Ralls





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