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



commit 8f951d552ecf598dbf5096cb38ef6e1396555a2f
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

 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]