forked from enlightenment/enventor
EDJ Viewer: fix reseting of layout on edc compiling
Summary: This commit changes the signal that is used to initiate the reset of edj layout: using of EIO_MONITOR_FILE_MODIFIED sometimes causes calling of edje_object_file_set() earlier than EDC-file compilation is finished. So, using of ECORE_EXE_EVENT_DEL to track the end of compilation helps to avoid this problem. Reviewers: Hermet Reviewed By: Hermet Projects: #enventor Differential Revision: https://phab.enlightenment.org/D1306
This commit is contained in:
parent
b96e83472a
commit
80b59d3b15
|
@ -22,11 +22,13 @@ struct viewer_s
|
||||||
Ecore_Timer *timer;
|
Ecore_Timer *timer;
|
||||||
Eio_Monitor *edj_monitor;
|
Eio_Monitor *edj_monitor;
|
||||||
Ecore_Event_Handler *monitor_event;
|
Ecore_Event_Handler *monitor_event;
|
||||||
|
Ecore_Event_Handler *exe_del_event;
|
||||||
|
|
||||||
void (*del_cb)(void *data);
|
void (*del_cb)(void *data);
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
Eina_Bool dummy_on;
|
Eina_Bool dummy_on;
|
||||||
|
Eina_Bool edj_reload_need : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -137,14 +139,12 @@ view_scroller_create(Evas_Object *parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
edj_changed_cb(void *data, int type EINA_UNUSED, void *event)
|
exe_del_event_cb(void *data, int type EINA_UNUSED, void *event)
|
||||||
{
|
{
|
||||||
view_data *vd = data;
|
view_data *vd = data;
|
||||||
Eio_Monitor_Event *ev = event;
|
Eio_Monitor_Event *ev = event;
|
||||||
|
|
||||||
if (vd->edj_monitor != ev->monitor) return ECORE_CALLBACK_PASS_ON;
|
if (!vd->edj_reload_need) return ECORE_CALLBACK_PASS_ON;
|
||||||
|
|
||||||
eio_monitor_del(vd->edj_monitor);
|
|
||||||
|
|
||||||
if (!edje_object_file_set(vd->layout, config_edj_path_get(),
|
if (!edje_object_file_set(vd->layout, config_edj_path_get(),
|
||||||
vd->group_name))
|
vd->group_name))
|
||||||
|
@ -152,16 +152,33 @@ edj_changed_cb(void *data, int type EINA_UNUSED, void *event)
|
||||||
vd->del_cb(vd->data);
|
vd->del_cb(vd->data);
|
||||||
view_term(vd);
|
view_term(vd);
|
||||||
EINA_LOG_ERR("Failed to load edj file \"%s\"", config_edj_path_get());
|
EINA_LOG_ERR("Failed to load edj file \"%s\"", config_edj_path_get());
|
||||||
|
vd->edj_reload_need = EINA_FALSE;
|
||||||
return ECORE_CALLBACK_DONE;
|
return ECORE_CALLBACK_DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
vd->edj_monitor = eio_monitor_add(config_edj_path_get());
|
|
||||||
if (!vd->edj_monitor) EINA_LOG_ERR("Failed to add Eio_Monitor");
|
|
||||||
|
|
||||||
view_obj_min_update(vd->layout);
|
view_obj_min_update(vd->layout);
|
||||||
view_part_highlight_set(vd, vd->part_name);
|
view_part_highlight_set(vd, vd->part_name);
|
||||||
dummy_obj_update(vd->layout);
|
dummy_obj_update(vd->layout);
|
||||||
|
|
||||||
|
vd->edj_reload_need = EINA_FALSE;
|
||||||
|
|
||||||
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
edj_changed_cb(void *data, int type EINA_UNUSED, void *event)
|
||||||
|
{
|
||||||
|
view_data *vd = data;
|
||||||
|
Eio_Monitor_Event *ev = event;
|
||||||
|
|
||||||
|
if (vd->edj_monitor != ev->monitor) return ECORE_CALLBACK_PASS_ON;
|
||||||
|
|
||||||
|
//FIXME: why it need to add monitor again??
|
||||||
|
vd->edj_monitor = eio_monitor_add(config_edj_path_get());
|
||||||
|
if (!vd->edj_monitor) EINA_LOG_ERR("Failed to add Eio_Monitor!");
|
||||||
|
|
||||||
|
vd->edj_reload_need = EINA_TRUE;
|
||||||
|
|
||||||
return ECORE_CALLBACK_DONE;
|
return ECORE_CALLBACK_DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,6 +309,13 @@ view_init(Evas_Object *parent, const char *group,
|
||||||
vd->monitor_event =
|
vd->monitor_event =
|
||||||
ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, edj_changed_cb, vd);
|
ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, edj_changed_cb, vd);
|
||||||
|
|
||||||
|
/* Is this required?? Suddenly, something is changed and
|
||||||
|
it won't successful with EIO_MONITOR_FILE_MODIFIED to reload the edj file
|
||||||
|
since the file couldn't be accessed at the moment. To fix this problem,
|
||||||
|
we check the ECORE_EXE_EVENT_DEL additionally. */
|
||||||
|
vd->exe_del_event =
|
||||||
|
ecore_event_handler_add(ECORE_EXE_EVENT_DEL, exe_del_event_cb, vd);
|
||||||
|
|
||||||
return vd;
|
return vd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,6 +335,7 @@ view_term(view_data *vd)
|
||||||
ecore_timer_del(vd->timer);
|
ecore_timer_del(vd->timer);
|
||||||
eio_monitor_del(vd->edj_monitor);
|
eio_monitor_del(vd->edj_monitor);
|
||||||
ecore_event_handler_del(vd->monitor_event);
|
ecore_event_handler_del(vd->monitor_event);
|
||||||
|
ecore_event_handler_del(vd->exe_del_event);
|
||||||
|
|
||||||
free(vd);
|
free(vd);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ int main(int argc, char **argv);
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
edc_changed_cb(void *data, int type EINA_UNUSED, void *event)
|
edc_changed_cb(void *data, int type EINA_UNUSED, void *event)
|
||||||
{
|
{
|
||||||
//FIXME: Why does this callback called multiple times?
|
|
||||||
Eio_Monitor_Event *ev = event;
|
Eio_Monitor_Event *ev = event;
|
||||||
app_data *ad = data;
|
app_data *ad = data;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue