From: Enlightenment C. <no...@cv...> - 2006-05-18 20:35:54
|
Enlightenment CVS committal Author : devilhorns Project : e_modules Module : tclock Dir : e_modules/tclock Modified Files: configure.in e_mod_main.c e_mod_main.h Log Message: Removed sv translation from configure.in as it was causing make to fail here. Cleaned up code a bit, no need to store a config item per instance when we can just look it up (less overhead). Make timer be per-instance so it can have different resolutions per instance. =================================================================== RCS file: /cvs/e/e_modules/tclock/configure.in,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- configure.in 18 May 2006 11:18:23 -0000 1.9 +++ configure.in 18 May 2006 20:34:29 -0000 1.10 @@ -17,7 +17,7 @@ AM_ENABLE_SHARED AM_PROG_LIBTOOL -ALL_LINGUAS="fi it ja sv" +ALL_LINGUAS="fi it ja" AC_SUBST(ALL_LINGUAS) AM_GNU_GETTEXT([external]) =================================================================== RCS file: /cvs/e/e_modules/tclock/e_mod_main.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -3 -r1.21 -r1.22 --- e_mod_main.c 18 May 2006 12:09:39 -0000 1.21 +++ e_mod_main.c 18 May 2006 20:34:29 -0000 1.22 @@ -36,8 +36,8 @@ { E_Gadcon_Client *gcc; Evas_Object *tclock; - Config_Item *cfg; const char *id; + Ecore_Timer *check_timer; }; static E_Gadcon_Client * @@ -65,13 +65,13 @@ gcc->data = inst; inst->gcc = gcc; inst->tclock = o; - inst->cfg = ci; evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _tclock_cb_mouse_down, inst); tclock_config->instances = evas_list_append(tclock_config->instances, inst); - _tclock_cb_check(NULL); + _tclock_cb_check(inst); + inst->check_timer = ecore_timer_add(ci->poll_time, _tclock_cb_check, inst); return gcc; } @@ -81,6 +81,8 @@ Instance *inst; inst = gcc->data; + if (inst->check_timer) + ecore_timer_del(inst->check_timer); evas_stringshare_del(inst->id); tclock_config->instances = evas_list_remove(tclock_config->instances, inst); evas_object_del(inst->tclock); @@ -192,27 +194,24 @@ inst = l->data; ci = _tclock_config_item_get(inst->gcc->gadcon->id); if ((inst->id) && (ci->id) && (!strcmp(inst->id, ci->id))) - { - inst->cfg = ci; - - if (!inst->cfg->show_time) + { + if (!ci->show_time) edje_object_signal_emit(inst->tclock, "time_hidden", ""); else edje_object_signal_emit(inst->tclock, "time_visible", ""); edje_object_message_signal_process(inst->tclock); - if (!inst->cfg->show_date) + if (!ci->show_date) edje_object_signal_emit(inst->tclock, "date_hidden", ""); else edje_object_signal_emit(inst->tclock, "date_visible", ""); edje_object_message_signal_process(inst->tclock); - if (tclock_config->tclock_check_timer) - ecore_timer_del(tclock_config->tclock_check_timer); + if (inst->check_timer) + ecore_timer_del(inst->check_timer); - tclock_config->tclock_check_timer = ecore_timer_add(inst->cfg->poll_time, - _tclock_cb_check, NULL); - _tclock_cb_check(NULL); + _tclock_cb_check(inst); + inst->check_timer = ecore_timer_add(ci->poll_time, _tclock_cb_check, inst); } } } @@ -221,6 +220,7 @@ _tclock_cb_check(void *data) { Instance *inst; + Config_Item *ci; Evas_List *l; time_t current_time; struct tm *local_time; @@ -230,32 +230,26 @@ current_time = time(NULL); local_time = localtime(¤t_time); - for (l = tclock_config->instances; l; l = l->next) - { - Instance *inst; - Config_Item *ci; - - inst = l->data; - ci = _tclock_config_item_get(inst->gcc->gadcon->id); - inst->cfg = ci; + inst = data; + ci = _tclock_config_item_get(inst->gcc->gadcon->id); - if (!inst->cfg->show_time) - edje_object_signal_emit(inst->tclock, "time_hidden", ""); - else - edje_object_signal_emit(inst->tclock, "time_visible", ""); - edje_object_message_signal_process(inst->tclock); - - if (!inst->cfg->show_date) - edje_object_signal_emit(inst->tclock, "date_hidden", ""); - else - edje_object_signal_emit(inst->tclock, "date_visible", ""); - edje_object_message_signal_process(inst->tclock); - - strftime(buf, 1024, inst->cfg->time_format, local_time); - edje_object_part_text_set(inst->tclock, "tclock_time", buf); - strftime(buf, 1024, inst->cfg->date_format, local_time); - edje_object_part_text_set(inst->tclock, "tclock_date", buf); - } + if (!ci->show_time) + edje_object_signal_emit(inst->tclock, "time_hidden", ""); + else + edje_object_signal_emit(inst->tclock, "time_visible", ""); + edje_object_message_signal_process(inst->tclock); + + if (!ci->show_date) + edje_object_signal_emit(inst->tclock, "date_hidden", ""); + else + edje_object_signal_emit(inst->tclock, "date_visible", ""); + edje_object_message_signal_process(inst->tclock); + + strftime(buf, 1024, ci->time_format, local_time); + edje_object_part_text_set(inst->tclock, "tclock_time", buf); + strftime(buf, 1024, ci->date_format, local_time); + edje_object_part_text_set(inst->tclock, "tclock_date", buf); + return 1; } @@ -337,8 +331,6 @@ E_CONFIG_LIMIT(ci->show_time, 0, 1); tclock_config->items = evas_list_append(tclock_config->items, ci); - tclock_config->tclock_check_timer = ecore_timer_add(ci->poll_time, - _tclock_cb_check, NULL); } tclock_config->module = m; @@ -356,8 +348,8 @@ if (tclock_config->config_dialog) e_object_del(E_OBJECT(tclock_config->config_dialog)); - if (tclock_config->tclock_check_timer) - ecore_timer_del(tclock_config->tclock_check_timer); +// if (tclock_config->tclock_check_timer) +// ecore_timer_del(tclock_config->tclock_check_timer); if (tclock_config->menu) { e_menu_post_deactivate_callback_set(tclock_config->menu, NULL, NULL); =================================================================== RCS file: /cvs/e/e_modules/tclock/e_mod_main.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- e_mod_main.h 18 May 2006 11:18:23 -0000 1.12 +++ e_mod_main.h 18 May 2006 20:34:29 -0000 1.13 @@ -16,7 +16,6 @@ E_Menu *menu; Evas_List *instances; Evas_List *items; - Ecore_Timer *tclock_check_timer; }; struct _Config_Item |