From 11644a361b8456eb4d0d5cfbed549593b275123c Mon Sep 17 00:00:00 2001
From: Alexandre Savard <alexandresavard@alexandresavard-desktop.(none)>
Date: Wed, 11 Nov 2009 14:32:01 -0500
Subject: [PATCH] [#2383] Do the same for IPtoIP (init localn ip with first in
 the list)

---
 .../src/config/preferencesdialog.c             | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/sflphone-client-gnome/src/config/preferencesdialog.c b/sflphone-client-gnome/src/config/preferencesdialog.c
index bf8ba55b0f..595210f4ca 100644
--- a/sflphone-client-gnome/src/config/preferencesdialog.c
+++ b/sflphone-client-gnome/src/config/preferencesdialog.c
@@ -241,22 +241,36 @@ GtkWidget* create_direct_ip_calls_tab()
     gchar ** iface_list = NULL;
     iface_list = (gchar**) dbus_get_all_ip_interface();
     gchar ** iface = NULL;
+
+    gboolean iface_found = FALSE;
     
     if (iface_list != NULL) {
+
+      // init interface list with first one
+      // iface = iface_list;
+      // g_hash_table_replace(directIpCallsProperties, g_strdup(LOCAL_ADDRESS), g_strdup((gchar *)gtk_combo_box_get_active_text(GTK_COMBO_BOX(localAddressCombo)))); 
+
       for (iface = iface_list; *iface; iface++) {         
 	DEBUG("Interface %s", *iface);            
 	gtk_list_store_append(ipInterfaceListStore, &iter );
 	gtk_list_store_set(ipInterfaceListStore, &iter, 0, *iface, -1 );
 
-	current_local_address_iter = iter;
-	if (g_strcmp0(*iface, local_address) == 0) {
+	if (!iface_found && (g_strcmp0(*iface, local_address) == 0)) {
 	    DEBUG("Setting active local address combo box");
 	    current_local_address_iter = iter;
+	    iface_found = TRUE;
 	}
       }
+
+      if(!iface_found) {
+	      DEBUG("Did not find local ip address, take fisrt in the list");
+	      gtk_tree_model_get_iter_first(GTK_TREE_MODEL(ipInterfaceListStore), &current_local_address_iter);
+      }
     }
 
     
+
+    
     localAddressCombo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(ipInterfaceListStore));
     gtk_label_set_mnemonic_widget(GTK_LABEL(localAddressLabel), localAddressCombo);
     gtk_table_attach ( GTK_TABLE( table ), localAddressCombo, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
-- 
GitLab