efl: implement efl.file::unload for classes that implement load

unload is a crucial method for classes that implement load, as this is
the method which is called during e.g., efl_file_simple_load() when
a new file is specified in order to destroy the previous object data

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D9786
devs/lauromoura/csharp-interface-protected
Mike Blumenkrantz 3 years ago committed by Marcel Hollerbach
parent 0ef9228e5f
commit 9e0a285eea
  1. 7
      src/lib/edje/edje_edit.c
  2. 1
      src/lib/edje/edje_edit_eo.c
  3. 23
      src/lib/edje/edje_smart.c
  4. 1
      src/lib/edje/efl_canvas_layout.eo
  5. 6
      src/lib/elementary/efl_ui_bg.c
  6. 1
      src/lib/elementary/efl_ui_bg.eo
  7. 32
      src/lib/elementary/efl_ui_image_zoomable.c
  8. 1
      src/lib/elementary/efl_ui_image_zoomable.eo
  9. 11
      src/lib/elementary/efl_ui_layout.c
  10. 1
      src/lib/elementary/efl_ui_layout.eo
  11. 8
      src/lib/elementary/efl_ui_text.c
  12. 1
      src/lib/elementary/efl_ui_text.eo
  13. 13
      src/lib/elementary/efl_ui_video.c
  14. 1
      src/lib/elementary/efl_ui_video.eo
  15. 8
      src/lib/elementary/efl_ui_widget.c
  16. 1
      src/lib/elementary/efl_ui_widget_part_bg.eo
  17. 21
      src/lib/elementary/efl_ui_win.c
  18. 1
      src/lib/elementary/efl_ui_win_part.eo
  19. 7
      src/lib/elementary/elm_photo.c
  20. 1
      src/lib/elementary/elm_photo_eo.c
  21. 30
      src/lib/elementary/elm_thumb.c
  22. 1
      src/lib/elementary/elm_thumb_eo.c
  23. 1
      src/lib/emotion/efl_canvas_video.eo
  24. 17
      src/lib/emotion/emotion_smart.c
  25. 7
      src/lib/evas/canvas/evas_canvas3d_mesh.c
  26. 1
      src/lib/evas/canvas/evas_canvas3d_mesh.eo
  27. 9
      src/lib/evas/canvas/evas_canvas3d_texture.c
  28. 1
      src/lib/evas/canvas/evas_canvas3d_texture.eo

@ -269,6 +269,13 @@ _edje_edit_efl_file_load(Eo *obj, Edje_Edit *eed)
return 0;
}
EOLIAN static void
_edje_edit_efl_file_unload(Eo *obj, Edje_Edit *eed)
{
efl_file_unload(efl_super(obj, MY_CLASS));
_edje_edit_data_clean(eed);
}
EAPI Evas_Object *
edje_edit_object_add(Evas *evas)
{

@ -23,6 +23,7 @@ _edje_edit_class_initializer(Efl_Class *klass)
EFL_OBJECT_OP_FUNC(efl_constructor, _edje_edit_efl_object_constructor),
EFL_OBJECT_OP_FUNC(efl_destructor, _edje_edit_efl_object_destructor),
EFL_OBJECT_OP_FUNC(efl_file_load, _edje_edit_efl_file_load),
EFL_OBJECT_OP_FUNC(efl_file_unload, _edje_edit_efl_file_unload),
EDJE_EDIT_EXTRA_OPS
);
opsp = &ops;

