From d7f342e8a34552248c1b070f04f2db56f2e28db6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sundstr=C3=B6m?= Date: Tue, 15 Mar 2011 21:00:16 +0000 Subject: [PATCH] Simplifying the BAboutMenuItem and adding it properly to the locale kit's DoCatalogs list. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40967 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/shared/AboutMenuItem.h | 2 +- src/kits/locale/Jamfile | 4 +++- src/kits/shared/AboutMenuItem.cpp | 14 ++++++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/headers/private/shared/AboutMenuItem.h b/headers/private/shared/AboutMenuItem.h index 6a1b96c3f6..a389122b7e 100644 --- a/headers/private/shared/AboutMenuItem.h +++ b/headers/private/shared/AboutMenuItem.h @@ -11,7 +11,7 @@ class BAboutMenuItem : public BMenuItem { public: - BAboutMenuItem(const char* appName); + BAboutMenuItem(); }; diff --git a/src/kits/locale/Jamfile b/src/kits/locale/Jamfile index 15ff077e7e..c99ff82b9a 100644 --- a/src/kits/locale/Jamfile +++ b/src/kits/locale/Jamfile @@ -63,14 +63,16 @@ StaticLibrary liblocalestub.a : CatalogStub.cpp ; -SEARCH on [ FGristFiles StringForSize.cpp ] += [ FDirName $(HAIKU_TOP) src kits shared ] ; +SEARCH on [ FGristFiles AboutMenuItem.cpp ] += [ FDirName $(HAIKU_TOP) src kits shared ] ; SEARCH on [ FGristFiles AboutWindow.cpp ] += [ FDirName $(HAIKU_TOP) src kits shared ] ; SEARCH on [ FGristFiles ColorControl.cpp ] += [ FDirName $(HAIKU_TOP) src kits interface ] ; +SEARCH on [ FGristFiles StringForSize.cpp ] += [ FDirName $(HAIKU_TOP) src kits shared ] ; SEARCH on [ FGristFiles TextView.cpp ] += [ FDirName $(HAIKU_TOP) src kits interface ] ; DoCatalogs liblocale.so : system : + AboutMenuItem.cpp AboutWindow.cpp ColorControl.cpp StringForSize.cpp diff --git a/src/kits/shared/AboutMenuItem.cpp b/src/kits/shared/AboutMenuItem.cpp index 32c14bc40b..e3b0ceef85 100644 --- a/src/kits/shared/AboutMenuItem.cpp +++ b/src/kits/shared/AboutMenuItem.cpp @@ -9,8 +9,10 @@ #include +#include #include #include +#include #include @@ -22,10 +24,15 @@ using BPrivate::LocaleBackend; #define B_TRANSLATE_CONTEXT "AboutMenuItem" -BAboutMenuItem::BAboutMenuItem(const char* appName) +BAboutMenuItem::BAboutMenuItem() : BMenuItem("", new BMessage(B_ABOUT_REQUESTED)) { + app_info info; + const char* name = NULL; + if (be_app != NULL && be_app->GetAppInfo(&info) == B_OK) + name = B_TRANSLATE_NOCOLLECT_APP_NAME(info.ref.name); + // we need to translate some strings, and in order to do so, we need // to use the LocaleBackend to reach liblocale.so if (gLocaleBackend == NULL) @@ -37,6 +44,9 @@ BAboutMenuItem::BAboutMenuItem(const char* appName) } BString label = string; - label.ReplaceFirst("%app%", appName); + if (name != NULL) + label.ReplaceFirst("%app%", name); + else + label.ReplaceFirst("%app%", "(NULL)"); SetLabel(label.String()); }