Compare commits

...

10 Commits

Author SHA1 Message Date
Marcel Hollerbach 6761696f53 entrance: test if there is allready a User 2014-07-26 13:01:29 +02:00
Marcel Hollerbach 15a5500763 entrance: load historiy at the corrent place 2014-07-26 13:01:08 +02:00
Marcel Hollerbach c3200fa89c entrance: load session for history 2014-07-26 13:00:46 +02:00
Marcel Hollerbach ac231982aa entrance: fixed autologin 2014-07-26 12:07:35 +02:00
Marcel Hollerbach 9ce973d6f7 entrance: free this correct 2014-06-01 13:17:05 +02:00
Marcel Hollerbach 83ee8347b0 entrance: free this one! 2014-06-01 12:56:11 +02:00
Marcel Hollerbach ee765399de entrance: cleanup eina_stringshares, and coderefactoring. 2014-06-01 12:51:41 +02:00
Marcel Hollerbach 768cb94854 entrance: the config panels are refreshing their content 2014-05-31 16:21:36 +02:00
Marcel Hollerbach 6595f25cc0 entrance: the config panel can be renewed 2014-05-31 16:19:04 +02:00
Marcel Hollerbach f266ddbc6a entrance: delete the timer if the object is deleted 2014-05-31 15:03:25 +02:00
7 changed files with 152 additions and 60 deletions

View File

