Skip to content

Commit 98e69d4

Browse files
committed
feat: Use AdwSpinRow for weron timeout and verbosity level, fix preferences dialog close detector
Signed-off-by: Felicitas Pojtinger <felicitas@pojtinger.com>
1 parent c9c24b5 commit 98e69d4

File tree

2 files changed

+11
-17
lines changed

2 files changed

+11
-17
lines changed

internal/components/main_menu.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func AddMainMenu(
4040
preferencesDialog := preferencesBuilder.GetObject("preferences-dialog").Cast().(*adw.PreferencesDialog)
4141
storageLocationInput := preferencesBuilder.GetObject("storage-location-input").Cast().(*gtk.Button)
4242
mpvCommandInput := preferencesBuilder.GetObject("mpv-command-input").Cast().(*gtk.Entry)
43-
verbosityLevelInput := preferencesBuilder.GetObject("verbosity-level-input").Cast().(*gtk.SpinButton)
43+
verbosityLevelInput := preferencesBuilder.GetObject("verbosity-level-input").Cast().(*adw.SpinRow)
4444
remoteGatewaySwitchInput := preferencesBuilder.GetObject("htorrent-remote-gateway-switch").Cast().(*gtk.Switch)
4545
remoteGatewayURLInput := preferencesBuilder.GetObject("htorrent-url-input").Cast().(*gtk.Entry)
4646
remoteGatewayUsernameInput := preferencesBuilder.GetObject("htorrent-username-input").Cast().(*gtk.Entry)
@@ -50,7 +50,7 @@ func AddMainMenu(
5050
remoteGatewayPasswordRow := preferencesBuilder.GetObject("htorrent-password-row").Cast().(*adw.ActionRow)
5151
weronURLInput := preferencesBuilder.GetObject("weron-url-input").Cast().(*gtk.Entry)
5252
weronICEInput := preferencesBuilder.GetObject("weron-ice-input").Cast().(*gtk.Entry)
53-
weronTimeoutInput := preferencesBuilder.GetObject("weron-timeout-input").Cast().(*gtk.SpinButton)
53+
weronTimeoutInput := preferencesBuilder.GetObject("weron-timeout-input").Cast().(*adw.SpinRow)
5454
weronForceRelayInput := preferencesBuilder.GetObject("weron-force-relay-input").Cast().(*gtk.Switch)
5555

5656
preferencesHaveChanged := false
@@ -80,7 +80,7 @@ func AddMainMenu(
8080
window.AddAction(copyMagnetLinkAction)
8181
}
8282

83-
preferencesDialog.ConnectHide(func() {
83+
preferencesDialog.ConnectClosed(func() {
8484
if preferencesHaveChanged {
8585
settings.Apply()
8686

internal/resources/preferences.ui

+8-14
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,13 @@
5353
<property name="title" translatable="yes">Advanced</property>
5454

5555
<child>
56-
<object class="AdwActionRow">
56+
<object class="AdwSpinRow" id="verbosity-level-input">
5757
<property name="title" translatable="yes">Verbosity level</property>
5858
<property name="subtitle" translatable="yes">Verbosity level (0 is disabled, default is info, 7 is trace)</property>
59-
<property name="activatable-widget">verbosity-level-input</property>
60-
61-
<child>
62-
<object class="GtkSpinButton" id="verbosity-level-input">
63-
<property name="valign">center</property>
59+
<property name="adjustment">
60+
<object class="GtkAdjustment">
6461
</object>
65-
</child>
62+
</property>
6663
</object>
6764
</child>
6865

@@ -180,16 +177,13 @@
180177
<property name="title" translatable="yes">Advanced</property>
181178

182179
<child>
183-
<object class="AdwActionRow">
180+
<object class="AdwSpinRow" id="weron-timeout-input">
184181
<property name="title" translatable="yes">Connection timeout</property>
185182
<property name="subtitle" translatable="yes">Time to wait to connect to the weron signaling server</property>
186-
<property name="activatable-widget">weron-timeout-input</property>
187-
188-
<child>
189-
<object class="GtkSpinButton" id="weron-timeout-input">
190-
<property name="valign">center</property>
183+
<property name="adjustment">
184+
<object class="GtkAdjustment">
191185
</object>
192-
</child>
186+
</property>
193187
</object>
194188
</child>
195189

0 commit comments

Comments
 (0)