diff options
author | Nathan Scott <nathans@redhat.com> | 2023-08-22 16:11:05 +1000 |
---|---|---|
committer | Nathan Scott <nathans@redhat.com> | 2023-08-30 13:11:57 +1000 |
commit | 0f751e991d399769fb8d7800f7c4bccec2ca7f60 (patch) | |
tree | 34cd7838f7ebf51049816f9acb6a63cea175af06 /CommandLine.c | |
parent | 68f4f10f012d11bd57bb725fe4113b2af937fc1d (diff) |
Introduce Row and Table classes for screens beyond top-processes
This commit refactors the Process and ProcessList structures such
they each have a new parent - Row and Table, respectively. These
new classes handle screen updates relating to anything that could
be represented in tabular format, e.g. cgroups, filesystems, etc,
without us having to reimplement the display logic repeatedly for
each new entity.
Diffstat (limited to 'CommandLine.c')
-rw-r--r-- | CommandLine.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/CommandLine.c b/CommandLine.c index 3d1f953f..848c7ae7 100644 --- a/CommandLine.c +++ b/CommandLine.c @@ -303,11 +303,11 @@ static void CommandLine_delay(Machine* host, unsigned long millisec) { } static void setCommFilter(State* state, char** commFilter) { - ProcessList* pl = state->host->pl; + Table* table = state->host->activeTable; IncSet* inc = state->mainPanel->inc; IncSet_setFilter(inc, *commFilter); - pl->incFilter = IncSet_filter(inc); + table->incFilter = IncSet_filter(inc); free(*commFilter); *commFilter = NULL; @@ -334,8 +334,6 @@ int CommandLine_run(int argc, char** argv) { if (!Platform_init()) return 1; - Process_setupColumnWidths(); - UsersTable* ut = UsersTable_new(); Hashtable* dm = DynamicMeters_new(); Hashtable* dc = DynamicColumns_new(); @@ -347,7 +345,7 @@ int CommandLine_run(int argc, char** argv) { Settings* settings = Settings_new(host->activeCPUs, dm, dc); host->settings = settings; - Machine_addList(host, pl); + Machine_addTable(host, &pl->super, true); Header* header = Header_new(host, 2); Header_populateFromSettings(header); @@ -379,7 +377,7 @@ int CommandLine_run(int argc, char** argv) { CRT_init(settings, flags.allowUnicode, flags.iterationsRemaining != -1); MainPanel* panel = MainPanel_new(); - ProcessList_setPanel(pl, (Panel*) panel); + Table_setPanel(&pl->super, (Panel*) panel); MainPanel_updateLabels(panel, settings->ss->treeView, flags.commFilter); @@ -400,13 +398,13 @@ int CommandLine_run(int argc, char** argv) { ScreenManager_add(scr, (Panel*) panel, -1); Machine_scan(host); - ProcessList_scan(pl); + Machine_scanTables(host); CommandLine_delay(host, 75); Machine_scan(host); - ProcessList_scan(pl); + Machine_scanTables(host); if (settings->ss->allBranchesCollapsed) - ProcessList_collapseAllBranches(pl); + Table_collapseAllBranches(&pl->super); ScreenManager_run(scr, NULL, NULL, NULL); @@ -421,7 +419,6 @@ int CommandLine_run(int argc, char** argv) { } Header_delete(header); - ProcessList_delete(pl); Machine_delete(host); ScreenManager_delete(scr); |