diff --git a/sflphone-client-gnome/src/config/preferencesdialog.c b/sflphone-client-gnome/src/config/preferencesdialog.c index bf8ba55b0f5ccce30a582aa67a15167b2b60a063..595210f4ca36f345b2848f8314b1e4aa83565670 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), ¤t_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);