hermet pushed a commit to branch master.

http://git.enlightenment.org/tools/enventor.git/commit/?id=a4d4fb748c0405704b6ab18d1b6e13e27540ecf9

commit a4d4fb748c0405704b6ab18d1b6e13e27540ecf9
Author: Hermet Park <her...@hermet.pe.kr>
Date:   Sat Apr 23 13:14:49 2016 +0900

    edc_navigator: support stop all programs.
    
    for this, added one more api, enventor_object_programs_stop()
---
 data/themes/default/images.edc           |   2 +
 data/themes/default/images/Makefile.am   |   3 +-
 data/themes/default/images/navi_stop.png | Bin 0 -> 155 bytes
 src/bin/edc_navigator.c                  |  67 +++++++++++++++++++++++++++----
 src/bin/main.c                           |   2 +-
 src/lib/edj_viewer.c                     |   8 ++++
 src/lib/enventor_object.eo               |   2 +
 src/lib/enventor_private.h               |   1 +
 src/lib/enventor_smart.c                 |   8 ++++
 9 files changed, 84 insertions(+), 9 deletions(-)

diff --git a/data/themes/default/images.edc b/data/themes/default/images.edc
index 3a09b0c..c437f0d 100644
--- a/data/themes/default/images.edc
+++ b/data/themes/default/images.edc
@@ -37,6 +37,7 @@ images {
    image: "navi_program.png" COMP;
    image: "navi_unknown.png" COMP;
    image: "navi_play.png" COMP;
+   image: "navi_stop.png" COMP;
 }
 
 #define ICON_GROUP(_group_name, _image_path) \
@@ -87,5 +88,6 @@ ICON_GROUP("navi_state", "navi_state.png")
 ICON_GROUP("navi_program", "navi_program.png")
 ICON_GROUP("navi_unknown", "navi_unknown.png")
 ICON_GROUP("navi_play", "navi_play.png")
+ICON_GROUP("navi_stop", "navi_stop.png")
 
 #undef ICON_GROUP
diff --git a/data/themes/default/images/Makefile.am 
b/data/themes/default/images/Makefile.am
index 9aada26..e3899a3 100644
--- a/data/themes/default/images/Makefile.am
+++ b/data/themes/default/images/Makefile.am
@@ -84,5 +84,6 @@ EXTRA_DIST = \
    navi_unknown.png \
    navi_state.png \
    navi_program.png \
-       navi_play.png \
+   navi_play.png \
+   navi_stop.png \
    bg_demo.png
diff --git a/data/themes/default/images/navi_stop.png 
b/data/themes/default/images/navi_stop.png
new file mode 100644
index 0000000..6ef754b
Binary files /dev/null and b/data/themes/default/images/navi_stop.png differ
diff --git a/src/bin/edc_navigator.c b/src/bin/edc_navigator.c
index 5ad0827..8a4d758 100644
--- a/src/bin/edc_navigator.c
+++ b/src/bin/edc_navigator.c
@@ -738,6 +738,7 @@ static Evas_Object *
 gl_program_content_get_cb(void *data EINA_UNUSED, Evas_Object *obj,
                           const char *part)
 {
+   //1. Icon
    if (!strcmp("elm.swallow.icon", part))
      {
         Evas_Object *image = elm_image_add(obj);
@@ -745,17 +746,30 @@ gl_program_content_get_cb(void *data EINA_UNUSED, 
Evas_Object *obj,
         return image;
      }
 
-   //play/stop button
+   //2. Play Button
    program_it *pit = data;
-   Evas_Object *btn = elm_button_add(obj);
+
+   //Box
+   Evas_Object *box = elm_box_add(obj);
+   elm_object_tooltip_text_set(box, "Play Program");
+
+   //Button
+   Evas_Object *btn = elm_button_add(box);
+   evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
    elm_object_scale_set(btn, 0.5);
    evas_object_smart_callback_add(btn, "clicked", program_btn_clicked_cb,
                                   pit);
+   evas_object_show(btn);
+
+   //Image
    Evas_Object *img = elm_image_add(btn);
    elm_image_file_set(img, EDJE_PATH, "navi_play");
    elm_object_content_set(btn, img);
 
-   return btn;
+   elm_box_pack_end(box, btn);
+
+   return box;
 }
 
 static void
@@ -814,6 +828,18 @@ sub_programs_update(navi_data *nd, programs_it *pit)
 /* Programs Related */
 
 static void
+programs_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+   programs_it *pit = data;
+   Evas_Object *enventor = base_enventor_get();
+   enventor_object_programs_stop(enventor);
+
+   if (!config_stats_bar_get()) return;
+
+   stats_info_msg_update(_("Stop all running programs."));
+}
+
+static void
 programs_expand(programs_it *pit)
 {
    if (elm_genlist_item_expanded_get(pit->it)) return;
@@ -966,12 +992,39 @@ static Evas_Object *
 gl_programs_content_get_cb(void *data EINA_UNUSED, Evas_Object *obj,
                            const char *part)
 {
-   if (strcmp("elm.swallow.icon", part)) return NULL;
+   //1. Icon
+   if (!strcmp("elm.swallow.icon", part))
+     {
+        Evas_Object *image = elm_image_add(obj);
+        elm_image_file_set(image, EDJE_PATH, "navi_program");
 
-   Evas_Object *image = elm_image_add(obj);
-   elm_image_file_set(image, EDJE_PATH, "navi_program");
+        return image;
+     }
 
-   return image;
+   //2. Stop All Button
+   programs_it *pit = data;
+
+   //Box
+   Evas_Object *box = elm_box_add(obj);
+   elm_object_tooltip_text_set(box, "Stop All Programs");
+
+   //Button
+   Evas_Object *btn = elm_button_add(box);
+   evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+   elm_object_scale_set(btn, 0.5);
+   evas_object_smart_callback_add(btn, "clicked", programs_btn_clicked_cb,
+                                  pit);
+   evas_object_show(btn);
+
+   //Image
+   Evas_Object *img = elm_image_add(btn);
+   elm_image_file_set(img, EDJE_PATH, "navi_stop");
+   elm_object_content_set(btn, img);
+
+   elm_box_pack_end(box, btn);
+
+   return box;
 }
 
 
diff --git a/src/bin/main.c b/src/bin/main.c
index 3d1e2c5..a0004c5 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -506,7 +506,7 @@ enventor_live_view_updated_cb(void *data, Evas_Object *obj,
         ad->lazy_save = EINA_FALSE;
         ad->on_saving = EINA_FALSE;
      }
-
+printf("%s\n", __func__);
    base_edc_navigator_group_update();
 }
 
