ajwillia-ms pushed a commit to branch master. http://git.enlightenment.org/tools/edi.git/commit/?id=cfe08f0756785c819c5a928b1f834ce5d8f75f85
commit cfe08f0756785c819c5a928b1f834ce5d8f75f85 Author: Andy Williams <[email protected]> Date: Fri Apr 28 21:16:47 2017 +0100 refactoring for re-use --- src/bin/edi_main.c | 54 ++++++++++++++++++++++++++------------------------- src/bin/edi_private.h | 2 ++ 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/src/bin/edi_main.c b/src/bin/edi_main.c index a94ef40..120ade9 100644 --- a/src/bin/edi_main.c +++ b/src/bin/edi_main.c @@ -501,34 +501,10 @@ _edi_popup_cancel_cb(void *data, Evas_Object *obj EINA_UNUSED, evas_object_del((Evas_Object *)data); } -static void -_edi_launcher_run(Edi_Project_Config_Launch *launch) +void +edi_launcher_config_missing() { Evas_Object *popup, *button; - char *full_cmd; - int full_len; - - if (_edi_project_config->launch.path) - { - if (!_edi_project_config->launch.args) - { - ecore_exe_run(launch->path, NULL); - - return; - } - else - { - full_len = strlen(_edi_project_config->launch.path) - + strlen(_edi_project_config->launch.path); - full_cmd = malloc(sizeof(char) * (full_len + 1)); - snprintf(full_cmd, full_len + 2, "%s %s", _edi_project_config->launch.path, - _edi_project_config->launch.args); - ecore_exe_run(full_cmd, NULL); - - free(full_cmd); - return; - } - } popup = elm_popup_add(_edi_main_win); elm_object_part_text_set(popup, "title,text", "Unable to launch"); @@ -543,6 +519,32 @@ _edi_launcher_run(Edi_Project_Config_Launch *launch) } static void +_edi_launcher_run(Edi_Project_Config_Launch *launch) +{ + char *full_cmd; + int full_len; + + if (!_edi_project_config->launch.path) + { + edi_launcher_config_missing(); + return; + } + + if (!_edi_project_config->launch.args) + { + ecore_exe_run(launch->path, NULL); + return; + } + + full_len = strlen(_edi_project_config->launch.path) + strlen(_edi_project_config->launch.path); + full_cmd = malloc(sizeof(char) * (full_len + 1)); + snprintf(full_cmd, full_len + 2, "%s %s", _edi_project_config->launch.path, _edi_project_config->launch.args); + ecore_exe_run(full_cmd, NULL); + + free(full_cmd); +} + +static void _tb_new_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) { const char *path, *selected; diff --git a/src/bin/edi_private.h b/src/bin/edi_private.h index 98def3e..470cdf7 100644 --- a/src/bin/edi_private.h +++ b/src/bin/edi_private.h @@ -43,4 +43,6 @@ void edi_open_url(); Eina_Bool edi_noproject(); +void edi_launcher_config_missing(); + #endif --
