Skip to content

Commit

Permalink
feat: Use AdwSpinRow for weron timeout and verbosity level, fix pre…
Browse files Browse the repository at this point in the history
…ferences dialog close detector

Signed-off-by: Felicitas Pojtinger <[email protected]>
  • Loading branch information
pojntfx committed Jul 18, 2024
1 parent c9c24b5 commit 98e69d4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
6 changes: 3 additions & 3 deletions internal/components/main_menu.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func AddMainMenu(
preferencesDialog := preferencesBuilder.GetObject("preferences-dialog").Cast().(*adw.PreferencesDialog)
storageLocationInput := preferencesBuilder.GetObject("storage-location-input").Cast().(*gtk.Button)
mpvCommandInput := preferencesBuilder.GetObject("mpv-command-input").Cast().(*gtk.Entry)
verbosityLevelInput := preferencesBuilder.GetObject("verbosity-level-input").Cast().(*gtk.SpinButton)
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)
Expand All @@ -50,7 +50,7 @@ func AddMainMenu(
remoteGatewayPasswordRow := preferencesBuilder.GetObject("htorrent-password-row").Cast().(*adw.ActionRow)
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().(*gtk.SpinButton)
weronTimeoutInput := preferencesBuilder.GetObject("weron-timeout-input").Cast().(*adw.SpinRow)
weronForceRelayInput := preferencesBuilder.GetObject("weron-force-relay-input").Cast().(*gtk.Switch)

preferencesHaveChanged := false
Expand Down Expand Up @@ -80,7 +80,7 @@ func AddMainMenu(
window.AddAction(copyMagnetLinkAction)
}

preferencesDialog.ConnectHide(func() {
preferencesDialog.ConnectClosed(func() {
if preferencesHaveChanged {
settings.Apply()

Expand Down
22 changes: 8 additions & 14 deletions internal/resources/preferences.ui
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,13 @@
<property name="title" translatable="yes">Advanced</property>

<child>
<object class="AdwActionRow">
<object class="AdwSpinRow" id="verbosity-level-input">
<property name="title" translatable="yes">Verbosity level</property>
<property name="subtitle" translatable="yes">Verbosity level (0 is disabled, default is info, 7 is trace)</property>
<property name="activatable-widget">verbosity-level-input</property>

<child>
<object class="GtkSpinButton" id="verbosity-level-input">
<property name="valign">center</property>
<property name="adjustment">
<object class="GtkAdjustment">
</object>
</child>
</property>
</object>
</child>

Expand Down Expand Up @@ -180,16 +177,13 @@
<property name="title" translatable="yes">Advanced</property>

<child>
<object class="AdwActionRow">
<object class="AdwSpinRow" id="weron-timeout-input">
<property name="title" translatable="yes">Connection timeout</property>
<property name="subtitle" translatable="yes">Time to wait to connect to the weron signaling server</property>
<property name="activatable-widget">weron-timeout-input</property>

<child>
<object class="GtkSpinButton" id="weron-timeout-input">
<property name="valign">center</property>
<property name="adjustment">
<object class="GtkAdjustment">
</object>
</child>
</property>
</object>
</child>

Expand Down

0 comments on commit 98e69d4

Please sign in to comment.