entrance: more work on log

SVN revision: 76477
This commit is contained in:
Michael BOUCHAUD 2012-09-11 19:52:26 +00:00
parent a1c7376558
commit 8692835556
5 changed files with 51 additions and 27 deletions

View File

@ -3,6 +3,10 @@
#include <Ecore_X.h> #include <Ecore_X.h>
#include <Ecore_Getopt.h> #include <Ecore_Getopt.h>
time_t current_time;
struct tm *local_time;
char entrance_time_d[4096];
static const Ecore_Getopt options = static const Ecore_Getopt options =
{ {
"entrance_client", "entrance_client",
@ -26,13 +30,13 @@ static const Ecore_Getopt options =
int int
entrance_client_main(const char *theme) entrance_client_main(const char *theme)
{ {
fprintf(stderr, PACKAGE"_client: client init\n"); PT("client init\n");
if (entrance_gui_init(theme)) return EXIT_FAILURE; if (entrance_gui_init(theme)) return EXIT_FAILURE;
fprintf(stderr, PACKAGE"_client: client run\n"); PT("client run\n");
entrance_connect_init(); entrance_connect_init();
elm_run(); elm_run();
entrance_connect_shutdown(); entrance_connect_shutdown();
fprintf(stderr, PACKAGE"_client: client shutdown\n"); PT("_client: client shutdown\n");
entrance_gui_shutdown(); entrance_gui_shutdown();
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
@ -61,7 +65,7 @@ main(int argc, char **argv)
return EXIT_SUCCESS; return EXIT_SUCCESS;
if (!display) if (!display)
{ {
printf("A display is required!\n"); fprintf(stderr, "A display is required!\n");
return EXIT_FAILURE; return EXIT_FAILURE;
} }
eina_init(); eina_init();

View File

@ -16,6 +16,21 @@
#include "entrance_fill.h" #include "entrance_fill.h"
#include "../event/entrance_event.h" #include "../event/entrance_event.h"
#define PT(x) \
do \
{ \
current_time = time(NULL); \
local_time = localtime(&current_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: %s", entrance_time_d, x); \
} while (0)
extern time_t current_time;
extern struct tm *local_time;
extern char entrance_time_d[4096];
int entrance_client_main(); int entrance_client_main();
#endif /* ENTRANCE_H_ */ #endif /* ENTRANCE_H_ */

View File

@ -15,7 +15,7 @@ _entrance_connect_add(void *data __UNUSED__, int type __UNUSED__, void *event)
{ {
Ecore_Con_Event_Server_Add *ev; Ecore_Con_Event_Server_Add *ev;
ev = event; ev = event;
fprintf(stderr, PACKAGE": client connected\n"); PT("connected\n");
return ECORE_CALLBACK_RENEW; return ECORE_CALLBACK_RENEW;
} }
@ -25,7 +25,7 @@ _entrance_connect_del(void *data __UNUSED__, int type __UNUSED__, void *event)
{ {
Ecore_Con_Event_Server_Del *ev; Ecore_Con_Event_Server_Del *ev;
ev = event; ev = event;
fprintf(stderr, PACKAGE": client disconnected\n"); PT("disconnected\n");
_entrance_connect = NULL; _entrance_connect = NULL;
return ECORE_CALLBACK_RENEW; return ECORE_CALLBACK_RENEW;
@ -57,7 +57,7 @@ _entrance_connect_data(void *data __UNUSED__, int type __UNUSED__, void *event)
else if (eev->type == ENTRANCE_EVENT_ACTIONS) else if (eev->type == ENTRANCE_EVENT_ACTIONS)
entrance_gui_actions_set(eev->event.actions.actions); entrance_gui_actions_set(eev->event.actions.actions);
else else
fprintf(stderr, PACKAGE": unknow signal\n"); PT("unknow signal\n");
} }
return ECORE_CALLBACK_RENEW; return ECORE_CALLBACK_RENEW;
} }
@ -98,9 +98,9 @@ entrance_connect_init()
_entrance_connect = ecore_con_server_connect(ECORE_CON_LOCAL_SYSTEM, _entrance_connect = ecore_con_server_connect(ECORE_CON_LOCAL_SYSTEM,
"entrance", 42, NULL); "entrance", 42, NULL);
if (_entrance_connect) if (_entrance_connect)
printf(PACKAGE": client server init ok\n"); PT("client server init ok\n");
else else
printf(PACKAGE": client server init fail\n"); PT("client server init fail\n");
h = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, h = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD,
_entrance_connect_add, NULL); _entrance_connect_add, NULL);
_handlers = eina_list_append(_handlers, h); _handlers = eina_list_append(_handlers, h);
@ -116,7 +116,7 @@ void
entrance_connect_shutdown() entrance_connect_shutdown()
{ {
Ecore_Event_Handler *h; Ecore_Event_Handler *h;
printf(PACKAGE": client server shutdown\n"); PT("client server shutdown\n");
EINA_LIST_FREE(_handlers, h) EINA_LIST_FREE(_handlers, h)
ecore_event_handler_del(h); ecore_event_handler_del(h);
ecore_con_shutdown(); ecore_con_shutdown();

View File

@ -61,8 +61,11 @@ _entrance_gui_theme_get (Evas_Object *win, const char *group, const char *theme)
snprintf(buf, sizeof(buf), PACKAGE_DATA_DIR"/themes/%s.edj", theme); snprintf(buf, sizeof(buf), PACKAGE_DATA_DIR"/themes/%s.edj", theme);
if (!elm_layout_file_set(edje, buf, group)) if (!elm_layout_file_set(edje, buf, group))
{ {
fprintf(stderr, PACKAGE": can't load %s theme fallback to default\n", theme); snprintf(buf, sizeof(buf),
elm_layout_file_set(edje, PACKAGE_DATA_DIR"/themes/default.edj", group); "can't load %s theme fallback to default\n", theme);
PT(buf);
elm_layout_file_set(edje, PACKAGE_DATA_DIR"/themes/default.edj",
group);
} }
} }
else else
@ -112,7 +115,7 @@ static void
_entrance_gui_shutdown(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) _entrance_gui_shutdown(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{ {
elm_exit(); elm_exit();
printf("shutdown cb\n"); PT("shutdown cb\n");
} }
static Eina_Bool static Eina_Bool
@ -162,9 +165,9 @@ _entrance_gui_login_cancel_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__
} }
static Eina_Bool static Eina_Bool
_entrance_gui_login_timeout(void *data) _entrance_gui_login_timeout(void *data __UNUSED__)
{ {
Evas_Object *popup, *o, *vbx, *bx; Evas_Object *popup, *o, *bx;
Entrance_Screen *screen; Entrance_Screen *screen;
Eina_List *l; Eina_List *l;
@ -173,7 +176,9 @@ _entrance_gui_login_timeout(void *data)
popup = elm_popup_add(screen->win); popup = elm_popup_add(screen->win);
evas_object_size_hint_weight_set(popup, evas_object_size_hint_weight_set(popup,
EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 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."); 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); bx = elm_box_add(popup);
elm_object_content_set(popup, bx); elm_object_content_set(popup, bx);
@ -370,7 +375,7 @@ void
entrance_gui_actions_set(Eina_List *actions) entrance_gui_actions_set(Eina_List *actions)
{ {
if (!actions) return; if (!actions) return;
fprintf(stderr, PACKAGE": Action set\n"); PT("Action set\n");
_gui->actions = actions; _gui->actions = actions;
_entrance_gui_actions_populate(); _entrance_gui_actions_populate();
} }
@ -384,11 +389,11 @@ entrance_gui_init(const char *theme)
int ii, i; int ii, i;
int x, y, w, h; int x, y, w, h;
fprintf(stderr, PACKAGE": client Gui init\n"); PT("Gui init\n");
_gui = calloc(1, sizeof(Entrance_Gui)); _gui = calloc(1, sizeof(Entrance_Gui));
if (!_gui) if (!_gui)
{ {
fprintf(stderr, PACKAGE": client Not Enough memory\n"); PT("Not Enough memory\n");
return 1; return 1;
} }
@ -396,7 +401,8 @@ entrance_gui_init(const char *theme)
char *tmp = getenv("DISPLAY"); char *tmp = getenv("DISPLAY");
if (tmp && *tmp) if (tmp && *tmp)
{ {
fprintf(stderr, PACKAGE": client Using display name %s", tmp); PT("client Using display name");
fprintf(stderr, " %s\n", tmp);
} }
#endif #endif
@ -419,7 +425,7 @@ entrance_gui_init(const char *theme)
if (!screen->edj) if (!screen->edj)
{ {
fprintf(stderr, PACKAGE": client Tut Tut Tut no theme\n"); PT("Tut Tut Tut no theme\n");
return 2; return 2;
} }
evas_object_size_hint_weight_set(screen->edj, evas_object_size_hint_weight_set(screen->edj,
@ -457,7 +463,7 @@ entrance_gui_shutdown()
Entrance_Xsession *xsession; Entrance_Xsession *xsession;
Entrance_Screen *screen; Entrance_Screen *screen;
Ecore_Event_Handler *h; Ecore_Event_Handler *h;
fprintf(stderr, PACKAGE": Gui shutdown\n"); PT("Gui shutdown\n");
EINA_LIST_FREE(_gui->screens, screen) EINA_LIST_FREE(_gui->screens, screen)
{ {
evas_object_del(screen->win); evas_object_del(screen->win);
@ -666,12 +672,10 @@ static void
_entrance_gui_actions_populate() _entrance_gui_actions_populate()
{ {
Evas_Object *o; Evas_Object *o;
Eina_List *l;
Entrance_Action *action;
Eina_List *l, *ll;
Entrance_Screen *screen; Entrance_Screen *screen;
EINA_LIST_FOREACH(_gui->screens, ll, screen) EINA_LIST_FOREACH(_gui->screens, l, screen)
{ {
Entrance_Fill *ef; Entrance_Fill *ef;
ef = entrance_fill_new(NULL, _entrance_gui_action_text_get, ef = entrance_fill_new(NULL, _entrance_gui_action_text_get,

View File

@ -25,6 +25,7 @@
#include "../event/entrance_event.h" #include "../event/entrance_event.h"
#define PT(x) \ #define PT(x) \
do \
{ \ { \
current_time = time(NULL); \ current_time = time(NULL); \
local_time = localtime(&current_time); \ local_time = localtime(&current_time); \
@ -32,7 +33,7 @@
strftime(entrance_time_d, sizeof(entrance_time_d), \ strftime(entrance_time_d, sizeof(entrance_time_d), \
"%b %_2d %T", local_time); \ "%b %_2d %T", local_time); \
fprintf(stderr, "(%s) "PACKAGE": %s", entrance_time_d, x); \ fprintf(stderr, "(%s) "PACKAGE": %s", entrance_time_d, x); \
} } while (0)
extern time_t current_time; extern time_t current_time;
extern struct tm *local_time; extern struct tm *local_time;