- introduced a SystemInfoHandler class used to watch for stuff when polling isn't needed.
- used it to add a count of running apps (not exactly the same as teams). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25012 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include "ActivityMonitor.h"
|
||||
#include "DataSource.h"
|
||||
#include "SystemInfo.h"
|
||||
#include "SystemInfoHandler.h"
|
||||
|
||||
|
||||
struct data_item {
|
||||
@@ -167,6 +168,7 @@ ActivityView::ActivityView(BMessage* archive)
|
||||
ActivityView::~ActivityView()
|
||||
{
|
||||
delete fOffscreen;
|
||||
delete fSystemInfoHandler;
|
||||
}
|
||||
|
||||
|
||||
@@ -182,6 +184,8 @@ ActivityView::_Init(const BMessage* settings)
|
||||
fDrawInterval = kInitialRefreshInterval * 2;
|
||||
fLastRefresh = 0;
|
||||
fDrawResolution = 1;
|
||||
|
||||
fSystemInfoHandler = new SystemInfoHandler;
|
||||
|
||||
if (settings == NULL
|
||||
|| settings->FindBool("show legend", &fShowLegend) != B_OK)
|
||||
@@ -349,6 +353,8 @@ ActivityView::RemoveAllDataSources()
|
||||
void
|
||||
ActivityView::AttachedToWindow()
|
||||
{
|
||||
Looper()->AddHandler(fSystemInfoHandler);
|
||||
fSystemInfoHandler->StartWatchingStuff();
|
||||
BMessage refresh(kMsgRefresh);
|
||||
fRunner = new BMessageRunner(this, &refresh, fRefreshInterval);
|
||||
|
||||
@@ -359,6 +365,8 @@ ActivityView::AttachedToWindow()
|
||||
void
|
||||
ActivityView::DetachedFromWindow()
|
||||
{
|
||||
fSystemInfoHandler->StopWatchingStuff();
|
||||
Looper()->RemoveHandler(fSystemInfoHandler);
|
||||
delete fRunner;
|
||||
}
|
||||
|
||||
@@ -738,7 +746,7 @@ ActivityView::Draw(BRect /*updateRect*/)
|
||||
void
|
||||
ActivityView::_Refresh()
|
||||
{
|
||||
SystemInfo info;
|
||||
SystemInfo info(fSystemInfoHandler);
|
||||
|
||||
// TODO: run refresh in another thread to decouple it from the UI!
|
||||
|
||||
|
||||
Reference in New Issue
Block a user