summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@yahoo.com>2018-10-29 19:58:55 +0200
committerDaniel Zaoui <daniel.zaoui@yahoo.com>2018-10-29 19:58:55 +0200
commitb5748fa921284a62c3b29d74753d80449b9d6f60 (patch)
tree2d63d0afc3a6e02f4368b3b0ff8b5564238cadcb
parentb95961ba0cd325303df8c9f7f97c7dbb44ece8c3 (diff)
Inspector: add action removal feature
This feature permits removing actions from exu files
-rw-r--r--src/bin/inspect.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/bin/inspect.c b/src/bin/inspect.c
index 3de56d7..01bbb6d 100644
--- a/src/bin/inspect.c
+++ b/src/bin/inspect.c
@@ -53,6 +53,8 @@ static Eina_Hash *_item_infos_hash = NULL;
53static Eina_Bool _show_only_diffs = EINA_FALSE; 53static Eina_Bool _show_only_diffs = EINA_FALSE;
54static Eina_List *_comp_vvs = NULL; 54static Eina_List *_comp_vvs = NULL;
55 55
56static Eina_List *_modified_units = NULL;
57
56static const char * 58static const char *
57_action_name_get(Exactness_Action *act) 59_action_name_get(Exactness_Action *act)
58{ 60{
@@ -888,6 +890,37 @@ _comp_gl_selected_cb(void *data EINA_UNUSED, Evas_Object *gl EINA_UNUSED, void *
888} 890}
889 891
890static void 892static void
893_scn_item_remove(void *data, Evas_Object *menu EINA_UNUSED, void *item EINA_UNUSED)
894{
895 Eo *glit = data;
896 Exactness_Unit *unit = efl_key_data_get(efl_parent_get(glit), "unit");
897 Exactness_Action *act = elm_object_item_data_get(glit);
898 unit->actions = eina_list_remove(unit->actions, act);
899 if (!eina_list_data_find(_modified_units, unit))
900 _modified_units = eina_list_append(_modified_units, unit);
901 efl_del(glit);
902}
903
904static void
905_gl_clicked_right_cb(void *data, Evas_Object *gl, void *event_info)
906{
907 int x = 0, y = 0;
908 Eo *win = data, *menu;
909 Elm_Object_Item *glit = event_info;
910
911 if (elm_genlist_item_item_class_get(glit) == _scn_itc)
912 {
913 elm_genlist_item_selected_set(glit, EINA_TRUE);
914 evas_pointer_canvas_xy_get(evas_object_evas_get(gl), &x, &y);
915
916 menu = elm_menu_add(win);
917 elm_menu_move(menu, x, y);
918 elm_menu_item_add(menu, NULL, NULL, "Remove", _scn_item_remove, glit);
919 efl_gfx_entity_visible_set(menu, EINA_TRUE);
920 }
921}
922
923static void
891_gui_unit_display(Exactness_Unit *unit1, Exactness_Unit *unit2) 924_gui_unit_display(Exactness_Unit *unit1, Exactness_Unit *unit2)
892{ 925{
893 Eina_List *itr1, *itr2; 926 Eina_List *itr1, *itr2;
@@ -906,6 +939,8 @@ _gui_unit_display(Exactness_Unit *unit1, Exactness_Unit *unit2)
906 evas_object_smart_callback_add(gl1, "contract,request", _gl_contract_request_cb, NULL); 939 evas_object_smart_callback_add(gl1, "contract,request", _gl_contract_request_cb, NULL);
907 evas_object_smart_callback_add(gl1, "expanded", _gl_expanded_cb, NULL); 940 evas_object_smart_callback_add(gl1, "expanded", _gl_expanded_cb, NULL);
908 evas_object_smart_callback_add(gl1, "contracted", _gl_contracted_cb, NULL); 941 evas_object_smart_callback_add(gl1, "contracted", _gl_contracted_cb, NULL);
942 if (!unit2)
943 evas_object_smart_callback_add(gl1, "clicked,right", _gl_clicked_right_cb, elm_win_get(_main_box));
909 944
910 if (unit2) 945 if (unit2)
911 { 946 {
@@ -1127,6 +1162,7 @@ static const Ecore_Getopt optdesc = {
1127int 1162int
1128main(int argc, char *argv[]) 1163main(int argc, char *argv[])
1129{ 1164{
1165 Eina_List *units_filenames = NULL;
1130 const char *ext = NULL; 1166 const char *ext = NULL;
1131 char *output = NULL; 1167 char *output = NULL;
1132 Exactness_Unit *unit = NULL; 1168 Exactness_Unit *unit = NULL;
@@ -1250,6 +1286,7 @@ main(int argc, char *argv[])
1250 if (!strcmp(ext, ".exu")) 1286 if (!strcmp(ext, ".exu"))
1251 { 1287 {
1252 Exactness_Unit *ex_unit = exactness_unit_file_read(argv[arg]); 1288 Exactness_Unit *ex_unit = exactness_unit_file_read(argv[arg]);
1289 units_filenames = eina_list_append(units_filenames, argv[arg]);
1253 _units = eina_list_append(_units, ex_unit); 1290 _units = eina_list_append(_units, ex_unit);
1254 } 1291 }
1255 else if (!strcmp(ext, ".rec")) 1292 else if (!strcmp(ext, ".rec"))
@@ -1459,6 +1496,16 @@ main(int argc, char *argv[])
1459 } 1496 }
1460 if (need_compare) _gui_unit_display(unit1, unit2); 1497 if (need_compare) _gui_unit_display(unit1, unit2);
1461 elm_run(); 1498 elm_run();
1499 EINA_LIST_FREE(_modified_units, unit)
1500 {
1501 int i = 0;
1502 EINA_LIST_FOREACH(_units, itr, unit2)
1503 {
1504 if (unit2 == unit) break;
1505 i++;
1506 }
1507 exactness_unit_file_write(unit, eina_list_nth(units_filenames, i));
1508 }
1462 } 1509 }
1463 1510
1464end: 1511end: