Add watching support for installation location package changes

Can be requested/stopped via BPackageRoster::{Start,Stop}Watching().
The notification message has the what code B_PACKAGE_UPDATE and contains
fields "event", "location", and "change count".
This commit is contained in:
Ingo Weinhold
2014-06-17 20:32:26 +02:00
parent 3f91ba29d9
commit 5c9672edeb
11 changed files with 271 additions and 3 deletions
+22 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2011, Haiku, Inc.
* Copyright 2011-2014, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _PACKAGE__PACKAGE_ROSTER_H_
@@ -34,6 +34,23 @@ class BRepositoryCache;
class BRepositoryConfig;
// watchable events
enum {
B_WATCH_PACKAGE_INSTALLATION_LOCATIONS = 0x0001,
// de-/activation of packages in standard installation locations
};
// notification message "event" field values
enum {
B_INSTALLATION_LOCATION_PACKAGES_CHANGED,
// "location": int32
// the installation location
// (B_PACKAGE_INSTALLATION_LOCATION_{SYSTEM,HOME}
// "change count": int64
// the installation location change count
};
class BPackageRoster {
public:
BPackageRoster();
@@ -68,6 +85,10 @@ public:
BPackageInstallationLocation location,
BPackageInfoSet& packageInfos);
status_t StartWatching(const BMessenger& target,
uint32 eventMask);
status_t StopWatching(const BMessenger& target);
private:
status_t _GetRepositoryPath(BPath* path, bool create,
directory_which whichDir) const;