[haiku-commits] r40967 - in haiku/trunk: headers/private/shared src/kits/locale src/kits/shared

  • From: jonas@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 15 Mar 2011 22:00:16 +0100 (CET)

Author: kirilla
Date: 2011-03-15 22:00:16 +0100 (Tue, 15 Mar 2011)
New Revision: 40967
Changeset: http://dev.haiku-os.org/changeset/40967

Modified:
   haiku/trunk/headers/private/shared/AboutMenuItem.h
   haiku/trunk/src/kits/locale/Jamfile
   haiku/trunk/src/kits/shared/AboutMenuItem.cpp
Log:
Simplifying the BAboutMenuItem and adding it properly to the locale kit's 
DoCatalogs list.

Modified: haiku/trunk/headers/private/shared/AboutMenuItem.h
===================================================================
--- haiku/trunk/headers/private/shared/AboutMenuItem.h  2011-03-15 20:52:25 UTC 
(rev 40966)
+++ haiku/trunk/headers/private/shared/AboutMenuItem.h  2011-03-15 21:00:16 UTC 
(rev 40967)
@@ -11,7 +11,7 @@
 
 class BAboutMenuItem : public BMenuItem {
 public:
-                                                       BAboutMenuItem(const 
char* appName);
+                                                       BAboutMenuItem();
 };
 
 

Modified: haiku/trunk/src/kits/locale/Jamfile
===================================================================
--- haiku/trunk/src/kits/locale/Jamfile 2011-03-15 20:52:25 UTC (rev 40966)
+++ haiku/trunk/src/kits/locale/Jamfile 2011-03-15 21:00:16 UTC (rev 40967)
@@ -63,14 +63,16 @@
        : 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

Modified: haiku/trunk/src/kits/shared/AboutMenuItem.cpp
===================================================================
--- haiku/trunk/src/kits/shared/AboutMenuItem.cpp       2011-03-15 20:52:25 UTC 
(rev 40966)
+++ haiku/trunk/src/kits/shared/AboutMenuItem.cpp       2011-03-15 21:00:16 UTC 
(rev 40967)
@@ -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 @@
 #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 @@
        }
 
        BString label = string;
-       label.ReplaceFirst("%app%", appName);
+       if (name != NULL)
+               label.ReplaceFirst("%app%", name);
+       else
+               label.ReplaceFirst("%app%", "(NULL)");
        SetLabel(label.String());
 }


Other related posts:

  • » [haiku-commits] r40967 - in haiku/trunk: headers/private/shared src/kits/locale src/kits/shared - jonas