jackdanielz pushed a commit to branch master. http://git.enlightenment.org/tools/erigo.git/commit/?id=192f6a6d7f12de139f4897faededde65c5db3b38
commit 192f6a6d7f12de139f4897faededde65c5db3b38 Author: Daniel Zaoui <daniel.za...@samsung.com> Date: Fri Sep 4 09:18:30 2015 +0300 Enventor: check availability in live Enabling/disabling Enventor was previously done in the Makefile itself. --- src/bin/gui/CMakeLists.txt | 5 ----- src/bin/gui/rmview.c | 55 +++++++++++++++++++++++++++++++++++----------- 2 files changed, 42 insertions(+), 18 deletions(-) diff --git a/src/bin/gui/CMakeLists.txt b/src/bin/gui/CMakeLists.txt index b91d3e4..e1abcf8 100644 --- a/src/bin/gui/CMakeLists.txt +++ b/src/bin/gui/CMakeLists.txt @@ -1,10 +1,5 @@ find_package(Gvc QUIET) find_package(CGraph QUIET) -find_program(ENVENTOR NAMES enventor) - -if (ENVENTOR) - add_definitions(-DHAVE_ENVENTOR) -endif(ENVENTOR) if (GVC_FOUND AND CGRAPH_FOUND) add_definitions(-DHAVE_GRAPHVIZ) diff --git a/src/bin/gui/rmview.c b/src/bin/gui/rmview.c index 0972310..067d549 100644 --- a/src/bin/gui/rmview.c +++ b/src/bin/gui/rmview.c @@ -23,6 +23,8 @@ static Rmview_Resource_Type _rmview_toolbar_selected_type = RMVIEW_NOT_SELECTED; static Egui_Layout_Rm_Win_Widgets *g_rm_win = NULL; +static Ecore_Event_Handler *_exe_event_data_handler = NULL; + void rm_win_set(Egui_Layout_Rm_Win_Widgets *rm_win) { if (g_rm_win) free(g_rm_win); @@ -248,7 +250,6 @@ _res_changed(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *desc E return EO_CALLBACK_CONTINUE; } -#ifdef HAVE_ENVENTOR static Eina_Bool _enventor_clicked(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { @@ -279,7 +280,6 @@ _enventor_clicked(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *d } return EO_CALLBACK_CONTINUE; } -#endif /* callback on sve_button 'clicked' event */ static Eina_Bool @@ -382,6 +382,35 @@ _bt_del_clicked(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *des return EO_CALLBACK_CONTINUE; } +static Eina_Bool +_exe_event_data_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event_info) +{ + Ecore_Exe_Event_Data *ev = event_info; + Ecore_Exe_Event_Data_Line *el; + Eo *widget = ecore_exe_data_get(ev->exe); + + if (eo_isa(widget, ELM_WIDGET_CLASS)) + { + for (el = ev->lines; el && el->line; el++) + { + if (strstr(el->line, "Version:")) + { + eo_do(widget, elm_obj_widget_disabled_set(EINA_FALSE)); + } + } + } + return ECORE_CALLBACK_RENEW; +} + +static void +_check_enventor(Eo *widget) +{ + ecore_exe_pipe_run("enventor -v", + ECORE_EXE_PIPE_READ_LINE_BUFFERED | ECORE_EXE_PIPE_READ | + ECORE_EXE_PIPE_ERROR_LINE_BUFFERED | ECORE_EXE_PIPE_ERROR, + widget); +} + static void _rmview_build(Rmview_Resource_Type type) { @@ -572,7 +601,6 @@ _rmview_build(Rmview_Resource_Type type) } } -#ifdef HAVE_ENVENTOR if (res_type == RESOURCE_EDJE) { Eo *icon = elm_image_add(g_rm_win->rm_table); @@ -583,19 +611,18 @@ _rmview_build(Rmview_Resource_Type type) efl_gfx_visible_set(EINA_TRUE) ); bt = _rmview_button_add(g_rm_win->rm_table, ""); - elm_object_tooltip_text_set(bt, "Open edc file in Enventor"); - eo_do(bt, - elm_obj_container_content_set("icon", icon), - elm_obj_widget_disabled_set(EINA_FALSE) - ); + eo_do(bt, elm_obj_container_content_set("icon", icon)); eo_do(g_rm_win->rm_table, elm_obj_table_pack(bt, table_col++, table_line, 1, 1)); data = RMVIEW_FIELD_DATA_BUILD(2, it_data); - eo_do(bt, eo_key_data_set(_STR_RMVIEW, data)); - eo_do(bt, eo_event_callback_add(EO_BASE_EVENT_DEL, _field_data_free, data)); - eo_do(bt, eo_event_callback_add(EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, _enventor_clicked, NULL)); + eo_do(bt, + eo_key_data_set(_STR_RMVIEW, data), + eo_event_callback_add(EO_BASE_EVENT_DEL, _field_data_free, data), + eo_event_callback_add(EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, _enventor_clicked, NULL), + elm_obj_widget_disabled_set(EINA_TRUE)); + elm_object_tooltip_text_set(bt, "Open edc file in Enventor"); + _check_enventor(bt); } -#endif bt = _rmview_button_add(g_rm_win->rm_table, "save"); it_data->bt_save = bt; @@ -686,6 +713,9 @@ _rmview_toolbar_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_in return; _rmview_toolbar_selected_type = type; + if (!_exe_event_data_handler) + _exe_event_data_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DATA, + _exe_event_data_cb, NULL); _rmview_build(type); } @@ -842,4 +872,3 @@ rm_win_post_configure() elm_object_tooltip_text_set(g_rm_win->rm_image_fileselector, "Image path"); _rmview_toolbar_clicked((void *) RMVIEW_IMAGE, NULL, NULL); } - --