From 36b9bd8376b4f7f3bc122edc8c6a47aed226a325 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Wed, 12 Feb 2014 18:54:34 +0100 Subject: [PATCH] GUI update & Bug Fix - Added a login button for the people that dont want to hit enter to login. - Added The returning of the Session for the case that someone wants to have the part "elm.text.sub". - The Itemstyle is now read from the theme. - Bug fix, If a Session is used, the icon is set the correct way. If not the widget and the space will be freed ! --- src/bin/entrance_gui.c | 17 +++++++++++++---- src/bin/entrance_login.c | 33 +++++++++++++++++++++++++++++---- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/src/bin/entrance_gui.c b/src/bin/entrance_gui.c index 5a47911..e8ae685 100755 --- a/src/bin/entrance_gui.c +++ b/src/bin/entrance_gui.c @@ -276,9 +276,12 @@ entrance_gui_users_set(Eina_List *users) Entrance_Screen *screen; Eina_List *l; Entrance_Fill *ef; + char *style = "double_label"; - PT("Add users list\n"); - ef = entrance_fill_new("default", + screen = eina_list_data_get(_gui->screens); + style = edje_object_data_get(elm_layout_edje_get(screen->edj), "item_style"); + PT("Add users list, using item style: %s\n", style); + ef = entrance_fill_new(style, _entrance_gui_user_text_get, _entrance_gui_user_content_get, _entrance_gui_user_state_get, @@ -515,11 +518,17 @@ _entrance_gui_user_sel_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_ static char * -_entrance_gui_user_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED) +_entrance_gui_user_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part) { Entrance_Login *eu; eu = data; - return strdup(eu->login); + if ((part) && (!strcmp(part, "elm.text.sub"))) + if (eu->lsess) + return strdup(eu->lsess); + else + return NULL; + else + return strdup(eu->login); } static Evas_Object * diff --git a/src/bin/entrance_login.c b/src/bin/entrance_login.c index 25654c3..0fb61db 100644 --- a/src/bin/entrance_login.c +++ b/src/bin/entrance_login.c @@ -312,10 +312,20 @@ _login_xsession_update(Evas_Object *obj) LOGIN_GET(obj); o = elm_object_part_content_get(obj, "entrance.xsessions"); if (!login->session) return; - icon = elm_icon_add(o); elm_object_text_set(o, login->session->name); - elm_image_file_set(o, login->session->icon, NULL); - elm_object_content_set(o, icon); + icon = elm_object_part_content_get(o, "icon"); + if (login->session->icon) + { + if (!icon) + icon = elm_icon_add(o); + elm_image_file_set(icon, login->session->icon, NULL); + elm_object_part_content_set(o, "icon", icon); + } + else + { + evas_object_del(icon); + elm_object_part_content_set(o, "icon", NULL); + } } static void @@ -343,6 +353,13 @@ _login_xsession_guess(void *data, const char *user) } } +static void +_login_loginbutton_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) +{ + _login_check_auth(data); +} + + static void _login_xsession_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) { @@ -434,7 +451,7 @@ entrance_login_shutdown(void) Evas_Object * entrance_login_add(Evas_Object *obj, Entrance_Login_Cb login_cb, void *data) { - Evas_Object *o, *h, *p; + Evas_Object *o, *h, *p, *b; Entrance_Gui_Login *login; /* layout */ @@ -460,6 +477,12 @@ entrance_login_add(Evas_Object *obj, Entrance_Login_Cb login_cb, void *data) elm_object_part_content_set(o, "entrance.password", p); evas_object_show(p); + /* login button */ + b = elm_button_add(o); + elm_object_part_content_set(o, "entrance.loginbtn", b); + elm_object_text_set(b, "Login"); + evas_object_show(b); + /* callbacks */ elm_object_event_callback_add(o, _login_input_event_cb, o); evas_object_smart_callback_add(h, "activated", @@ -470,6 +493,8 @@ entrance_login_add(Evas_Object *obj, Entrance_Login_Cb login_cb, void *data) _login_password_focused_cb, o); evas_object_smart_callback_add(p, "unfocused", _login_password_unfocused_cb, o); + evas_object_smart_callback_add(b, "clicked", + _login_loginbutton_cb, o); h = elm_hoversel_add(o); elm_hoversel_hover_parent_set(h, obj); evas_object_data_set(o, "entrance", login);