[gtk-mac-integration] Replace 10.6-only NSRunningApplication with NSBundle



commit 37ceb03080d76eef10211eeb7ee99f62aaa3e02a
Author: John Ralls <jralls ceridwen us>
Date:   Sun Sep 29 15:25:51 2013 -0700

    Replace 10.6-only NSRunningApplication with NSBundle

 src/gtkosxapplication_quartz.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/gtkosxapplication_quartz.c b/src/gtkosxapplication_quartz.c
index f645a29..8226dc1 100644
--- a/src/gtkosxapplication_quartz.c
+++ b/src/gtkosxapplication_quartz.c
@@ -186,7 +186,9 @@ create_apple_menu (GtkosxApplication *self)
                                                @"GtkOSXApplication",
                                                @"Services Menu title");
   NSMenu *menuServices = [[[NSMenu alloc] initWithTitle: title] autorelease];
-  NSString *appname = [[[NSRunningApplication currentApplication] localizedName] capitalizedString];
+  NSString *appname = [[[[NSBundle mainBundle] localizedInfoDictionary] objectForKey:@"CFBundleDisplayName"] 
capitalizedString];
+  if (appname == nil)
+    appname = [[[NSProcessInfo processInfo] processName] capitalizedString];
   [NSApp setServicesMenu: menuServices];
 
   [app_menu addItem: [NSMenuItem separatorItem]];
@@ -748,7 +750,11 @@ gtkosx_application_insert_app_menu_item (GtkosxApplication* self,
   if (index == 0)
     {
       gchar *label = gtk_menu_item_get_label (GTK_MENU_ITEM (item));
-      gchar *appname = [[[[NSRunningApplication currentApplication] localizedName] capitalizedString] 
UTF8String];
+      gchar *appname;
+      NSString *nsappname = [[[NSBundle mainBundle] localizedInfoDictionary] 
objectForKey:@"CFBundleDisplayName"];
+      if (nsappname == nil)
+       nsappname = [[NSProcessInfo processInfo] processName];
+      appname = [[nsappname capitalizedString] UTF8String];
       gtk_menu_item_set_label (GTK_MENU_ITEM (item), g_strdup_printf ("%s %s", label, appname));
     }
 


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