Ticket #13590: 0001-Package-daemon-notifications.patch

File 0001-Package-daemon-notifications.patch, 3.5 KB (added by humdinger, 3 years ago)

patch (incl. build failure)

  • src/servers/package/Jamfile

    From 871b942c7c87dde3a9ec0ade42aa3bbe81b36aee Mon Sep 17 00:00:00 2001
    From: Humdinger <humdingerb@gmail.com>
    Date: Sat, 8 Jul 2017 18:51:04 +0200
    Subject: [PATCH] Package daemon notifications
    
    * Sentence casing
    * Adding package daemon icon to notifications
    * Have "Package daemon" as group name and "Warning" as title
    
    Addresses part of #13590.
    ---
     src/servers/package/Jamfile            |  1 +
     src/servers/package/PackageManager.cpp | 26 ++++++++++++++++++++++++--
     src/servers/package/PackageManager.h   |  3 +++
     3 files changed, 28 insertions(+), 2 deletions(-)
    
    diff --git a/src/servers/package/Jamfile b/src/servers/package/Jamfile
    index ee33ef7..1c0e5c9 100644
    a b Server package_daemon  
    3333DoCatalogs package_daemon :
    3434    x-vnd.haiku-package_daemon
    3535    :
     36    PackageManager.cpp
    3637    ProblemWindow.cpp
    3738    ResultWindow.cpp
    3839;
  • src/servers/package/PackageManager.cpp

    diff --git a/src/servers/package/PackageManager.cpp b/src/servers/package/PackageManager.cpp
    index adaffff..77d9486 100644
    a b  
    66
    77#include "PackageManager.h"
    88
     9#include <Catalog.h>
     10#include <NodeInfo.h>
    911#include <Notification.h>
    1012#include <package/DownloadFileRequest.h>
    1113#include <package/RefreshRepositoryRequest.h>
     
    1315#include <package/solver/SolverPackageSpecifierList.h>
    1416#include <package/solver/SolverProblem.h>
    1517#include <package/solver/SolverProblemSolution.h>
     18#include <Roster.h>
    1619
    1720#include <AutoDeleter.h>
    1821#include <package/manager/Exceptions.h>
     
    2427#include "Root.h"
    2528#include "Volume.h"
    2629
     30#undef B_TRANSLATION_CONTEXT
     31#define B_TRANSLATION_CONTEXT "PackageManager"
    2732
    2833using BPackageKit::BManager::BPrivate::BAbortedByUserException;
    2934using BPackageKit::BManager::BPrivate::BFatalErrorException;
    3035using BPackageKit::BManager::BPrivate::BRepositoryBuilder;
    3136
    32 
    3337PackageManager::PackageManager(Root* root, Volume* volume)
    3438    :
    3539    BPackageManager(volume->Location(), this, this),
    PackageManager::Warn(status_t error, const char* format, ...)  
    306310        message << BString().SetToFormat(": %s", strerror(error));
    307311
    308312    BNotification notification(B_ERROR_NOTIFICATION);
    309     notification.SetTitle("Package Daemon");
     313    notification.SetGroup(B_TRANSLATE("Package daemon"));
     314    notification.SetTitle(B_TRANSLATE("Warning"));
    310315    notification.SetContent(message);
     316    BBitmap icon(_GetIcon());
     317    if (icon.IsValid())
     318        notification.SetIcon(&icon);
    311319    notification.Send();
    312320}
    313321
    PackageManager::_InitGui()  
    404412    if (server == NULL || server->InitGUIContext() != B_OK)
    405413        throw BFatalErrorException("failed to initialize the GUI");
    406414}
     415
     416
     417BBitmap
     418PackageManager::_GetIcon()
     419{
     420    int32 iconSize = B_LARGE_ICON;
     421    BBitmap icon(BRect(0, 0, iconSize - 1, iconSize - 1), 0, B_RGBA32);
     422    team_info teamInfo;
     423    get_team_info(B_CURRENT_TEAM, &teamInfo);
     424    app_info appInfo;
     425    be_roster->GetRunningAppInfo(teamInfo.team, &appInfo);
     426    BNodeInfo::GetTrackerIcon(&appInfo.ref, &icon, icon_size(iconSize));
     427    return icon;
     428}
  • src/servers/package/PackageManager.h

    diff --git a/src/servers/package/PackageManager.h b/src/servers/package/PackageManager.h
    index 123890d..e006c3a 100644
    a b  
    99#include <map>
    1010#include <set>
    1111
     12#include <Bitmap.h>
    1213#include <package/Context.h>
    1314#include <package/Job.h>
    1415
    private:  
    99100
    100101            void                _InitGui();
    101102
     103            BBitmap             _GetIcon();
     104
    102105private:
    103106            Root*               fRoot;
    104107            Volume*             fVolume;