[accounts-dialog] Add 'automatic-login' setters/getters to the UmUser object



commit 5f0bbc39bbedf8adcd70559599cb98b901476a87
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jan 20 13:32:32 2010 -0500

    Add 'automatic-login' setters/getters to the UmUser object

 src/um-user.c |   29 +++++++++++++++++++++++++++++
 src/um-user.h |    3 +++
 2 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/src/um-user.c b/src/um-user.c
index d7de01d..195be6f 100644
--- a/src/um-user.c
+++ b/src/um-user.c
@@ -58,6 +58,7 @@ typedef struct {
         guint64         login_frequency;
         gchar          *icon_file;
         gboolean        locked;
+        gboolean        automatic_login;
 } UserProperties;
 
 static void
@@ -97,6 +98,9 @@ collect_props (const gchar    *key,
         else if (strcmp (key, "Locked") == 0) {
                 props->locked = g_value_get_boolean (value);
         }
+        else if (strcmp (key, "AutomaticLogin") == 0) {
+                props->automatic_login = g_value_get_boolean (value);
+        }
         else if (strcmp (key, "PasswordMode") == 0) {
                 props->password_mode = g_value_get_int (value);
         }
@@ -698,6 +702,14 @@ um_user_get_icon_file (UmUser *user)
         return user->props->icon_file;
 }
 
+gboolean
+um_user_get_automatic_login (UmUser *user)
+{
+        g_return_val_if_fail (UM_IS_USER (user), FALSE);
+
+        return user->props->automatic_login;
+}
+
 const gchar *
 um_user_get_object_path (UmUser *user)
 {
@@ -1042,3 +1054,20 @@ um_user_is_logged_in (UmUser *user)
 }
 
 
+void
+um_user_set_automatic_login (UmUser   *user,
+                             gboolean  enabled)
+{
+        GError *error = NULL;
+
+        if (!dbus_g_proxy_call (user->proxy,
+                                "SetAutomaticLogin",
+                                &error,
+                                G_TYPE_BOOLEAN, enabled,
+                                G_TYPE_INVALID,
+                                G_TYPE_INVALID)) {
+                g_warning ("SetAutomaticLogin call failed: %s", error->message);
+                g_error_free (error);
+        }
+}
+
diff --git a/src/um-user.h b/src/um-user.h
index 6465171..5f0e50d 100644
--- a/src/um-user.h
+++ b/src/um-user.h
@@ -65,6 +65,7 @@ gulong         um_user_get_login_frequency (UmUser   *user);
 gint           um_user_get_password_mode   (UmUser   *user);
 const gchar   *um_user_get_password_hint   (UmUser   *user);
 const gchar   *um_user_get_icon_file       (UmUser   *user);
+gboolean       um_user_get_automatic_login (UmUser   *user);
 
 void           um_user_set_user_name       (UmUser      *user,
                                             const gchar *user_name);
@@ -82,6 +83,8 @@ void           um_user_set_icon_data       (UmUser      *user,
                                             GdkPixbuf   *pixbuf);
 void           um_user_set_account_type    (UmUser      *user,
                                             gint         account_type);
+void           um_user_set_automatic_login (UmUser      *user,
+                                            gboolean     enabled);
 void           um_user_set_password        (UmUser      *user,
                                             int          password_mode,
                                             const gchar *plain,



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