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.
This commit is contained in:
Humdinger 2017-07-08 18:51:04 +02:00
parent ec89bb26a7
commit 99e5e3fd08
5 changed files with 27 additions and 13 deletions

View File

@ -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);

View File

@ -143,3 +143,9 @@ for architectureObject in [ MultiArchSubDirSetup ] {
}
HaikuSubInclude solver ;
DoCatalogs libpackage.so
x-vnd.Haiku-libpackage
:
PackageManager.cpp
;

View File

@ -10,6 +10,7 @@
#include <package/manager/PackageManager.h>
#include <Catalog.h>
#include <Directory.h>
#include <package/CommitTransactionResult.h>
#include <package/DownloadFileRequest.h>
@ -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);

View File

@ -33,6 +33,7 @@ Server package_daemon
DoCatalogs package_daemon :
x-vnd.haiku-package_daemon
:
PackageManager.cpp
ProblemWindow.cpp
ResultWindow.cpp
;

View File

@ -6,6 +6,7 @@
#include "PackageManager.h"
#include <Catalog.h>
#include <Notification.h>
#include <package/DownloadFileRequest.h>
#include <package/RefreshRepositoryRequest.h>
@ -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();
}