Skip to content
Snippets Groups Projects
Commit f0c76091 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#2383] Use first interface in the list if local addresss is not defined

parent 4c22253f
No related branches found
No related tags found
No related merge requests found
...@@ -811,18 +811,30 @@ GtkWidget * create_advanced_tab(account_t **a) ...@@ -811,18 +811,30 @@ GtkWidget * create_advanced_tab(account_t **a)
iface_list = (gchar**) dbus_get_all_ip_interface(); iface_list = (gchar**) dbus_get_all_ip_interface();
gchar ** iface = NULL; gchar ** iface = NULL;
// flag to determine if local_address is found
gboolean iface_found = FALSE;
if (iface_list != NULL) { if (iface_list != NULL) {
// fill the iterface combo box
for (iface = iface_list; *iface; iface++) { for (iface = iface_list; *iface; iface++) {
DEBUG("Interface %s", *iface); DEBUG("Interface %s", *iface);
gtk_list_store_append(ipInterfaceListStore, &iter ); gtk_list_store_append(ipInterfaceListStore, &iter );
gtk_list_store_set(ipInterfaceListStore, &iter, 0, *iface, -1 ); gtk_list_store_set(ipInterfaceListStore, &iter, 0, *iface, -1 );
current_local_address_iter = iter; // set the current local address
if (g_strcmp0(*iface, local_address) == 0) { if (!iface_found && (g_strcmp0(*iface, local_address) == 0)) {
DEBUG("Setting active local address combo box"); DEBUG("Setting active local address combo box");
current_local_address_iter = iter; 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)); localAddressCombo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(ipInterfaceListStore));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment