quartz menu: add a hack for application name

Add a private hack to allow the insertion of the name of the application
into the label of menu items.

If it appears in the label of any menu item, the string
"`gtk-private-appname`" will be replaced with the name of the
application.

We will use this for the "Hide myapp", "Quit myapp" and "About myapp"
labels typically found on Mac OS programs.
This commit is contained in:
Ryan Lortie
2013-12-16 11:05:17 -05:00
parent 2d7110a2cd
commit 4894dccd9c

View File

@@ -433,8 +433,13 @@ tracker_item_changed (GObject *object,
{
NSString *label = [NSString stringWithUTF8String:gtk_menu_tracker_item_get_label (trackerItem) ? : ""];
NSMutableString *title = [NSMutableString stringWithCapacity:[label length]];
NSRange range;
int i;
range = [label rangeOfString:@"`gtk-private-appname`"];
if (range.location != NSNotFound)
label = [label stringByReplacingCharactersInRange:range withString:[[NSProcessInfo processInfo] processName]];
for (i = 0; i < [label length]; i++)
{
unichar c = [label characterAtIndex:i];