@ -402,6 +402,29 @@ _efl_canvas_layout_efl_canvas_group_group_calculate(Eo *obj EINA_UNUSED, Edje *e
_edje_recalc_do(ed);
}
EOLIAN static void
_efl_canvas_layout_efl_file_unload(Eo *obj, Edje *ed)
{
efl_file_unload(efl_super(obj, MY_CLASS));
if (_edje_lua_script_only(ed)) _edje_lua_script_only_shutdown(ed);
#ifdef HAVE_EPHYSICS
/* clear physics world / shutdown ephysics */
if ((ed->collection) && (ed->collection->physics_enabled) && (ed->world))
{
if (EPH_LOAD())
{
EPH_CALL(ephysics_world_del)(ed->world);
EPH_CALL(ephysics_shutdown)();
}
}
#endif
if (ed->persp) edje_object_perspective_set(obj, NULL);
_edje_file_del(ed);
eina_stringshare_replace(&ed->path, NULL);
eina_stringshare_replace(&ed->group, NULL);
eina_stringshare_replace(&ed->parent, NULL);
}
EOLIAN static Eina_Error
_efl_canvas_layout_efl_file_load(Eo *obj, Edje *ed)
{

@ -124,6 +124,7 @@ class @beta Efl.Canvas.Layout extends Efl.Canvas.Group implements Efl.File, Efl.
Efl.Ui.I18n.language { set; get; }
Efl.Gfx.Entity.scale { set; get; }
Efl.File.load;
Efl.File.unload;
Efl.Container.content_iterate;
Efl.Container.content_count;
Efl.Part.part_get; [[Returns @Efl.Canvas.Layout_Part]]

@ -218,6 +218,12 @@ _efl_ui_bg_efl_file_load(Eo *obj EINA_UNUSED, Efl_Ui_Bg_Data *sd)
return efl_file_load(sd->img);
}
EOLIAN static void
_efl_ui_bg_efl_file_unload(Eo *obj EINA_UNUSED, Efl_Ui_Bg_Data *sd)
{
efl_file_unload(sd->img);
}
EOLIAN static Eina_Error
_efl_ui_bg_efl_file_file_set(Eo *obj EINA_UNUSED, Efl_Ui_Bg_Data *sd, const char *file)
{

@ -10,6 +10,7 @@ class @beta Efl.Ui.Bg extends Efl.Ui.Layout_Base implements Efl.File, Efl.Gfx.Co
Efl.Object.destructor;
Efl.Object.finalize;
Efl.File.load;
Efl.File.unload;
Efl.File.file { get; set; }
Efl.File.key { get; set; }
Efl.File.mmap { get; set; }

@ -2314,6 +2314,25 @@ static Eina_Error
_efl_ui_image_zoomable_file_set_internal(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Evas_Load_Error *ret)
{
const char *file = efl_file_get(obj);
efl_file_unload(obj);
if (_efl_ui_image_zoomable_is_remote(file))
{
if (_efl_ui_image_zoomable_download(obj, sd, file))
{
efl_event_callback_legacy_call
(obj, EFL_UI_IMAGE_ZOOMABLE_EVENT_DOWNLOAD_START, NULL);
*ret = EVAS_LOAD_ERROR_NONE;
return 0;
}
}
return _internal_file_set(obj, sd, ret);
}
EOLIAN static void
_efl_ui_image_zoomable_efl_file_unload(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd)
{
ELM_SAFE_FREE(sd->edje, evas_object_del);
eina_stringshare_replace(&sd->stdicon, NULL);
@ -2332,19 +2351,6 @@ _efl_ui_image_zoomable_file_set_internal(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd
if (sd->remote.binbuf) ELM_SAFE_FREE(sd->remote.binbuf, eina_binbuf_free);
sd->preload_num = 0;
if (_efl_ui_image_zoomable_is_remote(file))
{
if (_efl_ui_image_zoomable_download(obj, sd, file))
{
efl_event_callback_legacy_call
(obj, EFL_UI_IMAGE_ZOOMABLE_EVENT_DOWNLOAD_START, NULL);
*ret = EVAS_LOAD_ERROR_NONE;
return 0;
}
}
return _internal_file_set(obj, sd, ret);
}
EOLIAN static Eina_Error

@ -64,6 +64,7 @@ class @beta Efl.Ui.Image_Zoomable extends Efl.Ui.Image implements Efl.Ui.Zoom,
Efl.Ui.Scrollable_Interactive.scroll;
Efl.Access.Widget.Action.elm_actions { get; }
Efl.File.load;
Efl.File.unload;
Efl.File.file { get; set; }
Efl.Gfx.Image_Orientable.image_orientation { get; set; }
Efl.Layout.Group.group_size_min { get; }

@ -930,6 +930,17 @@ _parts_cursors_find(Efl_Ui_Layout_Data *sd,
/* The public functions down here are meant to operate on whichever
* widget inheriting from elm_layout */
EOLIAN static void
_efl_ui_layout_efl_file_unload(Eo *obj, void *_pd EINA_UNUSED)
{
Efl_Ui_Layout_Data *sd = efl_data_scope_get(obj, MY_CLASS);
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
efl_file_unload(wd->resize_obj);
sd->file_set = EINA_FALSE;
}
EOLIAN static Eina_Error
_efl_ui_layout_efl_file_load(Eo *obj, void *_pd EINA_UNUSED)
{

@ -19,6 +19,7 @@ class Efl.Ui.Layout extends Efl.Ui.Layout_Base implements Efl.File
Efl.File.key { get; set; }
Efl.File.mmap { get; set; }
Efl.File.load;
Efl.File.unload;
Efl.Object.constructor;
Efl.Canvas.Group.group_calculate;
}

@ -2530,6 +2530,14 @@ _efl_ui_text_efl_file_file_set(Eo *obj, Efl_Ui_Text_Data *sd, const char *file)
return efl_file_set(efl_super(obj, MY_CLASS), file);
}
EOLIAN static void
_efl_ui_text_efl_file_unload(Eo *obj, Efl_Ui_Text_Data *sd)
{
efl_file_unload(efl_super(obj, MY_CLASS));
ELM_SAFE_FREE(sd->delay_write, ecore_timer_del);
elm_object_text_set(obj, "");
}
EOLIAN static Eina_Error
_efl_ui_text_efl_file_load(Eo *obj, Efl_Ui_Text_Data *sd)
{

@ -352,6 +352,7 @@ class @beta Efl.Ui.Text extends Efl.Ui.Layout_Base implements Efl.Input.Clickabl
Efl.Access.Editable.Text.paste;
Efl.File.file { set; }
Efl.File.load;
Efl.File.unload;
Efl.Text_Interactive.editable { set; }
Efl.Part.part_get;
}

@ -288,6 +288,19 @@ _efl_ui_video_efl_object_constructor(Eo *obj, Efl_Ui_Video_Data *_pd EINA_UNUSED
return obj;
}
EOLIAN static void
_efl_ui_video_efl_file_unload(Eo *obj, Efl_Ui_Video_Data *sd)
{
if (sd->remember) emotion_object_last_position_save(sd->emotion);
sd->stop = EINA_FALSE;
efl_file_unload(sd->emotion);
if(elm_widget_is_legacy(obj))
elm_layout_signal_emit(obj, "elm,video,stop", "elm");
else
elm_layout_signal_emit(obj, "efl,video,stop", "efl");
}
EOLIAN static Eina_Error
_efl_ui_video_efl_file_load(Eo *obj, Efl_Ui_Video_Data *sd)
{

@ -42,6 +42,7 @@ class @beta Efl.Ui.Video extends Efl.Ui.Layout_Base implements Efl.File, Efl.Pla
implements {
Efl.Object.constructor;
Efl.File.load;
Efl.File.unload;
Efl.Canvas.Group.group_calculate;
Efl.Ui.Widget.widget_input_event_handler;
Efl.Access.Widget.Action.elm_actions { get; }

@ -5693,6 +5693,14 @@ _efl_ui_widget_part_bg_efl_file_load(Eo *obj, void *pd EINA_UNUSED)
return efl_file_load(bg_obj);
}
EOLIAN static void
_efl_ui_widget_part_bg_efl_file_unload(Eo *obj, void *pd EINA_UNUSED)
{
Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj);
efl_file_unload(bg_obj);
}
EOLIAN static const char *
_efl_ui_widget_part_bg_efl_file_file_get(const Eo *obj, void *pd EINA_UNUSED)
{

@ -7,6 +7,7 @@ class @beta Efl.Ui.Widget_Part_Bg extends Efl.Ui.Widget_Part implements Efl.File
Efl.File.key { get; set; }
Efl.File.mmap { get; set; }
Efl.File.load;
Efl.File.unload;
Efl.Gfx.Color.color { set; get; }
Efl.Gfx.Image.scale_type { get; set; }
}

@ -7706,6 +7706,19 @@ _efl_ui_win_part_color_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, const char
return EINA_FALSE;
}
static void
_efl_ui_win_part_file_unload(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, Eo *part_obj EINA_UNUSED, const char *part)
{
sd->legacy.forbidden = EINA_TRUE;
if (eina_streq(part, "background"))
{
_elm_win_bg_set(sd, NULL);
return;
}
WIN_PART_ERR(part);
}
static Eina_Error
_efl_ui_win_part_file_load(Eo *obj, Efl_Ui_Win_Data *sd, Eo *part_obj, const char *part)
{
@ -7815,6 +7828,14 @@ _efl_ui_win_part_efl_file_key_get(const Eo *obj, void *_pd EINA_UNUSED)
return _efl_ui_win_part_file_key_get(pd->obj, sd, obj, pd->part);
}
EOLIAN static void
_efl_ui_win_part_efl_file_unload(Eo *obj, void *_pd EINA_UNUSED)
{
Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
Efl_Ui_Win_Data *sd = efl_data_scope_get(pd->obj, MY_CLASS);
return _efl_ui_win_part_file_unload(pd->obj, sd, obj, pd->part);
}
EOLIAN static Eina_Error
_efl_ui_win_part_efl_file_load(Eo *obj, void *_pd EINA_UNUSED)
{

@ -7,6 +7,7 @@ class @beta Efl.Ui.Win_Part extends Efl.Ui.Widget_Part implements Efl.Content, E
Efl.Content.content_unset;
Efl.Gfx.Color.color { get; set; }
Efl.File.load;
Efl.File.unload;
Efl.File.file { get; }
Efl.File.key { get; }
}

@ -335,6 +335,13 @@ _elm_photo_efl_object_constructor(Eo *obj, Elm_Photo_Data *_pd EINA_UNUSED)
return obj;
}
EOLIAN static void
_elm_photo_efl_file_unload(Eo *obj, Elm_Photo_Data *sd)
{
elm_icon_standard_set(sd->icon, "no_photo");
_sizing_eval(obj);
}
EOLIAN static Eina_Error
_elm_photo_efl_file_load(Eo *obj, Elm_Photo_Data *sd)
{

@ -56,6 +56,7 @@ _elm_photo_class_initializer(Efl_Class *klass)
EFL_OBJECT_OP_FUNC(efl_file_mmap_set, _elm_photo_efl_file_mmap_set),
EFL_OBJECT_OP_FUNC(efl_file_mmap_get, _elm_photo_efl_file_mmap_get),
EFL_OBJECT_OP_FUNC(efl_file_load, _elm_photo_efl_file_load),
EFL_OBJECT_OP_FUNC(efl_file_unload, _elm_photo_efl_file_unload),
EFL_OBJECT_OP_FUNC(efl_ui_widget_theme_apply, _elm_photo_efl_ui_widget_theme_apply),
EFL_OBJECT_OP_FUNC(efl_ui_draggable_drag_target_set, _elm_photo_efl_ui_draggable_drag_target_set),
EFL_OBJECT_OP_FUNC(efl_ui_draggable_drag_target_get, _elm_photo_efl_ui_draggable_drag_target_get),

@ -634,6 +634,36 @@ _elm_thumb_efl_file_loaded_get(const Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd)
return sd->loaded;
}
EOLIAN static void
_elm_thumb_efl_file_unload(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd)
{
sd->is_video = EINA_FALSE;
eina_stringshare_replace(&(sd->thumb.file), NULL);
eina_stringshare_replace(&(sd->thumb.key), NULL);
sd->loaded = EINA_FALSE;
if (sd->thumb.request)
{
ethumb_client_thumb_async_cancel(_elm_ethumb_client, sd->thumb.request);
sd->thumb.request = NULL;
}
if (sd->thumb.retry)
{
retry = eina_list_remove(retry, sd);
efl_data_unref(sd->obj, sd);
sd->thumb.retry = EINA_FALSE;
}
evas_object_event_callback_del_full(sd->view, EVAS_CALLBACK_IMAGE_PRELOADED,
_on_thumb_preloaded, sd);
ELM_SAFE_FREE(sd->view, evas_object_del);
eina_stringshare_replace(&sd->thumb.thumb_path, NULL);
eina_stringshare_replace(&sd->thumb.thumb_key, NULL);
ELM_SAFE_FREE(sd->eeh, ecore_event_handler_del);
}
EOLIAN static Eina_Error
_elm_thumb_efl_file_load(Eo *obj, Elm_Thumb_Data *sd)
{

@ -57,6 +57,7 @@ _elm_thumb_class_initializer(Efl_Class *klass)
EFL_OBJECT_OP_FUNC(efl_constructor, _elm_thumb_efl_object_constructor),
EFL_OBJECT_OP_FUNC(efl_finalize, _elm_thumb_efl_object_finalize),
EFL_OBJECT_OP_FUNC(efl_file_load, _elm_thumb_efl_file_load),
EFL_OBJECT_OP_FUNC(efl_file_unload, _elm_thumb_efl_file_unload),
EFL_OBJECT_OP_FUNC(efl_file_loaded_get, _elm_thumb_efl_file_loaded_get),
EFL_OBJECT_OP_FUNC(efl_file_set, _elm_thumb_efl_file_file_set),
EFL_OBJECT_OP_FUNC(efl_file_get, _elm_thumb_efl_file_file_get),

@ -52,6 +52,7 @@ class @beta Efl.Canvas.Video extends Efl.Canvas.Group implements Efl.File, Efl.P
Efl.Gfx.Entity.position { set; }
Efl.Gfx.Entity.size { set; }
Efl.File.load;
Efl.File.unload;
Efl.File.file { set; }
Efl.File.loaded { get; }
Efl.Player.play { get; set; }

@ -366,6 +366,22 @@ _efl_canvas_video_efl_file_loaded_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Vide
return sd->open && sd->loaded;
}
EOLIAN static void
_efl_canvas_video_efl_file_unload(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd)
{
if (sd->engine_instance) emotion_engine_instance_file_close(sd->engine_instance);
sd->engine_instance = NULL;
evas_object_image_data_set(sd->obj, NULL);
evas_object_image_size_set(sd->obj, 1, 1);
_emotion_image_data_zero(sd->obj);
if (sd->anim) ecore_animator_del(sd->anim);
sd->anim = NULL;
_xattr_data_cancel(sd->xattr);
sd->loaded = 0;
}
EOLIAN static Eina_Error
_efl_canvas_video_efl_file_load(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd)
{
@ -410,7 +426,6 @@ _efl_canvas_video_efl_file_load(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd)
evas_object_image_data_set(sd->obj, NULL);
evas_object_image_size_set(sd->obj, 1, 1);
_emotion_image_data_zero(sd->obj);
eina_stringshare_replace(&sd->file, NULL);
}
if (sd->anim) ecore_animator_del(sd->anim);

