From 1e8b6ab0e83f03eb5896acbf1dbec7f7c774eca9 Mon Sep 17 00:00:00 2001 From: Felicitas Pojtinger Date: Fri, 19 Jul 2024 18:09:11 -0400 Subject: [PATCH] refactor: Convert rest of general settings to modern libadwaita components Signed-off-by: Felicitas Pojtinger --- internal/components/main_menu.go | 21 ++++----- internal/resources/preferences.ui | 73 ++++++++++++++++++++++++------- 2 files changed, 66 insertions(+), 28 deletions(-) diff --git a/internal/components/main_menu.go b/internal/components/main_menu.go index ed025f7..ba54f6f 100644 --- a/internal/components/main_menu.go +++ b/internal/components/main_menu.go @@ -42,12 +42,9 @@ func AddMainMenu( mpvCommandInput := preferencesBuilder.GetObject("mpv-command-input").Cast().(*adw.EntryRow) verbosityLevelInput := preferencesBuilder.GetObject("verbosity-level-input").Cast().(*adw.SpinRow) remoteGatewaySwitchInput := preferencesBuilder.GetObject("htorrent-remote-gateway-switch").Cast().(*gtk.Switch) - remoteGatewayURLInput := preferencesBuilder.GetObject("htorrent-url-input").Cast().(*gtk.Entry) - remoteGatewayUsernameInput := preferencesBuilder.GetObject("htorrent-username-input").Cast().(*gtk.Entry) - remoteGatewayPasswordInput := preferencesBuilder.GetObject("htorrent-password-input").Cast().(*gtk.Entry) - remoteGatewayURLRow := preferencesBuilder.GetObject("htorrent-url-row").Cast().(*adw.ActionRow) - remoteGatewayUsernameRow := preferencesBuilder.GetObject("htorrent-username-row").Cast().(*adw.ActionRow) - remoteGatewayPasswordRow := preferencesBuilder.GetObject("htorrent-password-row").Cast().(*adw.ActionRow) + remoteGatewayURLInput := preferencesBuilder.GetObject("htorrent-url-input").Cast().(*adw.EntryRow) + remoteGatewayUsernameInput := preferencesBuilder.GetObject("htorrent-username-input").Cast().(*adw.EntryRow) + remoteGatewayPasswordInput := preferencesBuilder.GetObject("htorrent-password-input").Cast().(*adw.PasswordEntryRow) weronURLInput := preferencesBuilder.GetObject("weron-url-input").Cast().(*gtk.Entry) weronICEInput := preferencesBuilder.GetObject("weron-ice-input").Cast().(*gtk.Entry) weronTimeoutInput := preferencesBuilder.GetObject("weron-timeout-input").Cast().(*adw.SpinRow) @@ -96,13 +93,13 @@ func AddMainMenu( syncSensitivityState := func() { if remoteGatewaySwitchInput.State() { - remoteGatewayURLRow.SetSensitive(true) - remoteGatewayUsernameRow.SetSensitive(true) - remoteGatewayPasswordRow.SetSensitive(true) + remoteGatewayURLInput.SetEditable(true) + remoteGatewayUsernameInput.SetEditable(true) + remoteGatewayPasswordInput.SetEditable(true) } else { - remoteGatewayURLRow.SetSensitive(false) - remoteGatewayUsernameRow.SetSensitive(false) - remoteGatewayPasswordRow.SetSensitive(false) + remoteGatewayURLInput.SetEditable(false) + remoteGatewayUsernameInput.SetEditable(false) + remoteGatewayPasswordInput.SetEditable(false) } } preferencesDialog.ConnectShow(syncSensitivityState) diff --git a/internal/resources/preferences.ui b/internal/resources/preferences.ui index 263ab02..a4a207d 100644 --- a/internal/resources/preferences.ui +++ b/internal/resources/preferences.ui @@ -88,46 +88,63 @@ - + URL - API address of the remote gateway - htorrent-url-input - false + false - + + + + help-about + Show help center + htorrent-url-input-popover - + Username - The remote gateway's username - htorrent-username-input - false + false - + + + + help-about + Show help center + htorrent-username-input-popover - + Password - The remote gateway's password - htorrent-password-input - false + false - + + + + help-about + Show help center - false + htorrent-password-input-popover @@ -220,4 +237,28 @@ + + + + + API address of the remote gateway + + + + + + + + The remote gateway's username + + + + + + + + The remote gateway's password + + + \ No newline at end of file