@ -9,6 +9,7 @@ typedef struct Entrance_Conf_Module_
Entrance_Conf_Build build; Entrance_Conf_Build build;
Entrance_Conf_Check check; Entrance_Conf_Check check;
Entrance_Conf_Apply apply; Entrance_Conf_Apply apply;
Entrance_Conf_Refresh_Theme renew;
Elm_Object_Item *item; Elm_Object_Item *item;
} Entrance_Conf_Module; } Entrance_Conf_Module;
@ -232,7 +233,16 @@ entrance_conf_shutdown(void)
} }
void void
entrance_conf_module_register(const char *label, Entrance_Conf_Begin begin, Entrance_Conf_End end, Entrance_Conf_Build build, Entrance_Conf_Check check, Entrance_Conf_Apply apply) entrance_conf_theme_changed(void)
{
Eina_List *l;
Entrance_Conf_Module *conf;
EINA_LIST_FOREACH(_entrance_conf->modules, l, conf)
conf->renew();
}
void
entrance_conf_module_register(const char *label, Entrance_Conf_Begin begin, Entrance_Conf_End end, Entrance_Conf_Build build, Entrance_Conf_Check check, Entrance_Conf_Apply apply, Entrance_Conf_Refresh_Theme renew)
{ {
Entrance_Conf_Module *conf; Entrance_Conf_Module *conf;
conf = calloc(1, sizeof(Entrance_Conf_Module)); conf = calloc(1, sizeof(Entrance_Conf_Module));
@ -242,6 +252,7 @@ entrance_conf_module_register(const char *label, Entrance_Conf_Begin begin, Entr
conf->build = build; conf->build = build;
conf->check = check; conf->check = check;
conf->apply = apply; conf->apply = apply;
conf->renew = renew;
_entrance_conf->modules = eina_list_append(_entrance_conf->modules, conf); _entrance_conf->modules = eina_list_append(_entrance_conf->modules, conf);
} }

View File

@ -28,12 +28,14 @@ typedef void (*Entrance_Conf_End) (void);
typedef Evas_Object *(*Entrance_Conf_Build) (Evas_Object *obj); typedef Evas_Object *(*Entrance_Conf_Build) (Evas_Object *obj);
typedef Eina_Bool (*Entrance_Conf_Check) (void); typedef Eina_Bool (*Entrance_Conf_Check) (void);
typedef void (*Entrance_Conf_Apply) (void); typedef void (*Entrance_Conf_Apply) (void);
typedef void (*Entrance_Conf_Refresh_Theme) (void);
void entrance_conf_init(void); void entrance_conf_init(void);
void entrance_conf_shutdown(void); void entrance_conf_shutdown(void);
void entrance_conf_module_register(const char *label, Entrance_Conf_Begin begin, Entrance_Conf_End end, Entrance_Conf_Build build, Entrance_Conf_Check check, Entrance_Conf_Apply apply); void entrance_conf_module_register(const char *label, Entrance_Conf_Begin begin, Entrance_Conf_End end, Entrance_Conf_Build build, Entrance_Conf_Check check, Entrance_Conf_Apply apply, Entrance_Conf_Refresh_Theme theme);
void entrance_conf_begin(Evas_Object *obj, Evas_Object *parent); void entrance_conf_begin(Evas_Object *obj, Evas_Object *parent);
void entrance_conf_changed(void); void entrance_conf_changed(void);
void entrance_conf_theme_changed(void);
void entrance_conf_background_title_gen(Entrance_Conf_Background *ptr); void entrance_conf_background_title_gen(Entrance_Conf_Background *ptr);
Entrance_Fill *entrance_conf_background_fill_get(void); Entrance_Fill *entrance_conf_background_fill_get(void);

View File

@ -14,6 +14,7 @@ typedef struct Entrance_Int_Conf_Main_
double scale; double scale;
Eina_Bool vkbd_enabled : 1; Eina_Bool vkbd_enabled : 1;
Eina_Bool update : 1; Eina_Bool update : 1;
Evas_Object *list;
} Entrance_Int_Conf_Main; } Entrance_Int_Conf_Main;
static void _entrance_conf_main_begin(void); static void _entrance_conf_main_begin(void);
@ -188,7 +189,7 @@ _entrance_conf_main_build(Evas_Object *obj)
elm_box_pack_end(bx, o); elm_box_pack_end(bx, o);
evas_object_show(o); evas_object_show(o);
o = elm_gengrid_add(obj); _entrance_int_conf_main->list = o = elm_gengrid_add(obj);
elm_gengrid_item_size_set(o, elm_gengrid_item_size_set(o,
elm_config_scale_get() * 150, elm_config_scale_get() * 150,
elm_config_scale_get() * 150); elm_config_scale_get() * 150);
@ -338,7 +339,21 @@ _entrance_conf_main_apply(void)
entrance_gui_conf_set(&conf); entrance_gui_conf_set(&conf);
entrance_connect_conf_gui_send(&conf); entrance_connect_conf_gui_send(&conf);
} }
static void
_entrance_conf_main_renew(void)
{
Eina_List *s_bg, *t_bg, *l = NULL;
s_bg = entrance_gui_background_pool_get();
t_bg = entrance_gui_theme_backgrounds();
elm_gengrid_clear(_entrance_int_conf_main->list);
IMG_LIST_FORK(s_bg, l);
IMG_LIST_FORK(t_bg, l);
entrance_fill(_entrance_int_conf_main->list, entrance_conf_background_fill_get(),
l, _entrance_conf_bg_fill_cb,
_entrance_conf_bg_sel, _entrance_int_conf_main->list);
eina_list_free(l);
}
void void
entrance_conf_main_init(void) entrance_conf_main_init(void)
@ -349,7 +364,8 @@ entrance_conf_main_init(void)
_entrance_conf_main_end, _entrance_conf_main_end,
_entrance_conf_main_build, _entrance_conf_main_build,
_entrance_conf_main_check, _entrance_conf_main_check,
_entrance_conf_main_apply); _entrance_conf_main_apply,
_entrance_conf_main_renew);
} }
void void

View File

