1 /* 2 * Copyright 2007-2011 Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Ryan Leavengood, leavengood@gmail.com 7 * Jonas Sundström, jonas@kirilla.se 8 */ 9 10 11 #include <AboutMenuItem.h> 12 #include <Application.h> 13 #include <Roster.h> 14 #include <String.h> 15 #include <SystemCatalog.h> 16 17 using BPrivate::gSystemCatalog; 18 19 20 #undef B_TRANSLATION_CONTEXT 21 #define B_TRANSLATION_CONTEXT "AboutMenuItem" 22 23 24 BAboutMenuItem::BAboutMenuItem() 25 : 26 BMenuItem("", new BMessage(B_ABOUT_REQUESTED)) 27 { 28 app_info info; 29 const char* name = NULL; 30 if (be_app != NULL && be_app->GetAppInfo(&info) == B_OK) 31 name = B_TRANSLATE_NOCOLLECT_SYSTEM_NAME(info.ref.name); 32 33 const char* string = B_TRANSLATE_MARK("About %app%"); 34 string = gSystemCatalog.GetString(string, "AboutMenuItem"); 35 36 BString label = string; 37 if (name != NULL) 38 label.ReplaceFirst("%app%", name); 39 else 40 label.ReplaceFirst("%app%", "(NULL)"); 41 SetLabel(label.String()); 42 } 43