update date for time gadgets when day timer ticks

ref T5700
This commit is contained in:
Mike Blumenkrantz 2017-07-14 18:44:22 -04:00
parent 6630e602a9
commit a8869a14e9
3 changed files with 27 additions and 2 deletions

View File

@ -537,3 +537,18 @@ clock_timer_set(Eina_Bool set)
else
E_FREE_FUNC(clock_timer, ecore_timer_del);
}
EINTERN void
clock_date_update(void)
{
Eina_List *l;
Instance *inst;
char buf[128];
EINA_LIST_FOREACH(clock_instances, l, inst)
{
time_datestring_format(inst, buf, sizeof(buf) - 1);
elm_object_part_text_set(inst->o_clock, "e.text.sub", buf);
_eval_instance_size(inst);
}
}

View File

@ -87,6 +87,7 @@ EINTERN Evas_Object *analog_clock_wizard(E_Gadget_Wizard_End_Cb cb, void *data);
EINTERN void clock_popup_new(Instance *inst);
EINTERN void time_config_update(Config_Item *ci);
EINTERN void clock_timer_set(Eina_Bool set);
EINTERN void clock_date_update(void);
extern Config *time_config;
extern Eina_List *clock_instances;

View File

@ -277,9 +277,16 @@ _update_today_timer(void *data EINA_UNUSED)
t_tomorrow = mktime(&today) + 24 * 60 * 60;
if (update_today) ecore_timer_interval_set(update_today, t_tomorrow - t);
else update_today = ecore_timer_loop_add(t_tomorrow - t, _update_today_timer, NULL);
clock_date_update();
return EINA_TRUE;
}
static void
_time_changed(void)
{
_update_today_timer(NULL);
clock_instances_redo();
}
static Eina_Bool
_clock_eio_update(void *d EINA_UNUSED, int type EINA_UNUSED, void *event)
@ -292,7 +299,9 @@ _clock_eio_update(void *d EINA_UNUSED, int type EINA_UNUSED, void *event)
{
if (eina_streq(ev->filename, "/etc/localtime") ||
eina_streq(ev->filename, "/etc/timezone"))
clock_instances_redo();
{
_time_changed();
}
}
return ECORE_CALLBACK_PASS_ON;
}
@ -300,7 +309,7 @@ _clock_eio_update(void *d EINA_UNUSED, int type EINA_UNUSED, void *event)
static Eina_Bool
_clock_time_update(void *d EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
{
clock_instances_redo();
_time_changed();
return ECORE_CALLBACK_PASS_ON;
}