[gtk+/wip/quartzwork: 8/11] quartz menu: add a hack for application name
- From: Ryan Lortie <desrt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/quartzwork: 8/11] quartz menu: add a hack for application name
- Date: Mon, 16 Dec 2013 18:45:23 +0000 (UTC)
commit d435ccc5c8ed547872f859d056bf2e66853c25b9
Author: Ryan Lortie <desrt desrt ca>
Date: Mon Dec 16 11:05:17 2013 -0500
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.
gtk/gtkapplication-quartz-menu.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkapplication-quartz-menu.c b/gtk/gtkapplication-quartz-menu.c
index 6f334cb..625da39 100644
--- a/gtk/gtkapplication-quartz-menu.c
+++ b/gtk/gtkapplication-quartz-menu.c
@@ -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];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]