[haiku-commits] r40956 - in haiku/trunk: headers/private/shared src/kits/shared
- From: jonas@xxxxxxxxxxx
- To: haiku-commits@xxxxxxxxxxxxx
- Date: Tue, 15 Mar 2011 02:04:41 +0100 (CET)
Author: kirilla
Date: 2011-03-15 02:04:41 +0100 (Tue, 15 Mar 2011)
New Revision: 40956
Changeset: http://dev.haiku-os.org/changeset/40956
Added:
haiku/trunk/headers/private/shared/AboutMenuItem.h
haiku/trunk/src/kits/shared/AboutMenuItem.cpp
Modified:
haiku/trunk/src/kits/shared/Jamfile
Log:
Introducing BAboutMenuItem.
Added: haiku/trunk/headers/private/shared/AboutMenuItem.h
===================================================================
--- haiku/trunk/headers/private/shared/AboutMenuItem.h
(rev 0)
+++ haiku/trunk/headers/private/shared/AboutMenuItem.h 2011-03-15 01:04:41 UTC
(rev 40956)
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2011 Haiku, Inc.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef B_ABOUT_MENU_ITEM_H
+#define B_ABOUT_MENU_ITEM_H
+
+
+#include <MenuItem.h>
+
+
+class BAboutMenuItem : public BMenuItem {
+public:
+ BAboutMenuItem(const
char* appName);
+};
+
+
+#endif // B_ABOUT_MENU_ITEM_H
Added: haiku/trunk/src/kits/shared/AboutMenuItem.cpp
===================================================================
--- haiku/trunk/src/kits/shared/AboutMenuItem.cpp
(rev 0)
+++ haiku/trunk/src/kits/shared/AboutMenuItem.cpp 2011-03-15 01:04:41 UTC
(rev 40956)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2007-2011 Haiku, Inc.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ * Ryan Leavengood, leavengood@xxxxxxxxx
+ * Jonas Sundström, jonas@xxxxxxxxxx
+ */
+
+
+#include <AboutMenuItem.h>
+#include <Catalog.h>
+#include <LocaleBackend.h>
+#include <String.h>
+
+
+using BPrivate::gLocaleBackend;
+using BPrivate::LocaleBackend;
+
+
+#undef B_TRANSLATE_CONTEXT
+#define B_TRANSLATE_CONTEXT "AboutMenuItem"
+
+
+BAboutMenuItem::BAboutMenuItem(const char* appName)
+ :
+ BMenuItem("", new BMessage(B_ABOUT_REQUESTED))
+{
+ // 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)
+ LocaleBackend::LoadBackend();
+
+ const char* string = B_TRANSLATE_MARK("About %app%" B_UTF8_ELLIPSIS);
+ if (gLocaleBackend) {
+ string = gLocaleBackend->GetString(string, "AboutMenuItem");
+ }
+
+ BString label = string;
+ label.ReplaceFirst("%app%", appName);
+ SetLabel(label.String());
+}
Modified: haiku/trunk/src/kits/shared/Jamfile
===================================================================
--- haiku/trunk/src/kits/shared/Jamfile 2011-03-14 21:20:42 UTC (rev 40955)
+++ haiku/trunk/src/kits/shared/Jamfile 2011-03-15 01:04:41 UTC (rev 40956)
@@ -13,6 +13,7 @@
UsePrivateHeaders kernel libroot ;
StaticLibrary libshared.a :
+ AboutMenuItem.cpp
AboutWindow.cpp
CalendarView.cpp
ColorQuantizer.cpp
Other related posts:
- » [haiku-commits] r40956 - in haiku/trunk: headers/private/shared src/kits/shared - jonas