Migrate the static fields in PidginAccountEditor to AdwEntryRow

Sat, 29 Oct 2022 00:53:33 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Sat, 29 Oct 2022 00:53:33 -0500
changeset 41858
38e61d11b89f
parent 41857
ff94f8ff8a70
child 41859
ed82ab63d15a

Migrate the static fields in PidginAccountEditor to AdwEntryRow

I also moved the proxy port to an entry row instead of using a spin button. In
Pidgin 2 we just used an entry and used atoi() on it, so that's what I'm doing
here.

Testing Done:
Modified the alias and proxy settings and made sure they were saved properly.

Reviewed at https://reviews.imfreedom.org/r/1994/

pidgin/pidginaccounteditor.c file | annotate | diff | comparison | revisions
pidgin/resources/Accounts/editor.ui file | annotate | diff | comparison | revisions
--- a/pidgin/pidginaccounteditor.c	Sat Oct 29 00:52:04 2022 -0500
+++ b/pidgin/pidginaccounteditor.c	Sat Oct 29 00:53:33 2022 -0500
@@ -579,6 +579,7 @@
 pidgin_account_editor_update_proxy_options(PidginAccountEditor *editor) {
 	PurpleProxyInfo *info = NULL;
 	GListModel *model = NULL;
+	char *str = NULL;
 	const char *type = "global";
 	const char *hostname = NULL;
 	const char *username = NULL;
@@ -637,8 +638,10 @@
 	}
 	gtk_editable_set_text(GTK_EDITABLE(editor->proxy_host), hostname);
 
-	gtk_spin_button_set_value(GTK_SPIN_BUTTON(editor->proxy_port),
-	                          (gdouble)port);
+
+	str = g_strdup_printf("%d", port);
+	gtk_editable_set_text(GTK_EDITABLE(editor->proxy_port), str);
+	g_free(str);
 
 	if(username == NULL) {
 		username = "";
@@ -874,7 +877,6 @@
 	PurpleProxyType type = PURPLE_PROXY_TYPE_NONE;
 	GObject *item = NULL;
 	const gchar *svalue = NULL;
-	gint ivalue = 0;
 
 	/* Build the ProxyInfo object */
 	if(!new_account) {
@@ -911,8 +913,8 @@
 	svalue = gtk_editable_get_text(GTK_EDITABLE(editor->proxy_host));
 	purple_proxy_info_set_hostname(info, svalue);
 
-	ivalue = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(editor->proxy_port));
-	purple_proxy_info_set_port(info, ivalue);
+	svalue = gtk_editable_get_text(GTK_EDITABLE(editor->proxy_port));
+	purple_proxy_info_set_port(info, atoi(svalue));
 
 	svalue = gtk_editable_get_text(GTK_EDITABLE(editor->proxy_username));
 	purple_proxy_info_set_username(info, svalue);
--- a/pidgin/resources/Accounts/editor.ui	Sat Oct 29 00:52:04 2022 -0500
+++ b/pidgin/resources/Accounts/editor.ui	Sat Oct 29 00:53:33 2022 -0500
@@ -96,18 +96,10 @@
               <object class="AdwPreferencesGroup">
                 <property name="title" translatable="1">User Options</property>
                 <child>
-                  <object class="AdwActionRow">
-                    <property name="activatable-widget">alias</property>
+                  <object class="AdwEntryRow" id="alias">
                     <property name="focusable">0</property>
                     <property name="title" translatable="1">_Local alias</property>
                     <property name="use-underline">1</property>
-                    <child>
-                      <object class="GtkEntry" id="alias">
-                        <property name="truncate-multiline">1</property>
-                        <property name="hexpand">1</property>
-                        <property name="valign">center</property>
-                      </object>
-                    </child>
                   </object>
                 </child>
                 <child>
@@ -201,69 +193,32 @@
                       <object class="GtkListBox">
                         <property name="focusable">0</property>
                         <child>
-                          <object class="AdwActionRow">
-                            <property name="activatable-widget">proxy_host</property>
+                          <object class="AdwEntryRow" id="proxy_host">
                             <property name="focusable">0</property>
                             <property name="title" translatable="1">_Host</property>
                             <property name="use-underline">1</property>
-                            <child>
-                              <object class="GtkEntry" id="proxy_host">
-                                <property name="hexpand">1</property>
-                                <property name="valign">center</property>
-                              </object>
-                            </child>
                           </object>
                         </child>
                         <child>
-                          <object class="AdwActionRow">
-                            <property name="activatable-widget">proxy_port</property>
+                          <object class="AdwEntryRow" id="proxy_port">
                             <property name="focusable">0</property>
                             <property name="title" translatable="1">P_ort</property>
                             <property name="use-underline">1</property>
-                            <child>
-                              <object class="GtkSpinButton" id="proxy_port">
-                                <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">proxy_username</property>
+                          <object class="AdwEntryRow" id="proxy_username">
                             <property name="focusable">0</property>
                             <property name="title" translatable="1">User_name</property>
                             <property name="use-underline">1</property>
-                            <child>
-                              <object class="GtkEntry" id="proxy_username">
-                                <property name="hexpand">1</property>
-                                <property name="valign">center</property>
-                              </object>
-                            </child>
                           </object>
                         </child>
                         <child>
-                          <object class="AdwActionRow">
-                            <property name="activatable-widget">proxy_password</property>
+                          <object class="AdwPasswordEntryRow" id="proxy_password">
                             <property name="focusable">0</property>
                             <property name="title" translatable="1">Pa_ssword</property>
                             <property name="use-underline">1</property>
-                            <child>
-                              <object class="GtkPasswordEntry" id="proxy_password">
-                                <property name="hexpand">1</property>
-                                <property name="show-peek-icon">1</property>
-                                <property name="valign">center</property>
-                              </object>
-                            </child>
                           </object>
                         </child>
                       </object>

mercurial