summaryrefslogtreecommitdiffstats
path: root/Settings.c
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2018-01-28 17:06:53 -0200
committerHisham Muhammad <hisham@gobolinux.org>2018-01-30 12:59:11 -0200
commit5ea24db29cad0cbd437079a97ac50e1362062b42 (patch)
treeb23609d54ff7a9d4df73842163a4507b07ae7433 /Settings.c
parent42d50f1b9f0868d87b933569365584ea165587a2 (diff)
Screens: Fix "New Screen" option
Diffstat (limited to 'Settings.c')
-rw-r--r--Settings.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Settings.c b/Settings.c
index 31d344ba..afc76a77 100644
--- a/Settings.c
+++ b/Settings.c
@@ -246,7 +246,7 @@ static void readFields(ProcessField* fields, int* flags, const char* line) {
String_freeArray(ids);
}
-static void Settings_readScreen(Settings* this, const char* name, const char* line) {
+ScreenSettings* Settings_newScreen(Settings* this, const char* name, const char* line) {
ScreenSettings* ss = xCalloc(sizeof(ScreenSettings), 1);
ss->name = xStrdup(name);
ss->fields = xCalloc(Platform_numberOfFields+1, sizeof(ProcessField));
@@ -258,11 +258,12 @@ static void Settings_readScreen(Settings* this, const char* name, const char* li
this->nScreens++;
this->screens = xRealloc(this->screens, sizeof(ScreenSettings*) * (this->nScreens + 1));
this->screens[this->nScreens] = NULL;
+ return ss;
}
static void Settings_defaultScreens(Settings* this) {
- Settings_readScreen(this, "Default", "PID USER PRIORITY NICE M_SIZE M_RESIDENT M_SHARE STATE PERCENT_CPU PERCENT_MEM TIME Command");
- Settings_readScreen(this, "I/O", "PID IO_PRIORITY USER IO_READ_RATE IO_WRITE_RATE Command");
+ Settings_newScreen(this, "Default", "PID USER PRIORITY NICE M_SIZE M_RESIDENT M_SHARE STATE PERCENT_CPU PERCENT_MEM TIME Command");
+ Settings_newScreen(this, "I/O", "PID IO_PRIORITY USER IO_READ_RATE IO_WRITE_RATE Command");
}
static bool Settings_read(Settings* this, const char* fileName) {
@@ -342,7 +343,7 @@ static bool Settings_read(Settings* this, const char* fileName) {
Settings_readMeterModes(this, option[1], 1);
readMeters = true;
} else if (strncmp(option[0], "screen:", 7) == 0) {
- Settings_readScreen(this, option[0] + 7, option[1]);
+ Settings_newScreen(this, option[0] + 7, option[1]);
} else if (String_eq(option[0], ".tree_view")) {
if (this->nScreens > 0) {
this->screens[this->nScreens - 1]->treeView = atoi(option[1]);

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