ajwillia-ms pushed a commit to branch master.

http://git.enlightenment.org/tools/edi.git/commit/?id=78252cefc18d016bfe85c11f7470510c26c62e0f

commit 78252cefc18d016bfe85c11f7470510c26c62e0f
Author: Andy Williams <a...@andywilliams.me>
Date:   Sun May 31 19:46:18 2015 +0100

    run: Add args to settings for default run button
---
 src/bin/edi_main.c             | 23 ++++++++++++++++++++---
 src/bin/screens/edi_settings.c | 40 +++++++++++++++++++++++++++++++++++++++-
 2 files changed, 59 insertions(+), 4 deletions(-)

diff --git a/src/bin/edi_main.c b/src/bin/edi_main.c
index ad09c23..d404fd5 100644
--- a/src/bin/edi_main.c
+++ b/src/bin/edi_main.c
@@ -450,12 +450,29 @@ static void
 _edi_launcher_run(Edi_Project_Config_Launch *launch)
 {
    Evas_Object *popup, *button;
+   char *full_cmd;
+   int full_len;
 
    if (_edi_project_config->launch.path)
      {
-        ecore_exe_run(launch->path, NULL);
-
-        return;
+       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);
diff --git a/src/bin/screens/edi_settings.c b/src/bin/screens/edi_settings.c
index 7a94a63..a8c3cb7 100644
--- a/src/bin/screens/edi_settings.c
+++ b/src/bin/screens/edi_settings.c
@@ -256,10 +256,25 @@ _edi_settings_builds_binary_chosen_cb(void *data, 
Evas_Object *obj EINA_UNUSED,
    _edi_project_config_save();
 }
 
+static void
+_edi_settings_builds_args_cb(void *data EINA_UNUSED, Evas_Object *obj,
+                             void *event EINA_UNUSED)
+{
+   Evas_Object *entry;
+
+   entry = (Evas_Object *)obj;
+
+   if (_edi_project_config->launch.args)
+     eina_stringshare_del(_edi_project_config->launch.args);
+
+   _edi_project_config->launch.args = 
eina_stringshare_add(elm_object_text_get(entry));
+   _edi_project_config_save();
+}
+
 static Evas_Object *
 _edi_settings_builds_create(Evas_Object *parent)
 {
-   Evas_Object *box, *frame, *hbox, *label, *ic, *selector, *file;
+   Evas_Object *box, *frame, *hbox, *label, *ic, *selector, *file, *entry;
 
    frame = _edi_settings_panel_create(parent, "Builds");
    box = elm_object_part_content_get(frame, "default");
@@ -301,6 +316,29 @@ _edi_settings_builds_create(Evas_Object *parent)
    evas_object_smart_callback_add(selector, "file,chosen",
                                   _edi_settings_builds_binary_chosen_cb, file);
 
+   hbox = elm_box_add(parent);
+   elm_box_horizontal_set(hbox, EINA_TRUE);
+   evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
+   elm_box_pack_end(box, hbox);
+   evas_object_show(hbox);
+
+   label = elm_label_add(hbox);
+   elm_object_text_set(label, "Runtime args");
+   evas_object_size_hint_weight_set(label, 0.0, 0.0);
+   evas_object_size_hint_align_set(label, 0.0, EVAS_HINT_FILL);
+   elm_box_pack_end(hbox, label);
+   evas_object_show(label);
+
+   entry = elm_entry_add(hbox);
+   elm_object_text_set(entry, _edi_project_config->launch.args);
+   evas_object_size_hint_weight_set(entry, 0.75, 0.0);
+   evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
+   elm_box_pack_end(hbox, entry);
+   evas_object_show(entry);
+   evas_object_smart_callback_add(entry, "changed",
+                                  _edi_settings_builds_args_cb, NULL);
+
    return frame;
 }
 

-- 


Reply via email to