[gnome-control-center] user-accounts: Create the add account dialog on demand



commit 3f76a97915643522eeac207c17f2d62960271bad
Author: Stef Walter <stefw gnome org>
Date:   Tue Aug 14 17:04:41 2012 +0200

    user-accounts: Create the add account dialog on demand
    
     * Creating the add account dialog as the panel gets created
       means that realmd is invoked, network discovery is done
       and so on. Not optimal.
     * We also don't really need to cache the account dialog,
       and can create a new one for each [+] click.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=681852

 panels/user-accounts/um-user-panel.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/panels/user-accounts/um-user-panel.c b/panels/user-accounts/um-user-panel.c
index 2eb6c14..950b813 100644
--- a/panels/user-accounts/um-user-panel.c
+++ b/panels/user-accounts/um-user-panel.c
@@ -67,7 +67,6 @@ struct _UmUserPanelPrivate {
         GPermission *permission;
         GtkWidget *language_chooser;
 
-        UmAccountDialog *account_dialog;
         UmPasswordDialog *password_dialog;
         UmPhotoDialog *photo_dialog;
 };
@@ -303,6 +302,7 @@ select_created_user (GObject *object,
                      gpointer user_data)
 {
         UmUserPanelPrivate *d = user_data;
+        UmAccountDialog *dialog;
         GtkTreeView *tv;
         GtkTreeModel *model;
         GtkTreeSelection *selection;
@@ -311,7 +311,10 @@ select_created_user (GObject *object,
         GtkTreePath *path;
         UmUser *user;
 
-        user = um_account_dialog_finish (UM_ACCOUNT_DIALOG (object), result);
+        dialog = UM_ACCOUNT_DIALOG (object);
+        user = um_account_dialog_finish (dialog, result);
+        gtk_widget_destroy (GTK_WIDGET (dialog));
+
         if (user == NULL)
                 return;
 
@@ -340,8 +343,10 @@ select_created_user (GObject *object,
 static void
 add_user (GtkButton *button, UmUserPanelPrivate *d)
 {
-        um_account_dialog_show (d->account_dialog,
-                                GTK_WINDOW (gtk_widget_get_toplevel (d->main_box)),
+        UmAccountDialog *dialog;
+
+        dialog = um_account_dialog_new ();
+        um_account_dialog_show (dialog, GTK_WINDOW (gtk_widget_get_toplevel (d->main_box)),
                                 select_created_user, d);
 }
 
@@ -1278,7 +1283,6 @@ um_user_panel_init (UmUserPanel *self)
         }
 
         setup_main_window (d);
-        d->account_dialog = um_account_dialog_new ();
         d->password_dialog = um_password_dialog_new ();
         button = get_widget (d, "user-icon-button");
         d->photo_dialog = um_photo_dialog_new (button);
@@ -1304,10 +1308,6 @@ um_user_panel_dispose (GObject *object)
                 g_object_unref (priv->builder);
                 priv->builder = NULL;
         }
-        if (priv->account_dialog) {
-                gtk_widget_destroy (GTK_WIDGET (priv->account_dialog));
-                priv->account_dialog = NULL;
-        }
         if (priv->password_dialog) {
                 um_password_dialog_free (priv->password_dialog);
                 priv->password_dialog = NULL;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]