[gnome-control-center] Users: try harder not to show system accounts



commit 59db8d3716b9fe48549ba2e3e7b142f2a275c4f6
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Apr 11 14:36:20 2011 -0400

    Users: try harder not to show system accounts
    
    When used with accountsservice >= 0.6.9, this fixes the problem where,
    when you click the unlock button on the user panel, the root user pops
    up in the user list, unexpectedly.
    
    When used with 0.6.8 it silently does nothing, since the system-account
    property is not available.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=647487

 panels/user-accounts/um-user-manager.c |    5 +++++
 panels/user-accounts/um-user.c         |   13 ++++++++++++-
 panels/user-accounts/um-user.h         |    1 +
 3 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/panels/user-accounts/um-user-manager.c b/panels/user-accounts/um-user-manager.c
index 6b603bb..6bf8b42 100644
--- a/panels/user-accounts/um-user-manager.c
+++ b/panels/user-accounts/um-user-manager.c
@@ -206,6 +206,11 @@ user_added_handler (DBusGProxy *proxy,
         if (!user)
                 return;
 
+        if (um_user_is_system_account (user)) {
+                g_object_unref (user);
+                return;
+        }
+
         add_user_to_dupe_ring (manager, user);
 
         g_signal_connect (user, "changed",
diff --git a/panels/user-accounts/um-user.c b/panels/user-accounts/um-user.c
index ce92b4e..87aad57 100644
--- a/panels/user-accounts/um-user.c
+++ b/panels/user-accounts/um-user.c
@@ -64,6 +64,7 @@ typedef struct {
         gchar          *icon_file;
         gboolean        locked;
         gboolean        automatic_login;
+        gboolean        system_account;
 } UserProperties;
 
 static void
@@ -106,6 +107,9 @@ collect_props (const gchar    *key,
         else if (strcmp (key, "AutomaticLogin") == 0) {
                 props->automatic_login = g_value_get_boolean (value);
         }
+        else if (strcmp (key, "SystemAccount") == 0) {
+                props->system_account = g_value_get_boolean (value);
+        }
         else if (strcmp (key, "PasswordMode") == 0) {
                 props->password_mode = g_value_get_int (value);
         }
@@ -666,7 +670,6 @@ um_user_get_locked (UmUser *user)
 
         return user->props->locked;
 }
-
 gboolean
 um_user_get_automatic_login (UmUser *user)
 {
@@ -675,6 +678,14 @@ um_user_get_automatic_login (UmUser *user)
         return user->props->automatic_login;
 }
 
+gboolean
+um_user_is_system_account (UmUser *user)
+{
+        g_return_val_if_fail (UM_IS_USER (user), FALSE);
+
+        return user->props->system_account;
+}
+
 const gchar *
 um_user_get_object_path (UmUser *user)
 {
diff --git a/panels/user-accounts/um-user.h b/panels/user-accounts/um-user.h
index 43a88b0..8f78957 100644
--- a/panels/user-accounts/um-user.h
+++ b/panels/user-accounts/um-user.h
@@ -68,6 +68,7 @@ const gchar   *um_user_get_password_hint   (UmUser   *user);
 const gchar   *um_user_get_icon_file       (UmUser   *user);
 gboolean       um_user_get_locked          (UmUser   *user);
 gboolean       um_user_get_automatic_login (UmUser   *user);
+gboolean       um_user_is_system_account   (UmUser   *user);
 
 void           um_user_set_user_name       (UmUser      *user,
                                             const gchar *user_name);



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