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
This commit is contained in:
parent
5732d3822b
commit
d7f342e8a3
@ -11,7 +11,7 @@
|
||||
|
||||
class BAboutMenuItem : public BMenuItem {
|
||||
public:
|
||||
BAboutMenuItem(const char* appName);
|
||||
BAboutMenuItem();
|
||||
};
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -9,8 +9,10 @@
|
||||
|
||||
|
||||
#include <AboutMenuItem.h>
|
||||
#include <Application.h>
|
||||
#include <Catalog.h>
|
||||
#include <LocaleBackend.h>
|
||||
#include <Roster.h>
|
||||
#include <String.h>
|
||||
|
||||
|
||||
@ -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());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user