@ -861,6 +861,13 @@ _evas_canvas3d_mesh_alpha_test_enable_get(const Eo *obj EINA_UNUSED, Evas_Canvas
return pd->alpha_test_enabled;
}
EOLIAN static void
_evas_canvas3d_mesh_efl_file_unload(Eo *obj, Evas_Canvas3D_Mesh_Data *pd)
{
efl_file_unload(efl_super(obj, MY_CLASS));
_mesh_fini(pd);
}
EOLIAN static Eina_Error
_evas_canvas3d_mesh_efl_file_load(Eo *obj, Evas_Canvas3D_Mesh_Data *pd)
{

@ -427,6 +427,7 @@ class @beta Evas.Canvas3D.Mesh extends Evas.Canvas3D.Object implements Efl.File,
Evas.Canvas3D.Object.update_notify;
Evas.Canvas3D.Object.change_notify;
Efl.File.load;
Efl.File.unload;
Efl.File_Save.save;
@empty Evas.Canvas3D.Object.callback_register;
@empty Evas.Canvas3D.Object.callback_unregister;

@ -373,6 +373,15 @@ _evas_canvas3d_texture_data_set(Eo *obj, Evas_Canvas3D_Texture_Data *pd,
evas_canvas3d_object_change(obj, EVAS_CANVAS3D_STATE_TEXTURE_DATA, NULL);
}
EOLIAN static void
_evas_canvas3d_texture_efl_file_unload(Eo *obj, Evas_Canvas3D_Texture_Data *pd)
{
efl_file_unload(efl_super(obj, MY_CLASS));
eina_file_close(pd->f); // close matching open (matches open in _evas_canvas3d_texture_efl_file_load) OK
pd->f = NULL;
_texture_fini(obj);
}
EOLIAN static Eina_Error
_evas_canvas3d_texture_efl_file_load(Eo *obj, Evas_Canvas3D_Texture_Data *pd)
{

@ -156,6 +156,7 @@ class @beta Evas.Canvas3D.Texture extends Evas.Canvas3D.Object implements Efl.Fi
Evas.Canvas3D.Object.update_notify;
Evas.Canvas3D.Object.change_notify;
Efl.File.load;
Efl.File.unload;
@empty Evas.Canvas3D.Object.callback_register;
@empty Evas.Canvas3D.Object.callback_unregister;
}

Loading…
Cancel
Save