# HG changeset patch
# Node ID eb2506112d46
# Parent  3c3901fbe549
diff --git a/pidgin/prefs/pidginproxyprefs.c b/pidgin/prefs/pidginproxyprefs.c
--- a/pidgin/prefs/pidginproxyprefs.c
+++ b/pidgin/prefs/pidginproxyprefs.c
@@ -158,6 +158,30 @@
 	return g_variant_new_string(map[position]);
 }
 
+static gboolean
+pidgin_proxy_prefs_get_port_mapping(GValue *value, GVariant *variant,
+                                    G_GNUC_UNUSED gpointer data)
+{
+	g_value_take_string(value,
+	                    g_strdup_printf("%d", g_variant_get_uint16(variant)));
+
+	return TRUE;
+}
+
+static GVariant *
+pidgin_proxy_prefs_set_port_mapping(const GValue *value,
+                                    G_GNUC_UNUSED const GVariantType *expected_type,
+                                    G_GNUC_UNUSED gpointer data)
+{
+	const char *current = g_value_get_string(value);
+
+	if(current != NULL) {
+		return g_variant_new_uint16(atoi(current) & 0xFFFF);
+	}
+
+	return NULL;
+}
+
 static void
 pidgin_proxy_prefs_init_gnome(PidginProxyPrefs *prefs) {
 	gchar *path = NULL;
@@ -205,8 +229,13 @@
 
 	g_settings_bind(settings, "host", prefs->host, "text",
 	                G_SETTINGS_BIND_DEFAULT);
-	g_settings_bind(settings, "port", prefs->port, "value",
-	                G_SETTINGS_BIND_DEFAULT);
+	g_settings_bind_with_mapping(settings, "port",
+	                             prefs->port, "text",
+	                             G_SETTINGS_BIND_DEFAULT,
+	                             pidgin_proxy_prefs_get_port_mapping,
+	                             pidgin_proxy_prefs_set_port_mapping,
+	                             NULL,
+	                             NULL);
 	g_settings_bind(settings, "username", prefs->username, "text",
 	                G_SETTINGS_BIND_DEFAULT);
 	g_settings_bind(settings, "password", prefs->password, "text",
diff --git a/pidgin/resources/Prefs/proxy.ui b/pidgin/resources/Prefs/proxy.ui
--- a/pidgin/resources/Prefs/proxy.ui
+++ b/pidgin/resources/Prefs/proxy.ui
@@ -18,7 +18,7 @@
 -->
 <interface>
   <requires lib="gtk" version="4.0"/>
-  <requires lib="Adw" version="1.0"/>
+  <requires lib="Adw" version="1.2"/>
   <!-- interface-license-type gplv2 -->
   <!-- interface-name Pidgin -->
   <!-- interface-description Internet Messenger -->
@@ -85,73 +85,31 @@
             <child>
               <object class="GtkListBox">
                 <child>
-                  <object class="AdwActionRow">
-                    <property name="activatable-widget">host</property>
+                  <object class="AdwEntryRow" id="host">
                     <property name="title" translatable="1">_Host</property>
                     <property name="use-underline">1</property>
-                    <property name="focusable">0</property>
-                    <child>
-                      <object class="GtkEntry" id="host">
-                        <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">port</property>
+                  <object class="AdwEntryRow" id="port">
                     <property name="title" translatable="1">P_ort</property>
                     <property name="use-underline">1</property>
                     <property name="focusable">0</property>
-                    <child>
-                      <object class="GtkSpinButton" id="port">
-                        <property name="focusable">1</property>
-                        <property name="text" translatable="1">0</property>
-                        <property name="adjustment">
-                          <object class="GtkAdjustment">
-                            <property name="upper">65535</property>
-                            <property name="step-increment">1</property>
-                            <property name="page-increment">10</property>
-                          </object>
-                        </property>
-                        <property name="numeric">1</property>
-                        <property name="hexpand">1</property>
-                        <property name="valign">center</property>
-                      </object>
-                    </child>
+                    <property name="input-purpose">number</property>
                   </object>
                 </child>
                 <child>
-                  <object class="AdwActionRow">
-                    <property name="activatable-widget">username</property>
+                  <object class="AdwEntryRow" id="username">
                     <property name="title" translatable="1">User_name</property>
                     <property name="use-underline">1</property>
                     <property name="focusable">0</property>
-                    <child>
-                      <object class="GtkEntry" id="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">password</property>
+                  <object class="AdwPasswordEntryRow" id="password">
                     <property name="title" translatable="1">Pa_ssword</property>
                     <property name="use-underline">1</property>
                     <property name="focusable">0</property>
-                    <child>
-                      <object class="GtkPasswordEntry" id="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>
                 </child>
               </object>
