1 /* 2 * Copyright (C) 2010 Robert Ancell. 3 * Copyright (C) 2014 Canonical, Ltd. 4 * Authors: Robert Ancell <robert.ancell@canonical.com> 5 * Michael Terry <michael.terry@canonical.com> 6 * 7 * This library is free software; you can redistribute it and/or modify it under 8 * the terms of the GNU Lesser General Public License as published by the Free 9 * Software Foundation; either version 2 or version 3 of the License. 10 * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 11 */ 12 13 #ifndef COMMON_USER_LIST_H_ 14 #define COMMON_USER_LIST_H_ 15 16 #include <glib-object.h> 17 #include <sys/types.h> 18 19 G_BEGIN_DECLS 20 21 #define COMMON_TYPE_USER_LIST (common_user_list_get_type()) 22 #define COMMON_USER_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), COMMON_TYPE_USER_LIST, CommonUserList)); 23 #define COMMON_USER_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), COMMON_TYPE_USER_LIST, CommonUserListClass)) 24 #define COMMON_IS_USER_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), COMMON_TYPE_USER_LIST)) 25 #define COMMON_IS_USER_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), COMMON_TYPE_USER_LIST)) 26 #define COMMON_USER_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), COMMON_TYPE_USER_LIST, CommonUserListClass)) 27 28 #define COMMON_TYPE_USER (common_user_get_type()) 29 #define COMMON_USER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), COMMON_TYPE_USER, CommonUser)); 30 #define COMMON_USER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), COMMON_TYPE_USER, CommonUserClass)) 31 #define COMMON_IS_USER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), COMMON_TYPE_USER)) 32 #define COMMON_IS_USER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), COMMON_TYPE_USER)) 33 #define COMMON_USER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), COMMON_TYPE_USER, CommonUserClass)) 34 35 #define USER_LIST_SIGNAL_USER_ADDED "user-added" 36 #define USER_LIST_SIGNAL_USER_CHANGED "user-changed" 37 #define USER_LIST_SIGNAL_USER_REMOVED "user-removed" 38 39 #define USER_SIGNAL_CHANGED "changed" 40 41 typedef struct 42 { 43 GObject parent_instance; 44 } CommonUser; 45 46 typedef struct 47 { 48 GObjectClass parent_class; 49 50 void (*changed)(CommonUser *user); 51 } CommonUserClass; 52 53 typedef struct 54 { 55 GObject parent_instance; 56 } CommonUserList; 57 58 typedef struct 59 { 60 GObjectClass parent_class; 61 62 void (*user_added)(CommonUserList *user_list, CommonUser *user); 63 void (*user_changed)(CommonUserList *user_list, CommonUser *user); 64 void (*user_removed)(CommonUserList *user_list, CommonUser *user); 65 } CommonUserListClass; 66 67 GType common_user_list_get_type (void); 68 69 GType common_user_get_type (void); 70 71 CommonUserList *common_user_list_get_instance (void); 72 73 void common_user_list_cleanup (void); 74 75 gint common_user_list_get_length (CommonUserList *user_list); 76 77 CommonUser *common_user_list_get_user_by_name (CommonUserList *user_list, const gchar *username); 78 79 GList *common_user_list_get_users (CommonUserList *user_list); 80 81 const gchar *common_user_get_name (CommonUser *user); 82 83 const gchar *common_user_get_real_name (CommonUser *user); 84 85 const gchar *common_user_get_display_name (CommonUser *user); 86 87 const gchar *common_user_get_home_directory (CommonUser *user); 88 89 const gchar *common_user_get_shell (CommonUser *user); 90 91 const gchar *common_user_get_image (CommonUser *user); 92 93 const gchar *common_user_get_background (CommonUser *user); 94 95 const gchar *common_user_get_language (CommonUser *user); 96 97 void common_user_set_language (CommonUser *user, const gchar *language); 98 99 const gchar *common_user_get_layout (CommonUser *user); 100 101 const gchar * const *common_user_get_layouts (CommonUser *user); 102 103 const gchar *common_user_get_session (CommonUser *user); 104 105 void common_user_set_session (CommonUser *user, const gchar *session); 106 107 gboolean common_user_get_logged_in (CommonUser *user); 108 109 gboolean common_user_get_has_messages (CommonUser *user); 110 111 uid_t common_user_get_uid (CommonUser *user); 112 113 gid_t common_user_get_gid (CommonUser *user); 114 115 gboolean common_user_get_is_locked (CommonUser *user); 116 117 G_END_DECLS 118 119 #endif /* COMMON_USER_LIST_H_ */ 120