user-accounts: Don't have domains twice in the drop down
If we discover domains again, don't add them twice to the drop down and confuse the user. This is especially important if we receive two realms from realmd for the same domain for use with different clients (ie: sssd/winbind). We only want to offer the first choice https://bugzilla.gnome.org/show_bug.cgi?id=686397
This commit is contained in:
parent
11b5c87d26
commit
48ae461991
1 changed files with 30 additions and 4 deletions
|
@ -326,20 +326,46 @@ static void
|
|||
enterprise_add_realm (UmAccountDialog *self,
|
||||
UmRealmObject *realm)
|
||||
{
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
UmRealmCommon *common;
|
||||
|
||||
g_debug ("Adding new realm to drop down: %s",
|
||||
g_dbus_object_get_object_path (G_DBUS_OBJECT (realm)));
|
||||
const gchar *realm_name;
|
||||
gboolean match;
|
||||
gboolean ret;
|
||||
gchar *name;
|
||||
|
||||
common = um_realm_object_get_common (realm);
|
||||
realm_name = um_realm_common_get_name (common);
|
||||
|
||||
/*
|
||||
* Don't add a second realm if we already have one with this name.
|
||||
* Sometimes realmd returns to realms for the same name, if it has
|
||||
* different ways to use that realm. The first one that realmd
|
||||
* returns is the one it prefers.
|
||||
*/
|
||||
|
||||
model = GTK_TREE_MODEL (self->enterprise_realms);
|
||||
ret = gtk_tree_model_get_iter_first (model, &iter);
|
||||
while (ret) {
|
||||
gtk_tree_model_get (model, &iter, 0, &name, -1);
|
||||
match = (g_strcmp0 (name, realm_name) == 0);
|
||||
g_free (name);
|
||||
if (match) {
|
||||
g_debug ("ignoring duplicate realm: %s", realm_name);
|
||||
return;
|
||||
}
|
||||
ret = gtk_tree_model_iter_next (model, &iter);
|
||||
}
|
||||
|
||||
gtk_list_store_append (self->enterprise_realms, &iter);
|
||||
gtk_list_store_set (self->enterprise_realms, &iter,
|
||||
0, um_realm_common_get_name (common),
|
||||
0, realm_name,
|
||||
1, realm,
|
||||
-1);
|
||||
|
||||
g_debug ("added realm to drop down: %s %s", realm_name,
|
||||
g_dbus_object_get_object_path (G_DBUS_OBJECT (realm)));
|
||||
|
||||
if (!self->enterprise_domain_chosen && um_realm_is_configured (realm))
|
||||
gtk_combo_box_set_active_iter (self->enterprise_domain, &iter);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue