summaryrefslogtreecommitdiff
path: root/liblightdm-gobject/user.c
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2013-10-29 13:54:59 -0700
committerRobert Ancell <robert.ancell@canonical.com>2013-10-29 13:54:59 -0700
commit6d8d2a21b89899d245ed3d72e1cff00a737b3cd8 (patch)
tree78a4f50837a5ee7fa25cbf1d4d28d80925802673 /liblightdm-gobject/user.c
parent57a60230ab344c56f0d7ebbf3e62b3171a324ae2 (diff)
downloadlightdm-6d8d2a21b89899d245ed3d72e1cff00a737b3cd8.tar.gz
Add some comments, use g_strcmp0 for safety
Diffstat (limited to 'liblightdm-gobject/user.c')
-rw-r--r--liblightdm-gobject/user.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/liblightdm-gobject/user.c b/liblightdm-gobject/user.c
index 90251bd4..4137e650 100644
--- a/liblightdm-gobject/user.c
+++ b/liblightdm-gobject/user.c
@@ -93,18 +93,37 @@ typedef struct
typedef struct
{
+ /* User list this user is part of */
LightDMUserList *user_list;
+ /* DMRC file */
+ GKeyFile *dmrc_file;
+
+ /* Username */
gchar *name;
+
+ /* Descriptive name for user */
gchar *real_name;
+
+ /* Home directory of user */
gchar *home_directory;
+
+ /* Image for user */
gchar *image;
+
+ /* Background image for users */
gchar *background;
+
+ /* TRUE if this user has messages available */
gboolean has_messages;
- GKeyFile *dmrc_file;
+ /* User chosen language */
gchar *language;
+
+ /* User layout preferences */
gchar **layouts;
+
+ /* User default session */
gchar *session;
} LightDMUserPrivate;
@@ -158,7 +177,7 @@ get_user_by_name (LightDMUserList *user_list, const gchar *username)
for (link = priv->users; link; link = link->next)
{
LightDMUser *user = link->data;
- if (strcmp (lightdm_user_get_name (user), username) == 0)
+ if (g_strcmp0 (lightdm_user_get_name (user), username) == 0)
return user;
}
@@ -169,7 +188,7 @@ static gint
compare_user (gconstpointer a, gconstpointer b)
{
LightDMUser *user_a = (LightDMUser *) a, *user_b = (LightDMUser *) b;
- return strcmp (lightdm_user_get_display_name (user_a), lightdm_user_get_display_name (user_b));
+ return g_strcmp0 (lightdm_user_get_display_name (user_a), lightdm_user_get_display_name (user_b));
}
static gboolean
@@ -177,6 +196,7 @@ update_passwd_user (LightDMUser *user, const gchar *real_name, const gchar *home
{
LightDMUserPrivate *priv = GET_USER_PRIVATE (user);
+ /* Skip if already set to this */
if (g_strcmp0 (lightdm_user_get_real_name (user), real_name) == 0 &&
g_strcmp0 (lightdm_user_get_home_directory (user), home_directory) == 0 &&
g_strcmp0 (lightdm_user_get_image (user), image) == 0)
@@ -408,6 +428,7 @@ update_user (UserAccountObject *object)
if (!result)
return FALSE;
+ /* Store the properties we need */
g_variant_get (result, "(a{sv})", &iter);
while (g_variant_iter_loop (iter, "{&sv}", &name, &value))
{