summaryrefslogtreecommitdiff
path: root/Applications/SystemMonitor
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-04-21 17:19:27 +0200
committerAndreas Kling <kling@serenityos.org>2020-04-21 17:21:28 +0200
commit705cee528a803b1671d16eeaf222d3318708500b (patch)
treea80dc8135ed1a15fddd4c26c0e52fd2c241820e7 /Applications/SystemMonitor
parent1032ae014053ccf5482b78465f02554165212ba9 (diff)
downloadserenity-705cee528a803b1671d16eeaf222d3318708500b.zip
LibGUI: Make it easier to create checkable GUI::Actions
This patch adds GUI::Action::create_checkable() helpers that work just like the existing create() helpers, but the actions become checkable(!) Clients are no longer required to manage the checked state of their actions manually, but instead they will be checked/unchecked as needed by GUI::Action itself before the activation hook is fired.
Diffstat (limited to 'Applications/SystemMonitor')
-rw-r--r--Applications/SystemMonitor/main.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/Applications/SystemMonitor/main.cpp b/Applications/SystemMonitor/main.cpp
index eefd7a4980..ca2a27afce 100644
--- a/Applications/SystemMonitor/main.cpp
+++ b/Applications/SystemMonitor/main.cpp
@@ -200,11 +200,9 @@ int main(int argc, char** argv)
frequency_action_group.set_exclusive(true);
auto make_frequency_action = [&](auto& title, int interval, bool checked = false) {
- auto action = GUI::Action::create(title, [&refresh_timer, interval](auto& action) {
+ auto action = GUI::Action::create_checkable(title, [&refresh_timer, interval](auto&) {
refresh_timer.restart(interval);
- action.set_checked(true);
});
- action->set_checkable(true);
action->set_checked(checked);
frequency_action_group.add_action(*action);
frequency_menu.add_action(*action);