entrance: clean++
This commit is contained in:
parent
6de070c696
commit
00754fb57c
|
@ -17,17 +17,6 @@ static void _entrance_gui_update(void);
|
|||
static void _entrance_gui_auth_cb(void *data, const char *user, Eina_Bool granted);
|
||||
|
||||
|
||||
/*
|
||||
static void _entrance_gui_session_update(Entrance_Xsession *xsession);
|
||||
static void _entrance_gui_login_activated_cb(void *data, Evas_Object *obj, void *event_info);
|
||||
static void _entrance_gui_password_activated_cb(void *data, Evas_Object *obj, void *event_info);
|
||||
static void _entrance_gui_shutdown(void *data, Evas_Object *obj, void *event_info);
|
||||
static void _entrance_gui_focus(void *data, Evas_Object *obj, void *event_info);
|
||||
static void _entrance_gui_session_update(Entrance_Xsession *xsession);
|
||||
static Eina_Bool _entrance_gui_auth_enable(void *data);
|
||||
static void _entrance_gui_action_clicked_cb(void *data, Evas_Object *obj, void *event_info);
|
||||
static Ecore_Timer *_gui_login_timeout;
|
||||
*/
|
||||
static Entrance_Gui *_gui;
|
||||
|
||||
enum {
|
||||
|
@ -389,273 +378,7 @@ entrance_gui_vkbd_enabled_get(void)
|
|||
{
|
||||
return _gui->vkbd_enabled;
|
||||
}
|
||||
/*
|
||||
static void
|
||||
_entrance_gui_login_activated_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
|
||||
{
|
||||
char *txt;
|
||||
Eina_List *l, *ll;
|
||||
Entrance_Xsession *xsess;
|
||||
Entrance_Login *eu = NULL;
|
||||
Entrance_Screen *screen;
|
||||
|
||||
PT("login activated\n");
|
||||
txt = elm_entry_markup_to_utf8(elm_entry_entry_get(obj));
|
||||
if (!txt || !strcmp(txt, ""))
|
||||
{
|
||||
free(txt);
|
||||
return;
|
||||
}
|
||||
EINA_LIST_FOREACH(_gui->users, ll, eu)
|
||||
if (!strcmp(txt, eu->login)) break;
|
||||
free(txt);
|
||||
|
||||
if (eu && eu->lsess)
|
||||
{
|
||||
EINA_LIST_FOREACH(_gui->xsessions, l, xsess)
|
||||
{
|
||||
if (!strcmp(xsess->name, eu->lsess))
|
||||
{
|
||||
_entrance_gui_session_update(xsess);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_gui->xsessions)
|
||||
_entrance_gui_session_update(_gui->xsessions->data);
|
||||
elm_object_focus_set(data, EINA_TRUE);
|
||||
EINA_LIST_FOREACH(_gui->screens, l, screen)
|
||||
edje_object_signal_emit(elm_layout_edje_get(screen->edj),
|
||||
"entrance,auth,enable", "");
|
||||
}
|
||||
|
||||
static void
|
||||
_entrance_gui_shutdown(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
elm_exit();
|
||||
PT("shutdown cb\n");
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_entrance_gui_focus(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
Eina_List *l;
|
||||
Entrance_Screen *screen;
|
||||
|
||||
EINA_LIST_FOREACH(_gui->screens, l, screen)
|
||||
elm_object_focus_set(ENTRANCE_GUI_GET(screen->edj, "entrance.login"),
|
||||
EINA_TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
_entrance_gui_login_cancel_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
|
||||
{
|
||||
Evas_Object *o;
|
||||
Entrance_Screen *screen;
|
||||
Eina_List *l;
|
||||
|
||||
EINA_LIST_FOREACH(_gui->screens, l, screen)
|
||||
{
|
||||
o = ENTRANCE_GUI_GET(screen->edj, "entrance.login");
|
||||
elm_entry_entry_set(o, "");
|
||||
elm_object_focus_set(o, EINA_TRUE);
|
||||
o = ENTRANCE_GUI_GET(screen->edj, "entrance.password");
|
||||
elm_entry_entry_set(o, "");
|
||||
edje_object_signal_emit(elm_layout_edje_get(screen->edj),
|
||||
"entrance,auth,disable", "");
|
||||
}
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_entrance_gui_login_timeout(void *data EINA_UNUSED)
|
||||
{
|
||||
Evas_Object *popup, *o, *bx;
|
||||
Entrance_Screen *screen;
|
||||
Eina_List *l;
|
||||
|
||||
EINA_LIST_FOREACH(_gui->screens, l, screen)
|
||||
{
|
||||
popup = elm_popup_add(screen->win);
|
||||
evas_object_size_hint_weight_set(popup,
|
||||
EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
elm_object_text_set(popup, "Something wrong happened ... "
|
||||
"No window manager detected after a lapse of time. "
|
||||
"See your debug below.");
|
||||
|
||||
bx = elm_box_add(popup);
|
||||
elm_object_content_set(popup, bx);
|
||||
evas_object_show(bx);
|
||||
|
||||
o = elm_entry_add(popup);
|
||||
elm_entry_scrollable_set(o, EINA_TRUE);
|
||||
elm_object_text_set(o, "Test !!!!!");
|
||||
elm_box_pack_end(bx, o);
|
||||
evas_object_show(o);
|
||||
|
||||
o = evas_object_rectangle_add(evas_object_evas_get(popup));
|
||||
evas_object_size_hint_min_set(o, 0, 260);
|
||||
elm_box_pack_end(bx, o);
|
||||
|
||||
|
||||
o = elm_button_add(popup);
|
||||
elm_object_text_set(o, "Close");
|
||||
elm_object_part_content_set(popup, "button1", o);
|
||||
evas_object_smart_callback_add(o, "clicked",
|
||||
_entrance_gui_shutdown, NULL);
|
||||
evas_object_show(popup);
|
||||
}
|
||||
_gui_login_timeout = NULL;
|
||||
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
|
||||
static void
|
||||
_entrance_gui_login(Entrance_Screen *screen)
|
||||
{
|
||||
Eina_List *l;
|
||||
char *h, *s;
|
||||
h = entrance_gui_user_get(screen);
|
||||
s = entrance_gui_password_get(screen);
|
||||
if (h && s)
|
||||
{
|
||||
if (strcmp(h, "") && strcmp(s, ""))
|
||||
{
|
||||
if (_gui->selected_session)
|
||||
entrance_connect_auth_send(h, s, _gui->selected_session->name);
|
||||
else
|
||||
entrance_connect_auth_send(h, s, NULL);
|
||||
}
|
||||
}
|
||||
free(h);
|
||||
free(s);
|
||||
EINA_LIST_FOREACH(_gui->screens, l, screen)
|
||||
{
|
||||
elm_object_focus_set(ENTRANCE_GUI_GET(screen->edj, "entrance.password"), EINA_TRUE);
|
||||
edje_object_signal_emit(elm_layout_edje_get(screen->edj),
|
||||
"entrance,auth,enable", "");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_entrance_gui_login_request_cb(void *data, Evas_Object *obj EINA_UNUSED, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
|
||||
{
|
||||
_entrance_gui_login(data);
|
||||
}
|
||||
|
||||
static void
|
||||
_entrance_gui_password_activated_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
PT("password activated\n");
|
||||
_entrance_gui_login(data);
|
||||
}
|
||||
|
||||
static void
|
||||
_entrance_gui_xsessions_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
|
||||
{
|
||||
Evas_Object *icon;
|
||||
Eina_List *l;
|
||||
Entrance_Screen *screen;
|
||||
|
||||
_gui->selected_session = data;
|
||||
EINA_LIST_FOREACH(_gui->screens, l, screen)
|
||||
{
|
||||
elm_object_text_set(obj, _gui->selected_session->name);
|
||||
icon = elm_icon_add(screen->win);
|
||||
elm_image_file_set(icon, _gui->selected_session->icon, NULL);
|
||||
elm_object_content_set(obj, icon);
|
||||
evas_object_show(icon);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void
|
||||
_entrance_gui_callback_add(Entrance_Screen *screen)
|
||||
{
|
||||
Evas_Object *host, *pwd;
|
||||
Evas_Object *edj;
|
||||
|
||||
evas_object_smart_callback_add(screen->win, "delete,request",
|
||||
_entrance_gui_shutdown, NULL);
|
||||
evas_object_smart_callback_add(screen->win, "focus,in",
|
||||
_entrance_gui_focus, NULL);
|
||||
|
||||
edj = elm_layout_edje_get(screen->edj);
|
||||
host = ENTRANCE_GUI_GET(screen->edj, "entrance.login");
|
||||
pwd = ENTRANCE_GUI_GET(screen->edj, "entrance.password");
|
||||
edje_object_signal_callback_add(edj, "entrance.auth.cancel", "",
|
||||
_entrance_gui_login_cancel_cb, NULL);
|
||||
edje_object_signal_callback_add(edj, "entrance.auth.request", "",
|
||||
_entrance_gui_login_request_cb, screen);
|
||||
elm_entry_single_line_set(host, EINA_TRUE);
|
||||
elm_entry_single_line_set(pwd, EINA_TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
_entrance_gui_session_update(Entrance_Xsession *xsession)
|
||||
{
|
||||
Evas_Object *o, *icon;
|
||||
Eina_List *l;
|
||||
Entrance_Screen *screen;
|
||||
|
||||
if (!xsession) return;
|
||||
_gui->selected_session = xsession;
|
||||
EINA_LIST_FOREACH(_gui->screens, l, screen)
|
||||
{
|
||||
o = ENTRANCE_GUI_GET(screen->edj, "entrance.xsessions");
|
||||
elm_object_text_set(o, _gui->selected_session->name);
|
||||
icon = elm_icon_add(screen->win);
|
||||
elm_image_file_set(icon, _gui->selected_session->icon, NULL);
|
||||
elm_object_content_set(o, icon);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_entrance_gui_sessions_populate()
|
||||
{
|
||||
Evas_Object *o;
|
||||
|
||||
Entrance_Xsession *xsession;
|
||||
Eina_List *l, *ll;
|
||||
Entrance_Screen *screen;
|
||||
|
||||
EINA_LIST_FOREACH(_gui->screens, ll, screen)
|
||||
{
|
||||
o = ENTRANCE_GUI_GET(screen->edj, "entrance.xsessions");
|
||||
|
||||
EINA_LIST_FOREACH(_gui->xsessions, l, xsession)
|
||||
{
|
||||
elm_hoversel_item_add(o, xsession->name, xsession->icon,
|
||||
ELM_ICON_FILE,
|
||||
_entrance_gui_xsessions_clicked_cb, xsession);
|
||||
}
|
||||
edje_object_signal_emit(elm_layout_edje_get(screen->edj),
|
||||
"entrance,xsession,enabled", "");
|
||||
}
|
||||
if (_gui->xsessions)
|
||||
_entrance_gui_session_update(_gui->xsessions->data);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_entrance_gui_auth_enable(void *data EINA_UNUSED)
|
||||
{
|
||||
Evas_Object *o;
|
||||
Eina_List *l;
|
||||
Entrance_Screen *screen;
|
||||
|
||||
EINA_LIST_FOREACH(_gui->screens, l, screen)
|
||||
{
|
||||
o = ENTRANCE_GUI_GET(screen->edj, "entrance.login");
|
||||
elm_object_disabled_set(o, EINA_FALSE);
|
||||
o = ENTRANCE_GUI_GET(screen->edj, "entrance.password");
|
||||
elm_object_disabled_set(o, EINA_FALSE);
|
||||
}
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
|
||||
*/
|
||||
static void
|
||||
_entrance_gui_update(void)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue