From 410ec88ad5918b0919a1ad3d0afb4ca331565a12 Mon Sep 17 00:00:00 2001 From: Sebastian Wiesner Date: Wed, 1 Jan 2025 11:22:12 +0100 Subject: [PATCH] Turn scan network into an app action It never was a window action, semantically: It changed the discovery state of the global app model, and hence affected the entire app. Let's make this apparent by lifting the action to the app, which also removes the redundant property and overall simplifies state tracking. --- resources/gtk/help-overlay.blp | 2 +- resources/gtk/help-overlay.ui | 2 +- resources/ui/turnon-application-window.blp | 6 ++--- resources/ui/turnon-application-window.ui | 6 ++--- src/app.rs | 30 +++++++++++++++------- src/app/widgets/application_window.rs | 13 +--------- 6 files changed, 30 insertions(+), 29 deletions(-) diff --git a/resources/gtk/help-overlay.blp b/resources/gtk/help-overlay.blp index 313e9a5..2a94ca7 100644 --- a/resources/gtk/help-overlay.blp +++ b/resources/gtk/help-overlay.blp @@ -27,7 +27,7 @@ Gtk.ShortcutsWindow help_overlay { Gtk.ShortcutsShortcut { title: C_("shortcut description", "Toggle network scanning"); - accelerator: "F5"; + action-name: "app.scan-network"; } } diff --git a/resources/gtk/help-overlay.ui b/resources/gtk/help-overlay.ui index 58bd643..a257707 100644 --- a/resources/gtk/help-overlay.ui +++ b/resources/gtk/help-overlay.ui @@ -23,7 +23,7 @@ corresponding .blp file and regenerate this file with blueprint-compiler. Toggle network scanning - F5 + app.scan-network diff --git a/resources/ui/turnon-application-window.blp b/resources/ui/turnon-application-window.blp index 6c7950f..c095250 100644 --- a/resources/ui/turnon-application-window.blp +++ b/resources/ui/turnon-application-window.blp @@ -22,9 +22,9 @@ template $TurnOnApplicationWindow: Adw.ApplicationWindow { [start] Gtk.ToggleButton toggle_scan_network { - action-name: "win.toggle-scan-network"; + action-name: "app.scan-network"; icon-name: "waves-and-screen-symbolic"; - tooltip-text: C_("application-window.action.win.scan-network.tooltip", "Scan the network for devices"); + tooltip-text: C_("application-window.action.app.scan-network.tooltip", "Scan the network for devices"); } [end] @@ -79,7 +79,7 @@ template $TurnOnApplicationWindow: Adw.ApplicationWindow { Gtk.Button { label: C_("application-window.status-page.button.label", "Scan network"); - action-name: "win.toggle-scan-network"; + action-name: "app.scan-network"; styles [ "pill", diff --git a/resources/ui/turnon-application-window.ui b/resources/ui/turnon-application-window.ui index 290c2a1..d982af4 100644 --- a/resources/ui/turnon-application-window.ui +++ b/resources/ui/turnon-application-window.ui @@ -22,9 +22,9 @@ corresponding .blp file and regenerate this file with blueprint-compiler. - win.toggle-scan-network + app.scan-network waves-and-screen-symbolic - Scan the network for devices + Scan the network for devices @@ -81,7 +81,7 @@ corresponding .blp file and regenerate this file with blueprint-compiler. Scan network - win.toggle-scan-network + app.scan-network