2008-10-19 17:17:29 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2004-2008, Haiku, Inc. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2004-02-01 08:50:00 +03:00
|
|
|
#ifndef _ADD_ON_MONITOR_HANDLER_H
|
|
|
|
#define _ADD_ON_MONITOR_HANDLER_H
|
|
|
|
|
|
|
|
#include <list>
|
2008-10-19 17:17:29 +04:00
|
|
|
|
2004-02-01 08:50:00 +03:00
|
|
|
#include "NodeMonitorHandler.h"
|
|
|
|
|
2008-10-19 17:17:29 +04:00
|
|
|
|
2004-02-01 08:50:00 +03:00
|
|
|
namespace BPrivate {
|
|
|
|
namespace Storage {
|
|
|
|
|
|
|
|
struct add_on_entry_info {
|
|
|
|
char name[B_FILE_NAME_LENGTH];
|
|
|
|
node_ref nref;
|
|
|
|
node_ref dir_nref;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct add_on_directory_info {
|
|
|
|
node_ref nref;
|
|
|
|
std::list<add_on_entry_info> entries;
|
|
|
|
};
|
|
|
|
|
|
|
|
class AddOnMonitorHandler : public NodeMonitorHandler {
|
|
|
|
public:
|
2008-10-19 17:17:29 +04:00
|
|
|
AddOnMonitorHandler(const char* name = NULL);
|
|
|
|
virtual ~AddOnMonitorHandler();
|
2004-02-01 08:50:00 +03:00
|
|
|
|
2008-10-19 17:17:29 +04:00
|
|
|
virtual void MessageReceived(BMessage* msg);
|
2004-02-01 08:50:00 +03:00
|
|
|
|
2008-10-19 17:17:29 +04:00
|
|
|
// supply the add-on directories here, in the order you want them checked
|
|
|
|
virtual status_t AddDirectory(const node_ref* nref);
|
2004-02-01 08:50:00 +03:00
|
|
|
|
|
|
|
protected:
|
|
|
|
// hooks for subclass
|
2008-10-19 17:17:29 +04:00
|
|
|
virtual void AddOnCreated(const add_on_entry_info* entryInfo);
|
|
|
|
virtual void AddOnEnabled(const add_on_entry_info* entryInfo);
|
|
|
|
virtual void AddOnDisabled(const add_on_entry_info* entryInfo);
|
|
|
|
virtual void AddOnRemoved(const add_on_entry_info* entryInfo);
|
2004-02-01 08:50:00 +03:00
|
|
|
|
|
|
|
protected:
|
2008-10-19 17:17:29 +04:00
|
|
|
virtual void EntryCreated(const char* name, ino_t directory,
|
|
|
|
dev_t device, ino_t node);
|
|
|
|
virtual void EntryRemoved(ino_t directory, dev_t device, ino_t node);
|
|
|
|
virtual void EntryMoved(const char* name, ino_t fromDirectory,
|
|
|
|
ino_t toDirectory, dev_t device, ino_t node);
|
2004-02-01 08:50:00 +03:00
|
|
|
|
|
|
|
private:
|
2008-10-19 17:17:29 +04:00
|
|
|
typedef NodeMonitorHandler inherited;
|
|
|
|
|
|
|
|
void _HandlePulse();
|
2004-02-01 08:50:00 +03:00
|
|
|
|
2008-10-18 19:45:57 +04:00
|
|
|
std::list<add_on_directory_info> fDirectories;
|
|
|
|
std::list<add_on_entry_info> fPendingEntries;
|
|
|
|
std::list<add_on_entry_info> fFormerEntries;
|
2004-02-01 08:50:00 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}; // namespace Storage
|
|
|
|
}; // namespace BPrivate
|
|
|
|
|
|
|
|
using namespace BPrivate::Storage;
|
|
|
|
|
2008-10-19 17:17:29 +04:00
|
|
|
#endif // _ADD_ON_MONITOR_HANDLER_H
|