From c34ed4684b91fc2bcea4c64227fe2efffbb8e893 Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Fri, 31 Jul 2015 13:58:33 +0900 Subject: Update user message Change-Id: I14f596546f5687e340003f901fa0e691a3174119 Signed-off-by: jinwoo.shin --- include/strings.h | 2 +- src/square_view.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/include/strings.h b/include/strings.h index 964dc7a..fb210e0 100644 --- a/include/strings.h +++ b/include/strings.h @@ -31,7 +31,7 @@ #define STR_SQUARE_TITLE STR_NOTIFICATION_TITLE #define STR_NOTIFICATION_LIST_TITLE "Recent Notification" -#define STR_DEFAULT_USER_MESSAGE "Good morning !" +#define STR_DEFAULT_USER_MESSAGE "Welcome, %s" #define STR_DEFAULT_TIME_AM_PM "" #define STR_DEFAULT_TIME_HOUR "12" #define STR_DEFAULT_TIME_MINUTE "30" diff --git a/src/square_view.c b/src/square_view.c index 16db8a1..9dbcbf2 100644 --- a/src/square_view.c +++ b/src/square_view.c @@ -69,10 +69,20 @@ static input_handler scroller_handler = { static void _print_user_message(struct _priv *priv) { char *message; + uid_t uid; + struct passwd *passwd; + char buf[128]; message = vconf_get_str(KEY_USER_MESSAGE); - if (!message) - message = strdup(STR_DEFAULT_USER_MESSAGE); + if (!message) { + uid = getuid(); + passwd = getpwuid(uid); + if (passwd) { + snprintf(buf, sizeof(buf), + STR_DEFAULT_USER_MESSAGE, passwd->pw_name); + message = buf; + } + } elm_object_part_text_set(priv->base, PART_INFO_USER_MESSAGE, message); } -- cgit v1.2.3