[calls] account-widget: Actually use the entered port



commit f47139f7d2821a924d9a0a00116684eef0c40c59
Author: Evangelos Ribeiro Tzaras <devrtz fortysixandtwo eu>
Date:   Fri Aug 27 18:32:37 2021 +0200

    account-widget: Actually use the entered port

 plugins/sip/calls-sip-account-widget.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/plugins/sip/calls-sip-account-widget.c b/plugins/sip/calls-sip-account-widget.c
index df765be0..a2330879 100644
--- a/plugins/sip/calls-sip-account-widget.c
+++ b/plugins/sip/calls-sip-account-widget.c
@@ -172,6 +172,20 @@ update_port_cursor_position (GtkEntry *entry)
   return G_SOURCE_REMOVE;
 }
 
+
+static int
+get_port (CallsSipAccountWidget *self)
+{
+  const char *text;
+  int port = 0;
+
+  text = gtk_entry_get_text (self->port);
+  port = (int)g_ascii_strtod (text, NULL);
+
+  return port;
+}
+
+
 static void
 on_port_entry_after_insert_text (CallsSipAccountWidget *self,
                                  char                  *new_text,
@@ -179,11 +193,7 @@ on_port_entry_after_insert_text (CallsSipAccountWidget *self,
                                  gpointer               position,
                                  GtkEntry              *entry)
 {
-  const char *text;
-  int port = 0;
-
-  text = gtk_entry_get_text (entry);
-  port = (int)g_ascii_strtod (text, NULL);
+  int port = get_port (self);
 
   /* Reset to the old value if new port number is invalid */
   if ((port < 0 || port > 65535) && self->last_port) {
@@ -353,7 +363,7 @@ on_login_clicked (CallsSipAccountWidget *self)
                                           gtk_entry_get_text (GTK_ENTRY (self->password)),
                                           gtk_entry_get_text (GTK_ENTRY (self->display_name)),
                                           get_selected_protocol (self),
-                                          0,
+                                          get_port (self),
                                           TRUE);
 
   self->origin = origin;
@@ -386,7 +396,7 @@ on_apply_clicked (CallsSipAccountWidget *self)
                                     gtk_entry_get_text (self->password),
                                     gtk_entry_get_text (self->display_name),
                                     get_selected_protocol (self),
-                                    0,
+                                    get_port (self),
                                     TRUE);
 
   update_header (self);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]