fixed to load user list correctly 22/44222/3
authorSoohye Shin <soohye.shin@samsung.com>
Mon, 20 Jul 2015 04:51:18 +0000 (13:51 +0900)
committerSoohye Shin <soohye.shin@samsung.com>
Mon, 20 Jul 2015 06:17:17 +0000 (15:17 +0900)
- get user list which type is normal and admin
- except for login user itself

Change-Id: I4bb322ef6ee0278425db046dcd8028182a83a294
Signed-off-by: Soohye Shin <soohye.shin@samsung.com>
src/data/data_user.c

index b1f3192793a301e70bb8372d71a9408a258fb30b..0e843fc88d1c8b70e56d55caa9b09ef1e85c269a 100644 (file)
@@ -35,7 +35,8 @@
 #define GUM_ATTR_UID "uid"
 #define GUM_ATTR_ICON "icon"
 #define GUM_ATTR_PASSWORD "secret"
-#define GUM_LIST_USERTYPE "normal"
+#define GUM_LIST_USERTYPE_NORMAL "normal"
+#define GUM_LIST_USERTYPE_ADMIN "admin"
 
 #define ADDRESS_BUF_MAX 128
 #define USER_SWITCH_TLM_SEAT_ID "seat0"
@@ -319,6 +320,7 @@ static bool _load_users(Eina_List **list)
        struct datamgr_item *di;
        char *name, *icon;
        gchar **strv;
+       uid_t uid, user_uid;
        int i;
 
        service = gum_user_service_create_sync(FALSE);
@@ -327,7 +329,8 @@ static bool _load_users(Eina_List **list)
                return false;
        }
 
-       strv = _append_string(NULL, GUM_LIST_USERTYPE);
+       strv = _append_string(NULL, GUM_LIST_USERTYPE_NORMAL);
+       strv = _append_string(strv, GUM_LIST_USERTYPE_ADMIN);
        ulist = gum_user_service_get_user_list_sync(service,
                        (const gchar *const *)strv);
        g_strfreev(strv);
@@ -337,14 +340,18 @@ static bool _load_users(Eina_List **list)
                return false;
        }
 
+       user_uid = getuid();
        for (i = 0; i < g_list_length(ulist); i++) {
                user = g_list_nth_data(ulist, i);
                if (!user)
                        continue;
 
                g_object_get(G_OBJECT(user), GUM_ATTR_NAME, &name,
-                               GUM_ATTR_ICON, &icon,
+                               GUM_ATTR_ICON, &icon, GUM_ATTR_UID, &uid,
                                GUM_ATTR_USERTYPE, &type, NULL);
+               if (uid == user_uid)
+                       continue;
+
                di = _pack_user(name, icon, icon, ITEM_SELECT_ACTION_SWITCH,
                                NULL, type);
                if (!di)