From e631e14ad94e857977d3aff001a96eba957b8fbf Mon Sep 17 00:00:00 2001
From: Yun Liu <yun@yun.(none)>
Date: Thu, 9 Oct 2008 11:08:37 -0400
Subject: [PATCH] Add apply button beside port scrollbar

---
 sflphone-gtk/src/configwindow.c | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/sflphone-gtk/src/configwindow.c b/sflphone-gtk/src/configwindow.c
index acaba527ba..9081ef06e9 100644
--- a/sflphone-gtk/src/configwindow.c
+++ b/sflphone-gtk/src/configwindow.c
@@ -314,11 +314,9 @@ set_pulse_app_volume_control( void )
   dbus_set_pulse_app_volume_control();
 }
 
-//static void update_port( GtkSpinButton *button, void *ptr )
-static void update_port( GtkSpinButton *button )
+static void update_port( GtkSpinButton *button, void *ptr )
 {
-  dbus_set_sip_port(gtk_spin_button_get_value_as_int(button));
-  //dbus_set_sip_port(gtk_spin_button_get_value_as_int((GtkSpinButton *)(ptr)));
+  dbus_set_sip_port(gtk_spin_button_get_value_as_int((GtkSpinButton *)(ptr)));
 }
 
 /**
@@ -454,6 +452,7 @@ create_general_settings ()
 
   GtkWidget *frame;
   GtkWidget *vbox;
+  GtkWidget *hbox;
   GtkWidget *value;
   GtkWidget *label;
   GtkWidget *cleanButton;
@@ -552,18 +551,24 @@ create_general_settings ()
   gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0);
   gtk_widget_show( frame );
 
-  vbox = gtk_vbox_new(FALSE, 10);
-  gtk_widget_show( vbox );
-  gtk_container_add( GTK_CONTAINER(frame) , vbox);
+  hbox = gtk_hbox_new(FALSE, 10);
+  gtk_widget_show( hbox );
+  gtk_container_add( GTK_CONTAINER(frame) , hbox);
+
+  GtkWidget *applyButton = gtk_button_new_with_label(_("Apply"));
+  gtk_widget_set_size_request(applyButton, 60, 35);
+
+  label = gtk_label_new(_("Port:"));
 
-  label = gtk_label_new(_("Port number:"));
   entryPort = gtk_spin_button_new_with_range(1, 65535, 1);
   gtk_label_set_mnemonic_widget (GTK_LABEL (label), entryPort);
   gtk_spin_button_set_value(GTK_SPIN_BUTTON(entryPort), curPort);
-  //gtk_table_attach ( GTK_TABLE( table ), entryPort, 1, 2, 6, 7, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
-  gtk_box_pack_start( GTK_BOX(vbox) , entryPort , TRUE , TRUE , 1);
-  g_signal_connect( G_OBJECT( entryPort) , "value-changed" , G_CALLBACK( update_port ) , NULL);
-  //g_signal_connect( G_OBJECT( applyButton) , "value-changed" , G_CALLBACK( update_port ) , entryPort);
+  
+  gtk_box_pack_start( GTK_BOX(hbox) , label , TRUE , TRUE , 1);
+  gtk_box_pack_start( GTK_BOX(hbox) , entryPort , TRUE , TRUE , 1);
+  gtk_box_pack_start( GTK_BOX(hbox) , applyButton , FALSE , FALSE , 1);
+
+  g_signal_connect( G_OBJECT( applyButton) , "clicked" , G_CALLBACK( update_port ) , entryPort);
 
   gtk_widget_show_all(ret);
   
-- 
GitLab