[gnome-control-center/wip/feborges/new-users-panel] user-accounts: Handle the info update just on the show_user method



commit 398d6f6d0d55b49d584a315339088929b17cbdfd
Author: Felipe Borges <felipeborges gnome org>
Date:   Mon Jul 11 18:01:45 2016 +0200

    user-accounts: Handle the info update just on the show_user method
    
    Instead of setting the new values for the widgets in each of their
    buttons callbacks, use the show_user method to load what's set in
    the backend.

 panels/user-accounts/um-user-panel.c |   21 +++------------------
 1 files changed, 3 insertions(+), 18 deletions(-)
---
diff --git a/panels/user-accounts/um-user-panel.c b/panels/user-accounts/um-user-panel.c
index 228b172..b00672b 100644
--- a/panels/user-accounts/um-user-panel.c
+++ b/panels/user-accounts/um-user-panel.c
@@ -835,6 +835,7 @@ account_type_changed (GtkToggleButton    *button,
         if (account_type != act_user_get_account_type (user)) {
                 act_user_set_account_type (user, account_type);
 
+                show_user (user, d);
                 if (self_selected)
                         show_restart_notification (d, NULL);
         }
@@ -910,11 +911,9 @@ language_response (GtkDialog         *dialog,
                    gint               response_id,
                    CcUserPanelPrivate *d)
 {
-        GtkWidget *button;
         ActUser *user;
         const gchar *lang, *account_language;
         gchar *current_language;
-        gchar *name = NULL;
         gboolean self_selected;
 
         if (response_id != GTK_RESPONSE_OK) {
@@ -937,11 +936,6 @@ language_response (GtkDialog         *dialog,
                                 show_restart_notification (d, lang);
                         g_free (current_language);
                 }
-
-                button = get_widget (d, "account-language-button");
-                name = gnome_get_language_from_locale (lang, NULL);
-                um_editable_button_set_text (UM_EDITABLE_BUTTON (button), name);
-                g_free (name);
         }
 
         g_object_unref (user);
@@ -1092,18 +1086,12 @@ on_permission_changed (GPermission *permission,
                 gtk_stack_set_visible_child_name (GTK_STACK (get_widget (d, "account-type-stack")), 
"static");
                 gtk_widget_set_sensitive (GTK_WIDGET (get_widget (d, "autologin-switch")), FALSE);
 
-        } else if (is_authorized && act_user_is_local_account (user)) {
+        } else {
                 if (would_demote_only_admin (user)) {
                         gtk_stack_set_visible_child_name (GTK_STACK (get_widget (d, "account-type-stack")), 
"static");
                 } else {
                         gtk_stack_set_visible_child_name (GTK_STACK (get_widget (d, "account-type-stack")), 
"buttons");
                 }
-
-                gtk_widget_set_sensitive (GTK_WIDGET (get_widget (d, "autologin-switch")), 
get_autologin_possible (user));
-        }
-        else {
-                gtk_stack_set_visible_child_name (GTK_STACK (get_widget (d, "account-type-stack")), 
"static");
-                gtk_widget_set_sensitive (GTK_WIDGET (get_widget (d, "autologin-switch")), FALSE);
         }
 
         /* The full name entry: insensitive if remote or not authorized and not self */
@@ -1111,11 +1099,8 @@ on_permission_changed (GPermission *permission,
         if (!act_user_is_local_account (user)) {
                 cc_editable_entry_set_editable (CC_EDITABLE_ENTRY (widget), FALSE);
 
-        } else if (is_authorized || self_selected) {
-                cc_editable_entry_set_editable (CC_EDITABLE_ENTRY (widget), TRUE);
-
         } else {
-                cc_editable_entry_set_editable (CC_EDITABLE_ENTRY (widget), FALSE);
+                cc_editable_entry_set_editable (CC_EDITABLE_ENTRY (widget), TRUE);
         }
 
         gtk_widget_show (get_widget (d, "user-icon-button"));


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