diff --git a/src/lib/edj_viewer.c b/src/lib/edj_viewer.c
index 139c6fa..f474927 100644
--- a/src/lib/edj_viewer.c
+++ b/src/lib/edj_viewer.c
@@ -664,6 +664,14 @@ view_obj_need_reload_set(view_data *vd)
 }
 
 void
+view_programs_stop(view_data *vd)
+{
+   if (!vd || !vd->layout) return;
+   if (!vd->file_set_finished) return;
+   edje_edit_program_stop_all(vd->layout);
+}
+
+void
 view_program_run(view_data *vd, const char *program)
 {
    if (!vd) return;
diff --git a/src/lib/enventor_object.eo b/src/lib/enventor_object.eo
index a903c27..d3f418b 100644
--- a/src/lib/enventor_object.eo
+++ b/src/lib/enventor_object.eo
@@ -185,6 +185,8 @@ class Enventor.Object (Elm.Widget, Efl.File) {
             @in line: int;
          }
       }
+      programs_stop {
+      }
       program_run {
          params {
             @in program: const(char) *;
diff --git a/src/lib/enventor_private.h b/src/lib/enventor_private.h
index 39baefc..8249f00 100644
--- a/src/lib/enventor_private.h
+++ b/src/lib/enventor_private.h
@@ -221,6 +221,7 @@ void view_part_highlight_set(view_data *vd, const char 
*part_name);
 void view_dummy_set(view_data *vd, Eina_Bool dummy_on);
 void view_mirror_mode_update(view_data *vd);
 void view_program_run(view_data *vd, const char *program);
+void view_programs_stop(view_data *vd);
 Eina_Stringshare *view_group_name_get(view_data *vd);
 void *view_data_get(view_data *vd);
 void view_scale_set(view_data *vd, double scale);
diff --git a/src/lib/enventor_smart.c b/src/lib/enventor_smart.c
index 0cd58f5..3e6489c 100644
--- a/src/lib/enventor_smart.c
+++ b/src/lib/enventor_smart.c
@@ -786,6 +786,14 @@ _enventor_object_program_run(Eo *obj EINA_UNUSED,
    view_program_run(VIEW_DATA, program);
 }
 
+EOLIAN static void
+_enventor_object_programs_stop(Eo *obj EINA_UNUSED,
+                               Enventor_Object_Data *pd)
+{
+   view_programs_stop(VIEW_DATA);
+}
+
+
 /*****************************************************************************/
 /* Externally accessible calls                                               */
 /*****************************************************************************/

-- 


Reply via email to