Inspector: add action removal feature
This feature permits removing actions from exu files
This commit is contained in:
parent
b95961ba0c
commit
b5748fa921
|
@ -53,6 +53,8 @@ static Eina_Hash *_item_infos_hash = NULL;
|
|||
static Eina_Bool _show_only_diffs = EINA_FALSE;
|
||||
static Eina_List *_comp_vvs = NULL;
|
||||
|
||||
static Eina_List *_modified_units = NULL;
|
||||
|
||||
static const char *
|
||||
_action_name_get(Exactness_Action *act)
|
||||
{
|
||||
|
@ -887,6 +889,37 @@ _comp_gl_selected_cb(void *data EINA_UNUSED, Evas_Object *gl EINA_UNUSED, void *
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_scn_item_remove(void *data, Evas_Object *menu EINA_UNUSED, void *item EINA_UNUSED)
|
||||
{
|
||||
Eo *glit = data;
|
||||
Exactness_Unit *unit = efl_key_data_get(efl_parent_get(glit), "unit");
|
||||
Exactness_Action *act = elm_object_item_data_get(glit);
|
||||
unit->actions = eina_list_remove(unit->actions, act);
|
||||
if (!eina_list_data_find(_modified_units, unit))
|
||||
_modified_units = eina_list_append(_modified_units, unit);
|
||||
efl_del(glit);
|
||||
}
|
||||
|
||||
static void
|
||||
_gl_clicked_right_cb(void *data, Evas_Object *gl, void *event_info)
|
||||
{
|
||||
int x = 0, y = 0;
|
||||
Eo *win = data, *menu;
|
||||
Elm_Object_Item *glit = event_info;
|
||||
|
||||
if (elm_genlist_item_item_class_get(glit) == _scn_itc)
|
||||
{
|
||||
elm_genlist_item_selected_set(glit, EINA_TRUE);
|
||||
evas_pointer_canvas_xy_get(evas_object_evas_get(gl), &x, &y);
|
||||
|
||||
menu = elm_menu_add(win);
|
||||
elm_menu_move(menu, x, y);
|
||||
elm_menu_item_add(menu, NULL, NULL, "Remove", _scn_item_remove, glit);
|
||||
efl_gfx_entity_visible_set(menu, EINA_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_gui_unit_display(Exactness_Unit *unit1, Exactness_Unit *unit2)
|
||||
{
|
||||
|
@ -906,6 +939,8 @@ _gui_unit_display(Exactness_Unit *unit1, Exactness_Unit *unit2)
|
|||
evas_object_smart_callback_add(gl1, "contract,request", _gl_contract_request_cb, NULL);
|
||||
evas_object_smart_callback_add(gl1, "expanded", _gl_expanded_cb, NULL);
|
||||
evas_object_smart_callback_add(gl1, "contracted", _gl_contracted_cb, NULL);
|
||||
if (!unit2)
|
||||
evas_object_smart_callback_add(gl1, "clicked,right", _gl_clicked_right_cb, elm_win_get(_main_box));
|
||||
|
||||
if (unit2)
|
||||
{
|
||||
|
@ -1127,6 +1162,7 @@ static const Ecore_Getopt optdesc = {
|
|||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
Eina_List *units_filenames = NULL;
|
||||
const char *ext = NULL;
|
||||
char *output = NULL;
|
||||
Exactness_Unit *unit = NULL;
|
||||
|
@ -1250,6 +1286,7 @@ main(int argc, char *argv[])
|
|||
if (!strcmp(ext, ".exu"))
|
||||
{
|
||||
Exactness_Unit *ex_unit = exactness_unit_file_read(argv[arg]);
|
||||
units_filenames = eina_list_append(units_filenames, argv[arg]);
|
||||
_units = eina_list_append(_units, ex_unit);
|
||||
}
|
||||
else if (!strcmp(ext, ".rec"))
|
||||
|
@ -1459,6 +1496,16 @@ main(int argc, char *argv[])
|
|||
}
|
||||
if (need_compare) _gui_unit_display(unit1, unit2);
|
||||
elm_run();
|
||||
EINA_LIST_FREE(_modified_units, unit)
|
||||
{
|
||||
int i = 0;
|
||||
EINA_LIST_FOREACH(_units, itr, unit2)
|
||||
{
|
||||
if (unit2 == unit) break;
|
||||
i++;
|
||||
}
|
||||
exactness_unit_file_write(unit, eina_list_nth(units_filenames, i));
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
|
|
Loading…
Reference in New Issue