# HG changeset patch
# Node ID 13c4dfb6a5c8
# Parent  1ebd15de6634
diff --git a/pidgin/prefs/pidginnetworkprefs.c b/pidgin/prefs/pidginnetworkprefs.c
--- a/pidgin/prefs/pidginnetworkprefs.c
+++ b/pidgin/prefs/pidginnetworkprefs.c
@@ -34,12 +34,12 @@ struct _PidginNetworkPrefs {
 	AdwPreferencesPage parent;
 
 	GtkWidget *stun_server;
+	GtkWidget *auto_ip_row;
 	GtkWidget *auto_ip;
 	GtkWidget *public_ip;
-	GtkWidget *public_ip_hbox;
+	GtkWidget *public_ip_row;
 	GtkWidget *map_ports;
 	GtkWidget *ports_range_use;
-	GtkWidget *ports_range_hbox;
 	GtkWidget *ports_range_start;
 	GtkWidget *ports_range_end;
 	GtkWidget *turn_server;
@@ -101,8 +101,10 @@ network_turn_server_changed_cb(G_GNUC_UN
 }
 
 static void
-auto_ip_button_clicked_cb(GtkWidget *button, gpointer null)
+auto_ip_button_clicked_cb(G_GNUC_UNUSED GObject *obj,
+                          G_GNUC_UNUSED GParamSpec *pspec, gpointer data)
 {
+	PidginNetworkPrefs *prefs = PIDGIN_NETWORK_PREFS(data);
 	const char *ip;
 	PurpleStunNatDiscovery *stun;
 	char *auto_ip_text;
@@ -136,7 +138,8 @@ auto_ip_button_clicked_cb(GtkWidget *but
 	}
 
 	auto_ip_text = g_strdup_printf(_("Use _automatically detected IP address: %s"), ip);
-	gtk_check_button_set_label(GTK_CHECK_BUTTON(button), auto_ip_text);
+	adw_preferences_row_set_title(ADW_PREFERENCES_ROW(prefs->auto_ip_row),
+	                              auto_ip_text);
 	g_free(auto_ip_text);
 	g_list_free_full(list, g_free);
 }
@@ -157,18 +160,18 @@ pidgin_network_prefs_class_init(PidginNe
 	gtk_widget_class_bind_template_child(widget_class, PidginNetworkPrefs,
 	                                     stun_server);
 	gtk_widget_class_bind_template_child(widget_class, PidginNetworkPrefs,
+	                                     auto_ip_row);
+	gtk_widget_class_bind_template_child(widget_class, PidginNetworkPrefs,
 	                                     auto_ip);
 	gtk_widget_class_bind_template_child(widget_class, PidginNetworkPrefs,
 	                                     public_ip);
 	gtk_widget_class_bind_template_child(widget_class, PidginNetworkPrefs,
-	                                     public_ip_hbox);
+	                                     public_ip_row);
 	gtk_widget_class_bind_template_child(widget_class, PidginNetworkPrefs,
 	                                     map_ports);
 	gtk_widget_class_bind_template_child(widget_class, PidginNetworkPrefs,
 	                                     ports_range_use);
 	gtk_widget_class_bind_template_child(widget_class, PidginNetworkPrefs,
-	                                     ports_range_hbox);
-	gtk_widget_class_bind_template_child(widget_class, PidginNetworkPrefs,
 	                                     ports_range_start);
 	gtk_widget_class_bind_template_child(widget_class, PidginNetworkPrefs,
 	                                     ports_range_end);
@@ -199,24 +202,20 @@ pidgin_network_prefs_init(PidginNetworkP
 	gtk_editable_set_text(GTK_EDITABLE(prefs->stun_server),
 	                      purple_prefs_get_string("/purple/network/stun_server"));
 
-	pidgin_prefs_bind_checkbox("/purple/network/auto_ip", prefs->auto_ip);
-	auto_ip_button_clicked_cb(prefs->auto_ip, NULL); /* Update label */
+	pidgin_prefs_bind_switch("/purple/network/auto_ip", prefs->auto_ip);
+	auto_ip_button_clicked_cb(NULL, NULL, prefs); /* Update label */
 
 	gtk_editable_set_text(GTK_EDITABLE(prefs->public_ip),
 	                      purple_network_get_public_ip());
 
 	g_object_bind_property(prefs->auto_ip, "active",
-			prefs->public_ip_hbox, "sensitive",
-			G_BINDING_SYNC_CREATE|G_BINDING_INVERT_BOOLEAN);
-
-	pidgin_prefs_bind_checkbox("/purple/network/map_ports",
-			prefs->map_ports);
+	                       prefs->public_ip_row, "sensitive",
+	                       G_BINDING_SYNC_CREATE|G_BINDING_INVERT_BOOLEAN);
 
-	pidgin_prefs_bind_checkbox("/purple/network/ports_range_use",
-			prefs->ports_range_use);
-	g_object_bind_property(prefs->ports_range_use, "active",
-			prefs->ports_range_hbox, "sensitive",
-			G_BINDING_SYNC_CREATE);
+	pidgin_prefs_bind_switch("/purple/network/map_ports", prefs->map_ports);
+
+	pidgin_prefs_bind_expander_row("/purple/network/ports_range_use",
+	                               prefs->ports_range_use);
 
 	pidgin_prefs_bind_spin_button("/purple/network/ports_range_start",
 			prefs->ports_range_start);
diff --git a/pidgin/resources/Prefs/network.ui b/pidgin/resources/Prefs/network.ui
--- a/pidgin/resources/Prefs/network.ui
+++ b/pidgin/resources/Prefs/network.ui
@@ -48,61 +48,52 @@ along with this program; if not, see <ht
       <object class="AdwPreferencesGroup">
         <property name="title" translatable="1">IP Address</property>
         <child>
-          <object class="GtkBox">
-            <property name="margin-start">12</property>
-            <property name="orientation">vertical</property>
-            <property name="spacing">6</property>
+          <object class="AdwActionRow">
+            <property name="activatable-widget">stun_server</property>
+            <property name="title" translatable="1">ST_UN server</property>
+            <property name="use-underline">1</property>
             <child>
-              <object class="GtkBox">
-                <property name="spacing">6</property>
+              <object class="GtkEntry" id="stun_server">
+                <property name="halign">fill</property>
+                <property name="hexpand">1</property>
+                <property name="valign">center</property>
+                <property name="focusable">1</property>
+                <property name="placeholder-text" translatable="1">Example: stunserver.org</property>
+                <property name="input-purpose">url</property>
                 <child>
-                  <object class="GtkLabel" id="label8">
-                    <property name="label" translatable="1">ST_UN server:</property>
-                    <property name="use-underline">1</property>
-                    <property name="mnemonic-widget">stun_server</property>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkEntry" id="stun_server">
-                    <property name="halign">fill</property>
-                    <property name="hexpand">1</property>
-                    <property name="focusable">1</property>
-                    <property name="placeholder-text" translatable="1">Example: stunserver.org</property>
-                    <property name="input-purpose">url</property>
-                    <child>
-                      <object class="GtkEventControllerFocus">
-                        <signal name="leave" handler="network_stun_server_changed_cb" object="stun_server" swapped="no"/>
-                      </object>
-                    </child>
+                  <object class="GtkEventControllerFocus">
+                    <signal name="leave" handler="network_stun_server_changed_cb" object="stun_server" swapped="no"/>
                   </object>
                 </child>
               </object>
             </child>
+          </object>
+        </child>
+        <child>
+          <object class="AdwActionRow" id="auto_ip_row">
+            <property name="activatable-widget">auto_ip</property>
+            <property name="title" translatable="1">Use _automatically detected IP address</property>
+            <property name="use-underline">1</property>
             <child>
-              <object class="GtkCheckButton" id="auto_ip">
-                <property name="label" translatable="1">Use _automatically detected IP address</property>
+              <object class="GtkSwitch" id="auto_ip">
                 <property name="focusable">1</property>
-                <property name="use-underline">1</property>
-                <signal name="toggled" handler="auto_ip_button_clicked_cb" after="yes" swapped="no"/>
+                <property name="valign">center</property>
+                <signal name="notify::active" handler="auto_ip_button_clicked_cb" after="yes" swapped="no"/>
               </object>
             </child>
+          </object>
+        </child>
+        <child>
+          <object class="AdwActionRow" id="public_ip_row">
+            <property name="activatable-widget">public_ip</property>
+            <property name="title" translatable="1">Public _IP</property>
+            <property name="use-underline">1</property>
             <child>
-              <object class="GtkBox" id="public_ip_hbox">
-                <property name="spacing">6</property>
-                <child>
-                  <object class="GtkLabel" id="label9">
-                    <property name="label" translatable="1">Public _IP:</property>
-                    <property name="use-underline">1</property>
-                    <property name="mnemonic-widget">public_ip</property>
-                    <property name="xalign">0</property>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkEntry" id="public_ip">
-                    <property name="focusable">1</property>
-                    <signal name="changed" handler="network_ip_changed" swapped="no"/>
-                  </object>
-                </child>
+              <object class="GtkEntry" id="public_ip">
+                <property name="focusable">1</property>
+                <property name="hexpand">1</property>
+                <property name="valign">center</property>
+                <signal name="changed" handler="network_ip_changed" swapped="no"/>
               </object>
             </child>
           </object>
@@ -113,59 +104,51 @@ along with this program; if not, see <ht
       <object class="AdwPreferencesGroup">
         <property name="title" translatable="1">Ports</property>
         <child>
-          <object class="GtkBox">
-            <property name="margin-start">12</property>
-            <property name="orientation">vertical</property>
-            <property name="spacing">6</property>
+          <object class="AdwActionRow">
+            <property name="activatable-widget">map_ports</property>
+            <property name="title" translatable="1">_Enable automatic router port forwarding</property>
+            <property name="use-underline">1</property>
             <child>
-              <object class="GtkCheckButton" id="map_ports">
-                <property name="label" translatable="1">_Enable automatic router port forwarding</property>
+              <object class="GtkSwitch" id="map_ports">
                 <property name="focusable">1</property>
+                <property name="valign">center</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="AdwExpanderRow" id="ports_range_use">
+            <property name="title" translatable="1">_Manually specify range of ports to listen on</property>
+            <property name="show-enable-switch">1</property>
+            <property name="use-underline">1</property>
+            <child>
+              <object class="AdwActionRow">
+                <property name="activatable-widget">ports_range_start</property>
+                <property name="title" translatable="1">_Start</property>
                 <property name="use-underline">1</property>
+                <child>
+                  <object class="GtkSpinButton" id="ports_range_start">
+                    <property name="focusable">1</property>
+                    <property name="valign">center</property>
+                    <property name="text" translatable="1">0</property>
+                    <property name="adjustment">ports_range_start.adjustment</property>
+                    <property name="numeric">1</property>
+                  </object>
+                </child>
               </object>
             </child>
             <child>
-              <object class="GtkBox">
-                <property name="spacing">6</property>
-                <child>
-                  <object class="GtkCheckButton" id="ports_range_use">
-                    <property name="label" translatable="1">_Manually specify range of ports to listen on:</property>
-                    <property name="focusable">1</property>
-                    <property name="use-underline">1</property>
-                  </object>
-                </child>
+              <object class="AdwActionRow">
+                <property name="activatable-widget">ports_range_end</property>
+                <property name="title" translatable="1">_End</property>
+                <property name="use-underline">1</property>
                 <child>
-                  <object class="GtkBox" id="ports_range_hbox">
-                    <property name="spacing">6</property>
-                    <child>
-                      <object class="GtkLabel">
-                        <property name="label" translatable="1">_Start:</property>
-                        <property name="use-underline">1</property>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkSpinButton" id="ports_range_start">
-                        <property name="focusable">1</property>
-                        <property name="text" translatable="1">0</property>
-                        <property name="adjustment">ports_range_start.adjustment</property>
-                        <property name="numeric">1</property>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkLabel">
-                        <property name="label" translatable="1">_End:</property>
-                        <property name="use-underline">1</property>
-                        <property name="mnemonic-widget">ports_range_end</property>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkSpinButton" id="ports_range_end">
-                        <property name="focusable">1</property>
-                        <property name="text" translatable="1">0</property>
-                        <property name="adjustment">ports_range_end.adjustment</property>
-                        <property name="numeric">1</property>
-                      </object>
-                    </child>
+                  <object class="GtkSpinButton" id="ports_range_end">
+                    <property name="focusable">1</property>
+                    <property name="valign">center</property>
+                    <property name="text" translatable="1">0</property>
+                    <property name="adjustment">ports_range_end.adjustment</property>
+                    <property name="numeric">1</property>
                   </object>
                 </child>
               </object>
@@ -178,90 +161,81 @@ along with this program; if not, see <ht
       <object class="AdwPreferencesGroup">
         <property name="title" translatable="1">Relay Server (TURN)</property>
         <child>
-          <object class="GtkBox">
-            <property name="margin-start">12</property>
-            <property name="orientation">vertical</property>
-            <property name="spacing">6</property>
+          <object class="AdwActionRow">
+            <property name="activatable-widget">turn_server</property>
+            <property name="title" translatable="1">_TURN server</property>
+            <property name="use-underline">1</property>
             <child>
-              <object class="GtkBox">
-                <property name="spacing">6</property>
-                <child>
-                  <object class="GtkLabel" id="label10">
-                    <property name="label" translatable="1">_TURN server:</property>
-                    <property name="use-underline">1</property>
-                    <property name="mnemonic-widget">turn_server</property>
-                    <property name="xalign">0</property>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkEntry" id="turn_server">
-                    <property name="focusable">1</property>
-                    <child>
-                      <object class="GtkEventControllerFocus">
-                        <signal name="leave" handler="network_turn_server_changed_cb" swapped="no"/>
-                      </object>
-                    </child>
-                  </object>
-                </child>
+              <object class="GtkEntry" id="turn_server">
+                <property name="focusable">1</property>
+                <property name="hexpand">1</property>
+                <property name="valign">center</property>
                 <child>
-                  <object class="GtkLabel">
-                    <property name="label" translatable="1">_UDP Port:</property>
-                    <property name="use-underline">1</property>
-                    <property name="mnemonic-widget">turn_port_udp</property>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkSpinButton" id="turn_port_udp">
-                    <property name="focusable">1</property>
-                    <property name="adjustment">turn_port_udp.adjustment</property>
-                    <property name="numeric">1</property>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkLabel">
-                    <property name="label" translatable="1">T_CP Port:</property>
-                    <property name="use-underline">1</property>
-                    <property name="mnemonic-widget">turn_port_tcp</property>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkSpinButton" id="turn_port_tcp">
-                    <property name="focusable">1</property>
-                    <property name="adjustment">turn_port_tcp.adjustment</property>
-                    <property name="numeric">1</property>
+                  <object class="GtkEventControllerFocus">
+                    <signal name="leave" handler="network_turn_server_changed_cb" object="turn_server" swapped="no"/>
                   </object>
                 </child>
               </object>
             </child>
+          </object>
+        </child>
+        <child>
+          <object class="AdwActionRow">
+            <property name="activatable-widget">turn_port_udp</property>
+            <property name="title" translatable="1">_UDP Port</property>
+            <property name="use-underline">1</property>
             <child>
-              <object class="GtkBox">
-                <property name="spacing">6</property>
-                <child>
-                  <object class="GtkLabel" id="label11">
-                    <property name="label" translatable="1">Use_rname:</property>
-                    <property name="use-underline">1</property>
-                    <property name="mnemonic-widget">turn_username</property>
-                    <property name="xalign">0</property>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkEntry" id="turn_username">
-                    <property name="focusable">1</property>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkLabel">
-                    <property name="label" translatable="1">Pass_word:</property>
-                    <property name="use-underline">1</property>
-                    <property name="mnemonic-widget">turn_password</property>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkPasswordEntry" id="turn_password">
-                    <property name="focusable">1</property>
-                    <property name="show-peek-icon">1</property>
-                  </object>
-                </child>
+              <object class="GtkSpinButton" id="turn_port_udp">
+                <property name="focusable">1</property>
+                <property name="hexpand">1</property>
+                <property name="valign">center</property>
+                <property name="adjustment">turn_port_udp.adjustment</property>
+                <property name="numeric">1</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="AdwActionRow">
+            <property name="activatable-widget">turn_port_tcp</property>
+            <property name="title" translatable="1">T_CP Port</property>
+            <property name="use-underline">1</property>
+            <child>
+              <object class="GtkSpinButton" id="turn_port_tcp">
+                <property name="focusable">1</property>
+                <property name="hexpand">1</property>
+                <property name="valign">center</property>
+                <property name="adjustment">turn_port_tcp.adjustment</property>
+                <property name="numeric">1</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="AdwActionRow">
+            <property name="activatable-widget">turn_username</property>
+            <property name="title" translatable="1">Use_rname</property>
+            <property name="use-underline">1</property>
+            <child>
+              <object class="GtkEntry" id="turn_username">
+                <property name="focusable">1</property>
+                <property name="hexpand">1</property>
+                <property name="valign">center</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="AdwActionRow">
+            <property name="activatable-widget">turn_password</property>
+            <property name="title" translatable="1">Pass_word</property>
+            <property name="use-underline">1</property>
+            <child>
+              <object class="GtkPasswordEntry" id="turn_password">
+                <property name="focusable">1</property>
+                <property name="hexpand">1</property>
+                <property name="show-peek-icon">1</property>
+                <property name="valign">center</property>
               </object>
             </child>
           </object>
@@ -269,12 +243,4 @@ along with this program; if not, see <ht
       </object>
     </child>
   </template>
-  <object class="GtkSizeGroup" id="sg">
-    <widgets>
-      <widget name="label8"/>
-      <widget name="label9"/>
-      <widget name="label10"/>
-      <widget name="label11"/>
-    </widgets>
-  </object>
 </interface>