@ -47,7 +47,6 @@ static Eina_Bool _entrance_tp_login_timer(void *data);
static void _entrance_tp_animation_reset(void *data); static void _entrance_tp_animation_reset(void *data);
static void _entrance_tp_animation_init(Entrance_Theme_Preview *l); static void _entrance_tp_animation_init(Entrance_Theme_Preview *l);
static Evas_Object* _entrance_tp_add(Evas_Object *par, const char *name); static Evas_Object* _entrance_tp_add(Evas_Object *par, const char *name);
static void _entrance_tp_del(Evas_Object *par);
static void static void
@ -66,7 +65,7 @@ _entrance_conf_theme_update_preview(const char *name)
o = elm_object_part_content_get(_entrance_int_conf_theme->preview, "default"); o = elm_object_part_content_get(_entrance_int_conf_theme->preview, "default");
if (o) if (o)
_entrance_tp_del(o); evas_object_del(o);
o = _entrance_tp_add(_entrance_int_conf_theme->preview, name); o = _entrance_tp_add(_entrance_int_conf_theme->preview, name);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@ -79,10 +78,6 @@ _entrance_conf_theme_update_preview(const char *name)
static void static void
_entrance_conf_theme_end(void) _entrance_conf_theme_end(void)
{ {
Evas_Object *o;
o = elm_object_part_content_get(_entrance_int_conf_theme->preview, "default");
if (o)
_entrance_tp_del(o);
free(_entrance_int_conf_theme); free(_entrance_int_conf_theme);
} }
@ -175,7 +170,7 @@ _entrance_conf_theme_apply(void)
Entrance_Conf_Gui_Event conf; Entrance_Conf_Gui_Event conf;
conf.vkbd_enabled = entrance_gui_vkbd_enabled_get(); conf.vkbd_enabled = entrance_gui_vkbd_enabled_get();
conf.theme = eina_stringshare_add(_entrance_int_conf_theme->theme); conf.theme = _entrance_int_conf_theme->theme;
entrance_gui_background_get(&conf.bg.path, &conf.bg.group); entrance_gui_background_get(&conf.bg.path, &conf.bg.group);
entrance_connect_conf_gui_send(&conf); entrance_connect_conf_gui_send(&conf);
@ -183,6 +178,10 @@ _entrance_conf_theme_apply(void)
entrance_conf_changed(); entrance_conf_changed();
} }
static void
_entrance_conf_theme_renew(void)
{
}
void void
entrance_conf_theme_init(void) entrance_conf_theme_init(void)
@ -193,7 +192,8 @@ entrance_conf_theme_init(void)
_entrance_conf_theme_end, _entrance_conf_theme_end,
_entrance_conf_theme_build, _entrance_conf_theme_build,
_entrance_conf_theme_check, _entrance_conf_theme_check,
_entrance_conf_theme_apply); _entrance_conf_theme_apply,
_entrance_conf_theme_renew);
} }
void void
@ -338,11 +338,17 @@ _entrance_tp_login_timer(void *data)
return ECORE_CALLBACK_CANCEL; return ECORE_CALLBACK_CANCEL;
} }
static void
_animation_free(String_Animation *ani){
eina_stringshare_del(ani->text);
free(ani);
}
static void static void
_entrance_tp_animation_reset(void *data) _entrance_tp_animation_reset(void *data)
{ {
String_Animation *ani = data; String_Animation *ani = data;
free(ani); _animation_free(ani);
} }
static void static void
_entrance_tp_animation_init(Entrance_Theme_Preview *p) _entrance_tp_animation_init(Entrance_Theme_Preview *p)
@ -389,15 +395,30 @@ _entrance_tp_random_bg(Evas_Object *par, char *theme_path)
res = elm_layout_add(par); res = elm_layout_add(par);
elm_layout_file_set(res, theme_path, buf); elm_layout_file_set(res, theme_path, buf);
evas_object_del(o); evas_object_del(o);
// for (i = 0; user_bg[i]; i++) free(user_bg[0]);
//free(user_bg[i]); free(user_bg);
//free(user_bg);
return res; return res;
bad_end: bad_end:
evas_object_del(o); evas_object_del(o);
return NULL; return NULL;
} }
static void
_entrance_tp_del_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
{
Entrance_Theme_Preview *pre = evas_object_smart_data_get(obj);
String_Animation *ani;
if (!pre)
return;
if (pre->active_timer)
{
ani = ecore_timer_del(pre->active_timer);
_animation_free(ani);
}
free(pre);
}
static Evas_Object* static Evas_Object*
_entrance_tp_add(Evas_Object *par, const char *name) _entrance_tp_add(Evas_Object *par, const char *name)
{ {
@ -468,20 +489,9 @@ _entrance_tp_add(Evas_Object *par, const char *name)
_entrance_tp_animation_init(pre); _entrance_tp_animation_init(pre);
evas_object_smart_data_set(pre->transition, pre); evas_object_smart_data_set(pre->transition, pre);
evas_object_event_callback_add(pre->transition, EVAS_CALLBACK_DEL, _entrance_tp_del_cb, NULL);
return pre->transition; return pre->transition;
} }
static void
_entrance_tp_del(Evas_Object *obj)
{
Entrance_Theme_Preview *pre = evas_object_smart_data_get(obj);
String_Animation *ani;
if ((pre) && pre->active_timer)
{
ani = ecore_timer_del(pre->active_timer);
free(ani);
}
evas_object_del(obj);
}

