summaryrefslogtreecommitdiff
path: root/liblightdm-gobject
diff options
context:
space:
mode:
authorAndrea Cimitan <andrea.cimitan@gmail.com>2014-05-09 11:37:13 +0100
committerAndrea Cimitan <andrea.cimitan@gmail.com>2014-05-09 11:37:13 +0100
commit5d9aeed7698ff5f38d12296762aa0c69f11fafa2 (patch)
tree9e1167c442148377037fcb90b4726d825f6ea6c1 /liblightdm-gobject
parentea40a649796821a251d801498af924a8208edd54 (diff)
downloadlightdm-5d9aeed7698ff5f38d12296762aa0c69f11fafa2.tar.gz
Add UID to lightdm gobject and qt bindings
Diffstat (limited to 'liblightdm-gobject')
-rw-r--r--liblightdm-gobject/lightdm/user.h2
-rw-r--r--liblightdm-gobject/user.c30
2 files changed, 30 insertions, 2 deletions
diff --git a/liblightdm-gobject/lightdm/user.h b/liblightdm-gobject/lightdm/user.h
index b43fc516..f955ab29 100644
--- a/liblightdm-gobject/lightdm/user.h
+++ b/liblightdm-gobject/lightdm/user.h
@@ -106,6 +106,8 @@ gboolean lightdm_user_get_logged_in (LightDMUser *user);
gboolean lightdm_user_get_has_messages (LightDMUser *user);
+uid_t lightdm_user_get_uid (LightDMUser *user);
+
G_END_DECLS
#endif /* LIGHTDM_USER_H_ */
diff --git a/liblightdm-gobject/user.c b/liblightdm-gobject/user.c
index 4fb5f044..86b462f8 100644
--- a/liblightdm-gobject/user.c
+++ b/liblightdm-gobject/user.c
@@ -38,7 +38,8 @@ enum
USER_PROP_LAYOUTS,
USER_PROP_SESSION,
USER_PROP_LOGGED_IN,
- USER_PROP_HAS_MESSAGES
+ USER_PROP_HAS_MESSAGES,
+ USER_PROP_UID,
};
enum
@@ -526,6 +527,21 @@ lightdm_user_get_has_messages (LightDMUser *user)
return common_user_get_has_messages (GET_USER_PRIVATE (user)->common_user);
}
+/**
+ * lightdm_user_get_uid:
+ * @user: A #LightDMUser
+ *
+ * Get the uid of a user.
+ *
+ * Return value: The uid of the given user
+ **/
+uid_t
+lightdm_user_get_display_name (LightDMUser *user)
+{
+ g_return_val_if_fail (LIGHTDM_IS_USER (user), NULL);
+ return common_user_get_uid (GET_USER_PRIVATE (user)->common_user);
+}
+
static void
lightdm_user_init (LightDMUser *user)
{
@@ -599,6 +615,9 @@ lightdm_user_get_property (GObject *object,
case USER_PROP_HAS_MESSAGES:
g_value_set_boolean (value, lightdm_user_get_has_messages (self));
break;
+ case USER_PROP_UID:
+ g_value_set_uint64 (value, lightdm_user_get_uid (self));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -620,7 +639,7 @@ static void
lightdm_user_class_init (LightDMUserClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
+
g_type_class_add_private (klass, sizeof (LightDMUserPrivate));
object_class->set_property = lightdm_user_set_property;
@@ -718,6 +737,13 @@ lightdm_user_class_init (LightDMUserClass *klass)
"TRUE if the user is has waiting messages",
FALSE,
G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ USER_PROP_UID,
+ g_param_spec_string ("uid",
+ "uid",
+ "User UID",
+ NULL,
+ G_PARAM_READABLE));
/**
* LightDMUser::changed: