summaryrefslogtreecommitdiffstats
path: root/TasksMeter.c
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2006-04-10 20:40:38 +0000
committerHisham Muhammad <hisham@gobolinux.org>2006-04-10 20:40:38 +0000
commit33113fe0d73ea3299843b483f108ef5bcfcc944f (patch)
tree4c6b50b3bc6fbe9e1a44dd3b9c56e63571c83d73 /TasksMeter.c
parent34bcf8050e56fc799efb1013cb92ba1b44bd6df1 (diff)
- Overhaul meters implementation;
- add AllCPUsMeter; - because of that, the new .htoprc is incompatible with previous released versions.
Diffstat (limited to 'TasksMeter.c')
-rw-r--r--TasksMeter.c43
1 files changed, 18 insertions, 25 deletions
diff --git a/TasksMeter.c b/TasksMeter.c
index eab21c94..d970de06 100644
--- a/TasksMeter.c
+++ b/TasksMeter.c
@@ -14,33 +14,26 @@ in the source distribution for its full text.
#include "debug.h"
-/*{
-
-typedef struct TasksMeter_ TasksMeter;
-
-struct TasksMeter_ {
- Meter super;
- ProcessList* pl;
+/* private property */
+int TasksMeter_attributes[] = { TASKS_RUNNING };
+
+/* private */
+MeterType TasksMeter = {
+ .setValues = TasksMeter_setValues,
+ .display = TasksMeter_display,
+ .mode = TEXT_METERMODE,
+ .items = 1,
+ .total = 100.0,
+ .attributes = TasksMeter_attributes,
+ .name = "Tasks",
+ .uiName = "Task counter",
+ .caption = "Tasks: "
};
-}*/
-
-TasksMeter* TasksMeter_new(ProcessList* pl) {
- TasksMeter* this = malloc(sizeof(TasksMeter));
- Meter_init((Meter*)this, String_copy("Tasks"), String_copy("Tasks: "), 1);
- ((Meter*)this)->attributes[0] = TASKS_RUNNING;
- ((Object*)this)->display = TasksMeter_display;
- ((Meter*)this)->setValues = TasksMeter_setValues;
- this->pl = pl;
- Meter_setMode((Meter*)this, TEXT);
- return this;
-}
-
-void TasksMeter_setValues(Meter* cast) {
- TasksMeter* this = (TasksMeter*)cast;
- cast->total = this->pl->totalTasks;
- cast->values[0] = this->pl->runningTasks;
- snprintf(cast->displayBuffer.c, 20, "%d/%d", (int) cast->values[0], (int) cast->total);
+void TasksMeter_setValues(Meter* this, char* buffer, int len) {
+ this->total = this->pl->totalTasks;
+ this->values[0] = this->pl->runningTasks;
+ snprintf(buffer, len, "%d/%d", (int) this->values[0], (int) this->total);
}
void TasksMeter_display(Object* cast, RichString* out) {

© 2014-2024 Faster IT GmbH | imprint | privacy policy