diff options
author | ClementTsang <cjhtsang@uwaterloo.ca> | 2021-08-23 18:27:50 -0400 |
---|---|---|
committer | ClementTsang <cjhtsang@uwaterloo.ca> | 2021-08-24 16:03:23 -0400 |
commit | 88ebcab8f21ce6950c4d6292f1972c6d6e7e44e4 (patch) | |
tree | f29b51ac3c6182030768b3b7282fcf8e210bf704 /src/app | |
parent | 64c6d0c8984616b2b1dba32ea2fc18d46caf540a (diff) |
refactor: add glue to prep for the transition
Write some glue code to transition from the old code to the new one.
Diffstat (limited to 'src/app')
-rw-r--r-- | src/app/widgets/battery.rs | 6 | ||||
-rw-r--r-- | src/app/widgets/cpu.rs | 6 | ||||
-rw-r--r-- | src/app/widgets/disk.rs | 6 | ||||
-rw-r--r-- | src/app/widgets/mem.rs | 6 | ||||
-rw-r--r-- | src/app/widgets/mod.rs | 2 | ||||
-rw-r--r-- | src/app/widgets/net.rs | 12 | ||||
-rw-r--r-- | src/app/widgets/process.rs | 6 | ||||
-rw-r--r-- | src/app/widgets/temp.rs | 6 |
8 files changed, 42 insertions, 8 deletions
diff --git a/src/app/widgets/battery.rs b/src/app/widgets/battery.rs index 64236163..11459870 100644 --- a/src/app/widgets/battery.rs +++ b/src/app/widgets/battery.rs @@ -53,4 +53,8 @@ impl Component for BatteryTable { } } -impl Widget for BatteryTable {} +impl Widget for BatteryTable { + fn get_pretty_name(&self) -> &'static str { + "Battery" + } +} diff --git a/src/app/widgets/cpu.rs b/src/app/widgets/cpu.rs index ceb5e0d5..fabeed5c 100644 --- a/src/app/widgets/cpu.rs +++ b/src/app/widgets/cpu.rs @@ -124,4 +124,8 @@ impl Component for CpuGraph { } } -impl Widget for CpuGraph {} +impl Widget for CpuGraph { + fn get_pretty_name(&self) -> &'static str { + "CPU" + } +} diff --git a/src/app/widgets/disk.rs b/src/app/widgets/disk.rs index 7ae70229..18fd7704 100644 --- a/src/app/widgets/disk.rs +++ b/src/app/widgets/disk.rs @@ -73,4 +73,8 @@ impl Component for DiskTable { } } -impl Widget for DiskTable {} +impl Widget for DiskTable { + fn get_pretty_name(&self) -> &'static str { + "Disk" + } +} diff --git a/src/app/widgets/mem.rs b/src/app/widgets/mem.rs index a11d48a0..dc23f244 100644 --- a/src/app/widgets/mem.rs +++ b/src/app/widgets/mem.rs @@ -74,4 +74,8 @@ impl Component for MemGraph { } } -impl Widget for MemGraph {} +impl Widget for MemGraph { + fn get_pretty_name(&self) -> &'static str { + "Memory" + } +} diff --git a/src/app/widgets/mod.rs b/src/app/widgets/mod.rs index a80aa5dc..5920aabb 100644 --- a/src/app/widgets/mod.rs +++ b/src/app/widgets/mod.rs @@ -92,6 +92,8 @@ pub trait Widget { fn handle_widget_selection_down(&mut self) -> SelectionAction { SelectionAction::NotHandled } + + fn get_pretty_name(&self) -> &'static str; } /// The "main" widgets that are used by bottom to display information! diff --git a/src/app/widgets/net.rs b/src/app/widgets/net.rs index e2bd3db7..8be2f106 100644 --- a/src/app/widgets/net.rs +++ b/src/app/widgets/net.rs @@ -145,7 +145,11 @@ impl Component for NetGraph { } } -impl Widget for NetGraph {} +impl Widget for NetGraph { + fn get_pretty_name(&self) -> &'static str { + "Network" + } +} /// A widget denoting network usage via a graph and a separate, single row table. This is built on [`NetGraph`], /// and the main difference is that it also contains a bounding box for the graph + text. @@ -186,4 +190,8 @@ impl Component for OldNetGraph { } } -impl Widget for OldNetGraph {} +impl Widget for OldNetGraph { + fn get_pretty_name(&self) -> &'static str { + "Network" + } +} diff --git a/src/app/widgets/process.rs b/src/app/widgets/process.rs index 48070f11..b5357ddd 100644 --- a/src/app/widgets/process.rs +++ b/src/app/widgets/process.rs @@ -811,4 +811,8 @@ impl Component for ProcessManager { } } -impl Widget for ProcessManager {} +impl Widget for ProcessManager { + fn get_pretty_name(&self) -> &'static str { + "Processes" + } +} diff --git a/src/app/widgets/temp.rs b/src/app/widgets/temp.rs index 1234e149..ef54dab6 100644 --- a/src/app/widgets/temp.rs +++ b/src/app/widgets/temp.rs @@ -73,4 +73,8 @@ impl Component for TempTable { } } -impl Widget for TempTable {} +impl Widget for TempTable { + fn get_pretty_name(&self) -> &'static str { + "Temperature" + } +} |