[gnome-control-center/gnome-3-8] user-accounts: correctly selects the newly-created user



commit 6dc71282858625af53283d0cd23364f2ed4aa7dd
Author: Jonh Wendell <jonh wendell intel com>
Date:   Wed Jul 17 18:55:39 2013 -0300

    user-accounts: correctly selects the newly-created user
    
    don't compare pointers, as they can be different, given they
    can come from different sources. compare their UID's.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=704426

 panels/user-accounts/um-user-panel.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/panels/user-accounts/um-user-panel.c b/panels/user-accounts/um-user-panel.c
index e3dd8f4..b9cfb62 100644
--- a/panels/user-accounts/um-user-panel.c
+++ b/panels/user-accounts/um-user-panel.c
@@ -351,6 +351,7 @@ select_created_user (GObject *object,
         ActUser *current;
         GtkTreePath *path;
         ActUser *user;
+        uid_t user_uid;
 
         dialog = UM_ACCOUNT_DIALOG (object);
         user = um_account_dialog_finish (dialog, result);
@@ -363,20 +364,22 @@ select_created_user (GObject *object,
         tv = (GtkTreeView *)get_widget (d, "list-treeview");
         model = gtk_tree_view_get_model (tv);
         selection = gtk_tree_view_get_selection (tv);
+        user_uid = act_user_get_uid (user);
 
         gtk_tree_model_get_iter_first (model, &iter);
         do {
                 gtk_tree_model_get (model, &iter, USER_COL, &current, -1);
-                if (user == current) {
-                        path = gtk_tree_model_get_path (model, &iter);
-                        gtk_tree_view_scroll_to_cell (tv, path, NULL, FALSE, 0.0, 0.0);
-                        gtk_tree_selection_select_path (selection, path);
-                        gtk_tree_path_free (path);
+                if (current) {
+                        if (user_uid == act_user_get_uid (current)) {
+                                path = gtk_tree_model_get_path (model, &iter);
+                                gtk_tree_view_scroll_to_cell (tv, path, NULL, FALSE, 0.0, 0.0);
+                                gtk_tree_selection_select_path (selection, path);
+                                gtk_tree_path_free (path);
+                                g_object_unref (current);
+                                break;
+                        }
                         g_object_unref (current);
-                        break;
                 }
-                if (current)
-                        g_object_unref (current);
         } while (gtk_tree_model_iter_next (model, &iter));
 
         g_object_unref (user);


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