diff options
author | Brian Cameron <Brian.Cameron@sun.com> | 2009-09-10 19:13:44 -0500 |
---|---|---|
committer | Brian Cameron <Brian.Cameron@sun.com> | 2009-09-10 19:13:44 -0500 |
commit | 2df153a444c7123bd6b2fbafe7ed7e2f33791dab (patch) | |
tree | 0e91d3d1a94990616ed8195443cd6df0be722039 | |
parent | ea546ed9a80a8938c0a93fbfd6c301d4154c442d (diff) | |
download | gdm-2df153a444c7123bd6b2fbafe7ed7e2f33791dab.tar.gz |
Fix the options widget so that the user/language settings will remain
sticky on failed login. Fixes bug #591079.
-rw-r--r-- | gui/simple-greeter/gdm-option-widget.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gui/simple-greeter/gdm-option-widget.c b/gui/simple-greeter/gdm-option-widget.c index 15b73409..8467eb5a 100644 --- a/gui/simple-greeter/gdm-option-widget.c +++ b/gui/simple-greeter/gdm-option-widget.c @@ -281,6 +281,8 @@ void gdm_option_widget_set_default_item (GdmOptionWidget *widget, const char *item) { + char *active; + g_return_if_fail (GDM_IS_OPTION_WIDGET (widget)); g_return_if_fail (item == NULL || gdm_option_widget_lookup_item (widget, item, @@ -299,6 +301,31 @@ gdm_option_widget_set_default_item (GdmOptionWidget *widget, widget->priv->default_item_id = g_strdup (item); g_object_notify (G_OBJECT (widget), "default-item"); + + } + + /* If a row has already been selected, then reset the selection to + * the active row. This way when a user fails to authenticate, any + * previously selected value will still be selected. + */ + active = gdm_option_widget_get_active_item (widget); + + if (active != NULL && item != NULL && + strcmp (gdm_option_widget_get_active_item (widget), + item) != 0) { + GtkTreeRowReference *row; + GtkTreePath *active_path; + GtkTreeModel *model; + + gdm_option_widget_set_active_item (widget, active); + active_path = gtk_tree_row_reference_get_path (widget->priv->active_row); + model = GTK_TREE_MODEL (widget->priv->list_store); + if (active_path != NULL) { + row = gtk_tree_row_reference_new (model, active_path); + activate_from_row (widget, row); + gtk_tree_path_free (active_path); + gtk_tree_row_reference_free (row); + } } } |