From: <enl...@li...> - 2003-04-26 08:02:44
|
Enlightenment CVS committal Author : jeoparde Project : e17 Module : apps/entrance Dir : e17/apps/entrance/src/client Modified Files: entrance_config.c entrance_config.h entrance_session.c ui_callbacks.c Log Message: Patch to use mkstrftime() for formatting date and time from Tilman Sauerbeck. Keep 'em coming :) =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_config.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- entrance_config.c 9 Apr 2003 05:06:27 -0000 1.2 +++ entrance_config.c 26 Apr 2003 08:02:41 -0000 1.3 @@ -157,6 +157,16 @@ free(str); e->greeting = strdup(buf); + /* get the format strings used to display the current date and time */ + if ((str = e_db_str_get(db, "/entrance/date_format"))) + e->date_format = str; + else + e->date_format = strdup("%A %B %e, %Y"); + + if ((str = e_db_str_get(db, "/entrance/time_format"))) + e->time_format = str; + else + e->time_format = strdup("%l:%M:%S %p"); } Entrance_Config @@ -205,6 +215,10 @@ free(e->welcome); if (e->theme) free(e->theme); + if (e->date_format) + free(e->date_format); + if (e->time_format) + free(e->time_format); free(e); } =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_config.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- entrance_config.h 9 Apr 2003 05:06:28 -0000 1.2 +++ entrance_config.h 26 Apr 2003 08:02:41 -0000 1.3 @@ -25,6 +25,7 @@ int default_index; void *default_session; char *theme; + char *date_format, *time_format; }; typedef struct _Entrance_Config *Entrance_Config; =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_session.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- entrance_session.c 9 Apr 2003 05:06:28 -0000 1.5 +++ entrance_session.c 26 Apr 2003 08:02:42 -0000 1.6 @@ -226,8 +226,7 @@ THEME_MOVE(e->date, t->date, e->geom); evas_object_layer_set(e->date, 10); evas_object_show(e->date); - ecore_add_event_timer("date_update", 0.1, entrance_update_time_cb, 0, - e->date); + ecore_add_event_timer("date_update", 0.1, entrance_update_time_cb, 0, e); /* Time */ e->time = evas_object_text_add(e->evas); @@ -238,8 +237,7 @@ THEME_MOVE(e->time, t->time, e->geom); evas_object_layer_set(e->time, 10); evas_object_show(e->time); - ecore_add_event_timer("time_update", 0.1, entrance_update_time_cb, 1, - e->time); + ecore_add_event_timer("time_update", 0.1, entrance_update_time_cb, 1, e); } static void =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/ui_callbacks.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- ui_callbacks.c 11 Apr 2003 05:52:37 -0000 1.6 +++ ui_callbacks.c 26 Apr 2003 08:02:42 -0000 1.7 @@ -211,7 +211,8 @@ void entrance_update_time_cb(int val, void *data) { - Evas_Object *o = (Evas_Object *) data; + Entrance_Session e = (Entrance_Session) data; + Evas_Object *o = (val) ? e->time : e->date; char buf[PATH_MAX]; char *str; struct tm *current; @@ -223,9 +224,9 @@ /* Fetch and format time/date */ current = localtime(&_t); if (val) - strftime(buf, PATH_MAX, "%l:%M:%S %p", current); + strftime(buf, PATH_MAX, e->config->time_format, current); else - strftime(buf, PATH_MAX, "%A %B %e, %Y", current); + strftime(buf, PATH_MAX, e->config->date_format, current); /* Strip off leading space if necessary (for time) */ str = buf; |