switch to eina_log
This commit is contained in:
parent
60ee7d4596
commit
9f5b5e40b3
|
@ -3,10 +3,6 @@
|
|||
#include <Ecore_X.h>
|
||||
#include <Ecore_Getopt.h>
|
||||
|
||||
time_t current_time;
|
||||
struct tm *local_time;
|
||||
char entrance_time_d[4096];
|
||||
|
||||
static const Ecore_Getopt options =
|
||||
{
|
||||
"entrance_client",
|
||||
|
@ -49,37 +45,38 @@ main(int argc, char **argv)
|
|||
return EXIT_FAILURE;
|
||||
if (quit_option)
|
||||
return EXIT_SUCCESS;
|
||||
eina_init();
|
||||
if (!display)
|
||||
{
|
||||
fprintf(stderr, "A display is required!\n");
|
||||
PT("A display is required!");
|
||||
eina_shutdown();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
eina_init();
|
||||
ecore_init();
|
||||
ecore_x_init(display);
|
||||
elm_init(argc, argv);
|
||||
PT("login init\n");
|
||||
PT("login init");
|
||||
entrance_login_init();
|
||||
PT("gui init\n");
|
||||
PT("gui init");
|
||||
if (!entrance_gui_init(theme)) return EXIT_FAILURE;
|
||||
PT("conf init\n");
|
||||
PT("conf init");
|
||||
entrance_conf_init();
|
||||
PT("connect init\n");
|
||||
PT("connect init");
|
||||
entrance_connect_init();
|
||||
elm_run();
|
||||
PT("connect shutdown\n");
|
||||
PT("connect shutdown");
|
||||
entrance_connect_shutdown();
|
||||
PT("conf shutdown\n");
|
||||
PT("conf shutdown");
|
||||
entrance_conf_init();
|
||||
PT("gui shutdown\n");
|
||||
PT("gui shutdown");
|
||||
entrance_gui_shutdown();
|
||||
PT("login shutdown\n");
|
||||
PT("login shutdown");
|
||||
entrance_login_shutdown();
|
||||
elm_shutdown();
|
||||
ecore_x_shutdown();
|
||||
ecore_shutdown();
|
||||
eina_shutdown();
|
||||
PT("exit\n");
|
||||
PT("exit");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,18 +24,10 @@
|
|||
#define PT(f, x...) \
|
||||
do \
|
||||
{ \
|
||||
current_time = time(NULL); \
|
||||
local_time = localtime(¤t_time); \
|
||||
memset(entrance_time_d, 0, sizeof(entrance_time_d)); \
|
||||
strftime(entrance_time_d, sizeof(entrance_time_d), \
|
||||
"%b %_2d %T", local_time); \
|
||||
fprintf(stderr, "(%s) "PACKAGE"_client: "f, entrance_time_d, ##x); \
|
||||
printf(__FILE__"%d : "f"", __LINE__, ##x); \
|
||||
fflush(stdout); \
|
||||
} while (0)
|
||||
|
||||
extern time_t current_time;
|
||||
extern struct tm *local_time;
|
||||
extern char entrance_time_d[4096];
|
||||
|
||||
int entrance_client_main(void);
|
||||
|
||||
#endif /* ENTRANCE_H_ */
|
||||
|
|
|
@ -71,7 +71,7 @@ _entrance_conf_end(Evas_Object *win)
|
|||
Entrance_Conf_Module *conf;
|
||||
Eina_List *l;
|
||||
|
||||
PT("Delete config panel\n");
|
||||
PT("Delete config panel");
|
||||
evas_object_del(win);
|
||||
EINA_LIST_FOREACH(_entrance_conf->modules, l, conf)
|
||||
conf->end();
|
||||
|
@ -200,7 +200,7 @@ _entrance_conf_bg_del(void *data, Evas_Object *obj EINA_UNUSED)
|
|||
void
|
||||
entrance_conf_init(void)
|
||||
{
|
||||
PT("conf init\n");
|
||||
PT("conf init");
|
||||
_entrance_conf = calloc(1, sizeof(Entrance_Int_Conf));
|
||||
_entrance_conf->background_fill =
|
||||
entrance_fill_new("thumb",
|
||||
|
@ -219,7 +219,7 @@ entrance_conf_shutdown(void)
|
|||
{
|
||||
Entrance_Conf_Module *conf;
|
||||
|
||||
PT("conf shutdown\n");
|
||||
PT("conf shutdown");
|
||||
entrance_conf_user_shutdown();
|
||||
entrance_conf_main_shutdown();
|
||||
entrance_conf_theme_shutdown();
|
||||
|
@ -248,7 +248,7 @@ entrance_conf_module_register(const char *label, Entrance_Conf_Begin begin, Entr
|
|||
void
|
||||
entrance_conf_begin(Evas_Object *obj, Evas_Object *parent)
|
||||
{
|
||||
PT("Build config panel\n");
|
||||
PT("Build config panel");
|
||||
Evas_Object *win, *bg, *bx, *hbx, *sc, *nf, *o;
|
||||
Entrance_Conf_Module *conf;
|
||||
Eina_List *l;
|
||||
|
|
|
@ -98,7 +98,7 @@ _entrance_conf_vkbd_changed(void *data EINA_UNUSED, Evas_Object *obj, void *even
|
|||
{
|
||||
Elm_Actionslider_Pos p;
|
||||
|
||||
PT("User change vkbd state\n");
|
||||
PT("User change vkbd state");
|
||||
|
||||
p = elm_actionslider_indicator_pos_get(obj);
|
||||
_entrance_int_conf_main->vkbd_enabled = !!(p == ELM_ACTIONSLIDER_RIGHT);
|
||||
|
@ -343,7 +343,7 @@ _entrance_conf_main_apply(void)
|
|||
void
|
||||
entrance_conf_main_init(void)
|
||||
{
|
||||
PT("conf main init\n");
|
||||
PT("conf main init");
|
||||
entrance_conf_module_register("Main",
|
||||
_entrance_conf_main_begin,
|
||||
_entrance_conf_main_end,
|
||||
|
@ -355,6 +355,6 @@ entrance_conf_main_init(void)
|
|||
void
|
||||
entrance_conf_main_shutdown(void)
|
||||
{
|
||||
PT("conf main shutdown\n");
|
||||
PT("conf main shutdown");
|
||||
}
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ _entrance_conf_theme_apply(void)
|
|||
void
|
||||
entrance_conf_theme_init(void)
|
||||
{
|
||||
PT("conf theme init\n");
|
||||
PT("conf theme init");
|
||||
entrance_conf_module_register("Theme Selector",
|
||||
_entrance_conf_theme_begin,
|
||||
_entrance_conf_theme_end,
|
||||
|
@ -196,7 +196,7 @@ entrance_conf_theme_init(void)
|
|||
void
|
||||
entrance_conf_theme_shutdown(void)
|
||||
{
|
||||
PT("conf theme shutdown\n");
|
||||
PT("conf theme shutdown");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -208,12 +208,12 @@ _entrance_conf_remembersession_changed(void *data EINA_UNUSED, Evas_Object *obj,
|
|||
{
|
||||
if ((event_info) && !strcmp(event_info, "Enabled"))
|
||||
{
|
||||
PT("Turned remember session on\n");
|
||||
PT("Turned remember session on");
|
||||
_entrance_int_conf_user->remember_session = EINA_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
PT("Turned remember session off\n");
|
||||
PT("Turned remember session off");
|
||||
_entrance_int_conf_user->remember_session = EINA_FALSE;
|
||||
}
|
||||
_entrance_conf_remembersession_update(obj);
|
||||
|
@ -244,7 +244,7 @@ _entrance_conf_user_auth(void *data, const char *user, Eina_Bool granted)
|
|||
_entrance_int_conf_user->remember_session =
|
||||
eu->remember_session;
|
||||
/*
|
||||
printf("init %s %s | %s %s | %s | %d\n",
|
||||
printf("init %s %s | %s %s | %s | %d",
|
||||
_entrance_int_conf_user->bg.path,
|
||||
_entrance_int_conf_user->bg.group,
|
||||
_entrance_int_conf_user->image.path,
|
||||
|
@ -469,7 +469,7 @@ _entrance_conf_user_apply(void)
|
|||
eina_stringshare_replace(&eu->lsess, _entrance_int_conf_user->lsess);
|
||||
entrance_connect_conf_user_send(eu);
|
||||
/*
|
||||
printf("%s | %s\n%s | %s\n%s | %s\n%s | %s\n%d | %d\n%s | %s\n",
|
||||
printf("%s | %s%s | %s%s | %s%s | %s%d | %d%s | %s",
|
||||
eu->bg.path, _entrance_int_conf->bg.path,
|
||||
eu->bg.group, _entrance_int_conf->bg.group,
|
||||
eu->image.path, _entrance_int_conf->image.path,
|
||||
|
@ -482,7 +482,7 @@ _entrance_conf_user_apply(void)
|
|||
void
|
||||
entrance_conf_user_init(void)
|
||||
{
|
||||
PT("conf user init\n");
|
||||
PT("conf user init");
|
||||
_entrance_session_fill =
|
||||
entrance_fill_new("default",
|
||||
_entrance_conf_session_text_get,
|
||||
|
@ -501,7 +501,7 @@ entrance_conf_user_init(void)
|
|||
void
|
||||
entrance_conf_user_shutdown(void)
|
||||
{
|
||||
PT("conf user shutdown\n");
|
||||
PT("conf user shutdown");
|
||||
entrance_fill_del(_entrance_session_fill);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,14 +19,14 @@ static Eina_List *_auth_list = NULL;
|
|||
static Eina_Bool
|
||||
_entrance_connect_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
|
||||
{
|
||||
PT("connected\n");
|
||||
PT("connected");
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_entrance_connect_del(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
|
||||
{
|
||||
PT("disconnected\n");
|
||||
PT("disconnected");
|
||||
_entrance_connect = NULL;
|
||||
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
|
@ -66,51 +66,50 @@ _entrance_connect_read_cb(const void *data, size_t size EINA_UNUSED, void *user_
|
|||
if (eev->type == ENTRANCE_EVENT_STATUS)
|
||||
{
|
||||
if (eev->event.status.granted)
|
||||
PT("Auth granted :)\n");
|
||||
PT("Auth granted :)");
|
||||
else
|
||||
PT("Auth error :(\n");
|
||||
PT("Auth error :(");
|
||||
_entrance_connect_auth(eev->event.status.login,
|
||||
eev->event.status.granted);
|
||||
}
|
||||
else if (eev->type == ENTRANCE_EVENT_MAXTRIES)
|
||||
{
|
||||
PT("Max tries !\n");
|
||||
PT("Max tries !");
|
||||
entrance_gui_auth_max_tries();
|
||||
}
|
||||
else if (eev->type == ENTRANCE_EVENT_XSESSIONS)
|
||||
{
|
||||
PT("Xsession received\n");
|
||||
PT("Xsession received");
|
||||
entrance_gui_xsessions_set(eev->event.xsessions.xsessions);
|
||||
}
|
||||
else if (eev->type == ENTRANCE_EVENT_USERS)
|
||||
{
|
||||
PT("Users received\n");
|
||||
PT("Users received");
|
||||
entrance_gui_users_set(eev->event.users.users);
|
||||
}
|
||||
else if (eev->type == ENTRANCE_EVENT_ACTIONS)
|
||||
{
|
||||
PT("Action received\n");
|
||||
PT("Action received");
|
||||
entrance_gui_actions_set(eev->event.actions.actions);
|
||||
}
|
||||
else if (eev->type == ENTRANCE_EVENT_CONF_GUI)
|
||||
{
|
||||
PT("Gui conf received\n");
|
||||
PT("Gui conf received");
|
||||
entrance_gui_conf_set(&(eev->event.conf_gui));
|
||||
}
|
||||
else if (eev->type == ENTRANCE_EVENT_POOLS)
|
||||
{
|
||||
PT("Pools received\n");
|
||||
PT("Pools received");
|
||||
entrance_gui_pools_set(&(eev->event.pools));
|
||||
}
|
||||
else if (eev->type == ENTRANCE_EVENT_THEMES)
|
||||
{
|
||||
PT("Themes received\n");
|
||||
PT("Themes received");
|
||||
entrance_gui_themes_set(eev->event.themes.themes);
|
||||
}
|
||||
else
|
||||
{
|
||||
PT("UNKNOW signal ");
|
||||
fprintf(stderr, "%d\n", eev->type);
|
||||
PT("UNKNOW signal %d", eev->type);
|
||||
}
|
||||
//free(eev);
|
||||
}
|
||||
|
@ -129,7 +128,7 @@ entrance_connect_auth_send(const char *login, const char *password, const char *
|
|||
{
|
||||
Entrance_Event eev;
|
||||
|
||||
PT("Request auth\n");
|
||||
PT("Request auth");
|
||||
eev.event.auth.login = login;
|
||||
eev.event.auth.password = password;
|
||||
eev.event.auth.session = session;
|
||||
|
@ -143,7 +142,7 @@ entrance_connect_action_send(unsigned char id)
|
|||
{
|
||||
Entrance_Event eev;
|
||||
|
||||
PT("Request action %d\n", id);
|
||||
PT("Request action %d", id);
|
||||
eev.event.action.action = id;
|
||||
eev.type = ENTRANCE_EVENT_ACTION;
|
||||
entrance_event_send(&eev);
|
||||
|
@ -153,7 +152,7 @@ void
|
|||
entrance_connect_conf_gui_send(Entrance_Conf_Gui_Event *ev)
|
||||
{
|
||||
Entrance_Event eev;
|
||||
PT("Send gui config\n");
|
||||
PT("Send gui config");
|
||||
eev.event.conf_gui.bg.path = ev->bg.path;
|
||||
eev.event.conf_gui.bg.group = ev->bg.group;
|
||||
eev.event.conf_gui.theme = ev->theme;
|
||||
|
@ -166,7 +165,7 @@ void
|
|||
entrance_connect_conf_user_send(Entrance_Login *el)
|
||||
{
|
||||
Entrance_Event eev;
|
||||
PT("Send user config\n");
|
||||
PT("Send user config");
|
||||
eev.event.conf_user.login = el->login;
|
||||
eev.event.conf_user.lsess = el->lsess;
|
||||
eev.event.conf_user.image.group = el->image.group;
|
||||
|
@ -183,7 +182,7 @@ entrance_connect_conf_user_send(Entrance_Login *el)
|
|||
void *
|
||||
entrance_connect_auth_cb_add(Entrance_Connect_Auth_Cb func, void *data)
|
||||
{
|
||||
PT("auth handler add\n");
|
||||
PT("auth handler add");
|
||||
Entrance_Connect_Auth *auth;
|
||||
auth = malloc(sizeof(Entrance_Connect_Auth));
|
||||
auth->func = func;
|
||||
|
@ -195,7 +194,7 @@ entrance_connect_auth_cb_add(Entrance_Connect_Auth_Cb func, void *data)
|
|||
void
|
||||
entrance_connect_auth_cb_del(void *auth)
|
||||
{
|
||||
PT("auth handler remove\n");
|
||||
PT("auth handler remove");
|
||||
_auth_list = eina_list_remove(_auth_list, auth);
|
||||
}
|
||||
|
||||
|
@ -210,9 +209,9 @@ entrance_connect_init(void)
|
|||
_entrance_connect = ecore_con_server_connect(ECORE_CON_LOCAL_SYSTEM,
|
||||
"entrance", 42, NULL);
|
||||
if (_entrance_connect)
|
||||
PT("client server init ok\n");
|
||||
PT("client server init ok");
|
||||
else
|
||||
PT("client server init fail\n");
|
||||
PT("client server init fail");
|
||||
h = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD,
|
||||
_entrance_connect_add, NULL);
|
||||
_handlers = eina_list_append(_handlers, h);
|
||||
|
|
|
@ -189,8 +189,7 @@ entrance_fill(Evas_Object *obj, Entrance_Fill *ef, const Eina_List *contents, En
|
|||
_entrance_fill_hoversell(obj, ef, contents, fill_cb, func, data);
|
||||
else
|
||||
{
|
||||
PT("Unknow object type to fill ");
|
||||
fprintf(stderr, "%s\n", type);
|
||||
PT("Unknow object type to fill %s", type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,12 +77,11 @@ entrance_gui_init(const char *theme)
|
|||
int x, y, w, h;
|
||||
int ww = 0, hh = 0;
|
||||
|
||||
PT("Gui init: ");
|
||||
fprintf(stderr, "%s\n", theme);
|
||||
PT("Gui init: %s", theme);
|
||||
_gui = calloc(1, sizeof(Entrance_Gui));
|
||||
if (!_gui)
|
||||
{
|
||||
PT("Not Enough memory\n");
|
||||
PT("Not Enough memory");
|
||||
return 1;
|
||||
}
|
||||
_gui->theme = eina_stringshare_add(theme);
|
||||
|
@ -91,8 +90,7 @@ entrance_gui_init(const char *theme)
|
|||
char *tmp = getenv("DISPLAY");
|
||||
if (tmp && *tmp)
|
||||
{
|
||||
PT("client Using display name");
|
||||
fprintf(stderr, " %s\n", tmp);
|
||||
PT("client Using display name %s", tmp);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -116,8 +114,7 @@ entrance_gui_init(const char *theme)
|
|||
screen->edj = ol;
|
||||
if (!ol)
|
||||
{
|
||||
PT("Tut Tut Tut no theme");
|
||||
fprintf(stderr, "%s\n", "entrance");
|
||||
PT("Tut Tut Tut no theme for entrance");
|
||||
return j;
|
||||
}
|
||||
elm_object_part_content_set(o, "entrance.screen", ol);
|
||||
|
@ -204,7 +201,7 @@ entrance_gui_shutdown(void)
|
|||
Entrance_Screen *screen;
|
||||
Entrance_Xsession *xsession;
|
||||
Entrance_Image *img;
|
||||
PT("Gui shutdown\n");
|
||||
PT("Gui shutdown");
|
||||
evas_object_del(_gui->win);
|
||||
EINA_LIST_FREE(_gui->screens, screen)
|
||||
{
|
||||
|
@ -338,7 +335,7 @@ entrance_gui_theme_get (Evas_Object *win, const char *group)
|
|||
PACKAGE_DATA_DIR"/themes/%s.edj", _gui->theme);
|
||||
if (!elm_layout_file_set(edje, buf, group))
|
||||
{
|
||||
PT("Can't load %s theme fallback to default\n", _gui->theme);
|
||||
PT("Can't load %s theme fallback to default", _gui->theme);
|
||||
elm_layout_file_set(edje, PACKAGE_DATA_DIR"/themes/default.edj",
|
||||
group);
|
||||
}
|
||||
|
@ -386,7 +383,7 @@ void
|
|||
entrance_gui_actions_set(Eina_List *actions)
|
||||
{
|
||||
if (!actions) return;
|
||||
PT("Actions set\n");
|
||||
PT("Actions set");
|
||||
_gui->actions = actions;
|
||||
_entrance_gui_actions_populate();
|
||||
}
|
||||
|
@ -428,7 +425,7 @@ _entrance_gui_users_populate(void)
|
|||
if (!style)
|
||||
style = "default"; //theme has not settet a style
|
||||
|
||||
PT("Add users list, using item style: %s\n", style);
|
||||
PT("Add users list, using item style: %s", style);
|
||||
ef = entrance_fill_new(style,
|
||||
_entrance_gui_user_text_get,
|
||||
_entrance_gui_user_content_get,
|
||||
|
@ -666,7 +663,7 @@ entrance_gui_user_bg_set(const char *path, const char *group)
|
|||
Entrance_Screen *screen;
|
||||
Evas_Object *o;
|
||||
|
||||
PT("User Background - %s %s\n", path, group);
|
||||
PT("User Background - %s %s", path, group);
|
||||
EINA_LIST_FOREACH(_gui->screens, l, screen)
|
||||
{
|
||||
if (path || group)
|
||||
|
@ -695,14 +692,14 @@ _entrance_gui_update(void)
|
|||
Evas_Object *bg = NULL;
|
||||
if (_gui->changed & ENTRANCE_CONF_WALLPAPER)
|
||||
{
|
||||
PT("Set background %s - %s\n", _gui->bg.path, _gui->bg.group);
|
||||
PT("Set background %s - %s", _gui->bg.path, _gui->bg.group);
|
||||
bg = _entrance_gui_background_obj_get(screen->transition, _gui->bg.path, _gui->bg.group);
|
||||
if (!bg)
|
||||
{
|
||||
const char *path;
|
||||
const char *group;
|
||||
if ((_gui->bg.group) || (_gui->bg.path))
|
||||
PT("Failed to load new background, fallback on the theme default! \n");
|
||||
PT("Failed to load new background, fallback on the theme default! ");
|
||||
bg = entrance_gui_theme_get(screen->transition,
|
||||
"entrance/background/default");
|
||||
edje_object_file_get(elm_layout_edje_get(bg), &path, &group);
|
||||
|
@ -948,7 +945,7 @@ _entrance_gui_cb_window_property(void *data EINA_UNUSED, int type EINA_UNUSED, v
|
|||
ev = event_info;
|
||||
if (ev->atom == ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK)
|
||||
{
|
||||
PT("screen managed\n");
|
||||
PT("screen managed");
|
||||
elm_exit();
|
||||
}
|
||||
|
||||
|
|
|
@ -160,13 +160,13 @@ _login_password_catch(Evas_Object *widget, Eina_Bool catch)
|
|||
{
|
||||
if (catch)
|
||||
{
|
||||
PT("catch password\n");
|
||||
PT("catch password");
|
||||
login->handler = ecore_event_handler_add(
|
||||
ECORE_EVENT_KEY_DOWN, _login_key_down_cb, widget);
|
||||
}
|
||||
else
|
||||
{
|
||||
PT("uncatch password\n");
|
||||
PT("uncatch password");
|
||||
ecore_event_handler_del(login->handler);
|
||||
login->handler = NULL;
|
||||
}
|
||||
|
@ -219,12 +219,12 @@ _login_key_down_cb(void *data, int type EINA_UNUSED, void *event)
|
|||
{
|
||||
if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)
|
||||
{
|
||||
PT("focus previous\n");
|
||||
PT("focus previous");
|
||||
elm_object_focus_next(data, ELM_FOCUS_PREVIOUS);
|
||||
}
|
||||
else
|
||||
{
|
||||
PT("focus next\n");
|
||||
PT("focus next");
|
||||
elm_object_focus_next(data, ELM_FOCUS_NEXT);
|
||||
}
|
||||
}
|
||||
|
@ -548,7 +548,7 @@ entrance_login_add(Evas_Object *obj, Entrance_Login_Cb login_cb, void *data)
|
|||
void
|
||||
entrance_login_xsessions_populate(Evas_Object *widget, Eina_List *xsessions)
|
||||
{
|
||||
PT("Session set\n");
|
||||
PT("Session set");
|
||||
Evas_Object *o;
|
||||
LOGIN_GET(widget);
|
||||
|
||||
|
|
|
@ -21,14 +21,14 @@ _theme_get(Evas_Object *win, const char *group)
|
|||
static void
|
||||
_signal(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const char *sig, const char *src)
|
||||
{
|
||||
printf("Event: %s - %s \n", sig, src);
|
||||
printf("Event: %s - %s ", sig, src);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_shutdown(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
printf("Quit\n");
|
||||
printf("Quit");
|
||||
elm_exit();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,21 +2,24 @@
|
|||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <Eina.h>
|
||||
#include "Ecore_Getopt.h"
|
||||
#include <xcb/xcb.h>
|
||||
|
||||
#define ENTRANCE_DISPLAY ":0.0"
|
||||
#define ENTRANCE_XEPHYR ":1.0"
|
||||
time_t current_time;
|
||||
struct tm *local_time;
|
||||
char entrance_time_d[4096];
|
||||
|
||||
static Eina_Bool _open_log();
|
||||
static Eina_Bool _entrance_main(const char *dname);
|
||||
static void _remove_lock();
|
||||
static void _signal_cb(int sig);
|
||||
static void _signal_log(int sig);
|
||||
static void _entrance_autologin_lock_set(void);
|
||||
static Eina_Bool _entrance_autologin_lock_get(void);
|
||||
static Eina_Bool _entrance_client_error(void *data, int type, void *event);
|
||||
static Eina_Bool _entrance_client_data(void *data, int type, void *event);
|
||||
static Eina_Bool _entrance_client_del(void *data, int type, void *event);
|
||||
static void _entrance_wait(void);
|
||||
|
||||
static Eina_Bool _testing = 0;
|
||||
static Eina_Bool _xephyr = 0;
|
||||
|
@ -27,7 +30,7 @@ static Ecore_Exe *_entrance_client = NULL;
|
|||
static void
|
||||
_signal_cb(int sig)
|
||||
{
|
||||
PT("signal %d received\n", sig);
|
||||
PT("signal %d received", sig);
|
||||
//FIXME if I don't have main loop at this time ?
|
||||
if (_entrance_client)
|
||||
ecore_exe_terminate(_entrance_client);
|
||||
|
@ -38,7 +41,7 @@ _signal_cb(int sig)
|
|||
static void
|
||||
_signal_log(int sig EINA_UNUSED)
|
||||
{
|
||||
PT("reopen the log file\n");
|
||||
PT("reopen the log file");
|
||||
entrance_close_log();
|
||||
_open_log();
|
||||
}
|
||||
|
@ -58,14 +61,14 @@ _get_lock()
|
|||
f = fopen(entrance_config->lockfile, "w");
|
||||
if (!f)
|
||||
{
|
||||
PT("Couldn't create lockfile!\n");
|
||||
PT("Couldn't create lockfile!");
|
||||
return (EINA_FALSE);
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "%d\n", my_pid);
|
||||
snprintf(buf, sizeof(buf), "%d", my_pid);
|
||||
if (!fwrite(buf, strlen(buf), 1, f))
|
||||
{
|
||||
fclose(f);
|
||||
PT("Couldn't write the lockfile\n");
|
||||
PT("Couldn't write the lockfile");
|
||||
return EINA_FALSE;
|
||||
}
|
||||
fclose(f);
|
||||
|
@ -80,7 +83,7 @@ _get_lock()
|
|||
if (pid == my_pid)
|
||||
return EINA_TRUE;
|
||||
|
||||
PT("A lock file are present another instance are present ?\n");
|
||||
PT("A lock file are present another instance are present ?");
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
|
@ -93,9 +96,9 @@ _update_lock()
|
|||
FILE *f;
|
||||
char buf[128];
|
||||
f = fopen(entrance_config->lockfile, "w");
|
||||
snprintf(buf, sizeof(buf), "%d\n", getpid());
|
||||
snprintf(buf, sizeof(buf), "%d", getpid());
|
||||
if (!fwrite(buf, strlen(buf), 1, f))
|
||||
PT("Coudn't update lockfile\n");
|
||||
PT("Coudn't update lockfile");
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
|
@ -112,15 +115,15 @@ _open_log()
|
|||
elog = fopen(entrance_config->logfile, "a");
|
||||
if (!elog)
|
||||
{
|
||||
PT("could not open logfile !\n");
|
||||
PT("could not open logfile !");
|
||||
return EINA_FALSE;
|
||||
}
|
||||
fclose(elog);
|
||||
if (!freopen(entrance_config->logfile, "a", stdout))
|
||||
PT("Error on reopen stdout\n");
|
||||
PT("Error on reopen stdout");
|
||||
setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
|
||||
if (!freopen(entrance_config->logfile, "a", stderr))
|
||||
PT("Error on reopen stderr\n");
|
||||
PT("Error on reopen stderr");
|
||||
setvbuf(stderr, NULL, _IONBF, BUFSIZ);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
@ -139,42 +142,51 @@ _entrance_wait(void)
|
|||
{
|
||||
// XXX: use eina_prefix! hardcoding paths . :(
|
||||
execl(PACKAGE_BIN_DIR"/entrance_wait", PACKAGE_SBIN_DIR"/entrance", NULL);
|
||||
PT("HUM HUM HUM can't wait ...\n\n\n");
|
||||
PT("HUM HUM HUM can't wait ...");
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_entrance_client_error(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Exe_Event_Data *ev)
|
||||
_entrance_client_error(void *data EINA_UNUSED, int type, void *event)
|
||||
{
|
||||
char buf[4096];
|
||||
size_t size = ev->size;
|
||||
Ecore_Exe_Event_Data *ev;
|
||||
size_t size;
|
||||
|
||||
ev = event;
|
||||
size = ev->size;
|
||||
|
||||
if ((unsigned int)ev->size > sizeof(buf) - 1)
|
||||
size = sizeof(buf) - 1;
|
||||
|
||||
strncpy(buf, (char*)ev->data, size);
|
||||
PT("Client error: %s", buf);
|
||||
EINA_LOG_DOM_ERR(_entrance_client_log, "%s", buf);
|
||||
return ECORE_CALLBACK_DONE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_entrance_client_data(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Exe_Event_Data *ev)
|
||||
_entrance_client_data(void *d EINA_UNUSED, int t EINA_UNUSED, void *event)
|
||||
{
|
||||
char buf[4096];
|
||||
size_t size = ev->size;
|
||||
Ecore_Exe_Event_Data *ev;
|
||||
size_t size;
|
||||
|
||||
ev = event;
|
||||
size = ev->size;
|
||||
|
||||
|
||||
if ((unsigned int)ev->size > sizeof(buf) - 1)
|
||||
size = sizeof(buf) - 1;
|
||||
|
||||
strncpy(buf, (char*)ev->data, size);
|
||||
PT("Client output: %s", buf);
|
||||
snprintf(buf, size + 1, "%s", (char*)ev->data);
|
||||
EINA_LOG_DOM_INFO(_entrance_client_log, "%s", buf);
|
||||
return ECORE_CALLBACK_DONE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_entrance_main(const char *dname)
|
||||
{
|
||||
PT("starting...\n");
|
||||
PT("starting...");
|
||||
if (!entrance_config->autologin)
|
||||
{
|
||||
if (!_entrance_client)
|
||||
|
@ -183,7 +195,7 @@ _entrance_main(const char *dname)
|
|||
ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
|
||||
_entrance_client_del, NULL);
|
||||
ecore_event_handler_add(ECORE_EXE_EVENT_ERROR,
|
||||
(Ecore_Event_Handler_Cb)_entrance_client_error, NULL);
|
||||
_entrance_client_error, NULL);
|
||||
ecore_event_handler_add(ECORE_EXE_EVENT_DATA,
|
||||
(Ecore_Event_Handler_Cb)_entrance_client_data, NULL);
|
||||
snprintf(buf, sizeof(buf),
|
||||
|
@ -191,7 +203,7 @@ _entrance_main(const char *dname)
|
|||
"LD_LIBRARY_PATH="PACKAGE_LIB_DIR" "
|
||||
PACKAGE_BIN_DIR"/entrance_client -d %s -t %s",
|
||||
dname, entrance_config->theme);
|
||||
PT("Exec entrance_client: %s\n", buf);
|
||||
PT("Exec entrance_client: %s", buf);
|
||||
|
||||
_entrance_client = ecore_exe_pipe_run(buf, ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_ERROR, NULL);
|
||||
}
|
||||
|
@ -209,20 +221,50 @@ _entrance_client_del(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
|||
ev = event;
|
||||
if (ev->exe != _entrance_client)
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
PT("client have terminated\n");
|
||||
PT("client have terminated");
|
||||
ecore_main_loop_quit();
|
||||
_entrance_client = NULL;
|
||||
|
||||
return ECORE_CALLBACK_DONE;
|
||||
}
|
||||
|
||||
static void
|
||||
_entrance_autologin_lock_set(void)
|
||||
{
|
||||
system("touch /var/cache/entrance/login");
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_entrance_autologin_lock_get(void)
|
||||
{
|
||||
FILE *f;
|
||||
char buf[4096];
|
||||
double uptime, sleep_time;
|
||||
struct stat st_login;
|
||||
|
||||
f = fopen("/proc/uptime", "r");
|
||||
if (f)
|
||||
{
|
||||
fgets(buf, sizeof(buf), f);
|
||||
fscanf(f, "%lf %lf", &uptime, &sleep_time);
|
||||
fclose(f);
|
||||
if (stat("/var/run/entrance/login", &st_login) > 0)
|
||||
return EINA_FALSE;
|
||||
else
|
||||
return EINA_TRUE;
|
||||
}
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static const Ecore_Getopt options =
|
||||
{
|
||||
PACKAGE,
|
||||
"%prog [options]",
|
||||
VERSION,
|
||||
"(C) 2011 Enlightenment, see AUTHORS",
|
||||
"(C) 201e Enlightenment, see AUTHORS",
|
||||
"GPL, see COPYING",
|
||||
"Entrance is a login manager, written using core efl libraries",
|
||||
EINA_TRUE,
|
||||
|
@ -230,8 +272,8 @@ static const Ecore_Getopt options =
|
|||
ECORE_GETOPT_STORE_TRUE('n', "nodaemon", "Don't daemonize."),
|
||||
ECORE_GETOPT_STORE_TRUE('t', "test", "run in test mode."),
|
||||
ECORE_GETOPT_STORE_TRUE('e', "fastexit", "Will change the way entrance \
|
||||
handles the exit of the created session.\n If set, entrance will exit if the session \
|
||||
quits.\n If not, entrance will restart if the session is quit because of an error, \
|
||||
handles the exit of the created session. If set, entrance will exit if the session \
|
||||
quits. If not, entrance will restart if the session is quit because of an error, \
|
||||
or if the environment variable ENTRANCE_RESTART is set."),
|
||||
ECORE_GETOPT_STORE_TRUE('x', "xephyr", "run in test mode and use Xephyr."),
|
||||
ECORE_GETOPT_HELP ('h', "help"),
|
||||
|
@ -266,10 +308,18 @@ main (int argc, char ** argv)
|
|||
ECORE_GETOPT_VALUE_NONE
|
||||
};
|
||||
|
||||
eina_init();
|
||||
eina_log_threads_enable();
|
||||
ecore_init();
|
||||
_entrance_log = eina_log_domain_register("entrance", EINA_COLOR_CYAN);
|
||||
_entrance_client_log = eina_log_domain_register("entrance_client", EINA_COLOR_CYAN);
|
||||
eina_log_domain_level_set("entrance", 5);
|
||||
eina_log_domain_level_set("entrance_client", 5);
|
||||
|
||||
args = ecore_getopt_parse(&options, values, argc, argv);
|
||||
if (args < 0)
|
||||
{
|
||||
PT("ERROR: could not parse options.\n");
|
||||
PT("ERROR: could not parse options.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -278,7 +328,7 @@ main (int argc, char ** argv)
|
|||
|
||||
if (getuid() != 0)
|
||||
{
|
||||
fprintf(stderr, "Sorry, only root can run this program!\n");
|
||||
fprintf(stderr, "Sorry, only root can run this program!");
|
||||
return 1;
|
||||
}
|
||||
if (!_xephyr && getenv("ENTRANCE_XEPHYR"))
|
||||
|
@ -287,7 +337,7 @@ main (int argc, char ** argv)
|
|||
if (fastexit)
|
||||
{
|
||||
putenv(strdup("ENTRANCE_FAST_QUIT=1"));
|
||||
PT("Fast exit enabled !\n");
|
||||
PT("Fast exit enabled !");
|
||||
}
|
||||
|
||||
if (_xephyr)
|
||||
|
@ -323,7 +373,7 @@ main (int argc, char ** argv)
|
|||
{
|
||||
if (daemon(0, 1) == -1)
|
||||
{
|
||||
PT("Error on daemonize !\n");
|
||||
PT("Error on daemonize !");
|
||||
quit_option = EINA_TRUE;
|
||||
}
|
||||
_update_lock();
|
||||
|
@ -342,7 +392,7 @@ main (int argc, char ** argv)
|
|||
}
|
||||
if (!_testing && !_open_log())
|
||||
{
|
||||
PT("Can't open log file !!!!\n");
|
||||
PT("Can't open log file !!!!");
|
||||
entrance_config_shutdown();
|
||||
exit(1);
|
||||
}
|
||||
|
@ -353,6 +403,7 @@ main (int argc, char ** argv)
|
|||
{
|
||||
char *quit;
|
||||
entrance_xserver_wait();
|
||||
sleep(5);
|
||||
entrance_session_init(dname);
|
||||
entrance_session_end(entrance_user);
|
||||
entrance_session_shutdown();
|
||||
|
@ -360,14 +411,14 @@ main (int argc, char ** argv)
|
|||
if (quit)
|
||||
{
|
||||
unsetenv("ENTRANCE_QUIT");
|
||||
PT("Last DE Session quit with error!\n");
|
||||
PT("Last DE Session quit with error!");
|
||||
}
|
||||
_remove_lock();
|
||||
PT("Entrance will quit, bye bye :).\n");
|
||||
PT("Entrance will quit, bye bye :).");
|
||||
entrance_close_log();
|
||||
exit(1);
|
||||
}
|
||||
PT("Welcome\n");
|
||||
PT("Welcome");
|
||||
ecore_init();
|
||||
efreet_init();
|
||||
/* Initialise event handler */
|
||||
|
@ -381,32 +432,35 @@ main (int argc, char ** argv)
|
|||
signal(SIGALRM, _signal_cb);
|
||||
signal(SIGUSR2, _signal_log);
|
||||
|
||||
PT("session init\n");
|
||||
PT("session init");
|
||||
entrance_session_init(dname);
|
||||
entrance_session_cookie();
|
||||
if (!_xephyr)
|
||||
{
|
||||
PT("xserver init\n");
|
||||
PT("xserver init");
|
||||
pid = entrance_xserver_init(_entrance_main, dname);
|
||||
}
|
||||
else
|
||||
_entrance_main(dname);
|
||||
PT("history init\n");
|
||||
entrance_history_init();
|
||||
if (entrance_config->autologin)
|
||||
{
|
||||
PT("autologin init\n");
|
||||
putenv(strdup("ENTRANCE_XPID=-1"));
|
||||
_entrance_main(dname);
|
||||
}
|
||||
PT("history init");
|
||||
entrance_history_init();
|
||||
if ((entrance_config->autologin) && _entrance_autologin_lock_get())
|
||||
{
|
||||
PT("autologin init");
|
||||
xcb_connection_t *disp = NULL;
|
||||
disp = xcb_connect(dname, NULL);
|
||||
PT("main loop begin\n");
|
||||
PT("main loop begin");
|
||||
ecore_main_loop_begin();
|
||||
PT("auth user\n");
|
||||
PT("auth user");
|
||||
#ifdef HAVE_PAM
|
||||
entrance_pam_init(PACKAGE, dname, NULL);
|
||||
entrance_pam_item_set(ENTRANCE_PAM_ITEM_USER,
|
||||
entrance_config->userlogin);
|
||||
#endif
|
||||
PT("login user\n");
|
||||
PT("login user");
|
||||
entrance_session_login(
|
||||
entrance_history_user_session_get(entrance_config->userlogin),
|
||||
EINA_FALSE);
|
||||
|
@ -415,60 +469,61 @@ main (int argc, char ** argv)
|
|||
}
|
||||
else
|
||||
{
|
||||
PT("action init\n");
|
||||
PT("action init");
|
||||
entrance_action_init();
|
||||
PT("server init\n");
|
||||
PT("server init");
|
||||
entrance_server_init();
|
||||
PT("starting main loop\n");
|
||||
PT("starting main loop");
|
||||
ecore_main_loop_begin();
|
||||
PT("main loop end\n");
|
||||
PT("main loop end");
|
||||
entrance_server_shutdown();
|
||||
PT("server shutdown\n");
|
||||
PT("server shutdown");
|
||||
entrance_action_shutdown();
|
||||
PT("action shutdown\n");
|
||||
PT("action shutdown");
|
||||
}
|
||||
entrance_history_shutdown();
|
||||
PT("history shutdown\n");
|
||||
PT("history shutdown");
|
||||
if (_xephyr)
|
||||
{
|
||||
//ecore_exe_terminate(xephyr);
|
||||
PT("Xephyr shutdown\n");
|
||||
PT("Xephyr shutdown");
|
||||
}
|
||||
else
|
||||
{
|
||||
entrance_xserver_shutdown();
|
||||
PT("xserver shutdown\n");
|
||||
PT("xserver shutdown");
|
||||
}
|
||||
#ifdef HAVE_PAM
|
||||
entrance_pam_shutdown();
|
||||
PT("pam shutdown\n");
|
||||
PT("pam shutdown");
|
||||
#endif
|
||||
_entrance_autologin_lock_set();
|
||||
efreet_shutdown();
|
||||
PT("ecore shutdown\n");
|
||||
PT("ecore shutdown");
|
||||
ecore_shutdown();
|
||||
PT("session shutdown\n");
|
||||
PT("session shutdown");
|
||||
entrance_session_shutdown();
|
||||
if (entrance_session_logged_get())
|
||||
{
|
||||
PT("user logged, waiting...\n");
|
||||
PT("user logged, waiting...");
|
||||
_entrance_wait();
|
||||
/* no more running here */
|
||||
}
|
||||
_remove_lock();
|
||||
PT("config shutdown\n");
|
||||
PT("config shutdown");
|
||||
entrance_config_shutdown();
|
||||
PT("eet shutdown\n");
|
||||
PT("eet shutdown");
|
||||
eet_shutdown();
|
||||
free(dname);
|
||||
if (!_xephyr)
|
||||
{
|
||||
PT("ending xserver\n");
|
||||
PT("ending xserver");
|
||||
kill(pid, SIGTERM);
|
||||
entrance_xserver_end();
|
||||
entrance_xserver_wait();
|
||||
}
|
||||
else
|
||||
PT("No session to wait, exiting\n");
|
||||
PT("No session to wait, exiting");
|
||||
entrance_close_log();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -26,21 +26,15 @@
|
|||
#include "entrance_image.h"
|
||||
#include "entrance_theme.h"
|
||||
|
||||
int _entrance_log;
|
||||
int _entrance_client_log;
|
||||
|
||||
#define PT(f, x...) \
|
||||
do \
|
||||
{ \
|
||||
current_time = time(NULL); \
|
||||
local_time = localtime(¤t_time); \
|
||||
memset(entrance_time_d, 0, sizeof(entrance_time_d)); \
|
||||
strftime(entrance_time_d, sizeof(entrance_time_d), \
|
||||
"%b %_2d %T", local_time); \
|
||||
fprintf(stderr, "(%s) "PACKAGE": "f, entrance_time_d, ##x); \
|
||||
EINA_LOG_DOM_INFO(_entrance_log, f, ##x); \
|
||||
} while (0)
|
||||
|
||||
extern time_t current_time;
|
||||
extern struct tm *local_time;
|
||||
extern char entrance_time_d[4096];
|
||||
|
||||
void entrance_close_log();
|
||||
|
||||
#endif /* ENTRANCE_H_ */
|
||||
|
|
|
@ -136,7 +136,7 @@ _entrance_action_shutdown(void *data EINA_UNUSED)
|
|||
static void
|
||||
_entrance_action_reboot(void *data EINA_UNUSED)
|
||||
{
|
||||
PT("Reboot\n");
|
||||
PT("Reboot");
|
||||
_action_exe = ecore_exe_run(entrance_config->command.reboot, NULL);
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ _entrance_action_exe_event_del_cb(void *data EINA_UNUSED, int type EINA_UNUSED,
|
|||
if (!ev->exe) return ret;
|
||||
if (ev->exe == _action_exe)
|
||||
{
|
||||
PT("action quit requested by user\n");
|
||||
PT("action quit requested by user");
|
||||
ecore_main_loop_quit();
|
||||
ret = ECORE_CALLBACK_DONE;
|
||||
}
|
||||
|
@ -204,12 +204,15 @@ _entrance_action_grub2_get(void)
|
|||
|
||||
PT("trying to open "GRUB2_FILE);
|
||||
f = eina_file_open(GRUB2_FILE, EINA_FALSE);
|
||||
if (!f) return ;
|
||||
fprintf(stderr, " o");
|
||||
if (!f)
|
||||
{
|
||||
PT("Unable to open "GRUB2_FILE);
|
||||
return ;
|
||||
}
|
||||
|
||||
data = eina_file_map_all(f, EINA_FILE_SEQUENTIAL);
|
||||
if (!data) goto on_error;
|
||||
fprintf(stderr, "k\n");
|
||||
PT("open "GRUB2_FILE" ok");
|
||||
|
||||
s = data;
|
||||
r2 = NULL;
|
||||
|
@ -241,7 +244,7 @@ _entrance_action_grub2_get(void)
|
|||
if (!grub2_ok)
|
||||
{
|
||||
grub2_ok = 1;
|
||||
PT("GRUB2 save mode found\n");
|
||||
PT("GRUB2 save mode found");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -268,7 +271,7 @@ _entrance_action_grub2_get(void)
|
|||
if (!action) goto end_line;
|
||||
|
||||
sprintf(action, "Reboot on %s", local);
|
||||
PT("GRUB2 '%s'\n", action);
|
||||
PT("GRUB2 '%s'", action);
|
||||
_entrance_actions =
|
||||
eina_list_append(_entrance_actions,
|
||||
_entrance_action_add(action,
|
||||
|
|
|
@ -31,10 +31,10 @@ main (int argc, char **argv)
|
|||
ck_connector_get_cookie(ck), 1);
|
||||
}
|
||||
else
|
||||
fprintf(stderr, "entrance_ck: error connecting to ConsoleKit\n");
|
||||
fprintf(stderr, "entrance_ck: error connecting to ConsoleKit");
|
||||
}
|
||||
else
|
||||
fprintf(stderr, "entrance_ck: can't set up connection to ConsoleKit\n");
|
||||
fprintf(stderr, "entrance_ck: can't set up connection to ConsoleKit");
|
||||
|
||||
|
||||
if (argc > 1)
|
||||
|
|
|
@ -54,8 +54,7 @@ _users_get(void)
|
|||
f = fopen(SYSTEM_CONFIG_DIR"/entrance/entrance.conf", "rb");
|
||||
if (!f)
|
||||
{
|
||||
fprintf(stderr,
|
||||
PACKAGE": Could not open "SYSTEM_CONFIG_DIR"/entrance/entrance.conf\n");
|
||||
PT(PACKAGE": Could not open "SYSTEM_CONFIG_DIR"/entrance/entrance.conf");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -80,7 +79,7 @@ _users_get(void)
|
|||
|
||||
fclose(f);
|
||||
if (eet_data_undump(ef, ENTRANCE_CONFIG_KEY, text, textlen, 1))
|
||||
fprintf(stderr, PACKAGE": Updating configuration\n");
|
||||
PT(PACKAGE": Updating configuration");
|
||||
free(text);
|
||||
eet_close(ef);
|
||||
}
|
||||
|
@ -104,7 +103,7 @@ _cache_get(void)
|
|||
if (!config)
|
||||
{
|
||||
PT(": Warning no configuration found! This must "
|
||||
"not append, we will go back to default configuration\n");
|
||||
"not append, we will go back to default configuration");
|
||||
config = (Entrance_Config *) calloc(1, sizeof(Entrance_Config));
|
||||
_defaults_set(config);
|
||||
}
|
||||
|
@ -117,7 +116,7 @@ _cache_get(void)
|
|||
static void
|
||||
_config_free(Entrance_Config *config)
|
||||
{
|
||||
PT("Config free\n");
|
||||
PT("Config free");
|
||||
eina_stringshare_del(config->session_path);
|
||||
eina_stringshare_del(config->command.xinit_path);
|
||||
eina_stringshare_del(config->command.xinit_args);
|
||||
|
@ -232,7 +231,7 @@ entrance_config_set(const Entrance_Conf_Gui_Event *conf)
|
|||
}
|
||||
if (update)
|
||||
{
|
||||
PT("Config save\n");
|
||||
PT("Config save");
|
||||
if (!ecore_file_is_dir("/var/cache/"PACKAGE))
|
||||
ecore_file_mkdir("/var/cache/"PACKAGE);
|
||||
file = eet_open("/var/cache/"PACKAGE"/"ENTRANCE_CONFIG_FILE,
|
||||
|
|
|
@ -70,7 +70,7 @@ _entrance_history_read(void)
|
|||
if (!(ef)
|
||||
|| !(_entrance_history = eet_data_read(ef, _eddh, ENTRANCE_SESSION_KEY)))
|
||||
{
|
||||
PT("Error on reading last session login\n");
|
||||
PT("Error on reading last session login");
|
||||
_entrance_history = calloc(1, sizeof(Entrance_History));
|
||||
}
|
||||
eet_close(ef);
|
||||
|
@ -83,7 +83,7 @@ _entrance_history_write(void)
|
|||
|
||||
if (_history_update)
|
||||
{
|
||||
PT("writing history file\n");
|
||||
PT("writing history file");
|
||||
ef = eet_open("/var/cache/"PACKAGE"/"ENTRANCE_HISTORY_FILE,
|
||||
EET_FILE_MODE_READ_WRITE);
|
||||
if (!ef)
|
||||
|
@ -92,7 +92,7 @@ _entrance_history_write(void)
|
|||
|
||||
if (!eet_data_write(ef, _eddh, ENTRANCE_SESSION_KEY,
|
||||
_entrance_history, 1))
|
||||
PT("Error on updating last session login\n");
|
||||
PT("Error on updating last session login");
|
||||
|
||||
eet_close(ef);
|
||||
}
|
||||
|
@ -118,12 +118,12 @@ entrance_history_push(const char *login, const char *session)
|
|||
Eina_List *l;
|
||||
Entrance_Login *el;
|
||||
|
||||
PT("history push for user %s session %s\n", login, session);
|
||||
PT("history push for user %s session %s", login, session);
|
||||
EINA_LIST_FOREACH(_entrance_history->history, l, el)
|
||||
{
|
||||
if (!strcmp(login, el->login))
|
||||
{
|
||||
PT("History updating\n");
|
||||
PT("History updating");
|
||||
if (el->remember_session)
|
||||
{
|
||||
if (!session)
|
||||
|
@ -142,7 +142,7 @@ entrance_history_push(const char *login, const char *session)
|
|||
}
|
||||
if (!el)
|
||||
{
|
||||
PT("History create a new entry for %s\n", login);
|
||||
PT("History create a new entry for %s", login);
|
||||
if ((el = calloc(1, sizeof(Entrance_Login))))
|
||||
{
|
||||
el->login = eina_stringshare_add(login);
|
||||
|
@ -178,13 +178,13 @@ entrance_history_user_update(const Entrance_Login *eu)
|
|||
Eina_List *l;
|
||||
Entrance_Login *el;
|
||||
|
||||
PT("Updating user info\n");
|
||||
PT("Updating user info");
|
||||
|
||||
EINA_LIST_FOREACH(_entrance_history->history, l, el)
|
||||
{
|
||||
if (!strcmp(eu->login, el->login))
|
||||
{
|
||||
PT("Find user in history\n");
|
||||
PT("Find user in history");
|
||||
_entrance_history_user_set(el, eu);
|
||||
break;
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ entrance_history_user_update(const Entrance_Login *eu)
|
|||
{
|
||||
if (!strcmp(eu->login, el->login))
|
||||
{
|
||||
PT("Append user in history\n");
|
||||
PT("Append user in history");
|
||||
_entrance_history_user_set(el, eu);
|
||||
_entrance_history->history = eina_list_append(_entrance_history->history, el);
|
||||
break;
|
||||
|
@ -232,7 +232,7 @@ _entrance_user_init(void)
|
|||
char *user;
|
||||
int uid;
|
||||
|
||||
PT("scan for users\n");
|
||||
PT("scan for users");
|
||||
f = fopen("/etc/passwd", "r");
|
||||
if (f)
|
||||
{
|
||||
|
|
|
@ -47,26 +47,25 @@ _entrance_pam_conv(int num_msg, const struct pam_message **msg,
|
|||
{
|
||||
case PAM_PROMPT_ECHO_ON:
|
||||
// We assume PAM is asking for the username
|
||||
PT("echo on\n");
|
||||
PT("echo on");
|
||||
resp[i]->resp = _login;
|
||||
break;
|
||||
|
||||
case PAM_PROMPT_ECHO_OFF:
|
||||
PT("echo off\n");
|
||||
PT("echo off");
|
||||
resp[i]->resp = _passwd;
|
||||
_passwd = NULL;
|
||||
break;
|
||||
case PAM_ERROR_MSG:
|
||||
PT("error msg\n");
|
||||
PT("error msg");
|
||||
case PAM_TEXT_INFO:
|
||||
PT("info ");
|
||||
fprintf(stderr, "%s\n", msg[i]->msg);
|
||||
PT("info %s", msg[i]->msg);
|
||||
break;
|
||||
case PAM_SUCCESS:
|
||||
PT("success :)\n");
|
||||
PT("success :)");
|
||||
break;
|
||||
default:
|
||||
PT("default\n");
|
||||
PT("default");
|
||||
}
|
||||
if (result != PAM_SUCCESS) break;
|
||||
}
|
||||
|
@ -104,14 +103,14 @@ entrance_pam_open_session(void)
|
|||
{
|
||||
case PAM_CRED_ERR:
|
||||
case PAM_USER_UNKNOWN:
|
||||
PT("PAM user unknow\n");
|
||||
PT("PAM user unknow");
|
||||
return 1;
|
||||
case PAM_AUTH_ERR:
|
||||
case PAM_PERM_DENIED:
|
||||
PT("PAM error on login password\n");
|
||||
PT("PAM error on login password");
|
||||
return 1;
|
||||
default:
|
||||
PT("PAM open warning unknow error\n");
|
||||
PT("PAM open warning unknow error");
|
||||
return 1;
|
||||
case PAM_SUCCESS:
|
||||
break;
|
||||
|
@ -132,13 +131,13 @@ entrance_pam_open_session(void)
|
|||
void
|
||||
entrance_pam_close_session(const Eina_Bool opened)
|
||||
{
|
||||
PT("PAM close session\n");
|
||||
PT("PAM close session");
|
||||
last_result = pam_close_session(_pam_handle, PAM_SILENT);
|
||||
switch (last_result)
|
||||
{
|
||||
default:
|
||||
//case PAM_SESSION_ERROR:
|
||||
PT("error on close session\n");
|
||||
PT("error on close session");
|
||||
pam_setcred(_pam_handle, PAM_DELETE_CRED);
|
||||
entrance_pam_end();
|
||||
case PAM_SUCCESS:
|
||||
|
@ -178,24 +177,24 @@ entrance_pam_authenticate(void)
|
|||
{
|
||||
case PAM_ABORT:
|
||||
case PAM_AUTHINFO_UNAVAIL:
|
||||
PT("PAM error !\n");
|
||||
PT("PAM error !");
|
||||
entrance_pam_end();
|
||||
return 1;
|
||||
case PAM_USER_UNKNOWN:
|
||||
PT("PAM user unknow error !\n");
|
||||
PT("PAM user unknow error !");
|
||||
return 1;
|
||||
case PAM_MAXTRIES:
|
||||
PT("PAM max tries error !\n");
|
||||
PT("PAM max tries error !");
|
||||
entrance_server_client_wait();
|
||||
return 1;
|
||||
case PAM_CRED_INSUFFICIENT:
|
||||
PT("PAM don't have sufficient credential to authenticate !\n");
|
||||
PT("PAM don't have sufficient credential to authenticate !");
|
||||
return 1;
|
||||
case PAM_AUTH_ERR:
|
||||
PT("PAM authenticate error !\n");
|
||||
PT("PAM authenticate error !");
|
||||
return 1;
|
||||
default:
|
||||
PT("PAM auth warning unknow error\n");
|
||||
PT("PAM auth warning unknow error");
|
||||
return 1;
|
||||
case PAM_SUCCESS:
|
||||
break;
|
||||
|
@ -206,18 +205,18 @@ entrance_pam_authenticate(void)
|
|||
default:
|
||||
//case PAM_NEW_AUTHTOKEN_REQD:
|
||||
case PAM_ACCT_EXPIRED:
|
||||
PT("PAM user acct expired error\n");
|
||||
PT("PAM user acct expired error");
|
||||
entrance_pam_end();
|
||||
return 1;
|
||||
case PAM_USER_UNKNOWN:
|
||||
PT("PAM user unknow error\n");
|
||||
PT("PAM user unknow error");
|
||||
entrance_pam_end();
|
||||
return 1;
|
||||
case PAM_AUTH_ERR:
|
||||
PT("PAM auth error\n");
|
||||
PT("PAM auth error");
|
||||
return 1;
|
||||
case PAM_PERM_DENIED:
|
||||
PT("PAM perm_denied error\n");
|
||||
PT("PAM perm_denied error");
|
||||
return 1;
|
||||
case PAM_SUCCESS:
|
||||
break;
|
||||
|
@ -250,7 +249,7 @@ entrance_pam_init(const char *service, const char *display, const char *user)
|
|||
return 0;
|
||||
|
||||
pam_error:
|
||||
PT("PAM error !!!\n");
|
||||
PT("PAM error !!!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -262,7 +261,7 @@ entrance_pam_item_set(ENTRANCE_PAM_ITEM_TYPE type, const void *value)
|
|||
return 0;
|
||||
}
|
||||
|
||||
PT("PAM error: %d on %d\n", last_result, type);
|
||||
PT("PAM error: %d on %d", last_result, type);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -275,7 +274,7 @@ entrance_pam_item_get(ENTRANCE_PAM_ITEM_TYPE type)
|
|||
default:
|
||||
case PAM_SYSTEM_ERR:
|
||||
entrance_pam_end();
|
||||
PT("error on pam item get\n");
|
||||
PT("error on pam item get");
|
||||
case PAM_PERM_DENIED: /* Here data was NULL */
|
||||
case PAM_SUCCESS:
|
||||
break;
|
||||
|
|
|
@ -15,38 +15,38 @@ _entrance_server_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event E
|
|||
{
|
||||
Entrance_Event eev;
|
||||
|
||||
PT("server client connected\n");
|
||||
PT("Sending users\n");
|
||||
PT("server client connected");
|
||||
PT("Sending users");
|
||||
eev.type = ENTRANCE_EVENT_USERS;
|
||||
eev.event.users.users = entrance_history_get();
|
||||
entrance_event_send(&eev);
|
||||
|
||||
PT("Sending actions\n");
|
||||
PT("Sending actions");
|
||||
eev.type = ENTRANCE_EVENT_ACTIONS;
|
||||
eev.event.actions.actions = entrance_action_get();
|
||||
entrance_event_send(&eev);
|
||||
if (entrance_config->xsessions)
|
||||
{
|
||||
PT("Sending xsessions\n");
|
||||
PT("Sending xsessions");
|
||||
eev.type = ENTRANCE_EVENT_XSESSIONS;
|
||||
eev.event.xsessions.xsessions = entrance_session_list_get();
|
||||
entrance_event_send(&eev);
|
||||
}
|
||||
if (entrance_config->custom_conf)
|
||||
{
|
||||
PT("Sending custom settings is enabled\n");
|
||||
PT("Sending custom settings is enabled");
|
||||
eev.type = ENTRANCE_EVENT_CONF_GUI;
|
||||
eev.event.conf_gui.enabled = EINA_TRUE;
|
||||
eev.event.conf_gui.bg.path = entrance_config->bg.path;
|
||||
eev.event.conf_gui.bg.group = entrance_config->bg.group;
|
||||
entrance_event_send(&eev);
|
||||
}
|
||||
PT("Sending pools\n");
|
||||
PT("Sending pools");
|
||||
eev.type = ENTRANCE_EVENT_POOLS;
|
||||
eev.event.pools.icon_pool = entrance_image_system_icons();
|
||||
eev.event.pools.background_pool = entrance_image_system_backgrounds();
|
||||
entrance_event_send(&eev);
|
||||
PT("Sending themes\n");
|
||||
PT("Sending themes");
|
||||
eev.type = ENTRANCE_EVENT_THEMES;
|
||||
eev.event.themes.themes = entrance_theme_themes_get();
|
||||
entrance_event_send(&eev);
|
||||
|
@ -57,7 +57,7 @@ _entrance_server_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event E
|
|||
static Eina_Bool
|
||||
_entrance_server_del(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
|
||||
{
|
||||
PT("server client disconnected\n");
|
||||
PT("server client disconnected");
|
||||
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
@ -87,12 +87,12 @@ _entrance_server_read_cb(const void *data, size_t size EINA_UNUSED, void *user_d
|
|||
if (entrance_session_authenticate(eev->event.auth.login,
|
||||
eev->event.auth.password))
|
||||
{
|
||||
PT("server authenticate granted\n");
|
||||
PT("server authenticate granted");
|
||||
neev.event.status.login = entrance_session_login_get();
|
||||
neev.event.status.granted = EINA_TRUE;
|
||||
if (eev->event.auth.open_session)
|
||||
{
|
||||
PT("opening session now ...\n");
|
||||
PT("opening session now ...");
|
||||
entrance_session_login(eev->event.auth.session, EINA_TRUE);
|
||||
}
|
||||
else
|
||||
|
@ -103,28 +103,28 @@ _entrance_server_read_cb(const void *data, size_t size EINA_UNUSED, void *user_d
|
|||
entrance_session_close(EINA_FALSE);
|
||||
neev.event.status.login = NULL;
|
||||
neev.event.status.granted = EINA_FALSE;
|
||||
PT("server authenticate error\n");
|
||||
PT("server authenticate error");
|
||||
}
|
||||
entrance_event_send(&neev);
|
||||
|
||||
}
|
||||
else if (eev->type == ENTRANCE_EVENT_ACTION)
|
||||
{
|
||||
PT("Action received\n");
|
||||
PT("Action received");
|
||||
entrance_action_run(eev->event.action.action);
|
||||
}
|
||||
else if (eev->type == ENTRANCE_EVENT_CONF_GUI)
|
||||
{
|
||||
PT("Conf Gui received\n");
|
||||
PT("Conf Gui received");
|
||||
entrance_config_set(&eev->event.conf_gui);
|
||||
}
|
||||
else if (eev->type == ENTRANCE_EVENT_CONF_USER)
|
||||
{
|
||||
PT("Conf user received\n");
|
||||
PT("Conf user received");
|
||||
entrance_history_user_update(&eev->event.conf_user);
|
||||
}
|
||||
else
|
||||
PT("UNKNOW signal server\n");
|
||||
PT("UNKNOW signal server");
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ entrance_server_init(void)
|
|||
_entrance_server = ecore_con_server_add(ECORE_CON_LOCAL_SYSTEM,
|
||||
"entrance", 42, NULL);
|
||||
if (!_entrance_server)
|
||||
PT("server init fail\n");
|
||||
PT("server init fail");
|
||||
|
||||
h = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD,
|
||||
_entrance_server_add, NULL);
|
||||
|
|
|
@ -49,11 +49,11 @@ _entrance_session_cookie_add(const char *mcookie, const char *display,
|
|||
|
||||
if (!xauth_cmd || !auth_file) return 1;
|
||||
snprintf(buf, sizeof(buf), "%s -f %s -q", xauth_cmd, auth_file);
|
||||
PT("write auth on display %s with file %s\n", display, auth_file);
|
||||
PT("write auth on display %s with file %s", display, auth_file);
|
||||
cmd = popen(buf, "w");
|
||||
if (!cmd)
|
||||
{
|
||||
PT("write auth fail !\n");
|
||||
PT("write auth fail !");
|
||||
return 1;
|
||||
}
|
||||
fprintf(cmd, "remove %s\n", display);
|
||||
|
@ -68,26 +68,26 @@ _entrance_session_userid_set(struct passwd *pwd)
|
|||
{
|
||||
if (!pwd)
|
||||
{
|
||||
PT("no passwd !\n");
|
||||
PT("no passwd !");
|
||||
return 1;
|
||||
}
|
||||
if (initgroups(pwd->pw_name, pwd->pw_gid) != 0)
|
||||
{
|
||||
PT("can't init group\n");
|
||||
PT("can't init group");
|
||||
return 1;
|
||||
}
|
||||
if (setgid(pwd->pw_gid) != 0)
|
||||
{
|
||||
PT("can't set gid\n");
|
||||
PT("can't set gid");
|
||||
return 1;
|
||||
}
|
||||
if (setuid(pwd->pw_uid) != 0)
|
||||
{
|
||||
PT("can't set uid\n");
|
||||
PT("can't set uid");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* PT("name -> %s, gid -> %d, uid -> %d\n",
|
||||
/* PT("name -> %s, gid -> %d, uid -> %d",
|
||||
pwd->pw_name, pwd->pw_gid, pwd->pw_uid); */
|
||||
return 0;
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ _entrance_session_userid_set(struct passwd *pwd)
|
|||
static Eina_Bool
|
||||
_entrance_session_begin(struct passwd *pwd, const char *cookie)
|
||||
{
|
||||
PT("Session Init\n");
|
||||
PT("Session Init");
|
||||
if (pwd->pw_shell[0] == '\0')
|
||||
{
|
||||
setusershell();
|
||||
|
@ -128,7 +128,7 @@ _entrance_session_run(struct passwd *pwd, const char *cmd, const char *cookie)
|
|||
if (pid == 0)
|
||||
{
|
||||
|
||||
PT("Session Run\n");
|
||||
PT("Session Run");
|
||||
#ifdef HAVE_PAM
|
||||
env = entrance_pam_env_list_get();
|
||||
entrance_pam_end();
|
||||
|
@ -160,11 +160,11 @@ _entrance_session_run(struct passwd *pwd, const char *cmd, const char *cookie)
|
|||
env[n++]=0;
|
||||
#endif
|
||||
snprintf(buf, sizeof(buf),
|
||||
"%s %s ",
|
||||
"%s %s",
|
||||
entrance_config->command.session_start,
|
||||
pwd->pw_name);
|
||||
if (-1 == system(buf))
|
||||
PT("Error on session start command\n");
|
||||
PT("Error on session start command");
|
||||
if(_entrance_session_userid_set(pwd)) return;
|
||||
_entrance_session_cookie_add(_mcookie, _dname,//":0",
|
||||
entrance_config->command.xauth_path, cookie);
|
||||
|
@ -173,7 +173,7 @@ _entrance_session_run(struct passwd *pwd, const char *cmd, const char *cookie)
|
|||
PT("change directory for user fail");
|
||||
return;
|
||||
}
|
||||
// PT("Open %s`s session\n", pwd->pw_name);
|
||||
// PT("Open %s`s session", pwd->pw_name);
|
||||
snprintf(buf, sizeof(buf), "%s/.entrance_session.log", pwd->pw_dir);
|
||||
remove(buf);
|
||||
|
||||
|
@ -184,9 +184,9 @@ _entrance_session_run(struct passwd *pwd, const char *cmd, const char *cookie)
|
|||
snprintf(buf, sizeof(buf), "%s %s > %s/.entrance_session.log 2>&1",
|
||||
entrance_config->command.session_login, cmd, pwd->pw_dir);
|
||||
#endif
|
||||
PT("Executing: %s --login -c %s \n", pwd->pw_shell, buf);
|
||||
PT("Executing: %s --login -c %s ", pwd->pw_shell, buf);
|
||||
execle(pwd->pw_shell, pwd->pw_shell, "--login", "-c", buf, NULL, env);
|
||||
PT("The Xsessions are not launched :(\n");
|
||||
PT("The Xsessions are not launched :(");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -198,9 +198,9 @@ entrance_session_end(const char *user)
|
|||
#endif
|
||||
char buf[PATH_MAX];
|
||||
snprintf(buf, sizeof(buf),
|
||||
"%s %s ", entrance_config->command.session_stop, user);
|
||||
"%s %s", entrance_config->command.session_stop, user);
|
||||
if (-1 == system(buf))
|
||||
PT("Error on session stop command\n");
|
||||
PT("Error on session stop command");
|
||||
entrance_session_close(EINA_TRUE);
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,7 @@ entrance_session_close(const Eina_Bool opened)
|
|||
void
|
||||
entrance_session_pid_set(pid_t pid)
|
||||
{
|
||||
fprintf(stderr, "%s: session pid %d\n", PACKAGE, pid);
|
||||
PT("%s: session pid %d", PACKAGE, pid);
|
||||
_session_pid = pid;
|
||||
}
|
||||
|
||||
|
@ -261,7 +261,7 @@ entrance_session_cookie(void)
|
|||
snprintf(buf, sizeof(buf), "XAUTHORITY=%s",
|
||||
entrance_config->command.xauth_file);
|
||||
putenv(strdup(buf));
|
||||
//PT("cookie %s \n", _mcookie);
|
||||
//PT("cookie %s ", _mcookie);
|
||||
_entrance_session_cookie_add(_mcookie, _dname,
|
||||
entrance_config->command.xauth_path,
|
||||
entrance_config->command.xauth_file);
|
||||
|
@ -344,17 +344,17 @@ entrance_session_login(const char *session, Eina_Bool push)
|
|||
snprintf(buf, sizeof(buf), "%s/.Xauthority", pwd->pw_dir);
|
||||
if (!_entrance_session_begin(pwd, buf))
|
||||
{
|
||||
fprintf(stderr, "Entrance: couldn't open session\n");
|
||||
PT("Entrance: couldn't open session");
|
||||
exit(1);
|
||||
}
|
||||
if (push) entrance_history_push(pwd->pw_name, session);
|
||||
cmd = _entrance_session_find_command(pwd->pw_dir, session);
|
||||
if (!cmd)
|
||||
{
|
||||
PT("Error !!! No command to launch, can't open a session :'(\n");
|
||||
PT("Error !!! No command to launch, can't open a session :'(");
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
PT("launching session %s for user %s\n", cmd, _login);
|
||||
PT("launching session %s for user %s", cmd, _login);
|
||||
_entrance_session_run(pwd, cmd, buf);
|
||||
snprintf(buf, sizeof(buf), "ENTRANCE_USER=%s", pwd->pw_name);
|
||||
putenv(buf);
|
||||
|
@ -442,7 +442,6 @@ _entrance_session_desktops_init(void)
|
|||
_xsessions = eina_list_append(_xsessions, xsession);
|
||||
|
||||
efreet_desktop_type_alias(EFREET_DESKTOP_TYPE_APPLICATION, "XSession");
|
||||
PT("scanning directory: ");
|
||||
/* Maybee need to scan other directories ? */
|
||||
_entrance_session_desktops_scan("/etc/share/xsessions");
|
||||
_entrance_session_desktops_scan("/etc/X11/dm/Sessions");
|
||||
|
@ -451,11 +450,10 @@ _entrance_session_desktops_init(void)
|
|||
dirs = efreet_data_dirs_get();
|
||||
EINA_LIST_FOREACH(dirs, l, path)
|
||||
{
|
||||
PT("scanning directory: %s", path);
|
||||
snprintf(buf, sizeof(buf), "%s/xsessions", path);
|
||||
_entrance_session_desktops_scan(buf);
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
PT("scan directory end\n");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -467,7 +465,6 @@ _entrance_session_desktops_scan(const char *dir)
|
|||
|
||||
if (ecore_file_is_dir(dir))
|
||||
{
|
||||
fprintf(stderr, " %s", dir);
|
||||
files = ecore_file_ls(dir);
|
||||
EINA_LIST_FREE(files, filename)
|
||||
{
|
||||
|
@ -503,6 +500,7 @@ _entrance_session_desktops_scan_file(const char *path)
|
|||
command = eina_list_data_get(commands);
|
||||
if (command && desktop->name)
|
||||
{
|
||||
PT("Adding %s as wm", desktop->name);
|
||||
xsession= calloc(1, sizeof(Entrance_Xsession));
|
||||
xsession->command = eina_stringshare_add(command);
|
||||
xsession->name = eina_stringshare_add(desktop->name);
|
||||
|
|
|
@ -21,14 +21,14 @@ _theme_get(Evas_Object *win, const char *group)
|
|||
static void
|
||||
_signal(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const char *sig, const char *src)
|
||||
{
|
||||
printf("Event: %s - %s \n", sig, src);
|
||||
printf("Event: %s - %s ", sig, src);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_shutdown(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
printf("Quit\n");
|
||||
printf("Quit");
|
||||
elm_exit();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
|
@ -38,6 +39,7 @@ main (int argc __UNUSED__, char **argv __UNUSED__)
|
|||
pid = getenv("ENTRANCE_XPID");
|
||||
if (!pid) return -1;
|
||||
_x_pid = atoi(pid);
|
||||
printf("waiting\n");
|
||||
|
||||
action.sa_sigaction = _entrance_wait_action;
|
||||
action.sa_flags = SA_RESTART | SA_SIGINFO;
|
||||
|
|
|
@ -35,7 +35,7 @@ _xserver_start(void)
|
|||
char **args = NULL;
|
||||
pid_t pid;
|
||||
|
||||
PT("Launching xserver\n");
|
||||
PT("Launching xserver");
|
||||
pid = fork();
|
||||
if (!pid)
|
||||
{
|
||||
|
@ -86,7 +86,7 @@ _xserver_start(void)
|
|||
execv(args[0], args);
|
||||
if (buf) free(buf);
|
||||
if (args) free(args);
|
||||
PT("Couldn't launch Xserver ...\n");
|
||||
PT("Couldn't launch Xserver ...");
|
||||
}
|
||||
return pid;
|
||||
xserver_error:
|
||||
|
@ -96,7 +96,7 @@ xserver_error:
|
|||
static Eina_Bool
|
||||
_xserver_started(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
|
||||
{
|
||||
PT("xserver started\n");
|
||||
PT("xserver started");
|
||||
_env_set(_xserver->dname);
|
||||
_xserver->start(_xserver->dname);
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
|
@ -116,7 +116,7 @@ entrance_xserver_init(Entrance_X_Cb start, const char *dname)
|
|||
pid = _xserver_start();
|
||||
snprintf(buf, sizeof(buf), "ENTRANCE_XPID=%d", pid);
|
||||
putenv(strdup(buf));
|
||||
PT("xserver adding signal user handler\n");
|
||||
PT("xserver adding signal user handler");
|
||||
_handler_start = ecore_event_handler_add(ECORE_EVENT_SIGNAL_USER,
|
||||
_xserver_started,
|
||||
NULL);
|
||||
|
@ -136,19 +136,18 @@ entrance_xserver_wait(void)
|
|||
pid = atoi(xpid);
|
||||
while (waitpid(pid, NULL, WUNTRACED | WCONTINUED) > 0)
|
||||
{
|
||||
printf(".");
|
||||
PT("Waiting ...");
|
||||
sleep(1);
|
||||
}
|
||||
unsetenv("ENTRANCE_XPID");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void
|
||||
entrance_xserver_end(void)
|
||||
{
|
||||
const char *xpid;
|
||||
PT("xserver end\n");
|
||||
PT("xserver end");
|
||||
xpid = getenv("ENTRANCE_XPID");
|
||||
if (xpid)
|
||||
kill(atoi(xpid), SIGTERM);
|
||||
|
|
Loading…
Reference in New Issue