From 99e5e3fd0837214e0586254b6625dde46ad238b0 Mon Sep 17 00:00:00 2001 From: Humdinger Date: Sat, 8 Jul 2017 18:51:04 +0200 Subject: [PATCH] Package daemon notifications * Sentence casing * Localize notification texts in the package kit * Have "Package daemon" as group name and "Warning" as title * Use ::BPrivate in Bitmap.h to solve an ambiguity (as pointed out by PulkoMandy). Though not needed for my changes any more, since a the icon of the notifying app is now shown by default. Fixes #13590. --- headers/os/interface/Bitmap.h | 2 +- src/kits/package/Jamfile | 6 ++++++ src/kits/package/manager/PackageManager.cpp | 24 ++++++++++++--------- src/servers/package/Jamfile | 1 + src/servers/package/PackageManager.cpp | 7 ++++-- 5 files changed, 27 insertions(+), 13 deletions(-) diff --git a/headers/os/interface/Bitmap.h b/headers/os/interface/Bitmap.h index d519166cda..aa5801970d 100644 --- a/headers/os/interface/Bitmap.h +++ b/headers/os/interface/Bitmap.h @@ -114,7 +114,7 @@ public: private: friend class BView; friend class BApplication; - friend class BPrivate::BPrivateScreen; + friend class ::BPrivate::BPrivateScreen; friend class Private; virtual status_t Perform(perform_code d, void* arg); diff --git a/src/kits/package/Jamfile b/src/kits/package/Jamfile index 9063876059..dd9a0d1163 100644 --- a/src/kits/package/Jamfile +++ b/src/kits/package/Jamfile @@ -143,3 +143,9 @@ for architectureObject in [ MultiArchSubDirSetup ] { } HaikuSubInclude solver ; + +DoCatalogs libpackage.so + x-vnd.Haiku-libpackage + : + PackageManager.cpp +; diff --git a/src/kits/package/manager/PackageManager.cpp b/src/kits/package/manager/PackageManager.cpp index 4cafea4b2e..a5fc8db394 100644 --- a/src/kits/package/manager/PackageManager.cpp +++ b/src/kits/package/manager/PackageManager.cpp @@ -10,6 +10,7 @@ #include +#include #include #include #include @@ -32,6 +33,9 @@ #include "PackageManagerUtils.h" +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "PackageManagerKit" + using BPackageKit::BPrivate::FetchFileJob; using BPackageKit::BPrivate::ValidateChecksumJob; @@ -126,7 +130,7 @@ BPackageManager::Init(uint32 flags) error = roster.GetRepositoryNames(repositoryNames); if (error != B_OK) { fUserInteractionHandler->Warn(error, - "Failed to get repository names"); + B_TRANSLATE("Failed to get repository names")); } int32 repositoryNameCount = repositoryNames.CountStrings(); @@ -619,7 +623,7 @@ BPackageManager::_CommitPackageChanges(Transaction& transaction) .GetEntry(&transactionDirectoryEntry)) != B_OK || (error = transactionDirectoryEntry.Remove()) != B_OK) { fUserInteractionHandler->Warn(error, - "Failed to remove transaction directory"); + B_TRANSLATE("Failed to remove transaction directory")); } fUserInteractionHandler->ProgressApplyingChangesDone( @@ -669,8 +673,8 @@ BPackageManager::_FindBasePackage(const PackageList& packages, } if (basePackage == NULL) { - fUserInteractionHandler->Warn(B_OK, "Package %s-%s doesn't have a " - "matching requires for its base package \"%s\"", + fUserInteractionHandler->Warn(B_OK, B_TRANSLATE("Package %s-%s " + "doesn't have a matching requires for its base package \"%s\""), info.Name().String(), info.Version().ToString().String(), info.BasePackage().String()); return -1; @@ -711,16 +715,16 @@ BPackageManager::_AddRemoteRepository(BPackageRoster& roster, const char* name, BRepositoryConfig config; status_t error = roster.GetRepositoryConfig(name, &config); if (error != B_OK) { - fUserInteractionHandler->Warn(error, - "Failed to get config for repository \"%s\". Skipping.", name); + fUserInteractionHandler->Warn(error, B_TRANSLATE( + "Failed to get config for repository \"%s\". Skipping."), name); return; } BRepositoryCache cache; error = _GetRepositoryCache(roster, config, refresh, cache); if (error != B_OK) { - fUserInteractionHandler->Warn(error, - "Failed to get cache for repository \"%s\". Skipping.", name); + fUserInteractionHandler->Warn(error, B_TRANSLATE( + "Failed to get cache for repository \"%s\". Skipping."), name); return; } @@ -744,8 +748,8 @@ BPackageManager::_GetRepositoryCache(BPackageRoster& roster, status_t error = RefreshRepository(config); if (error != B_OK) { - fUserInteractionHandler->Warn(error, - "Refreshing repository \"%s\" failed", config.Name().String()); + fUserInteractionHandler->Warn(error, B_TRANSLATE( + "Refreshing repository \"%s\" failed"), config.Name().String()); } return roster.GetRepositoryCache(config.Name(), &_cache); diff --git a/src/servers/package/Jamfile b/src/servers/package/Jamfile index ee33ef7c68..1c0e5c94c6 100644 --- a/src/servers/package/Jamfile +++ b/src/servers/package/Jamfile @@ -33,6 +33,7 @@ Server package_daemon DoCatalogs package_daemon : x-vnd.haiku-package_daemon : + PackageManager.cpp ProblemWindow.cpp ResultWindow.cpp ; diff --git a/src/servers/package/PackageManager.cpp b/src/servers/package/PackageManager.cpp index adaffff756..dc94ea819a 100644 --- a/src/servers/package/PackageManager.cpp +++ b/src/servers/package/PackageManager.cpp @@ -6,6 +6,7 @@ #include "PackageManager.h" +#include #include #include #include @@ -24,12 +25,13 @@ #include "Root.h" #include "Volume.h" +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "PackageManager" using BPackageKit::BManager::BPrivate::BAbortedByUserException; using BPackageKit::BManager::BPrivate::BFatalErrorException; using BPackageKit::BManager::BPrivate::BRepositoryBuilder; - PackageManager::PackageManager(Root* root, Volume* volume) : BPackageManager(volume->Location(), this, this), @@ -306,7 +308,8 @@ PackageManager::Warn(status_t error, const char* format, ...) message << BString().SetToFormat(": %s", strerror(error)); BNotification notification(B_ERROR_NOTIFICATION); - notification.SetTitle("Package Daemon"); + notification.SetGroup(B_TRANSLATE("Package daemon")); + notification.SetTitle(B_TRANSLATE("Warning")); notification.SetContent(message); notification.Send(); }