View File

@ -16,6 +16,8 @@ typedef struct Entrance_Int_Conf_User_
const char *lsess; const char *lsess;
Eina_Bool remember_session : 1; Eina_Bool remember_session : 1;
Eina_Bool update : 1; Eina_Bool update : 1;
Evas_Object *ic_list;
Evas_Object *bg_list;
} Entrance_Int_Conf_User; } Entrance_Int_Conf_User;
@ -330,7 +332,7 @@ _entrance_conf_user_build_cb(Evas_Object *t, Entrance_Login *eu)
elm_box_pack_end(bx, o); elm_box_pack_end(bx, o);
evas_object_show(o); evas_object_show(o);
gl = elm_gengrid_add(t); _entrance_int_conf_user->bg_list = gl = elm_gengrid_add(t);
elm_scroller_bounce_set(gl, EINA_FALSE, EINA_TRUE); elm_scroller_bounce_set(gl, EINA_FALSE, EINA_TRUE);
evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
@ -368,7 +370,7 @@ _entrance_conf_user_build_cb(Evas_Object *t, Entrance_Login *eu)
elm_box_pack_end(bx, o); elm_box_pack_end(bx, o);
evas_object_show(o); evas_object_show(o);
gl = elm_gengrid_add(t); _entrance_int_conf_user->ic_list = gl = elm_gengrid_add(t);
elm_scroller_bounce_set(gl, EINA_FALSE, EINA_TRUE); elm_scroller_bounce_set(gl, EINA_FALSE, EINA_TRUE);
evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
@ -479,6 +481,41 @@ _entrance_conf_user_apply(void)
*/ */
} }
static void
_entrance_conf_user_renew(void)
{
Entrance_Conf_Background *img;
Eina_List *l = NULL;
if (!_entrance_int_conf_user->orig) /* no one is logged in */
return;
elm_gengrid_clear(_entrance_int_conf_user->bg_list);
elm_gengrid_clear(_entrance_int_conf_user->ic_list);
img = calloc(1, sizeof(Entrance_Conf_Background));
img->name = eina_stringshare_add("None");
l = eina_list_append(l, img);
IMG_LIST_FORK(entrance_gui_background_pool_get(), l);
IMG_LIST_FORK(entrance_gui_theme_backgrounds(), l);
IMG_LIST_FORK(_entrance_int_conf_user->orig->background_pool, l);
entrance_fill(_entrance_int_conf_user->bg_list,
entrance_conf_background_fill_get(),
l, _entrance_conf_user_bg_fill_cb,
_entrance_conf_user_bg_sel, NULL);
eina_list_free(l);
l = NULL;
IMG_LIST_FORK(entrance_gui_background_pool_get(), l);
IMG_LIST_FORK(entrance_gui_theme_backgrounds(), l);
IMG_LIST_FORK(_entrance_int_conf_user->orig->background_pool, l);
entrance_fill(_entrance_int_conf_user->ic_list,
entrance_conf_background_fill_get(),
l, _entrance_conf_user_bg_fill_cb,
_entrance_conf_user_bg_sel, NULL);
eina_list_free(l);
}
void void
entrance_conf_user_init(void) entrance_conf_user_init(void)
{ {
@ -494,7 +531,8 @@ entrance_conf_user_init(void)
_entrance_conf_user_end, _entrance_conf_user_end,
_entrance_conf_user_build, _entrance_conf_user_build,
_entrance_conf_user_check, _entrance_conf_user_check,
_entrance_conf_user_apply); _entrance_conf_user_apply,
_entrance_conf_user_renew);
} }

