[gnome-control-center/wip/feborges/new-users-panel: 9/17] user-accounts: Prevent the removal of own account and only-admin



commit 58ac035cea891586850db9cab7cf404f5bc1a4fe
Author: Felipe Borges <felipeborges gnome org>
Date:   Mon Jul 11 16:55:10 2016 +0200

    user-accounts: Prevent the removal of own account and only-admin
    
    https://bugzilla.gnome.org/show_bug.cgi?id=767065

 panels/user-accounts/um-user-panel.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/panels/user-accounts/um-user-panel.c b/panels/user-accounts/um-user-panel.c
index 948701e..ad18575 100644
--- a/panels/user-accounts/um-user-panel.c
+++ b/panels/user-accounts/um-user-panel.c
@@ -1079,6 +1079,9 @@ on_permission_changed (GPermission *permission,
         is_authorized = g_permission_get_allowed (G_PERMISSION (d->permission));
         self_selected = act_user_get_uid (user) == geteuid ();
 
+        widget = get_widget (d, "remove-user-button");
+        gtk_widget_set_sensitive (widget, !self_selected || !would_demote_only_admin (user));
+
         if (!act_user_is_local_account (user)) {
                 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);


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