[gnome-initial-setup: 12/20] account: Remove internal storage of created user account
- From: Will Thompson <wjt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup: 12/20] account: Remove internal storage of created user account
- Date: Fri, 14 Feb 2020 16:49:43 +0000 (UTC)
commit 128283ad10a49ae9e9039261dc3a6e7e191ab781
Author: Philip Withnall <withnall endlessm com>
Date: Thu Feb 6 13:33:51 2020 +0000
account: Remove internal storage of created user account
It was not necessary and just made the code a little bit more complex
than it needed to be.
Signed-off-by: Philip Withnall <withnall endlessm com>
.../pages/account/gis-account-page-local.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/gnome-initial-setup/pages/account/gis-account-page-local.c
b/gnome-initial-setup/pages/account/gis-account-page-local.c
index 3aa9be4..a017b85 100644
--- a/gnome-initial-setup/pages/account/gis-account-page-local.c
+++ b/gnome-initial-setup/pages/account/gis-account-page-local.c
@@ -59,7 +59,6 @@ struct _GisAccountPageLocalPrivate
GdkPixbuf *avatar_pixbuf;
gchar *avatar_filename;
- ActUser *act_user;
ActUserManager *act_client;
GoaClient *goa_client;
@@ -473,7 +472,8 @@ gis_account_page_local_dispose (GObject *object)
}
static void
-set_user_avatar (GisAccountPageLocal *page)
+set_user_avatar (GisAccountPageLocal *page,
+ ActUser *user)
{
GisAccountPageLocalPrivate *priv = gis_account_page_local_get_instance_private (page);
GFile *file = NULL;
@@ -482,7 +482,7 @@ set_user_avatar (GisAccountPageLocal *page)
GError *error = NULL;
if (priv->avatar_filename != NULL) {
- act_user_set_icon_file (priv->act_user, priv->avatar_filename);
+ act_user_set_icon_file (user, priv->avatar_filename);
return;
}
@@ -498,7 +498,7 @@ set_user_avatar (GisAccountPageLocal *page)
if (!gdk_pixbuf_save_to_stream (priv->avatar_pixbuf, stream, "png", NULL, &error, NULL))
goto out;
- act_user_set_icon_file (priv->act_user, g_file_get_path (file));
+ act_user_set_icon_file (user, g_file_get_path (file));
out:
if (error != NULL) {
@@ -515,21 +515,21 @@ local_create_user (GisAccountPageLocal *page)
GisAccountPageLocalPrivate *priv = gis_account_page_local_get_instance_private (page);
const gchar *username;
const gchar *fullname;
- GError *error = NULL;
+ g_autoptr(GError) local_error = NULL;
+ g_autoptr(ActUser) main_user = NULL;
username = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (priv->username_combo));
fullname = gtk_entry_get_text (GTK_ENTRY (priv->fullname_entry));
- priv->act_user = act_user_manager_create_user (priv->act_client, username, fullname, priv->account_type,
&error);
- if (error != NULL) {
- g_warning ("Failed to create user: %s", error->message);
- g_error_free (error);
+ main_user = act_user_manager_create_user (priv->act_client, username, fullname, priv->account_type,
&local_error);
+ if (local_error != NULL) {
+ g_warning ("Failed to create user: %s", local_error->message);
return;
}
- set_user_avatar (page);
+ set_user_avatar (page, main_user);
- g_signal_emit (page, signals[USER_CREATED], 0, priv->act_user, "");
+ g_signal_emit (page, signals[USER_CREATED], 0, main_user, "");
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]