View File

@ -570,6 +570,7 @@ entrance_gui_theme_name_set(const char *theme)
else else
eina_stringshare_replace(&_gui->theme, theme); eina_stringshare_replace(&_gui->theme, theme);
_entrance_gui_theme_update(); _entrance_gui_theme_update();
entrance_conf_theme_changed();
} }
const char * const char *

View File

@ -12,7 +12,7 @@ struct tm *local_time;
char entrance_time_d[4096]; char entrance_time_d[4096];
static Eina_Bool _open_log(); static Eina_Bool _open_log();
static Eina_Bool _entrance_main(const char *dname); static Eina_Bool _entrance_display_ready(const char *dname);
static void _remove_lock(); static void _remove_lock();
static void _signal_cb(int sig); static void _signal_cb(int sig);
static void _signal_log(int sig); static void _signal_log(int sig);
@ -172,7 +172,7 @@ _entrance_client_data(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Exe_Event_Da
} }
static Eina_Bool static Eina_Bool
_entrance_main(const char *dname) _entrance_display_ready(const char *dname)
{ {
PT("starting...\n"); PT("starting...\n");
if (!entrance_config->autologin) if (!entrance_config->autologin)
@ -197,7 +197,34 @@ _entrance_main(const char *dname)
} }
} }
else else
ecore_main_loop_quit(); {
Entrance_Login *el;
Eina_List *l;
const char *session = NULL;
if (getenv("ENTRANCE_USER"))
return ECORE_CALLBACK_CANCEL;
PT("auth user\n");
entrance_pam_init("entrance", dname, NULL);
#ifdef HAVE_PAM
entrance_pam_item_set(ENTRANCE_PAM_ITEM_USER, entrance_config->userlogin);
#endif
//query the history for the session name
EINA_LIST_FOREACH(entrance_history_get(), l, el)
{
if (el->login == entrance_config->userlogin)
break;
}
if (el)
session = el->lsess;
PT("Using last session %s", session);
PT("login user\n");
entrance_session_login(session, EINA_FALSE);
//we have a loged user begin entrance shutdown
ecore_main_loop_quit();
}
return ECORE_CALLBACK_CANCEL; return ECORE_CALLBACK_CANCEL;
} }
@ -385,40 +412,27 @@ main (int argc, char ** argv)
PT("session init\n"); PT("session init\n");
entrance_session_init(dname); entrance_session_init(dname);
entrance_session_cookie(); entrance_session_cookie();
PT("history init\n");
entrance_history_init();
if (!_xephyr) if (!_xephyr)
{ {
PT("xserver init\n"); PT("xserver init\n");
pid = entrance_xserver_init(_entrance_main, dname); pid = entrance_xserver_init(_entrance_display_ready, dname);
}
else
_entrance_main(dname);
PT("history init\n");
entrance_history_init();
if (entrance_config->autologin && !entrance_user)
{
PT("autologin init\n");
xcb_connection_t *disp = NULL;
disp = xcb_connect(dname, NULL);
PT("main loop begin\n");
ecore_main_loop_begin();
PT("auth user\n");
#ifdef HAVE_PAM
entrance_pam_item_set(ENTRANCE_PAM_ITEM_USER, entrance_config->userlogin);
#endif
PT("login user\n");
entrance_session_login(NULL, EINA_FALSE);
sleep(30);
xcb_disconnect(disp);
} }
else else
_entrance_display_ready(dname);
if (!entrance_config->autologin)
{ {
PT("action init\n"); PT("action init\n");
entrance_action_init(); entrance_action_init();
PT("server init\n"); PT("server init\n");
entrance_server_init(); entrance_server_init();
PT("starting main loop\n"); }
ecore_main_loop_begin(); PT("starting main loop\n");
PT("main loop end\n"); ecore_main_loop_begin();
PT("main loop end\n");
if (!entrance_config->autologin)
{
entrance_server_shutdown(); entrance_server_shutdown();
PT("server shutdown\n"); PT("server shutdown\n");
entrance_action_shutdown(); entrance_action_shutdown();