diff options
-rw-r--r-- | src/data/data_user.c | 46 |
1 files changed, 10 insertions, 36 deletions
diff --git a/src/data/data_user.c b/src/data/data_user.c index 1461ce0..85faf84 100644 --- a/src/data/data_user.c +++ b/src/data/data_user.c @@ -20,9 +20,9 @@ #include <stdbool.h> #include <viewmgr.h> #include <stdlib.h> -#include <gum/gum-user.h> -#include <gum/gum-user-service.h> -#include <gum/common/gum-user-types.h> +#include <gum-user.h> +#include <gum-user-service.h> +#include <common/gum-user-types.h> #include <gio/gio.h> #include "data_user.h" @@ -292,33 +292,6 @@ static bool _load_login_user(Eina_List **list) return true; } -static gchar **_append_string(gchar **src_strv, const gchar *string) -{ - gchar **dest_strv; - gint ind; - gint len; - - if (src_strv) - len = g_strv_length(src_strv); - - len = 0; - ind = 0; - dest_strv = NULL; - - dest_strv = (gchar **)g_malloc0(sizeof(gchar *) * (len + 2)); - if (src_strv) { - while (src_strv[ind]) { - dest_strv[ind] = g_strdup(src_strv[ind]); - ind++; - } - } - - dest_strv[ind++] = g_strdup(string); - dest_strv[ind] = NULL; - - return dest_strv; -} - static bool _load_users(Eina_List **list) { GumUserList *ulist; @@ -327,21 +300,22 @@ static bool _load_users(Eina_List **list) GumUserType type; struct datamgr_item *di; char *name, *icon; - gchar **strv; uid_t uid, user_uid; int i; + static const gchar * const strv[] = { + GUM_LIST_USERTYPE_NORMAL, + GUM_LIST_USERTYPE_ADMIN, + NULL + }; + service = gum_user_service_create_sync(FALSE); if (!service) { _ERR("failed to create service"); return false; } - 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); + ulist = gum_user_service_get_user_list_sync(service, strv); if (!ulist) { _ERR("failed to get user list"); g_object_unref(service); |