[gnome-control-center] user-accounts: really selects the newly-created user
- From: Jonh Wendell <jwendell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] user-accounts: really selects the newly-created user
- Date: Tue, 30 Jul 2013 12:51:47 +0000 (UTC)
commit 7e62ec47ce7be035a1f873b1b5c96b2d4c098650
Author: Jonh Wendell <jonh wendell intel com>
Date: Mon Jul 29 14:32:51 2013 -0300
user-accounts: really selects the newly-created user
complement to f438da7c3b7d0978e4f03d4d810d175ce9218e0f
make sure to only return the newly created User object when
it is fully loaded.
https://bugzilla.gnome.org/show_bug.cgi?id=704426
panels/user-accounts/um-account-dialog.c | 35 ++++++++++++++++++++---------
1 files changed, 24 insertions(+), 11 deletions(-)
---
diff --git a/panels/user-accounts/um-account-dialog.c b/panels/user-accounts/um-account-dialog.c
index 78d7a5b..1888e4e 100644
--- a/panels/user-accounts/um-account-dialog.c
+++ b/panels/user-accounts/um-account-dialog.c
@@ -191,15 +191,30 @@ complete_dialog (UmAccountDialog *self,
}
static void
+user_loaded_cb (ActUser *user,
+ GParamSpec *pspec,
+ UmAccountDialog *self)
+{
+ const gchar *password;
+
+ finish_action (self);
+
+ /* Set a password for the user */
+ password = gtk_entry_get_text (GTK_ENTRY (self->local_password));
+ act_user_set_password_mode (user, self->local_password_mode);
+ if (self->local_password_mode == ACT_USER_PASSWORD_MODE_REGULAR)
+ act_user_set_password (user, password, "");
+
+ complete_dialog (self, user);
+}
+
+static void
create_user_done (ActUserManager *manager,
GAsyncResult *res,
UmAccountDialog *self)
{
ActUser *user;
GError *error;
- const gchar *password;
-
- finish_action (self);
/* Note that user is returned without an extra reference */
@@ -207,6 +222,7 @@ create_user_done (ActUserManager *manager,
user = act_user_manager_create_user_finish (manager, res, &error);
if (user == NULL) {
+ finish_action (self);
g_debug ("Failed to create user: %s", error->message);
if (!g_error_matches (error, ACT_USER_MANAGER_ERROR,
ACT_USER_MANAGER_ERROR_PERMISSION_DENIED))
show_error_dialog (self, _("Failed to add account"), error);
@@ -215,14 +231,11 @@ create_user_done (ActUserManager *manager,
} else {
g_debug ("Created user: %s", act_user_get_user_name (user));
- /* Set a password for the user */
- password = gtk_entry_get_text (GTK_ENTRY (self->local_password));
- act_user_set_password_mode (user, self->local_password_mode);
- if (self->local_password_mode == ACT_USER_PASSWORD_MODE_REGULAR) {
- act_user_set_password (user, password, "");
- }
-
- complete_dialog (self, user);
+ /* Check if the returned object is fully loaded before returning it */
+ if (act_user_is_loaded (user))
+ user_loaded_cb (user, NULL, self);
+ else
+ g_signal_connect (user, "notify::is-loaded", G_CALLBACK (user_loaded_cb), self);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]