Add the possibility to load all add-ons in a directory immediately.
Rename _HandlePulse to _HandlePendingEntries. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38433 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -40,7 +40,10 @@ public:
|
|||||||
// Note that directories are not watched recursively, and all entries
|
// Note that directories are not watched recursively, and all entries
|
||||||
// are reported as add-ons regardless of their node type (files,
|
// are reported as add-ons regardless of their node type (files,
|
||||||
// directories, symlinks).
|
// directories, symlinks).
|
||||||
virtual status_t AddDirectory(const node_ref* nref);
|
// If sync is true all pending add-on entries are handled immediately.
|
||||||
|
// Including entries from other directories.
|
||||||
|
virtual status_t AddDirectory(const node_ref* nref,
|
||||||
|
bool sync = false);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// hooks for sub-class
|
// hooks for sub-class
|
||||||
@@ -66,7 +69,7 @@ protected:
|
|||||||
virtual void StatChanged(ino_t node, dev_t device);
|
virtual void StatChanged(ino_t node, dev_t device);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _HandlePulse();
|
void _HandlePendingEntries();
|
||||||
void _EntryCreated(add_on_entry_info& info);
|
void _EntryCreated(add_on_entry_info& info);
|
||||||
|
|
||||||
typedef NodeMonitorHandler inherited;
|
typedef NodeMonitorHandler inherited;
|
||||||
|
|||||||
@@ -47,14 +47,14 @@ void
|
|||||||
AddOnMonitorHandler::MessageReceived(BMessage* msg)
|
AddOnMonitorHandler::MessageReceived(BMessage* msg)
|
||||||
{
|
{
|
||||||
if (msg->what == B_PULSE)
|
if (msg->what == B_PULSE)
|
||||||
_HandlePulse();
|
_HandlePendingEntries();
|
||||||
|
|
||||||
inherited::MessageReceived(msg);
|
inherited::MessageReceived(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
AddOnMonitorHandler::AddDirectory(const node_ref* nref)
|
AddOnMonitorHandler::AddDirectory(const node_ref* nref, bool sync)
|
||||||
{
|
{
|
||||||
// Keep the looper thread locked, since this method is likely to be called
|
// Keep the looper thread locked, since this method is likely to be called
|
||||||
// in a thread other than the looper thread. Otherwise we may access the
|
// in a thread other than the looper thread. Otherwise we may access the
|
||||||
@@ -98,6 +98,9 @@ AddOnMonitorHandler::AddDirectory(const node_ref* nref)
|
|||||||
fPendingEntries.push_back(entryInfo);
|
fPendingEntries.push_back(entryInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sync)
|
||||||
|
_HandlePendingEntries();
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,7 +444,7 @@ AddOnMonitorHandler::StatChanged(ino_t node, dev_t device)
|
|||||||
|
|
||||||
//! Process pending entries.
|
//! Process pending entries.
|
||||||
void
|
void
|
||||||
AddOnMonitorHandler::_HandlePulse()
|
AddOnMonitorHandler::_HandlePendingEntries()
|
||||||
{
|
{
|
||||||
BDirectory directory;
|
BDirectory directory;
|
||||||
EntryList::iterator iter = fPendingEntries.begin();
|
EntryList::iterator iter = fPendingEntries.begin();
|
||||||
|
|||||||
Reference in New Issue
Block a user