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 !
This commit is contained in:
Marcel Hollerbach 2014-02-12 18:54:34 +01:00
parent cf3498a3c8
commit 36b9bd8376
2 changed files with 42 additions and 8 deletions

View File

@ -276,9 +276,12 @@ entrance_gui_users_set(Eina_List *users)
Entrance_Screen *screen; Entrance_Screen *screen;
Eina_List *l; Eina_List *l;
Entrance_Fill *ef; Entrance_Fill *ef;
char *style = "double_label";
PT("Add users list\n"); screen = eina_list_data_get(_gui->screens);
ef = entrance_fill_new("default", 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_text_get,
_entrance_gui_user_content_get, _entrance_gui_user_content_get,
_entrance_gui_user_state_get, _entrance_gui_user_state_get,
@ -515,10 +518,16 @@ _entrance_gui_user_sel_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_
static char * 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; Entrance_Login *eu;
eu = data; eu = data;
if ((part) && (!strcmp(part, "elm.text.sub")))
if (eu->lsess)
return strdup(eu->lsess);
else
return NULL;
else
return strdup(eu->login); return strdup(eu->login);
} }

View File

@ -312,10 +312,20 @@ _login_xsession_update(Evas_Object *obj)
LOGIN_GET(obj); LOGIN_GET(obj);
o = elm_object_part_content_get(obj, "entrance.xsessions"); o = elm_object_part_content_get(obj, "entrance.xsessions");
if (!login->session) return; if (!login->session) return;
icon = elm_icon_add(o);
elm_object_text_set(o, login->session->name); elm_object_text_set(o, login->session->name);
elm_image_file_set(o, login->session->icon, NULL); icon = elm_object_part_content_get(o, "icon");
elm_object_content_set(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 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 static void
_login_xsession_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) _login_xsession_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
{ {
@ -434,7 +451,7 @@ entrance_login_shutdown(void)
Evas_Object * Evas_Object *
entrance_login_add(Evas_Object *obj, Entrance_Login_Cb login_cb, void *data) 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; Entrance_Gui_Login *login;
/* layout */ /* 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); elm_object_part_content_set(o, "entrance.password", p);
evas_object_show(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 */ /* callbacks */
elm_object_event_callback_add(o, _login_input_event_cb, o); elm_object_event_callback_add(o, _login_input_event_cb, o);
evas_object_smart_callback_add(h, "activated", 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); _login_password_focused_cb, o);
evas_object_smart_callback_add(p, "unfocused", evas_object_smart_callback_add(p, "unfocused",
_login_password_unfocused_cb, o); _login_password_unfocused_cb, o);
evas_object_smart_callback_add(b, "clicked",
_login_loginbutton_cb, o);
h = elm_hoversel_add(o); h = elm_hoversel_add(o);
elm_hoversel_hover_parent_set(h, obj); elm_hoversel_hover_parent_set(h, obj);
evas_object_data_set(o, "entrance", login); evas_object_data_set(o, "entrance", login);