- 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:
François Revol
2008-04-17 22:04:18 +00:00
parent 03aaa278a5
commit 74158bb474
9 changed files with 220 additions and 4 deletions
+9 -1
View File
@@ -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!