2011-07-15 07:02:54 -07:00
|
|
|
/*
|
|
|
|
* TODO:
|
|
|
|
* - child elements focusing support
|
|
|
|
* - user defined icon/label cb
|
|
|
|
* - show/hide/add buttons ???
|
2013-06-18 17:00:41 -07:00
|
|
|
* - Pattern Filter support
|
2009-08-12 09:08:53 -07:00
|
|
|
*/
|
2013-04-25 22:13:00 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
2009-08-12 09:08:53 -07:00
|
|
|
|
2018-04-03 04:27:30 -07:00
|
|
|
#define EFL_ACCESS_OBJECT_PROTECTED
|
2017-11-15 18:31:26 -08:00
|
|
|
#define EFL_ACCESS_WIDGET_ACTION_PROTECTED
|
2018-05-03 16:34:17 -07:00
|
|
|
#define EFL_PART_PROTECTED
|
elm_fileselector: move to focus compostition
Summary:
elm_fileselector was using efl_ui_widget_state_apply to call for internal chain update.
This internal chain update was relying on efl_ui_focus_object_manager_get, which
results in a wrong value at this time, since the value is still the old one and not the
current one. (This behaviour will be updated after the release). Focus composition
solves this issue by not relying on the properties of efl.ui.focus_object, but rather
take the values from the configuration in the state_apply call.
fix T6147
fix T7105
Reviewers: zmike, stefan_schmidt, segfaultxavi, devilhorns, herdsman
Reviewed By: zmike
Subscribers: herdsman, cedric, #committers
Tags: #efl
Maniphest Tasks: T7105, T6147
Differential Revision: https://phab.enlightenment.org/D6552
2018-07-12 06:33:29 -07:00
|
|
|
#define EFL_UI_FOCUS_COMPOSITION_PROTECTED
|
2014-10-17 08:56:11 -07:00
|
|
|
|
2019-03-07 07:57:46 -08:00
|
|
|
#include "elm_priv.h"
|
2019-03-15 03:42:41 -07:00
|
|
|
#include "eo_internal.h"
|
2012-05-03 15:44:26 -07:00
|
|
|
#include <Elementary.h>
|
2018-01-26 16:56:31 -08:00
|
|
|
#include "Eio_Eo.h"
|
2019-03-05 14:00:37 -08:00
|
|
|
#include "elm_fileselector_button_eo.h"
|
|
|
|
#include "elm_fileselector_entry_eo.h"
|
2014-01-21 05:50:35 -08:00
|
|
|
#include "elm_interface_fileselector.h"
|
2012-08-01 14:03:33 -07:00
|
|
|
#include "elm_widget_fileselector.h"
|
2019-03-05 14:00:37 -08:00
|
|
|
#include "elm_entry_eo.h"
|
2019-03-05 14:00:37 -08:00
|
|
|
#include "elm_fileselector_eo.h"
|
2019-03-05 14:00:37 -08:00
|
|
|
#include "elm_genlist_eo.h"
|
2019-03-05 14:00:37 -08:00
|
|
|
#include "elm_gengrid_eo.h"
|
2009-08-12 09:08:53 -07:00
|
|
|
|
edje/elm: Rename _internal_ to _part_ (EO)
In Edje and Elementary, we have part objects, which are what is returned
by the interface efl_part(). Those objects can't be of an opaque type as
this doesn't work nicely with strongly typed languages such as C++ or
C#. In JS, Lua, C the types are weak and mostly runtime-based so it
doesn't matter much.
As a consequence, the documentation and the types need to look nice in
this EO API. Thus, we remove the abusive term "internal" and explicitly
call all those classes "part" something.
Eventually we want the types to be declared in the EO file so bindings
(C#, C++, ...) can generate the proper access methods, returning the
best possible types.
Note that right now a few of those part types are used in the legacy API
but don't actually need to be exposed externally.
This is kind of a mega commit that does all the renaming at once, but
it's really just a big sed operation. The power of good IDEs :)
Ref T5315
Ref T5306
2017-09-12 21:29:25 -07:00
|
|
|
#include "elm_fileselector_part.eo.h"
|
2017-06-04 07:25:36 -07:00
|
|
|
#include "elm_part_helper.h"
|
|
|
|
|
2014-06-03 03:35:28 -07:00
|
|
|
#define MY_CLASS ELM_FILESELECTOR_CLASS
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-11-07 03:44:22 -08:00
|
|
|
#define MY_CLASS_NAME "Elm_Fileselector"
|
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_fileselector"
|
2011-06-25 16:39:43 -07:00
|
|
|
|
2013-12-03 01:28:52 -08:00
|
|
|
/* FIXME: need a way to find a gap between the size of item and thumbnail */
|
2017-05-23 11:05:15 -07:00
|
|
|
#define ITEM_SIZE_DEFAULT 70
|
2013-12-03 01:28:52 -08:00
|
|
|
|
2016-08-22 17:59:10 -07:00
|
|
|
typedef struct _Legacy_Event_Path_Then_Data
|
|
|
|
{
|
|
|
|
Eo *eo_obj;
|
|
|
|
const Efl_Event_Description *evt_desc;
|
|
|
|
} Legacy_Event_Path_Then_Data;
|
|
|
|
|
2012-02-20 00:26:17 -08:00
|
|
|
static Elm_Genlist_Item_Class *list_itc[ELM_FILE_LAST];
|
2012-02-22 23:36:12 -08:00
|
|
|
static Elm_Gengrid_Item_Class *grid_itc[ELM_FILE_LAST];
|
2009-08-12 09:08:53 -07:00
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
EAPI Eina_Error ELM_FILESELECTOR_ERROR_UNKNOWN = 0;
|
|
|
|
EAPI Eina_Error ELM_FILESELECTOR_ERROR_INVALID_MODEL = 0;
|
|
|
|
|
|
|
|
static const char ELM_FILESELECTOR_ERROR_UNKNOWN_STR[] = "Unknown Error";
|
|
|
|
static const char ELM_FILESELECTOR_ERROR_INVALID_MODEL_STR[] = "Model not set";
|
2013-09-02 16:39:02 -07:00
|
|
|
|
2016-08-22 17:59:10 -07:00
|
|
|
#define ELM_PRIV_FILESELECTOR_SIGNALS(cmd) \
|
|
|
|
cmd(SIG_ACTIVATED, "activated", "s") \
|
|
|
|
cmd(SIG_DIRECTORY_OPEN, "directory,open", "s") \
|
|
|
|
cmd(SIG_DONE, "done", "s") \
|
|
|
|
cmd(SIG_SELECTED, "selected", "s") \
|
|
|
|
cmd(SIG_SELECTED_INVALID, "selected,invalid", "s")
|
|
|
|
|
|
|
|
ELM_PRIV_FILESELECTOR_SIGNALS(ELM_PRIV_STATIC_VARIABLE_DECLARE);
|
|
|
|
|
2012-05-03 15:44:26 -07:00
|
|
|
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
2016-08-22 17:59:10 -07:00
|
|
|
ELM_PRIV_FILESELECTOR_SIGNALS(ELM_PRIV_SMART_CALLBACKS_DESC)
|
2014-02-05 23:18:57 -08:00
|
|
|
{SIG_LAYOUT_FOCUSED, ""}, /**< handled by elm_layout */
|
|
|
|
{SIG_LAYOUT_UNFOCUSED, ""}, /**< handled by elm_layout */
|
2010-12-07 11:18:14 -08:00
|
|
|
{NULL, NULL}
|
2010-04-05 12:18:36 -07:00
|
|
|
};
|
2016-08-22 17:59:10 -07:00
|
|
|
#undef ELM_PRIV_FILESELECTOR_SIGNALS
|
2010-04-05 12:18:36 -07:00
|
|
|
|
2014-04-14 21:58:01 -07:00
|
|
|
static Eina_Bool _key_action_select(Evas_Object *obj, const char *params);
|
|
|
|
static Eina_Bool _key_action_escape(Evas_Object *obj, const char *params);
|
2016-03-04 15:32:22 -08:00
|
|
|
static Eina_Bool _key_action_backspace(Evas_Object *obj, const char *params);
|
2014-04-14 21:58:01 -07:00
|
|
|
|
|
|
|
static const Elm_Action key_actions[] = {
|
|
|
|
{"select", _key_action_select},
|
|
|
|
{"escape", _key_action_escape},
|
2016-03-04 15:32:22 -08:00
|
|
|
{"backspace", _key_action_backspace},
|
2014-04-14 21:58:01 -07:00
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2016-08-30 05:34:10 -07:00
|
|
|
static void _ok(void *data, const Efl_Event *event);
|
|
|
|
static void _canc(void *data, const Efl_Event *event);
|
|
|
|
static void _on_dir_up(void *data, const Efl_Event *event);
|
2016-06-06 00:16:57 -07:00
|
|
|
static void _populate(Evas_Object *obj, Efl_Model *model, Elm_Object_Item *parent_it, Efl_Model *selected);
|
|
|
|
static Elm_Fileselector_Item_Data *_selected_item_data_get(Elm_Fileselector_Data *sd);
|
|
|
|
|
2016-08-30 05:34:10 -07:00
|
|
|
static void _resource_created(void *, const Efl_Event *);
|
|
|
|
static void _resource_deleted(void *, const Efl_Event *);
|
2016-06-06 00:16:57 -07:00
|
|
|
static void _listing_request_cleanup(Listing_Request *);
|
2018-05-23 20:24:21 -07:00
|
|
|
static void _properties_ready(void *data, const Efl_Event *ev);
|
2016-06-06 00:16:57 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
EFL_CALLBACKS_ARRAY_DEFINE(monitoring_callbacks,
|
2016-06-21 09:58:47 -07:00
|
|
|
{ EFL_MODEL_EVENT_CHILD_ADDED, _resource_created },
|
|
|
|
{ EFL_MODEL_EVENT_CHILD_REMOVED, _resource_deleted });
|
|
|
|
|
2019-03-15 16:56:33 -07:00
|
|
|
static void _properties_changed(void *data, const Efl_Event *ev);
|
2017-06-25 08:50:35 -07:00
|
|
|
|
|
|
|
static void
|
|
|
|
_focus_chain_update(Eo *obj, Elm_Fileselector_Data *pd)
|
|
|
|
{
|
2017-09-29 02:09:33 -07:00
|
|
|
Eina_List *tmp = NULL;
|
2017-06-25 08:50:35 -07:00
|
|
|
|
elm_fileselector: move to focus compostition
Summary:
elm_fileselector was using efl_ui_widget_state_apply to call for internal chain update.
This internal chain update was relying on efl_ui_focus_object_manager_get, which
results in a wrong value at this time, since the value is still the old one and not the
current one. (This behaviour will be updated after the release). Focus composition
solves this issue by not relying on the properties of efl.ui.focus_object, but rather
take the values from the configuration in the state_apply call.
fix T6147
fix T7105
Reviewers: zmike, stefan_schmidt, segfaultxavi, devilhorns, herdsman
Reviewed By: zmike
Subscribers: herdsman, cedric, #committers
Tags: #efl
Maniphest Tasks: T7105, T6147
Differential Revision: https://phab.enlightenment.org/D6552
2018-07-12 06:33:29 -07:00
|
|
|
#define A(p) if (p) tmp = eina_list_append(tmp, p);
|
2017-09-29 02:09:33 -07:00
|
|
|
|
|
|
|
A(pd->up_button)
|
|
|
|
A(pd->home_button)
|
|
|
|
A(pd->search_entry)
|
|
|
|
A(pd->files_view)
|
|
|
|
A(pd->path_entry)
|
|
|
|
A(pd->name_entry)
|
|
|
|
A(pd->filter_hoversel)
|
|
|
|
A(pd->ok_button)
|
|
|
|
A(pd->cancel_button)
|
|
|
|
|
|
|
|
|
2017-06-25 08:50:35 -07:00
|
|
|
#undef A
|
|
|
|
|
elm_fileselector: move to focus compostition
Summary:
elm_fileselector was using efl_ui_widget_state_apply to call for internal chain update.
This internal chain update was relying on efl_ui_focus_object_manager_get, which
results in a wrong value at this time, since the value is still the old one and not the
current one. (This behaviour will be updated after the release). Focus composition
solves this issue by not relying on the properties of efl.ui.focus_object, but rather
take the values from the configuration in the state_apply call.
fix T6147
fix T7105
Reviewers: zmike, stefan_schmidt, segfaultxavi, devilhorns, herdsman
Reviewed By: zmike
Subscribers: herdsman, cedric, #committers
Tags: #efl
Maniphest Tasks: T7105, T6147
Differential Revision: https://phab.enlightenment.org/D6552
2018-07-12 06:33:29 -07:00
|
|
|
efl_ui_focus_composition_elements_set(obj, tmp);
|
2017-06-25 08:50:35 -07:00
|
|
|
}
|
|
|
|
|
2016-08-22 17:59:10 -07:00
|
|
|
void
|
2019-03-13 10:39:49 -07:00
|
|
|
_event_to_legacy_call(Eo *obj, const char *legacy_evt, void *event_info)
|
2016-08-22 17:59:10 -07:00
|
|
|
{
|
2019-03-13 10:39:49 -07:00
|
|
|
const Efl_Event_Description *legacy_desc = efl_object_legacy_only_event_description_get(legacy_evt);
|
2016-08-22 17:59:10 -07:00
|
|
|
efl_event_callback_call(obj, legacy_desc, event_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2019-03-13 10:39:49 -07:00
|
|
|
_model_event_call(Eo *obj, const Efl_Event_Description *evt_desc, const char *legacy_evt, Efl_Model *model, const char *path)
|
2016-08-22 17:59:10 -07:00
|
|
|
{
|
2019-03-13 10:39:49 -07:00
|
|
|
_event_to_legacy_call(obj, legacy_evt, (void *)path);
|
2016-08-22 17:59:10 -07:00
|
|
|
efl_event_callback_call(obj, evt_desc, model);
|
|
|
|
}
|
|
|
|
|
2016-06-17 12:40:49 -07:00
|
|
|
static void
|
|
|
|
_monitoring_start(Elm_Fileselector *fs, Elm_Fileselector_Data *sd, Efl_Model *model)
|
|
|
|
{
|
2018-05-24 15:54:00 -07:00
|
|
|
if (sd->monitoring) return ;
|
2016-06-17 12:40:49 -07:00
|
|
|
sd->monitoring = EINA_TRUE;
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_array_add(model, monitoring_callbacks(), fs);
|
2016-06-17 12:40:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_monitoring_stop(Elm_Fileselector *fs, Elm_Fileselector_Data *sd, Efl_Model *model)
|
|
|
|
{
|
2018-05-24 15:54:00 -07:00
|
|
|
if (!sd->monitoring) return ;
|
2016-06-17 12:40:49 -07:00
|
|
|
sd->monitoring = EINA_FALSE;
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_array_del(model, monitoring_callbacks(), fs);
|
2016-06-17 12:40:49 -07:00
|
|
|
}
|
|
|
|
|
2018-05-04 16:15:18 -07:00
|
|
|
static void _noref_death(void *data EINA_UNUSED, const Efl_Event *event);
|
|
|
|
static void _invalidated(void *data EINA_UNUSED, const Efl_Event *event);
|
|
|
|
|
|
|
|
EFL_CALLBACKS_ARRAY_DEFINE(noref_death,
|
|
|
|
{ EFL_EVENT_NOREF, _noref_death },
|
|
|
|
{ EFL_EVENT_INVALIDATE, _invalidated });
|
|
|
|
|
|
|
|
static void
|
|
|
|
_noref_death(void *data EINA_UNUSED, const Efl_Event *event)
|
|
|
|
{
|
|
|
|
efl_event_callback_array_del(event->object, noref_death(), NULL);
|
|
|
|
efl_del(event->object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_invalidated(void *data EINA_UNUSED, const Efl_Event *event)
|
|
|
|
{
|
|
|
|
// This means our parent is dying, EFL_EVENT_NOREF can be called after invalidated
|
|
|
|
efl_event_callback_array_del(event->object, noref_death(), NULL);
|
|
|
|
}
|
|
|
|
|
2018-05-23 20:24:21 -07:00
|
|
|
static void
|
|
|
|
_reset_target(Elm_Fileselector_Data *pd)
|
|
|
|
{
|
|
|
|
efl_event_callback_del(pd->target, EFL_MODEL_EVENT_PROPERTIES_CHANGED, _properties_ready, pd->obj);
|
|
|
|
efl_replace(&pd->target, NULL);
|
|
|
|
}
|
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
static void
|
|
|
|
_elm_fileselector_replace_model(Elm_Fileselector *fs, Elm_Fileselector_Data *sd, Efl_Model *model, const char *path)
|
|
|
|
{
|
2018-05-24 15:54:00 -07:00
|
|
|
_monitoring_stop(fs, sd, sd->model);
|
2018-01-26 16:56:31 -08:00
|
|
|
|
|
|
|
efl_replace(&sd->model, model);
|
|
|
|
eina_stringshare_replace(&sd->path, path);
|
2016-06-06 00:16:57 -07:00
|
|
|
|
|
|
|
if (model && path)
|
|
|
|
{
|
2016-06-17 12:40:49 -07:00
|
|
|
_monitoring_start(fs, sd, sd->model);
|
2016-06-06 00:16:57 -07:00
|
|
|
/* TODO: sub directory should be monitored for expand mode */
|
|
|
|
}
|
|
|
|
}
|
2014-01-21 22:53:49 -08:00
|
|
|
|
2012-05-03 15:44:26 -07:00
|
|
|
/* final routine on deletion */
|
|
|
|
static void
|
2016-06-06 00:16:57 -07:00
|
|
|
_elm_fileselector_smart_del_do(Elm_Fileselector *fs, Elm_Fileselector_Data *sd)
|
2012-05-03 15:44:26 -07:00
|
|
|
{
|
2019-03-15 16:56:33 -07:00
|
|
|
Eo *child;
|
|
|
|
EINA_LIST_FREE(sd->children, child)
|
|
|
|
{
|
|
|
|
efl_event_callback_del(child, EFL_MODEL_EVENT_PROPERTIES_CHANGED, _properties_changed, sd);
|
|
|
|
efl_unref(child);
|
|
|
|
}
|
2016-06-06 00:16:57 -07:00
|
|
|
_elm_fileselector_replace_model(fs, sd, NULL, NULL);
|
2019-03-13 14:54:39 -07:00
|
|
|
efl_replace(&sd->prev_model, NULL);
|
2014-09-02 20:44:05 -07:00
|
|
|
ecore_idler_del(sd->path_entry_idler);
|
2012-05-02 18:19:05 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_del(efl_super(sd->obj, MY_CLASS));
|
2011-06-25 16:39:43 -07:00
|
|
|
}
|
|
|
|
|
2011-02-08 04:08:28 -08:00
|
|
|
static void
|
|
|
|
_mirrored_set(Evas_Object *obj, Eina_Bool rtl)
|
|
|
|
{
|
2012-05-03 15:44:26 -07:00
|
|
|
ELM_FILESELECTOR_DATA_GET(obj, sd);
|
|
|
|
|
2017-06-13 03:41:15 -07:00
|
|
|
efl_ui_mirrored_set(sd->cancel_button, rtl);
|
|
|
|
efl_ui_mirrored_set(sd->ok_button, rtl);
|
|
|
|
efl_ui_mirrored_set(sd->files_view, rtl);
|
|
|
|
efl_ui_mirrored_set(sd->up_button, rtl);
|
|
|
|
efl_ui_mirrored_set(sd->home_button, rtl);
|
2011-02-08 04:08:28 -08:00
|
|
|
}
|
|
|
|
|
2019-03-04 10:37:07 -08:00
|
|
|
EOLIAN static Eina_Error
|
2018-01-07 20:55:35 -08:00
|
|
|
_elm_fileselector_efl_ui_widget_theme_apply(Eo *obj, Elm_Fileselector_Data *sd)
|
2010-11-22 11:24:48 -08:00
|
|
|
{
|
2012-05-03 15:44:26 -07:00
|
|
|
const char *style;
|
2010-11-22 11:24:48 -08:00
|
|
|
const char *data;
|
|
|
|
char buf[1024];
|
2019-03-04 10:37:07 -08:00
|
|
|
Eina_Error int_ret = EFL_UI_THEME_APPLY_ERROR_GENERIC;
|
2016-03-04 15:39:29 -08:00
|
|
|
|
2017-10-23 22:03:46 -07:00
|
|
|
int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS));
|
2019-03-04 10:36:41 -08:00
|
|
|
if (int_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return int_ret;
|
2010-11-22 11:24:48 -08:00
|
|
|
|
2012-05-03 15:44:26 -07:00
|
|
|
style = elm_widget_style_get(obj);
|
2017-06-13 03:41:15 -07:00
|
|
|
_mirrored_set(obj, efl_ui_mirrored_get(obj));
|
2010-11-22 11:24:48 -08:00
|
|
|
|
2016-03-04 15:39:29 -08:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
|
|
|
|
2012-05-03 15:44:26 -07:00
|
|
|
data = edje_object_data_get
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, "path_separator");
|
2012-05-03 15:44:26 -07:00
|
|
|
if (data) sd->path_separator = data;
|
|
|
|
else sd->path_separator = "/";
|
2010-11-22 11:24:48 -08:00
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "fileselector/%s", style);
|
|
|
|
|
2016-03-04 15:39:29 -08:00
|
|
|
elm_widget_style_set(sd->up_button, buf);
|
|
|
|
elm_widget_style_set(sd->home_button, buf);
|
2017-04-26 01:16:01 -07:00
|
|
|
elm_widget_style_set(sd->spinner, buf);
|
2012-05-03 15:44:26 -07:00
|
|
|
|
2017-04-14 01:23:47 -07:00
|
|
|
elm_widget_style_set(sd->files_view, buf);
|
|
|
|
|
2016-03-04 15:39:29 -08:00
|
|
|
elm_widget_style_set(sd->path_entry, buf);
|
|
|
|
elm_widget_style_set(sd->name_entry, buf);
|
|
|
|
elm_widget_style_set(sd->search_entry, buf);
|
2010-11-22 11:24:48 -08:00
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "fileselector/actions/%s", style);
|
|
|
|
|
2016-03-04 15:39:29 -08:00
|
|
|
if (sd->filter_hoversel)
|
|
|
|
elm_widget_style_set(sd->filter_hoversel, buf);
|
2012-05-03 15:44:26 -07:00
|
|
|
|
2016-03-04 15:39:29 -08:00
|
|
|
if (sd->ok_button)
|
|
|
|
{
|
|
|
|
elm_widget_style_set(sd->cancel_button, buf);
|
|
|
|
elm_widget_style_set(sd->ok_button, buf);
|
|
|
|
}
|
2012-05-03 15:44:26 -07:00
|
|
|
|
theme: return enum from elm_widget_style_set instead of bool
Summary:
if trying to apply incorrect theme, widget apply default theme and return TRUE.
so there is no way to check it really apply correct theme.
To resolve this problem, _elm_theme_set return three type enum
* related history : 4ca3ef45146e05908a13d1010909abeba9693ad6
* elm_object_style_set is public api, so I didn't change it.
* typedef name [ Theme_Apply ] is temporarily, please suggest better one.
@fix
Reviewers: singh.amitesh, herb, Hermet, cedric, jpeg, raster
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4073
2016-06-30 23:09:42 -07:00
|
|
|
return int_ret;
|
2009-08-12 09:08:53 -07:00
|
|
|
}
|
|
|
|
|
2014-04-14 21:58:01 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_key_action_select(Evas_Object *obj, const char *params EINA_UNUSED)
|
|
|
|
{
|
2016-08-30 05:34:10 -07:00
|
|
|
Efl_Event event = {};
|
2016-02-29 03:32:52 -08:00
|
|
|
_ok(obj, &event);
|
2014-04-14 21:58:01 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_key_action_escape(Evas_Object *obj, const char *params EINA_UNUSED)
|
|
|
|
{
|
2016-08-30 05:34:10 -07:00
|
|
|
Efl_Event event = {};
|
2016-02-29 03:32:52 -08:00
|
|
|
_canc(obj, &event);
|
2014-04-14 21:58:01 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2016-03-04 15:32:22 -08:00
|
|
|
static Eina_Bool
|
|
|
|
_key_action_backspace(Evas_Object *obj, const char *params EINA_UNUSED)
|
|
|
|
{
|
|
|
|
ELM_FILESELECTOR_DATA_GET(obj, sd);
|
2016-06-06 00:16:57 -07:00
|
|
|
if (sd->prev_model)
|
|
|
|
{
|
2018-05-04 16:15:18 -07:00
|
|
|
Efl_Model *tmp = NULL;
|
|
|
|
|
|
|
|
tmp = sd->prev_model;
|
2016-06-06 00:16:57 -07:00
|
|
|
sd->prev_model = NULL;
|
2018-05-04 16:15:18 -07:00
|
|
|
_populate(obj, sd->prev_model, NULL, NULL);
|
|
|
|
efl_unref(tmp);
|
2016-06-06 00:16:57 -07:00
|
|
|
}
|
2016-03-04 15:32:22 -08:00
|
|
|
else
|
|
|
|
_on_dir_up(obj, NULL);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2012-05-03 15:44:26 -07:00
|
|
|
/*** GENLIST/GENGRID "MODEL" ***/
|
2010-12-07 11:18:14 -08:00
|
|
|
static char *
|
2012-05-03 15:44:26 -07:00
|
|
|
_itc_text_get(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2009-08-12 09:08:53 -07:00
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
Elm_Fileselector_Item_Data *it_data = data;
|
2012-05-03 15:44:26 -07:00
|
|
|
return elm_entry_utf8_to_markup
|
2016-06-06 00:16:57 -07:00
|
|
|
(it_data->filename); /* NOTE this will be free()'d by
|
2012-05-03 15:44:26 -07:00
|
|
|
* the caller */
|
2009-08-12 09:08:53 -07:00
|
|
|
}
|
|
|
|
|
2010-12-07 11:18:14 -08:00
|
|
|
static Evas_Object *
|
2014-01-06 06:30:02 -08:00
|
|
|
_itc_icon_folder_get(void *data EINA_UNUSED,
|
2011-06-25 16:39:43 -07:00
|
|
|
Evas_Object *obj,
|
2012-05-03 15:44:26 -07:00
|
|
|
const char *source)
|
2009-08-12 09:08:53 -07:00
|
|
|
{
|
2017-04-18 01:29:29 -07:00
|
|
|
Evas_Object *ic, *grid;
|
2009-08-12 09:08:53 -07:00
|
|
|
|
2011-06-25 16:39:43 -07:00
|
|
|
if (strcmp(source, "elm.swallow.icon")) return NULL;
|
2011-05-31 09:16:01 -07:00
|
|
|
|
2011-06-25 16:39:43 -07:00
|
|
|
ic = elm_icon_add(obj);
|
|
|
|
elm_icon_standard_set(ic, "folder");
|
2012-05-03 15:44:26 -07:00
|
|
|
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
|
2013-12-03 01:28:52 -08:00
|
|
|
evas_object_show(ic);
|
|
|
|
|
|
|
|
grid = elm_grid_add(obj);
|
|
|
|
elm_grid_size_set(grid, 1, 1);
|
|
|
|
elm_grid_pack(grid, ic, 0, 0, 1, 1);
|
|
|
|
evas_object_show(grid);
|
|
|
|
|
|
|
|
return grid;
|
2011-06-25 16:39:43 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static Evas_Object *
|
2012-05-03 15:44:26 -07:00
|
|
|
_itc_icon_image_get(void *data,
|
2011-06-25 16:39:43 -07:00
|
|
|
Evas_Object *obj,
|
2012-05-03 15:44:26 -07:00
|
|
|
const char *source)
|
2011-06-25 16:39:43 -07:00
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
Elm_Fileselector_Item_Data *it_data = data;
|
2017-04-18 01:29:29 -07:00
|
|
|
Evas_Object *ic, *grid;
|
2011-06-25 16:39:43 -07:00
|
|
|
|
|
|
|
if (strcmp(source, "elm.swallow.icon")) return NULL;
|
|
|
|
|
|
|
|
ic = elm_icon_add(obj);
|
|
|
|
elm_icon_standard_set(ic, "image");
|
2016-06-06 00:16:57 -07:00
|
|
|
// FIXME: maybe use Efl.Model.connect
|
|
|
|
elm_icon_thumb_set(ic, it_data->path, NULL);
|
2012-05-03 15:44:26 -07:00
|
|
|
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
|
2013-12-03 01:28:52 -08:00
|
|
|
evas_object_show(ic);
|
|
|
|
|
|
|
|
grid = elm_grid_add(obj);
|
|
|
|
elm_grid_size_set(grid, 1, 1);
|
|
|
|
elm_grid_pack(grid, ic, 0, 0, 1, 1);
|
|
|
|
evas_object_show(grid);
|
|
|
|
|
|
|
|
return grid;
|
2011-06-25 16:39:43 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static Evas_Object *
|
2014-01-06 06:30:02 -08:00
|
|
|
_itc_icon_file_get(void *data EINA_UNUSED,
|
2011-06-25 16:39:43 -07:00
|
|
|
Evas_Object *obj,
|
2012-05-03 15:44:26 -07:00
|
|
|
const char *source)
|
2011-06-25 16:39:43 -07:00
|
|
|
{
|
2017-04-18 01:29:29 -07:00
|
|
|
Evas_Object *ic, *grid;
|
2011-06-25 16:39:43 -07:00
|
|
|
|
|
|
|
if (strcmp(source, "elm.swallow.icon")) return NULL;
|
|
|
|
|
|
|
|
ic = elm_icon_add(obj);
|
|
|
|
elm_icon_standard_set(ic, "file");
|
2012-05-03 15:44:26 -07:00
|
|
|
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
|
2013-12-03 01:28:52 -08:00
|
|
|
evas_object_show(ic);
|
|
|
|
|
|
|
|
grid = elm_grid_add(obj);
|
|
|
|
elm_grid_size_set(grid, 1, 1);
|
|
|
|
elm_grid_pack(grid, ic, 0, 0, 1, 1);
|
|
|
|
evas_object_show(grid);
|
|
|
|
|
|
|
|
return grid;
|
2009-08-12 09:08:53 -07:00
|
|
|
}
|
|
|
|
|
2009-10-22 15:10:23 -07:00
|
|
|
static Eina_Bool
|
2014-01-06 06:30:02 -08:00
|
|
|
_itc_state_get(void *data EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2009-08-12 09:08:53 -07:00
|
|
|
{
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-05-03 15:44:26 -07:00
|
|
|
_itc_del(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED)
|
2009-08-12 09:08:53 -07:00
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
Elm_Fileselector_Item_Data *it_data = data;
|
2018-05-05 21:27:31 -07:00
|
|
|
efl_key_data_set(it_data->model, ".item.data", NULL);
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_unref(it_data->model);
|
2016-06-06 00:16:57 -07:00
|
|
|
eina_stringshare_del(it_data->path);
|
|
|
|
eina_stringshare_del(it_data->filename);
|
|
|
|
eina_stringshare_del(it_data->mime_type);
|
|
|
|
eina_stringshare_del(it_data->parent_path);
|
|
|
|
free(it_data);
|
2009-08-12 09:08:53 -07:00
|
|
|
}
|
|
|
|
|
2012-05-03 15:45:01 -07:00
|
|
|
static void
|
|
|
|
_anchors_do(Evas_Object *obj,
|
|
|
|
const char *path)
|
|
|
|
{
|
|
|
|
char **tok, buf[PATH_MAX * 3], *s;
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
ELM_FILESELECTOR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
s = elm_entry_utf8_to_markup(path);
|
2013-07-17 18:25:57 -07:00
|
|
|
if (!s) return;
|
2012-05-03 15:45:01 -07:00
|
|
|
|
|
|
|
buf[0] = '\0';
|
|
|
|
tok = eina_str_split(s, "/", 0);
|
|
|
|
free(s);
|
|
|
|
|
2014-01-27 23:16:44 -08:00
|
|
|
eina_strlcat(buf, "<a href='/'>root</a>", sizeof(buf));
|
2012-05-03 15:45:01 -07:00
|
|
|
for (i = 0; tok[i]; i++)
|
|
|
|
{
|
|
|
|
if ((!tok[i]) || (!tok[i][0])) continue;
|
|
|
|
eina_strlcat(buf, sd->path_separator, sizeof(buf));
|
|
|
|
eina_strlcat(buf, "<a href=", sizeof(buf));
|
|
|
|
for (j = 0; j <= i; j++)
|
|
|
|
{
|
|
|
|
if (strlen(tok[j]) < 1) continue;
|
|
|
|
eina_strlcat(buf, "/", sizeof(buf));
|
|
|
|
eina_strlcat(buf, tok[j], sizeof(buf));
|
|
|
|
}
|
|
|
|
eina_strlcat(buf, ">", sizeof(buf));
|
|
|
|
eina_strlcat(buf, tok[i], sizeof(buf));
|
|
|
|
eina_strlcat(buf, "</a>", sizeof(buf));
|
|
|
|
}
|
|
|
|
free(tok[0]);
|
|
|
|
free(tok);
|
|
|
|
|
|
|
|
elm_object_text_set(sd->path_entry, buf);
|
|
|
|
}
|
|
|
|
|
2013-06-18 17:00:41 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_mime_type_matched(const char *mime_filter, const char *mime_type)
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
while (mime_filter[i] != '\0')
|
|
|
|
{
|
|
|
|
if (mime_filter[i] != mime_type[i])
|
|
|
|
{
|
|
|
|
if (mime_filter[i] == '*' && mime_filter[i + 1] == '\0')
|
|
|
|
return EINA_TRUE;
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mime_type[i] != '\0') return EINA_FALSE;
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2016-06-06 00:16:57 -07:00
|
|
|
_is_in_filter(const Elm_Fileselector_Filter *filter, const char *mime_type)
|
2013-06-18 17:00:41 -07:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
if (!mime_type) return EINA_FALSE;
|
|
|
|
|
2013-12-28 20:23:17 -08:00
|
|
|
for (i = 0; filter->filter.mime_types[i]; ++i)
|
2013-06-18 17:00:41 -07:00
|
|
|
{
|
2013-12-28 20:23:17 -08:00
|
|
|
if (_mime_type_matched(filter->filter.mime_types[i], mime_type))
|
2013-06-18 17:00:41 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2011-06-25 16:39:43 -07:00
|
|
|
static Eina_Bool
|
2016-06-06 00:16:57 -07:00
|
|
|
_filter_child(Elm_Fileselector_Data* sd,
|
|
|
|
const char *path,
|
|
|
|
const char *filename,
|
|
|
|
Eina_Bool dir,
|
|
|
|
const char *mime_type)
|
2011-06-25 16:39:43 -07:00
|
|
|
{
|
2013-12-28 20:23:17 -08:00
|
|
|
Elm_Fileselector_Filter *cf;
|
2014-06-10 02:50:01 -07:00
|
|
|
char *pch = NULL, *temp = NULL;
|
|
|
|
char temp_path[EINA_PATH_MAX];
|
2011-06-25 16:39:43 -07:00
|
|
|
|
2015-01-07 02:33:27 -08:00
|
|
|
if (!sd) return EINA_FALSE;
|
2011-06-25 16:39:43 -07:00
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
if (!sd->hidden_visible && filename[0] == '.')
|
|
|
|
return EINA_FALSE;
|
2011-06-25 16:39:43 -07:00
|
|
|
|
2015-01-07 02:33:27 -08:00
|
|
|
if (sd->only_folder && !dir)
|
2013-06-18 17:00:41 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
|
2014-06-10 02:50:01 -07:00
|
|
|
//Search entry filter
|
2015-01-07 02:33:27 -08:00
|
|
|
if ((sd->search_string) && (sd->search_string[0] != '\0'))
|
2014-06-10 02:50:01 -07:00
|
|
|
{
|
2016-08-08 02:32:16 -07:00
|
|
|
strncpy(temp_path, path, sizeof(temp_path) - 1);
|
|
|
|
temp_path[sizeof(temp_path) - 1] = 0;
|
2016-12-27 00:17:43 -08:00
|
|
|
pch = strchr(temp_path, EINA_PATH_SEP_C);
|
2014-06-10 02:50:01 -07:00
|
|
|
while (pch != NULL)
|
|
|
|
{
|
|
|
|
temp = pch;
|
2016-12-27 00:17:43 -08:00
|
|
|
pch = strchr(pch + 1, EINA_PATH_SEP_C);
|
2014-06-10 02:50:01 -07:00
|
|
|
}
|
|
|
|
temp++;
|
2015-01-07 02:33:27 -08:00
|
|
|
if ((temp) && (sd->search_string) &&
|
|
|
|
(!strstr(temp, sd->search_string)))
|
2014-06-10 02:50:01 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2015-01-07 02:33:27 -08:00
|
|
|
cf = sd->current_filter;
|
2013-12-28 20:23:17 -08:00
|
|
|
if (!cf)
|
|
|
|
return EINA_TRUE;
|
|
|
|
|
|
|
|
switch (cf->filter_type)
|
|
|
|
{
|
|
|
|
case ELM_FILESELECTOR_MIME_FILTER:
|
2016-06-06 00:16:57 -07:00
|
|
|
return dir || _is_in_filter(cf, mime_type);
|
2013-12-28 20:23:17 -08:00
|
|
|
case ELM_FILESELECTOR_CUSTOM_FILTER:
|
2016-06-06 00:16:57 -07:00
|
|
|
return cf->filter.custom->func(path, dir,
|
2013-12-28 20:23:17 -08:00
|
|
|
cf->filter.custom->data);
|
|
|
|
default:
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
2011-06-25 16:39:43 -07:00
|
|
|
}
|
|
|
|
|
2013-12-18 03:05:35 -08:00
|
|
|
static const char *
|
|
|
|
_file_type(const char *a)
|
|
|
|
{
|
|
|
|
char *p = strrchr(a, '.');
|
|
|
|
if (!p) return "";
|
|
|
|
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2016-06-06 00:16:57 -07:00
|
|
|
_filename_cmp(const Elm_Fileselector_Item_Data *a, const Elm_Fileselector_Item_Data *b)
|
2013-12-18 03:05:35 -08:00
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
return strcoll(a->filename, b->filename);
|
2013-12-18 03:05:35 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2016-06-06 00:16:57 -07:00
|
|
|
_filename_cmp_rev(const Elm_Fileselector_Item_Data *a, const Elm_Fileselector_Item_Data *b)
|
2013-12-18 03:05:35 -08:00
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
return _filename_cmp(b, a);
|
2013-12-18 03:05:35 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2016-06-06 00:16:57 -07:00
|
|
|
_type_cmp(const Elm_Fileselector_Item_Data *a, const Elm_Fileselector_Item_Data *b)
|
2013-12-18 03:05:35 -08:00
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
return strcoll(_file_type(a->filename), _file_type(b->filename));
|
2013-12-18 03:05:35 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2016-06-06 00:16:57 -07:00
|
|
|
_type_cmp_rev(const Elm_Fileselector_Item_Data *a, const Elm_Fileselector_Item_Data *b)
|
2013-12-18 03:05:35 -08:00
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
return _type_cmp(b, a);
|
2013-12-18 03:05:35 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2016-06-06 00:16:57 -07:00
|
|
|
_size_cmp(const Elm_Fileselector_Item_Data *a, const Elm_Fileselector_Item_Data *b)
|
|
|
|
{
|
|
|
|
return a->size - b->size;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_size_cmp_rev(const Elm_Fileselector_Item_Data *a, const Elm_Fileselector_Item_Data *b)
|
2013-12-18 03:05:35 -08:00
|
|
|
{
|
|
|
|
return _size_cmp(b, a);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2016-06-06 00:16:57 -07:00
|
|
|
_modified_cmp(const Elm_Fileselector_Item_Data *a, const Elm_Fileselector_Item_Data *b)
|
2013-12-18 03:05:35 -08:00
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
if (a->mtime > b->mtime)
|
2013-12-18 03:05:35 -08:00
|
|
|
return 1;
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2016-06-06 00:16:57 -07:00
|
|
|
_modified_cmp_rev(const Elm_Fileselector_Item_Data *a, const Elm_Fileselector_Item_Data *b)
|
2013-12-18 03:05:35 -08:00
|
|
|
{
|
|
|
|
return _modified_cmp(b, a);
|
|
|
|
}
|
|
|
|
|
2011-06-25 16:39:43 -07:00
|
|
|
static int
|
2013-12-18 03:05:35 -08:00
|
|
|
_file_grid_cmp(const void *a, const void *b)
|
2011-06-25 16:39:43 -07:00
|
|
|
{
|
2013-12-18 03:05:35 -08:00
|
|
|
Evas_Object *f;
|
|
|
|
|
2012-01-30 02:29:51 -08:00
|
|
|
const Elm_Object_Item *ga = a;
|
|
|
|
const Elm_Object_Item *gb = b;
|
2011-06-25 16:39:43 -07:00
|
|
|
const Elm_Gengrid_Item_Class *ca = elm_gengrid_item_item_class_get(ga);
|
|
|
|
const Elm_Gengrid_Item_Class *cb = elm_gengrid_item_item_class_get(gb);
|
|
|
|
|
2012-02-22 23:36:12 -08:00
|
|
|
if (ca == grid_itc[ELM_DIRECTORY])
|
2011-06-25 16:39:43 -07:00
|
|
|
{
|
2012-02-22 23:36:12 -08:00
|
|
|
if (cb != grid_itc[ELM_DIRECTORY])
|
2011-06-25 16:39:43 -07:00
|
|
|
return -1;
|
|
|
|
}
|
2012-02-22 23:36:12 -08:00
|
|
|
else if (cb == grid_itc[ELM_DIRECTORY])
|
2011-09-05 13:30:12 -07:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
2011-06-25 16:39:43 -07:00
|
|
|
|
2013-12-18 03:05:35 -08:00
|
|
|
f = evas_object_data_get(elm_object_item_widget_get(ga), "parent");
|
|
|
|
ELM_FILESELECTOR_DATA_GET(f, sd);
|
|
|
|
return sd->sort_method(elm_object_item_data_get(ga),
|
|
|
|
elm_object_item_data_get(gb));
|
2011-06-25 16:39:43 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2013-12-18 03:05:35 -08:00
|
|
|
_file_list_cmp(const void *a, const void *b)
|
2011-06-25 16:39:43 -07:00
|
|
|
{
|
2013-12-18 03:05:35 -08:00
|
|
|
Evas_Object *f;
|
|
|
|
|
2012-01-19 21:18:31 -08:00
|
|
|
const Elm_Object_Item *la = a;
|
|
|
|
const Elm_Object_Item *lb = b;
|
2011-06-25 16:39:43 -07:00
|
|
|
const Elm_Genlist_Item_Class *ca = elm_genlist_item_item_class_get(la);
|
|
|
|
const Elm_Genlist_Item_Class *cb = elm_genlist_item_item_class_get(lb);
|
|
|
|
|
2012-02-20 00:26:17 -08:00
|
|
|
if (ca == list_itc[ELM_DIRECTORY])
|
2011-06-25 16:39:43 -07:00
|
|
|
{
|
2012-02-20 00:26:17 -08:00
|
|
|
if (cb != list_itc[ELM_DIRECTORY])
|
2011-06-25 16:39:43 -07:00
|
|
|
return -1;
|
|
|
|
}
|
2012-02-20 00:26:17 -08:00
|
|
|
else if (cb == list_itc[ELM_DIRECTORY])
|
2011-09-05 13:30:12 -07:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
2011-06-25 16:39:43 -07:00
|
|
|
|
2013-12-18 03:05:35 -08:00
|
|
|
f = evas_object_data_get(elm_object_item_widget_get(la), "parent");
|
|
|
|
ELM_FILESELECTOR_DATA_GET(f, sd);
|
|
|
|
return sd->sort_method(elm_object_item_data_get(la),
|
|
|
|
elm_object_item_data_get(lb));
|
2011-06-25 16:39:43 -07:00
|
|
|
}
|
|
|
|
|
2012-05-03 15:44:26 -07:00
|
|
|
static void
|
|
|
|
_signal_first(Listing_Request *lreq)
|
2012-05-02 10:01:48 -07:00
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
Elm_Fileselector_Data *sd = lreq->sd;
|
2018-01-26 16:56:31 -08:00
|
|
|
|
2012-05-03 15:44:26 -07:00
|
|
|
if (!lreq->first) return;
|
2015-01-07 02:33:27 -08:00
|
|
|
if (!sd) return;
|
2012-05-03 15:44:26 -07:00
|
|
|
|
2015-01-07 02:33:27 -08:00
|
|
|
if (sd->multi)
|
2013-10-16 19:04:57 -07:00
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
sd->multi_selection = eina_list_free(sd->multi_selection);
|
2013-10-16 19:04:57 -07:00
|
|
|
}
|
|
|
|
|
2019-03-13 10:39:49 -07:00
|
|
|
_model_event_call(lreq->obj, ELM_FILESELECTOR_EVENT_DIRECTORY_OPEN, ELM_FILESELECTOR_EVENT_DIRECTORY_OPEN->name, lreq->model, lreq->path);
|
2012-05-03 15:44:26 -07:00
|
|
|
|
|
|
|
if (!lreq->parent_it)
|
2012-05-02 10:01:48 -07:00
|
|
|
{
|
2015-01-07 02:33:27 -08:00
|
|
|
if (sd->mode == ELM_FILESELECTOR_LIST)
|
|
|
|
elm_genlist_clear(sd->files_view);
|
2013-10-17 22:25:20 -07:00
|
|
|
else
|
2015-01-07 02:33:27 -08:00
|
|
|
elm_gengrid_clear(sd->files_view);
|
2016-06-06 00:16:57 -07:00
|
|
|
_elm_fileselector_replace_model(lreq->obj, sd, lreq->model, lreq->path);
|
2012-05-03 15:44:26 -07:00
|
|
|
_anchors_do(lreq->obj, lreq->path);
|
2012-05-02 10:01:48 -07:00
|
|
|
}
|
|
|
|
|
2012-05-03 15:44:26 -07:00
|
|
|
lreq->first = EINA_FALSE;
|
2011-06-25 16:39:43 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-06-06 00:16:57 -07:00
|
|
|
_process_last(Listing_Request *lreq)
|
|
|
|
{
|
|
|
|
Elm_Fileselector_Data *sd = lreq->sd;
|
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
if (lreq->valid)
|
|
|
|
{
|
|
|
|
elm_progressbar_pulse(sd->spinner, EINA_FALSE);
|
|
|
|
elm_layout_signal_emit(lreq->obj, "elm,action,spinner,hide", "elm");
|
|
|
|
}
|
2016-06-06 00:16:57 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
_listing_request_cleanup(lreq);
|
2016-06-06 00:16:57 -07:00
|
|
|
sd->current_populate_lreq = NULL;
|
|
|
|
}
|
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
static void
|
|
|
|
_listing_request_cleanup(Listing_Request *lreq)
|
|
|
|
{
|
|
|
|
if (!lreq) return ;
|
|
|
|
if (lreq->parent_it)
|
|
|
|
efl_unref(lreq->parent_it);
|
|
|
|
efl_unref(lreq->obj);
|
|
|
|
efl_unref(lreq->model);
|
|
|
|
if (lreq->selected)
|
|
|
|
efl_unref(lreq->selected);
|
|
|
|
eina_stringshare_del(lreq->path);
|
|
|
|
eina_stringshare_del(lreq->selected_path);
|
|
|
|
free(lreq);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_check_again(Eina_Value *fetch)
|
|
|
|
{
|
|
|
|
Eina_Error err = 0;
|
|
|
|
char *str;
|
|
|
|
|
|
|
|
if (eina_value_type_get(fetch) != EINA_VALUE_TYPE_ERROR)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
eina_value_error_get(fetch, &err);
|
|
|
|
if (err == EAGAIN) return EINA_TRUE;
|
|
|
|
|
|
|
|
str = eina_value_to_string(fetch);
|
|
|
|
ERR("Unexpected error: '%s'.", str);
|
|
|
|
free(str);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
static Eina_Bool
|
2018-01-26 16:56:31 -08:00
|
|
|
_fetch_string_value(Efl_Model *child, const char *name, char **str)
|
2011-06-25 16:39:43 -07:00
|
|
|
{
|
2018-01-26 16:56:31 -08:00
|
|
|
Eina_Value *fetch;
|
|
|
|
Eina_Bool r = EINA_FALSE;
|
|
|
|
|
|
|
|
*str = NULL;
|
|
|
|
|
|
|
|
fetch = efl_model_property_get(child, name);
|
|
|
|
if (_check_again(fetch)) goto on_error;
|
|
|
|
|
|
|
|
*str = eina_value_to_string(fetch);
|
|
|
|
r = EINA_TRUE;
|
|
|
|
|
|
|
|
on_error:
|
|
|
|
eina_value_free(fetch);
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_fetch_bool_value(Efl_Model *child, const char *name, Eina_Bool *b)
|
|
|
|
{
|
|
|
|
Eina_Value *fetch;
|
|
|
|
Eina_Bool r = EINA_FALSE;
|
|
|
|
|
|
|
|
fetch = efl_model_property_get(child, name);
|
|
|
|
if (_check_again(fetch)) goto on_error;
|
|
|
|
if (!eina_value_bool_get(fetch, b)) goto on_error;
|
|
|
|
|
|
|
|
r = EINA_TRUE;
|
|
|
|
|
|
|
|
on_error:
|
|
|
|
eina_value_free(fetch);
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_fetch_double_value(Efl_Model *child, const char *name, double *d)
|
|
|
|
{
|
|
|
|
Eina_Value convert = EINA_VALUE_EMPTY;
|
|
|
|
Eina_Value *fetch;
|
|
|
|
Eina_Bool r = EINA_FALSE;
|
|
|
|
|
|
|
|
fetch = efl_model_property_get(child, name);
|
|
|
|
if (_check_again(fetch)) goto on_error;
|
|
|
|
if (!eina_value_setup(&convert, EINA_VALUE_TYPE_DOUBLE))
|
|
|
|
goto on_error;
|
|
|
|
if (!eina_value_convert(fetch, &convert))
|
|
|
|
goto on_error;
|
|
|
|
if (!eina_value_double_get(&convert, d)) goto on_error;
|
|
|
|
|
|
|
|
r = EINA_TRUE;
|
|
|
|
|
|
|
|
on_error:
|
|
|
|
eina_value_flush(&convert);
|
|
|
|
eina_value_free(fetch);
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_fetch_int64_value(Efl_Model *child, const char *name, int64_t *i)
|
|
|
|
{
|
|
|
|
Eina_Value convert = EINA_VALUE_EMPTY;
|
|
|
|
Eina_Value *fetch;
|
|
|
|
Eina_Bool r = EINA_FALSE;
|
|
|
|
|
|
|
|
fetch = efl_model_property_get(child, name);
|
|
|
|
if (_check_again(fetch)) goto on_error;
|
|
|
|
if (!eina_value_setup(&convert, EINA_VALUE_TYPE_INT64))
|
|
|
|
goto on_error;
|
|
|
|
if (!eina_value_convert(fetch, &convert))
|
|
|
|
goto on_error;
|
|
|
|
if (!eina_value_int64_get(&convert, i)) goto on_error;
|
|
|
|
|
|
|
|
r = EINA_TRUE;
|
|
|
|
|
|
|
|
on_error:
|
|
|
|
eina_value_free(fetch);
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_process_model(Elm_Fileselector_Data *sd, Efl_Model *child)
|
|
|
|
{
|
|
|
|
Elm_Fileselector_Item_Data *it_data;
|
2018-05-02 10:20:22 -07:00
|
|
|
Elm_Object_Item *item, *it_parent;
|
2012-05-15 13:02:59 -07:00
|
|
|
int itcn = ELM_FILE_UNKNOW;
|
2018-01-26 16:56:31 -08:00
|
|
|
|
|
|
|
Efl_Model *parent = efl_parent_get(child);
|
|
|
|
char *parent_path = NULL;
|
|
|
|
// FIXME: This could be only needed with ELM_FILESELECTOR_MIME_FILTER
|
|
|
|
char *mime_type = NULL;
|
|
|
|
char *filename = NULL;
|
|
|
|
char *path = NULL;
|
2016-06-06 00:16:57 -07:00
|
|
|
int64_t size = 0;
|
|
|
|
double mtime = 0;
|
|
|
|
Eina_Bool dir = EINA_FALSE;
|
|
|
|
|
2019-03-28 14:09:54 -07:00
|
|
|
// In case we are shutting down, there might be an error being gnerated
|
|
|
|
if (!parent) return ;
|
|
|
|
|
|
|
|
// We should be good now
|
2018-01-26 16:56:31 -08:00
|
|
|
if (!_fetch_string_value(parent, "path", &parent_path) ||
|
|
|
|
!_fetch_string_value(child, "path", &path) ||
|
|
|
|
!_fetch_string_value(child, "filename", &filename) ||
|
|
|
|
!_fetch_string_value(child, "mime_type", &mime_type) ||
|
|
|
|
!_fetch_double_value(child, "mtime", &mtime) ||
|
|
|
|
!_fetch_int64_value(child, "size", &size) ||
|
|
|
|
!_fetch_bool_value(child, "is_dir", &dir))
|
|
|
|
{
|
2019-03-13 14:54:39 -07:00
|
|
|
Eina_Value *check_error = efl_model_property_get(child, "mtime");
|
|
|
|
Eina_Error err = EAGAIN;
|
|
|
|
|
|
|
|
if (eina_value_type_get(check_error) == EINA_VALUE_TYPE_ERROR)
|
|
|
|
{
|
|
|
|
// If the error is different from EAGAIN, we should definitively drop this one.
|
|
|
|
eina_value_error_get(check_error, &err);
|
|
|
|
}
|
2018-01-26 16:56:31 -08:00
|
|
|
// SETUP listener to retry fetching all data when ready
|
2019-03-13 14:54:39 -07:00
|
|
|
if (err == EAGAIN)
|
|
|
|
{
|
2019-03-15 16:56:33 -07:00
|
|
|
efl_event_callback_add(efl_ref(child), EFL_MODEL_EVENT_PROPERTIES_CHANGED, _properties_changed, sd);
|
|
|
|
sd->children = eina_list_append(sd->children, child);
|
2019-03-13 14:54:39 -07:00
|
|
|
}
|
2018-01-26 16:56:31 -08:00
|
|
|
goto cleanup;
|
|
|
|
}
|
2012-05-03 15:44:26 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
if (!path || !filename || !mime_type)
|
2011-06-27 03:26:06 -07:00
|
|
|
{
|
2018-01-26 16:56:31 -08:00
|
|
|
ERR("Wrong file info ('%s', '%s', '%s').", path, filename, mime_type);
|
|
|
|
goto cleanup;
|
2011-06-27 03:26:06 -07:00
|
|
|
}
|
2011-06-25 16:39:43 -07:00
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
if (!_filter_child(sd, path, filename, dir, mime_type))
|
2018-01-26 16:56:31 -08:00
|
|
|
goto cleanup;
|
2016-06-06 00:16:57 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
it_data = calloc(1, sizeof(Elm_Fileselector_Item_Data));
|
|
|
|
if (!it_data)
|
|
|
|
{
|
|
|
|
ERR("Not enough memory.");
|
|
|
|
goto cleanup;
|
|
|
|
}
|
2011-06-25 16:39:43 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
it_data->model = efl_ref(child);
|
2018-05-02 10:20:22 -07:00
|
|
|
it_data->parent_model = parent;
|
2018-01-26 16:56:31 -08:00
|
|
|
it_data->parent_path = eina_stringshare_add(parent_path);
|
2016-06-06 00:16:57 -07:00
|
|
|
it_data->path = eina_stringshare_add(path);
|
|
|
|
it_data->filename = eina_stringshare_add(filename);
|
|
|
|
it_data->size = size;
|
|
|
|
it_data->mtime = mtime;
|
|
|
|
it_data->mime_type = eina_stringshare_add(mime_type);
|
|
|
|
it_data->is_dir = dir;
|
|
|
|
|
2018-05-02 10:20:22 -07:00
|
|
|
it_parent = efl_key_data_get(parent, ".item.data");
|
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
if (dir)
|
|
|
|
{
|
|
|
|
itcn = ELM_DIRECTORY;
|
|
|
|
}
|
2012-05-15 13:02:59 -07:00
|
|
|
else
|
2012-07-25 04:19:59 -07:00
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
if (evas_object_image_extension_can_load_get(it_data->filename))
|
2012-07-25 04:19:59 -07:00
|
|
|
itcn = ELM_FILE_IMAGE;
|
|
|
|
}
|
2012-05-15 13:02:59 -07:00
|
|
|
|
2015-01-07 02:33:27 -08:00
|
|
|
if (sd->mode == ELM_FILESELECTOR_LIST)
|
2018-01-26 16:56:31 -08:00
|
|
|
item = elm_genlist_item_sorted_insert(sd->files_view, list_itc[itcn],
|
|
|
|
it_data,
|
2018-05-02 10:20:22 -07:00
|
|
|
it_parent,
|
2018-01-26 16:56:31 -08:00
|
|
|
(sd->expand && itcn == ELM_DIRECTORY) ? ELM_GENLIST_ITEM_TREE : ELM_GENLIST_ITEM_NONE,
|
|
|
|
_file_list_cmp, NULL, NULL);
|
|
|
|
else
|
|
|
|
item = elm_gengrid_item_sorted_insert(sd->files_view, grid_itc[itcn],
|
|
|
|
it_data,
|
|
|
|
_file_grid_cmp, NULL, NULL);
|
|
|
|
efl_key_data_set(child, ".item.data", item);
|
|
|
|
|
|
|
|
// Is this item selected
|
2019-03-22 10:31:52 -07:00
|
|
|
if (sd->target && sd->target_ready)
|
2013-09-10 02:47:30 -07:00
|
|
|
{
|
efl_model : rename all efl_model based classes.
Summary:
As the result of discussion in T7458,
we need to rename all efl_model based classes with efl_XXX_Model sequence.
I've run few vote for this, see V42, V43
few classes are totally renamed as our consideration of misnaming.
| Efl.Model_Loop | Efl.Loop_Model |
| Efl.Model_Item | Efl.Generic_Model |
| Efl.Model_Container | Efl.Container_Model |
| Efl.Model_Container_Item | Efl.Container_Model_Item |
| Efl.Model_Composite | Efl.Composite_Model |
| Efl.Model_Composite_Boolean | Efl.Boolean_Model |
| Efl.Model_Composite_Boolean_Chlidren | Efl.Boolean_Model_Item |
| Efl.Model_Composite_Selection | Efl.Select_Model |
| Efl.Model_Composite_Selection_Chlidren | Efl.Select_Model_Item |
| Efl.Model_View | Efl.View_Model |
| Eio.Model | Efl.Io.Model |
| Efl.Ui.Model_State | Efl.Ui.State_Model |
| Efl.Ui.Model_Size | Efl.Ui.Size_Model |
| Efl.Ui.Model_Exact | Efl.Ui.Exact_Model |
| Efl.Ui.Model_Average | Efl.Ui.Average_Model |
| Efl.Ui.Model_Homogeneous | Efl.Ui.Homogeneous_Model |
I worried about Efl.Io.Model changes, cause it is widely used,
but as I tested, there is no issue found yet.
Eldbus.Model also may can changed Efl.Dbus.Model,
but I cannot found any class who using Efl.Dbus namespace,
so I left it future work.
Test Plan:
Run the Make Test,
it works well except Efl test about selection.
there are class inheritance problem exist in select_model,
I reported it and will fix it in another patch.
Reviewers: cedric, felipealmeida, woohyun, Hermet
Reviewed By: cedric
Subscribers: lauromoura
Tags: #efl, #do_not_merge
Differential Revision: https://phab.enlightenment.org/D7533
2019-01-30 20:35:34 -08:00
|
|
|
const char *target_path = efl_io_model_path_get(sd->target);
|
2013-09-10 02:47:30 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
if (!strcmp(it_data->path, target_path))
|
2013-09-25 07:43:22 -07:00
|
|
|
{
|
|
|
|
elm_genlist_item_selected_set(item, EINA_TRUE);
|
2016-06-06 00:16:57 -07:00
|
|
|
elm_object_text_set(sd->name_entry, it_data->filename);
|
2013-09-10 02:47:30 -07:00
|
|
|
|
2018-05-23 20:24:21 -07:00
|
|
|
_reset_target(sd);
|
2013-09-25 07:43:22 -07:00
|
|
|
}
|
2013-09-10 02:47:30 -07:00
|
|
|
}
|
2016-06-06 00:16:57 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
cleanup:
|
|
|
|
free(mime_type);
|
|
|
|
free(filename);
|
|
|
|
free(path);
|
|
|
|
free(parent_path);
|
2016-06-06 00:16:57 -07:00
|
|
|
}
|
|
|
|
|
2011-06-25 16:39:43 -07:00
|
|
|
static void
|
2018-01-26 16:56:31 -08:00
|
|
|
_properties_changed(void *data, const Efl_Event *ev)
|
2011-06-25 16:39:43 -07:00
|
|
|
{
|
2018-01-26 16:56:31 -08:00
|
|
|
Elm_Fileselector_Data *sd = data;
|
|
|
|
Efl_Model *child = ev->object;
|
|
|
|
|
2019-03-15 16:56:33 -07:00
|
|
|
sd->children = eina_list_remove(sd->children, child);
|
|
|
|
efl_event_callback_del(child, EFL_MODEL_EVENT_PROPERTIES_CHANGED, _properties_changed, sd);
|
2018-01-26 16:56:31 -08:00
|
|
|
_process_model(sd, child);
|
|
|
|
efl_unref(child);
|
2011-06-25 16:39:43 -07:00
|
|
|
}
|
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
static Eina_Value
|
|
|
|
_process_children_cb(void *data, const Eina_Value v, const Eina_Future *dead_future EINA_UNUSED)
|
2011-06-25 16:39:43 -07:00
|
|
|
{
|
2012-05-03 15:44:26 -07:00
|
|
|
Listing_Request *lreq = data;
|
2018-01-26 16:56:31 -08:00
|
|
|
Efl_Model *child = NULL;
|
|
|
|
unsigned int i, len;
|
2016-08-24 15:43:51 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
if (eina_value_type_get(&v) == EINA_VALUE_TYPE_ERROR)
|
|
|
|
goto end;
|
2016-08-24 15:43:51 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
if (!lreq->valid) goto end;
|
2016-06-06 00:16:57 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
EINA_VALUE_ARRAY_FOREACH(&v, len, i, child)
|
|
|
|
_process_model(lreq->sd, child);
|
2016-08-24 15:43:51 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
lreq->item_total = len;
|
2011-06-25 16:39:43 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
_signal_first(lreq);
|
2016-06-06 00:16:57 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
end:
|
|
|
|
_process_last(lreq);
|
2011-06-25 16:39:43 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
return v;
|
2011-06-25 16:39:43 -07:00
|
|
|
}
|
|
|
|
|
2009-08-12 09:08:53 -07:00
|
|
|
static void
|
2012-05-03 15:44:26 -07:00
|
|
|
_populate(Evas_Object *obj,
|
2016-06-06 00:16:57 -07:00
|
|
|
Efl_Model *model,
|
2013-09-10 02:47:30 -07:00
|
|
|
Elm_Object_Item *parent_it,
|
2016-06-06 00:16:57 -07:00
|
|
|
Efl_Model *selected)
|
2009-08-12 09:08:53 -07:00
|
|
|
{
|
2012-05-03 15:44:26 -07:00
|
|
|
ELM_FILESELECTOR_DATA_GET(obj, sd);
|
|
|
|
Listing_Request *lreq;
|
2018-01-26 16:56:31 -08:00
|
|
|
Eina_Future *future;
|
|
|
|
Eina_Value *fetch;
|
|
|
|
char *string;
|
|
|
|
|
|
|
|
if (!model) return;
|
2009-08-12 15:43:50 -07:00
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
if (sd->expand && sd->current_populate_lreq)
|
|
|
|
return;
|
2012-05-03 15:44:26 -07:00
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
if (sd->current_populate_lreq)
|
|
|
|
{
|
|
|
|
sd->current_populate_lreq->valid = EINA_FALSE;
|
|
|
|
sd->current_populate_lreq = NULL;
|
|
|
|
}
|
2012-05-03 15:44:26 -07:00
|
|
|
|
2018-05-04 16:15:18 -07:00
|
|
|
if (sd->monitoring)
|
2016-06-17 12:40:49 -07:00
|
|
|
_monitoring_stop(obj, sd, sd->model);
|
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
lreq = calloc(1, sizeof (Listing_Request));
|
2012-05-03 15:44:26 -07:00
|
|
|
if (!lreq) return;
|
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
lreq->sd = sd;
|
2016-08-15 06:44:41 -07:00
|
|
|
lreq->parent_it = (parent_it ? efl_ref(parent_it) : NULL);
|
|
|
|
lreq->obj = efl_ref(obj);
|
|
|
|
lreq->model = efl_ref(model);
|
|
|
|
lreq->selected = (selected ? efl_ref(selected) : NULL);
|
2016-06-06 00:16:57 -07:00
|
|
|
lreq->path = NULL;
|
|
|
|
lreq->selected_path = NULL;
|
|
|
|
lreq->item_total = 0;
|
|
|
|
lreq->item_processed_count = 0;
|
2012-05-03 15:44:26 -07:00
|
|
|
lreq->first = EINA_TRUE;
|
2016-06-06 00:16:57 -07:00
|
|
|
lreq->valid = EINA_TRUE;
|
2012-05-03 15:44:26 -07:00
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
sd->current_populate_lreq = lreq;
|
2013-09-10 02:47:30 -07:00
|
|
|
|
2012-05-16 12:40:47 -07:00
|
|
|
elm_progressbar_pulse(sd->spinner, EINA_TRUE);
|
|
|
|
elm_layout_signal_emit(lreq->obj, "elm,action,spinner,show", "elm");
|
2014-10-05 16:08:24 -07:00
|
|
|
|
|
|
|
// Clear name entry not in case of save mode.
|
|
|
|
if (elm_object_disabled_get(sd->name_entry))
|
|
|
|
elm_object_text_set(sd->name_entry, "");
|
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
fetch = efl_model_property_get(model, "path");
|
|
|
|
string = eina_value_to_string(fetch);
|
|
|
|
lreq->path = eina_stringshare_add(string);
|
|
|
|
eina_value_free(fetch);
|
|
|
|
free(string);
|
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
if (selected)
|
2018-01-26 16:56:31 -08:00
|
|
|
{
|
|
|
|
fetch = efl_model_property_get(selected, "path");
|
2018-05-10 16:45:15 -07:00
|
|
|
string = eina_value_to_string(fetch);
|
|
|
|
lreq->selected_path = eina_stringshare_add(string);
|
|
|
|
eina_value_free(fetch);
|
|
|
|
free(string);
|
2018-01-26 16:56:31 -08:00
|
|
|
}
|
2016-06-06 00:16:57 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
_signal_first(lreq);
|
2018-05-10 16:45:15 -07:00
|
|
|
|
|
|
|
if (efl_model_children_count_get(model))
|
|
|
|
{
|
|
|
|
future = efl_model_children_slice_get(model, 0, efl_model_children_count_get(model));
|
2018-11-07 06:52:41 -08:00
|
|
|
future = eina_future_then(future, _process_children_cb, lreq, NULL);
|
2018-11-21 17:33:10 -08:00
|
|
|
efl_future_then(obj, future);
|
2018-05-10 16:45:15 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_process_last(lreq);
|
|
|
|
}
|
2009-08-12 09:08:53 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_on_list_expanded(void *data, const Efl_Event *event)
|
2012-05-03 15:44:26 -07:00
|
|
|
{
|
2016-04-12 07:23:55 -07:00
|
|
|
Elm_Object_Item *it = event->info;
|
2016-06-06 00:16:57 -07:00
|
|
|
const Elm_Fileselector_Item_Data *it_data = elm_object_item_data_get(it);
|
2012-05-03 15:44:26 -07:00
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
_populate(data, it_data->model, it, NULL);
|
2012-05-03 15:44:26 -07:00
|
|
|
}
|
2010-09-07 20:54:42 -07:00
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_on_list_contracted(void *data EINA_UNUSED, const Efl_Event *event)
|
2012-05-02 10:01:48 -07:00
|
|
|
{
|
2016-04-12 07:23:55 -07:00
|
|
|
Elm_Object_Item *it = event->info;
|
2012-05-03 15:44:26 -07:00
|
|
|
|
|
|
|
elm_genlist_item_subitems_clear(it);
|
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_on_list_expand_req(void *data EINA_UNUSED, const Efl_Event *event)
|
2012-05-03 15:44:26 -07:00
|
|
|
{
|
2016-04-12 07:23:55 -07:00
|
|
|
Elm_Object_Item *it = event->info;
|
2012-05-03 15:44:26 -07:00
|
|
|
|
|
|
|
elm_genlist_item_expanded_set(it, EINA_TRUE);
|
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_on_list_contract_req(void *data EINA_UNUSED, const Efl_Event *event)
|
2012-05-03 15:44:26 -07:00
|
|
|
{
|
2016-04-12 07:23:55 -07:00
|
|
|
Elm_Object_Item *it = event->info;
|
2012-05-03 15:44:26 -07:00
|
|
|
|
|
|
|
elm_genlist_item_expanded_set(it, EINA_FALSE);
|
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_on_item_activated(void *data, const Efl_Event *event)
|
2013-09-30 08:49:50 -07:00
|
|
|
{
|
|
|
|
//This event_info could be a list or gengrid item
|
2016-04-12 07:23:55 -07:00
|
|
|
Elm_Object_Item *it = event->info;
|
2016-06-06 00:16:57 -07:00
|
|
|
const Elm_Fileselector_Item_Data *it_data;
|
2013-09-30 08:49:50 -07:00
|
|
|
|
|
|
|
ELM_FILESELECTOR_DATA_GET(data, sd);
|
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
it_data = elm_object_item_data_get(it);
|
2016-06-20 07:31:31 -07:00
|
|
|
if (!it_data) return;
|
2013-09-30 08:49:50 -07:00
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
if (!it_data->is_dir)
|
2014-01-09 15:24:22 -08:00
|
|
|
{
|
2019-03-13 10:39:49 -07:00
|
|
|
_model_event_call(data, ELM_FILESELECTOR_EVENT_ACTIVATED, ELM_FILESELECTOR_EVENT_ACTIVATED->name, it_data->model, it_data->path);
|
2016-06-20 07:31:31 -07:00
|
|
|
return;
|
2014-01-09 15:24:22 -08:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
if (!sd->double_tap_navigation) return;
|
2013-09-30 08:49:50 -07:00
|
|
|
|
2019-03-22 11:20:51 -07:00
|
|
|
efl_parent_set(it_data->model, data);
|
2019-03-27 15:19:32 -07:00
|
|
|
_populate(data, it_data->model, NULL, NULL);
|
2013-09-30 08:49:50 -07:00
|
|
|
}
|
|
|
|
|
2013-10-16 19:04:57 -07:00
|
|
|
static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_clear_selections(Elm_Fileselector_Data *sd, Elm_Object_Item *last_selected)
|
2013-10-16 19:04:57 -07:00
|
|
|
{
|
|
|
|
Eina_List *items;
|
|
|
|
Elm_Object_Item *sel;
|
|
|
|
|
|
|
|
if (sd->mode == ELM_FILESELECTOR_LIST)
|
|
|
|
{
|
2013-10-17 22:25:20 -07:00
|
|
|
items = eina_list_clone(elm_genlist_selected_items_get(sd->files_view));
|
2013-10-16 19:04:57 -07:00
|
|
|
|
|
|
|
EINA_LIST_FREE(items, sel)
|
|
|
|
{
|
|
|
|
if (sel == last_selected) continue;
|
|
|
|
elm_genlist_item_selected_set(sel, EINA_FALSE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (sd->mode == ELM_FILESELECTOR_GRID)
|
|
|
|
{
|
2013-10-17 22:25:20 -07:00
|
|
|
items = eina_list_clone(elm_gengrid_selected_items_get(sd->files_view));
|
2013-10-16 19:04:57 -07:00
|
|
|
|
|
|
|
EINA_LIST_FREE(items, sel)
|
|
|
|
{
|
|
|
|
if (sel == last_selected) continue;
|
|
|
|
elm_gengrid_item_selected_set(sel, EINA_FALSE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
elc_filselector: solve the mysterium of sometimes failing tests
so after a phone call, two days of debugging, tears, crying etc. etc. we
finally came to a point of enlightenment! *Someone* (bu5hm4n) moved
gengrid and genlist events from eo back to smart events, so we can work
arround legacy borks and event-name collisions, at this point he did not
knew that some widgets (fileselector) already relied on those *lovely*
events. Hence this broke theoretically the testsuite, however, the
fileselector testsuite is ultimatily buggy, and the wait function does
not return false when it timeouts, (i don't know why not). So this break
was never discovered.
Additionally there is a second issue. it appears, that when we
immidiatly quit the mainloop after we have got the selected callback,
that then genlist decides to forget about the sd->selected pointer, and
NULLs that one out. Which then results in the fact that
elm_fileselector_selected_get ends up returning invalid paths.
Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D8488
2019-03-27 13:15:53 -07:00
|
|
|
_on_item_selected(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
2012-05-03 15:44:26 -07:00
|
|
|
{
|
|
|
|
//This event_info could be a list or gengrid item
|
elc_filselector: solve the mysterium of sometimes failing tests
so after a phone call, two days of debugging, tears, crying etc. etc. we
finally came to a point of enlightenment! *Someone* (bu5hm4n) moved
gengrid and genlist events from eo back to smart events, so we can work
arround legacy borks and event-name collisions, at this point he did not
knew that some widgets (fileselector) already relied on those *lovely*
events. Hence this broke theoretically the testsuite, however, the
fileselector testsuite is ultimatily buggy, and the wait function does
not return false when it timeouts, (i don't know why not). So this break
was never discovered.
Additionally there is a second issue. it appears, that when we
immidiatly quit the mainloop after we have got the selected callback,
that then genlist decides to forget about the sd->selected pointer, and
NULLs that one out. Which then results in the fact that
elm_fileselector_selected_get ends up returning invalid paths.
Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D8488
2019-03-27 13:15:53 -07:00
|
|
|
Elm_Object_Item *it = event_info;
|
2016-06-06 00:16:57 -07:00
|
|
|
Elm_Fileselector_Item_Data *it_data = NULL;
|
2012-05-03 15:44:26 -07:00
|
|
|
|
|
|
|
ELM_FILESELECTOR_DATA_GET(data, sd);
|
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
it_data = elm_object_item_data_get(it);
|
2016-06-20 07:31:31 -07:00
|
|
|
if (!it_data) return;
|
2013-09-30 08:49:50 -07:00
|
|
|
|
|
|
|
/* We need to send callback when:
|
|
|
|
* - path is dir and mode is ONLY FOLDER
|
|
|
|
* - path is file and mode is NOT ONLY FOLDER */
|
2016-06-06 00:16:57 -07:00
|
|
|
if (it_data->is_dir == sd->only_folder)
|
2012-05-03 15:44:26 -07:00
|
|
|
{
|
2013-10-16 19:04:57 -07:00
|
|
|
if (sd->multi)
|
|
|
|
{
|
|
|
|
Eina_List *li;
|
2016-06-06 00:16:57 -07:00
|
|
|
Elm_Object_Item *it2;
|
2013-10-16 19:04:57 -07:00
|
|
|
Eina_Strbuf *buf;
|
|
|
|
|
|
|
|
if (sd->dir_selected)
|
|
|
|
{
|
|
|
|
_clear_selections(sd, it);
|
|
|
|
sd->dir_selected = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
buf = eina_strbuf_new();
|
2016-06-06 00:16:57 -07:00
|
|
|
EINA_LIST_FOREACH(sd->multi_selection, li, it2)
|
2013-10-16 19:04:57 -07:00
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
Elm_Fileselector_Item_Data *it2_data = elm_object_item_data_get(it2);
|
|
|
|
eina_strbuf_append(buf, it2_data->filename);
|
2013-10-16 19:04:57 -07:00
|
|
|
eina_strbuf_append_length(buf, ", ", 2);
|
|
|
|
}
|
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
sd->multi_selection = eina_list_append(sd->multi_selection, it);
|
|
|
|
eina_strbuf_append(buf, it_data->filename);
|
2013-10-16 19:04:57 -07:00
|
|
|
|
|
|
|
elm_object_text_set(sd->name_entry, eina_strbuf_string_get(buf));
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
}
|
|
|
|
else
|
2016-06-06 00:16:57 -07:00
|
|
|
elm_object_text_set(sd->name_entry, it_data->filename);
|
2013-10-16 19:04:57 -07:00
|
|
|
|
2019-03-13 10:39:49 -07:00
|
|
|
_model_event_call(data, EFL_UI_EVENT_ITEM_SELECTED, "selected", it_data->model, it_data->path);
|
2013-09-30 08:49:50 -07:00
|
|
|
}
|
2016-06-06 00:16:57 -07:00
|
|
|
else if (sd->multi && it_data->is_dir && sd->double_tap_navigation)
|
2013-10-16 19:04:57 -07:00
|
|
|
{
|
2014-10-05 16:08:24 -07:00
|
|
|
_clear_selections(sd, it);
|
|
|
|
sd->dir_selected = EINA_TRUE;
|
2013-10-16 19:04:57 -07:00
|
|
|
}
|
2013-09-30 08:49:50 -07:00
|
|
|
|
|
|
|
/* We need to populate, if path is directory and:
|
|
|
|
* - mode is GRID;
|
|
|
|
* - mode is LIST and 'not expand mode';
|
|
|
|
* in other cases update anchors. */
|
2012-05-03 15:44:26 -07:00
|
|
|
|
2013-09-30 08:49:50 -07:00
|
|
|
if (sd->expand && sd->mode == ELM_FILESELECTOR_LIST)
|
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
if (!it_data->is_dir)
|
|
|
|
{
|
|
|
|
_elm_fileselector_replace_model(data, sd, it_data->parent_model, it_data->parent_path);
|
|
|
|
_anchors_do(data, it_data->parent_path);
|
2016-06-20 07:31:31 -07:00
|
|
|
return;
|
2016-06-06 00:16:57 -07:00
|
|
|
}
|
2013-09-30 08:49:50 -07:00
|
|
|
if (sd->only_folder)
|
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
_elm_fileselector_replace_model(data, sd, it_data->parent_model, it_data->parent_path);
|
|
|
|
_anchors_do(data, it_data->parent_path);
|
2013-09-30 08:49:50 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
_elm_fileselector_replace_model(data, sd, it_data->model, it_data->path);
|
|
|
|
_anchors_do(data, it_data->path);
|
2013-09-30 08:49:50 -07:00
|
|
|
}
|
2016-06-06 00:16:57 -07:00
|
|
|
// Clear name entry not in case of save mode.
|
|
|
|
if (elm_object_disabled_get(sd->name_entry))
|
|
|
|
elm_object_text_set(sd->name_entry, "");
|
2016-06-20 07:31:31 -07:00
|
|
|
return;
|
2012-05-03 15:44:26 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
if (!it_data->is_dir) return;
|
2016-06-06 00:16:57 -07:00
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
if (sd->double_tap_navigation) return;
|
2013-09-30 08:49:50 -07:00
|
|
|
|
2019-03-27 15:19:32 -07:00
|
|
|
_populate(data, it_data->model, NULL, NULL);
|
2012-05-03 15:44:26 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
elc_filselector: solve the mysterium of sometimes failing tests
so after a phone call, two days of debugging, tears, crying etc. etc. we
finally came to a point of enlightenment! *Someone* (bu5hm4n) moved
gengrid and genlist events from eo back to smart events, so we can work
arround legacy borks and event-name collisions, at this point he did not
knew that some widgets (fileselector) already relied on those *lovely*
events. Hence this broke theoretically the testsuite, however, the
fileselector testsuite is ultimatily buggy, and the wait function does
not return false when it timeouts, (i don't know why not). So this break
was never discovered.
Additionally there is a second issue. it appears, that when we
immidiatly quit the mainloop after we have got the selected callback,
that then genlist decides to forget about the sd->selected pointer, and
NULLs that one out. Which then results in the fact that
elm_fileselector_selected_get ends up returning invalid paths.
Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D8488
2019-03-27 13:15:53 -07:00
|
|
|
_on_item_unselected(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
2013-10-16 19:04:57 -07:00
|
|
|
{
|
|
|
|
Eina_List *li, *l;
|
2016-06-06 00:16:57 -07:00
|
|
|
const Elm_Fileselector_Item_Data *it_data;
|
2013-10-16 19:04:57 -07:00
|
|
|
Eina_Strbuf *buf;
|
elc_filselector: solve the mysterium of sometimes failing tests
so after a phone call, two days of debugging, tears, crying etc. etc. we
finally came to a point of enlightenment! *Someone* (bu5hm4n) moved
gengrid and genlist events from eo back to smart events, so we can work
arround legacy borks and event-name collisions, at this point he did not
knew that some widgets (fileselector) already relied on those *lovely*
events. Hence this broke theoretically the testsuite, however, the
fileselector testsuite is ultimatily buggy, and the wait function does
not return false when it timeouts, (i don't know why not). So this break
was never discovered.
Additionally there is a second issue. it appears, that when we
immidiatly quit the mainloop after we have got the selected callback,
that then genlist decides to forget about the sd->selected pointer, and
NULLs that one out. Which then results in the fact that
elm_fileselector_selected_get ends up returning invalid paths.
Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D8488
2019-03-27 13:15:53 -07:00
|
|
|
Elm_Object_Item *it = event_info;
|
2016-06-06 00:16:57 -07:00
|
|
|
Elm_Object_Item *it2 = NULL;
|
2013-10-16 19:04:57 -07:00
|
|
|
Eina_Bool first = EINA_TRUE;
|
|
|
|
|
|
|
|
ELM_FILESELECTOR_DATA_GET(data, sd);
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
if (!sd->multi) return;
|
2013-10-16 19:04:57 -07:00
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
it_data = elm_object_item_data_get(it);
|
2016-06-20 07:31:31 -07:00
|
|
|
if (!it_data) return;
|
2013-10-16 19:04:57 -07:00
|
|
|
|
|
|
|
buf = eina_strbuf_new();
|
2016-06-06 00:16:57 -07:00
|
|
|
EINA_LIST_FOREACH_SAFE(sd->multi_selection, li, l, it2)
|
2013-10-16 19:04:57 -07:00
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
if (it2 == it)
|
2013-10-16 19:04:57 -07:00
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
sd->multi_selection = eina_list_remove_list(sd->multi_selection, li);
|
2013-10-16 19:04:57 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
Elm_Fileselector_Item_Data *it2_data = elm_object_item_data_get(it2);
|
|
|
|
if (!it2_data)
|
|
|
|
continue;
|
2013-10-16 19:04:57 -07:00
|
|
|
if (!first)
|
|
|
|
eina_strbuf_append_length(buf, ", ", 2);
|
|
|
|
else
|
|
|
|
first = EINA_FALSE;
|
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
eina_strbuf_append(buf, it2_data->path);
|
2013-10-16 19:04:57 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
elm_object_text_set(sd->name_entry, eina_strbuf_string_get(buf));
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_on_dir_up(void *data, const Efl_Event *event EINA_UNUSED)
|
2012-05-03 15:44:26 -07:00
|
|
|
{
|
|
|
|
Evas_Object *fs = data;
|
2016-06-06 00:16:57 -07:00
|
|
|
Efl_Model *parent = NULL;
|
2012-05-03 15:44:26 -07:00
|
|
|
|
|
|
|
ELM_FILESELECTOR_DATA_GET(fs, sd);
|
|
|
|
|
2016-08-10 07:23:04 -07:00
|
|
|
parent = efl_parent_get(sd->model);
|
2018-01-26 16:56:31 -08:00
|
|
|
if (!parent) return;
|
|
|
|
|
efl_model : rename all efl_model based classes.
Summary:
As the result of discussion in T7458,
we need to rename all efl_model based classes with efl_XXX_Model sequence.
I've run few vote for this, see V42, V43
few classes are totally renamed as our consideration of misnaming.
| Efl.Model_Loop | Efl.Loop_Model |
| Efl.Model_Item | Efl.Generic_Model |
| Efl.Model_Container | Efl.Container_Model |
| Efl.Model_Container_Item | Efl.Container_Model_Item |
| Efl.Model_Composite | Efl.Composite_Model |
| Efl.Model_Composite_Boolean | Efl.Boolean_Model |
| Efl.Model_Composite_Boolean_Chlidren | Efl.Boolean_Model_Item |
| Efl.Model_Composite_Selection | Efl.Select_Model |
| Efl.Model_Composite_Selection_Chlidren | Efl.Select_Model_Item |
| Efl.Model_View | Efl.View_Model |
| Eio.Model | Efl.Io.Model |
| Efl.Ui.Model_State | Efl.Ui.State_Model |
| Efl.Ui.Model_Size | Efl.Ui.Size_Model |
| Efl.Ui.Model_Exact | Efl.Ui.Exact_Model |
| Efl.Ui.Model_Average | Efl.Ui.Average_Model |
| Efl.Ui.Model_Homogeneous | Efl.Ui.Homogeneous_Model |
I worried about Efl.Io.Model changes, cause it is widely used,
but as I tested, there is no issue found yet.
Eldbus.Model also may can changed Efl.Dbus.Model,
but I cannot found any class who using Efl.Dbus namespace,
so I left it future work.
Test Plan:
Run the Make Test,
it works well except Efl test about selection.
there are class inheritance problem exist in select_model,
I reported it and will fix it in another patch.
Reviewers: cedric, felipealmeida, woohyun, Hermet
Reviewed By: cedric
Subscribers: lauromoura
Tags: #efl, #do_not_merge
Differential Revision: https://phab.enlightenment.org/D7533
2019-01-30 20:35:34 -08:00
|
|
|
if (!efl_isa(parent, EFL_IO_MODEL_CLASS))
|
2018-01-26 16:56:31 -08:00
|
|
|
{
|
efl_model : rename all efl_model based classes.
Summary:
As the result of discussion in T7458,
we need to rename all efl_model based classes with efl_XXX_Model sequence.
I've run few vote for this, see V42, V43
few classes are totally renamed as our consideration of misnaming.
| Efl.Model_Loop | Efl.Loop_Model |
| Efl.Model_Item | Efl.Generic_Model |
| Efl.Model_Container | Efl.Container_Model |
| Efl.Model_Container_Item | Efl.Container_Model_Item |
| Efl.Model_Composite | Efl.Composite_Model |
| Efl.Model_Composite_Boolean | Efl.Boolean_Model |
| Efl.Model_Composite_Boolean_Chlidren | Efl.Boolean_Model_Item |
| Efl.Model_Composite_Selection | Efl.Select_Model |
| Efl.Model_Composite_Selection_Chlidren | Efl.Select_Model_Item |
| Efl.Model_View | Efl.View_Model |
| Eio.Model | Efl.Io.Model |
| Efl.Ui.Model_State | Efl.Ui.State_Model |
| Efl.Ui.Model_Size | Efl.Ui.Size_Model |
| Efl.Ui.Model_Exact | Efl.Ui.Exact_Model |
| Efl.Ui.Model_Average | Efl.Ui.Average_Model |
| Efl.Ui.Model_Homogeneous | Efl.Ui.Homogeneous_Model |
I worried about Efl.Io.Model changes, cause it is widely used,
but as I tested, there is no issue found yet.
Eldbus.Model also may can changed Efl.Dbus.Model,
but I cannot found any class who using Efl.Dbus namespace,
so I left it future work.
Test Plan:
Run the Make Test,
it works well except Efl test about selection.
there are class inheritance problem exist in select_model,
I reported it and will fix it in another patch.
Reviewers: cedric, felipealmeida, woohyun, Hermet
Reviewed By: cedric
Subscribers: lauromoura
Tags: #efl, #do_not_merge
Differential Revision: https://phab.enlightenment.org/D7533
2019-01-30 20:35:34 -08:00
|
|
|
const char *path = efl_io_model_path_get(sd->model);
|
2018-01-26 16:56:31 -08:00
|
|
|
char dir[PATH_MAX] = "";
|
|
|
|
char *r;
|
|
|
|
|
|
|
|
eina_strlcpy(dir, path, sizeof (dir));
|
|
|
|
r = dirname(dir);
|
|
|
|
|
|
|
|
// In case we have reached '/'
|
|
|
|
if (!strcmp(r, path)) return ;
|
|
|
|
|
|
|
|
elm_fileselector_path_set(fs, r);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_populate(fs, parent, NULL, NULL);
|
|
|
|
}
|
2012-05-03 15:44:26 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2018-01-26 16:56:31 -08:00
|
|
|
_home(void *data, const Efl_Event *event EINA_UNUSED)
|
2012-05-03 15:44:26 -07:00
|
|
|
{
|
|
|
|
Evas_Object *fs = data;
|
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
// FIXME: maybe use vpath
|
2018-01-26 16:56:31 -08:00
|
|
|
elm_fileselector_path_set(fs, eina_environment_home_get());
|
2012-05-03 15:44:26 -07:00
|
|
|
}
|
|
|
|
|
2013-06-18 17:00:41 -07:00
|
|
|
static void
|
2013-12-26 04:08:33 -08:00
|
|
|
_current_filter_changed(void *data,
|
|
|
|
Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *event_info EINA_UNUSED)
|
2013-06-18 17:00:41 -07:00
|
|
|
{
|
|
|
|
Elm_Fileselector_Filter *filter = data;
|
|
|
|
|
|
|
|
if (filter->sd->current_filter == filter) return;
|
|
|
|
|
|
|
|
elm_object_text_set(obj, filter->filter_name);
|
|
|
|
filter->sd->current_filter = filter;
|
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
_populate(filter->sd->obj, filter->sd->model, NULL, NULL);
|
2013-06-18 17:00:41 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2019-03-22 11:20:51 -07:00
|
|
|
_ok(void *data, const Efl_Event *event EINA_UNUSED)
|
2012-05-03 15:44:26 -07:00
|
|
|
{
|
2013-09-25 07:43:22 -07:00
|
|
|
const char *name;
|
|
|
|
const char *selection = NULL;
|
2012-05-03 15:44:26 -07:00
|
|
|
Evas_Object *fs = data;
|
2013-09-25 07:43:22 -07:00
|
|
|
ELM_FILESELECTOR_DATA_GET(fs, sd);
|
2012-05-03 15:44:26 -07:00
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
if (!sd->model || !sd->path)
|
2013-09-25 07:43:22 -07:00
|
|
|
{
|
2019-03-13 10:39:49 -07:00
|
|
|
_model_event_call(fs, ELM_FILESELECTOR_EVENT_DONE, ELM_FILESELECTOR_EVENT_DONE->name, NULL, NULL);
|
2016-06-20 07:31:31 -07:00
|
|
|
return;
|
2013-09-25 07:43:22 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
name = elm_object_text_get(sd->name_entry);
|
|
|
|
if (name && name[0] != '\0')
|
2014-01-29 06:08:55 -08:00
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
Efl_Model *selected_model = NULL;
|
2014-01-29 06:08:55 -08:00
|
|
|
int len = eina_stringshare_strlen(sd->path);
|
|
|
|
if (sd->path[len - 1] == '/')
|
|
|
|
selection = eina_stringshare_printf("%s%s", sd->path, name);
|
|
|
|
else
|
|
|
|
selection = eina_stringshare_printf("%s/%s", sd->path, name);
|
2016-06-06 00:16:57 -07:00
|
|
|
|
2019-03-22 11:20:51 -07:00
|
|
|
selected_model = efl_add_ref(efl_class_get(sd->model), fs,
|
2019-03-13 14:54:39 -07:00
|
|
|
efl_event_callback_array_add(efl_added, noref_death(), NULL),
|
|
|
|
efl_io_model_path_set(efl_added, selection));
|
2016-06-06 00:16:57 -07:00
|
|
|
|
2019-03-13 10:39:49 -07:00
|
|
|
_model_event_call(fs, ELM_FILESELECTOR_EVENT_DONE, ELM_FILESELECTOR_EVENT_DONE->name, selected_model, selection);
|
2016-06-06 00:16:57 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_unref(selected_model);
|
2016-06-06 00:16:57 -07:00
|
|
|
eina_stringshare_del(selection);
|
2014-01-29 06:08:55 -08:00
|
|
|
}
|
2013-09-25 07:43:22 -07:00
|
|
|
else
|
2016-06-06 00:16:57 -07:00
|
|
|
{
|
|
|
|
Elm_Fileselector_Item_Data *it_data = _selected_item_data_get(sd);
|
|
|
|
if (it_data)
|
|
|
|
{
|
2019-03-13 10:39:49 -07:00
|
|
|
_model_event_call(fs, ELM_FILESELECTOR_EVENT_DONE, ELM_FILESELECTOR_EVENT_DONE->name, it_data->model, it_data->path);
|
2016-08-22 17:59:10 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-03-13 10:39:49 -07:00
|
|
|
_model_event_call(fs, ELM_FILESELECTOR_EVENT_DONE, ELM_FILESELECTOR_EVENT_DONE->name, sd->model, sd->path);
|
2016-06-06 00:16:57 -07:00
|
|
|
}
|
|
|
|
}
|
2012-05-03 15:44:26 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_canc(void *data, const Efl_Event *event EINA_UNUSED)
|
2012-05-03 15:44:26 -07:00
|
|
|
{
|
|
|
|
Evas_Object *fs = data;
|
|
|
|
|
2019-03-13 10:39:49 -07:00
|
|
|
_model_event_call(fs, ELM_FILESELECTOR_EVENT_DONE, ELM_FILESELECTOR_EVENT_DONE->name, NULL, NULL);
|
2012-05-03 15:44:26 -07:00
|
|
|
}
|
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
static void
|
2019-03-21 15:04:46 -07:00
|
|
|
_on_text_activated(void *data, const Efl_Event *event)
|
2016-06-06 00:16:57 -07:00
|
|
|
{
|
|
|
|
Evas_Object *fs = data;
|
2019-03-21 15:04:46 -07:00
|
|
|
const char *path;
|
|
|
|
Efl_Model *model = NULL, *parent;
|
2018-01-26 16:56:31 -08:00
|
|
|
Eina_Bool dir = EINA_FALSE;
|
2019-03-21 15:04:46 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
ELM_FILESELECTOR_DATA_GET(fs, sd);
|
|
|
|
|
2019-03-21 15:04:46 -07:00
|
|
|
if (!sd->model) return;
|
2013-09-10 02:47:30 -07:00
|
|
|
|
2019-03-21 15:04:46 -07:00
|
|
|
path = elm_widget_part_text_get(event->object, NULL);
|
|
|
|
if (!ecore_file_exists(path))
|
2013-09-10 02:47:30 -07:00
|
|
|
{
|
2019-03-21 15:04:46 -07:00
|
|
|
_model_event_call(fs, ELM_FILESELECTOR_EVENT_SELECTED_INVALID,
|
|
|
|
ELM_FILESELECTOR_EVENT_SELECTED_INVALID->name, NULL, path);
|
2013-09-10 02:47:30 -07:00
|
|
|
|
2019-03-21 15:04:46 -07:00
|
|
|
elm_widget_part_text_set(event->object, NULL, efl_io_model_path_get(sd->model));
|
|
|
|
goto end;
|
|
|
|
}
|
2013-09-12 06:17:07 -07:00
|
|
|
|
2019-03-21 15:04:46 -07:00
|
|
|
if (!ecore_file_is_dir(path))
|
2018-01-26 16:56:31 -08:00
|
|
|
{
|
2019-03-22 11:20:51 -07:00
|
|
|
model = efl_add_ref(efl_class_get(sd->model), fs,
|
2019-03-21 15:04:46 -07:00
|
|
|
efl_io_model_path_set(efl_added, path),
|
|
|
|
efl_event_callback_array_add(efl_added, noref_death(), NULL));
|
2018-01-26 16:56:31 -08:00
|
|
|
|
2019-03-21 15:04:46 -07:00
|
|
|
path = eina_slstr_steal_new(ecore_file_dir_get(path));
|
2013-09-12 06:17:07 -07:00
|
|
|
}
|
2013-01-03 12:48:14 -08:00
|
|
|
else
|
2013-09-10 02:47:30 -07:00
|
|
|
{
|
2019-03-21 15:04:46 -07:00
|
|
|
dir = EINA_TRUE;
|
2013-09-10 02:47:30 -07:00
|
|
|
}
|
2013-01-03 12:48:14 -08:00
|
|
|
|
2019-03-22 11:20:51 -07:00
|
|
|
parent = efl_add_ref(efl_class_get(sd->model), fs,
|
2019-03-21 15:04:46 -07:00
|
|
|
efl_io_model_path_set(efl_added, path),
|
|
|
|
efl_event_callback_array_add(efl_added, noref_death(), NULL));
|
|
|
|
if (!parent) goto end;
|
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
_populate(fs, parent, NULL, model);
|
2016-06-06 00:16:57 -07:00
|
|
|
|
2019-03-21 15:04:46 -07:00
|
|
|
if (sd->only_folder && dir)
|
|
|
|
_model_event_call(fs, EFL_UI_EVENT_ITEM_SELECTED, "selected", parent, path);
|
2016-06-06 00:16:57 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
end:
|
2016-05-18 08:17:36 -07:00
|
|
|
elm_object_focus_set(event->object, EINA_FALSE);
|
2013-01-03 12:48:14 -08:00
|
|
|
}
|
|
|
|
|
2014-09-02 20:44:05 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_anchors_undo(void *data)
|
|
|
|
{
|
|
|
|
ELM_FILESELECTOR_DATA_GET(data, sd);
|
|
|
|
|
|
|
|
elm_entry_entry_set(sd->path_entry, sd->path);
|
|
|
|
elm_entry_cursor_pos_set(sd->path_entry, eina_stringshare_strlen(sd->path));
|
|
|
|
|
|
|
|
sd->path_entry_idler = NULL;
|
|
|
|
|
|
|
|
return ECORE_CALLBACK_CANCEL;
|
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2017-11-16 14:13:42 -08:00
|
|
|
_on_text_focus_changed(void *data, const Efl_Event *event)
|
2014-09-02 20:44:05 -07:00
|
|
|
{
|
|
|
|
ELM_FILESELECTOR_DATA_GET(data, sd);
|
|
|
|
|
2017-11-16 14:13:42 -08:00
|
|
|
if (efl_ui_focus_object_focus_get(event->object))
|
|
|
|
{
|
|
|
|
if (!sd->path_entry_idler)
|
|
|
|
sd->path_entry_idler = ecore_idler_add(_anchors_undo, data);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_anchors_do(data, sd->path);
|
|
|
|
}
|
2013-01-03 12:48:14 -08:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_anchor_clicked(void *data, const Efl_Event *event)
|
2012-05-03 15:44:26 -07:00
|
|
|
{
|
2016-04-12 07:23:55 -07:00
|
|
|
Elm_Entry_Anchor_Info *info = event->info;
|
2012-05-03 15:44:26 -07:00
|
|
|
Evas_Object *fs = data;
|
2016-06-06 00:16:57 -07:00
|
|
|
Efl_Model *model = NULL;
|
2012-05-03 15:44:26 -07:00
|
|
|
|
2014-09-02 20:44:05 -07:00
|
|
|
ELM_FILESELECTOR_DATA_GET(fs, sd);
|
|
|
|
|
2019-03-13 14:54:39 -07:00
|
|
|
if (!sd->model) return;
|
2016-06-06 00:16:57 -07:00
|
|
|
|
2019-03-22 11:20:51 -07:00
|
|
|
model = efl_add_ref(efl_class_get(sd->model), fs,
|
2019-03-13 14:54:39 -07:00
|
|
|
efl_event_callback_array_add(efl_added, noref_death(), NULL),
|
|
|
|
efl_io_model_path_set(efl_added, info->name));
|
|
|
|
if (!model) return;
|
2016-06-06 00:16:57 -07:00
|
|
|
|
|
|
|
_populate(fs, model, NULL, NULL);
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_unref(model);
|
2013-07-23 03:34:34 -07:00
|
|
|
/* After anchor was clicked, entry will be focused, and will be editable.
|
|
|
|
* It's wrong. So remove focus. */
|
2016-05-18 08:17:36 -07:00
|
|
|
elm_object_focus_set(event->object, EINA_FALSE);
|
2014-09-02 20:44:05 -07:00
|
|
|
|
|
|
|
if (sd->path_entry_idler) {
|
|
|
|
ecore_idler_del(sd->path_entry_idler);
|
|
|
|
sd->path_entry_idler = NULL;
|
|
|
|
}
|
2012-05-03 15:44:26 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_files_key_down(void *data, const Efl_Event *event)
|
2015-01-06 22:17:46 -08:00
|
|
|
{
|
2016-08-25 03:20:10 -07:00
|
|
|
Efl_Input_Key *ev = event->info;
|
2015-01-06 22:17:46 -08:00
|
|
|
Evas_Object *par, *searchbar;
|
2016-06-13 05:19:06 -07:00
|
|
|
const char *string, *key;
|
2015-01-06 22:17:46 -08:00
|
|
|
|
|
|
|
par = data;
|
|
|
|
searchbar = evas_object_data_get(par, "search");
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
if (!searchbar) return;
|
2015-01-06 22:17:46 -08:00
|
|
|
|
2016-08-25 03:20:10 -07:00
|
|
|
key = efl_input_key_get(ev);
|
|
|
|
string = efl_input_key_string_get(ev);
|
2016-06-13 05:19:06 -07:00
|
|
|
if (string && *(string) && (isalpha(*string) || isdigit(*string)))
|
2015-01-06 22:17:46 -08:00
|
|
|
{
|
|
|
|
|
2016-06-13 05:19:06 -07:00
|
|
|
elm_entry_entry_append(searchbar, string);
|
2016-08-25 03:20:10 -07:00
|
|
|
efl_input_processed_set(ev, EINA_TRUE);
|
2015-01-06 22:17:46 -08:00
|
|
|
}
|
2016-06-13 05:19:06 -07:00
|
|
|
else if (key && *(key) && !strcmp(key, "BackSpace"))
|
2015-01-06 22:17:46 -08:00
|
|
|
{
|
|
|
|
char buf[PATH_MAX];
|
|
|
|
const char *en;
|
|
|
|
en = elm_entry_entry_get(searchbar);
|
2016-09-19 21:40:37 -07:00
|
|
|
if (en && strlen(en) > 0)
|
2015-01-06 22:17:46 -08:00
|
|
|
{
|
|
|
|
memmove(buf, en, strlen(en) -1);
|
|
|
|
buf[strlen(en) -1] = '\0';
|
|
|
|
elm_entry_entry_set(searchbar, buf);
|
2016-08-25 03:20:10 -07:00
|
|
|
efl_input_processed_set(ev, EINA_TRUE);
|
2015-01-06 22:17:46 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-17 22:25:20 -07:00
|
|
|
static Evas_Object *
|
|
|
|
_files_list_add(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Evas_Object *li;
|
|
|
|
|
|
|
|
li = elm_genlist_add(obj);
|
2013-12-03 01:28:52 -08:00
|
|
|
evas_object_data_set(li, "parent", obj);
|
2017-06-14 19:12:00 -07:00
|
|
|
efl_ui_mirrored_automatic_set(li, EINA_FALSE);
|
2013-10-17 22:25:20 -07:00
|
|
|
|
elc_filselector: solve the mysterium of sometimes failing tests
so after a phone call, two days of debugging, tears, crying etc. etc. we
finally came to a point of enlightenment! *Someone* (bu5hm4n) moved
gengrid and genlist events from eo back to smart events, so we can work
arround legacy borks and event-name collisions, at this point he did not
knew that some widgets (fileselector) already relied on those *lovely*
events. Hence this broke theoretically the testsuite, however, the
fileselector testsuite is ultimatily buggy, and the wait function does
not return false when it timeouts, (i don't know why not). So this break
was never discovered.
Additionally there is a second issue. it appears, that when we
immidiatly quit the mainloop after we have got the selected callback,
that then genlist decides to forget about the sd->selected pointer, and
NULLs that one out. Which then results in the fact that
elm_fileselector_selected_get ends up returning invalid paths.
Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D8488
2019-03-27 13:15:53 -07:00
|
|
|
evas_object_smart_callback_add(li, "selected", _on_item_selected, obj);
|
|
|
|
evas_object_smart_callback_add(li, "unselected", _on_item_unselected, obj);
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_add
|
2016-03-02 04:10:48 -08:00
|
|
|
(li, ELM_GENLIST_EVENT_ACTIVATED, _on_item_activated, obj);
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_add
|
2016-03-02 04:10:48 -08:00
|
|
|
(li, ELM_GENLIST_EVENT_EXPAND_REQUEST, _on_list_expand_req, obj);
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_add
|
2016-03-02 04:10:48 -08:00
|
|
|
(li, ELM_GENLIST_EVENT_CONTRACT_REQUEST, _on_list_contract_req, obj);
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_add
|
2016-03-02 04:10:48 -08:00
|
|
|
(li, ELM_GENLIST_EVENT_EXPANDED, _on_list_expanded, obj);
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_add
|
2016-03-02 04:10:48 -08:00
|
|
|
(li, ELM_GENLIST_EVENT_CONTRACTED, _on_list_contracted, obj);
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_add
|
2016-06-13 05:19:06 -07:00
|
|
|
(li, EFL_EVENT_KEY_DOWN, _files_key_down, obj);
|
2013-10-17 22:25:20 -07:00
|
|
|
|
|
|
|
return li;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Evas_Object *
|
|
|
|
_files_grid_add(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Evas_Object *grid;
|
2013-12-03 01:28:52 -08:00
|
|
|
|
|
|
|
ELM_FILESELECTOR_DATA_GET(obj, sd);
|
2013-10-17 22:25:20 -07:00
|
|
|
|
|
|
|
grid = elm_gengrid_add(obj);
|
2013-12-03 01:28:52 -08:00
|
|
|
evas_object_data_set(grid, "parent", obj);
|
2017-06-14 19:12:00 -07:00
|
|
|
efl_ui_mirrored_automatic_set(grid, EINA_FALSE);
|
2013-10-17 22:25:20 -07:00
|
|
|
evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
|
2017-04-17 23:25:51 -07:00
|
|
|
elm_gengrid_item_size_set(grid, sd->thumbnail_size.w, sd->thumbnail_size.h);
|
2013-12-03 01:28:52 -08:00
|
|
|
|
2013-10-17 22:25:20 -07:00
|
|
|
elm_gengrid_align_set(grid, 0.0, 0.0);
|
|
|
|
|
elc_filselector: solve the mysterium of sometimes failing tests
so after a phone call, two days of debugging, tears, crying etc. etc. we
finally came to a point of enlightenment! *Someone* (bu5hm4n) moved
gengrid and genlist events from eo back to smart events, so we can work
arround legacy borks and event-name collisions, at this point he did not
knew that some widgets (fileselector) already relied on those *lovely*
events. Hence this broke theoretically the testsuite, however, the
fileselector testsuite is ultimatily buggy, and the wait function does
not return false when it timeouts, (i don't know why not). So this break
was never discovered.
Additionally there is a second issue. it appears, that when we
immidiatly quit the mainloop after we have got the selected callback,
that then genlist decides to forget about the sd->selected pointer, and
NULLs that one out. Which then results in the fact that
elm_fileselector_selected_get ends up returning invalid paths.
Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D8488
2019-03-27 13:15:53 -07:00
|
|
|
evas_object_smart_callback_add(grid, "selected", _on_item_selected, obj);
|
|
|
|
evas_object_smart_callback_add(grid, "unselected", _on_item_unselected, obj);
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_add
|
2016-03-02 04:10:48 -08:00
|
|
|
(grid, ELM_GENGRID_EVENT_ACTIVATED, _on_item_activated, obj);
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_add
|
2016-06-13 05:19:06 -07:00
|
|
|
(grid, EFL_EVENT_KEY_DOWN, _files_key_down, obj);
|
2013-10-17 22:25:20 -07:00
|
|
|
|
|
|
|
return grid;
|
|
|
|
}
|
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
static Eina_Value
|
|
|
|
_resource_created_then(void *data, const Eina_Value v, const Eina_Future *dead_future EINA_UNUSED)
|
2016-06-06 00:16:57 -07:00
|
|
|
{
|
2018-01-26 16:56:31 -08:00
|
|
|
Evas_Object *fs = data;
|
|
|
|
Efl_Model *child = NULL;
|
|
|
|
unsigned int len, i;
|
2016-06-14 15:37:48 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
if (eina_value_type_get(&v) == EINA_VALUE_TYPE_ERROR)
|
|
|
|
goto end;
|
2016-06-06 00:16:57 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
ELM_FILESELECTOR_DATA_GET(fs, sd);
|
2013-10-20 19:14:47 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
EINA_VALUE_ARRAY_FOREACH(&v, len, i, child)
|
|
|
|
_process_model(sd, child);
|
2013-10-20 19:14:47 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
end:
|
|
|
|
return v;
|
2016-06-06 00:16:57 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_resource_created(void *data, const Efl_Event *event)
|
2016-06-06 00:16:57 -07:00
|
|
|
{
|
|
|
|
Elm_Fileselector *fs = data;
|
|
|
|
Efl_Model_Children_Event* evt = event->info;
|
2018-01-26 16:56:31 -08:00
|
|
|
Eina_Future *f;
|
2016-06-06 00:16:57 -07:00
|
|
|
|
|
|
|
ELM_FILESELECTOR_DATA_GET(fs, sd);
|
|
|
|
|
2016-06-17 12:40:49 -07:00
|
|
|
if (!sd || !sd->monitoring || sd->model != event->object)
|
2016-06-20 07:31:31 -07:00
|
|
|
return;
|
2016-06-06 00:16:57 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
f = efl_model_children_slice_get(sd->model, evt->index, 1);
|
2018-11-07 06:52:41 -08:00
|
|
|
f = eina_future_then(f, _resource_created_then, fs, NULL);
|
2018-11-21 17:33:10 -08:00
|
|
|
efl_future_then(fs, f);
|
2013-10-20 19:14:47 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_resource_deleted(void *data, const Efl_Event *event)
|
2013-10-20 19:14:47 -07:00
|
|
|
{
|
|
|
|
Evas_Object *obj = data;
|
2016-06-06 00:16:57 -07:00
|
|
|
Efl_Model_Children_Event* evt = event->info;
|
2013-10-20 19:14:47 -07:00
|
|
|
Elm_Object_Item *it = NULL;
|
|
|
|
Eina_Bool selected = EINA_FALSE;
|
|
|
|
|
|
|
|
ELM_FILESELECTOR_DATA_GET(obj, sd);
|
|
|
|
|
2016-06-17 12:40:49 -07:00
|
|
|
if (!sd || !sd->monitoring || sd->model != event->object)
|
2016-06-20 07:31:31 -07:00
|
|
|
return;
|
2016-06-06 00:16:57 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
if (!evt->child) return ;
|
2013-10-20 19:14:47 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
it = efl_key_data_get(evt->child, ".item.data");
|
|
|
|
if (!it) return ;
|
|
|
|
|
|
|
|
selected = elm_genlist_item_selected_get(it);
|
2013-10-20 19:14:47 -07:00
|
|
|
|
|
|
|
if (selected)
|
|
|
|
{
|
|
|
|
if (sd->multi)
|
|
|
|
{
|
|
|
|
Eina_List *li, *l;
|
2016-06-06 00:16:57 -07:00
|
|
|
Elm_Object_Item *item;
|
2013-10-20 19:14:47 -07:00
|
|
|
Eina_Strbuf *buf;
|
|
|
|
Eina_Bool first = EINA_TRUE;
|
|
|
|
|
|
|
|
buf = eina_strbuf_new();
|
2016-06-06 00:16:57 -07:00
|
|
|
EINA_LIST_FOREACH_SAFE(sd->multi_selection, li, l, item)
|
2013-10-20 19:14:47 -07:00
|
|
|
{
|
2018-01-26 16:56:31 -08:00
|
|
|
if (item == it)
|
2013-10-20 19:14:47 -07:00
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
sd->multi_selection = eina_list_remove_list(sd->multi_selection, li);
|
2013-10-20 19:14:47 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-01-26 16:56:31 -08:00
|
|
|
Elm_Fileselector_Item_Data *it_data = elm_object_item_data_get(item);
|
|
|
|
|
2013-10-20 19:14:47 -07:00
|
|
|
if (!first)
|
|
|
|
eina_strbuf_append_length(buf, ", ", 2);
|
|
|
|
else
|
|
|
|
first = EINA_FALSE;
|
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
eina_strbuf_append(buf, it_data->filename);
|
2013-10-20 19:14:47 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
elm_object_text_set(sd->name_entry, eina_strbuf_string_get(buf));
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
elm_object_text_set(sd->name_entry, "");
|
|
|
|
}
|
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
if (it) efl_del(it);
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
return;
|
2013-10-20 19:14:47 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_preedit_cb(void *data, const Efl_Event *event)
|
2014-06-10 02:50:01 -07:00
|
|
|
{
|
|
|
|
ELM_FILESELECTOR_DATA_GET(data, sd);
|
|
|
|
|
2016-05-18 08:17:36 -07:00
|
|
|
sd->search_string = elm_entry_entry_get(event->object);
|
2014-06-10 02:50:01 -07:00
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
if (sd->search_string && sd->model)
|
|
|
|
_populate(data, sd->model, NULL, NULL);
|
2014-06-10 02:50:01 -07:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_fileselector_efl_canvas_group_group_add(Eo *obj, Elm_Fileselector_Data *priv)
|
2012-05-03 15:44:26 -07:00
|
|
|
{
|
2013-10-17 22:25:20 -07:00
|
|
|
Evas_Object *ic, *bt, *en, *pb;
|
2016-03-04 15:39:29 -08:00
|
|
|
const char *data;
|
|
|
|
char buf[1024];
|
2011-04-01 04:51:11 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_add(efl_super(obj, MY_CLASS));
|
2017-06-09 07:30:46 -07:00
|
|
|
elm_widget_can_focus_set(obj, EINA_FALSE);
|
2009-08-12 09:08:53 -07:00
|
|
|
|
2012-05-03 15:44:26 -07:00
|
|
|
priv->expand = !!_elm_config->fileselector_expand_enable;
|
2013-09-30 08:49:50 -07:00
|
|
|
priv->double_tap_navigation = !!_elm_config->fileselector_double_tap_navigation_enable;
|
2011-04-01 04:51:11 -07:00
|
|
|
|
2013-03-01 18:04:31 -08:00
|
|
|
if (!elm_layout_theme_set
|
|
|
|
(obj, "fileselector", "base", elm_widget_style_get(obj)))
|
2013-12-25 20:03:55 -08:00
|
|
|
CRI("Failed to set layout!");
|
2009-10-22 15:10:23 -07:00
|
|
|
|
2016-03-04 15:39:29 -08:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
|
|
|
|
|
|
|
data = edje_object_data_get
|
|
|
|
(wd->resize_obj, "path_separator");
|
|
|
|
if (data) priv->path_separator = data;
|
|
|
|
else priv->path_separator = "/";
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "fileselector/%s", elm_widget_style_get(obj));
|
|
|
|
|
2009-08-12 09:08:53 -07:00
|
|
|
// up btn
|
2012-05-03 15:44:26 -07:00
|
|
|
ic = elm_icon_add(obj);
|
2016-04-26 16:01:08 -07:00
|
|
|
elm_icon_standard_set(ic, "go-up");
|
2012-05-03 15:44:26 -07:00
|
|
|
bt = elm_button_add(obj);
|
2017-06-14 19:12:00 -07:00
|
|
|
efl_ui_mirrored_automatic_set(bt, EINA_FALSE);
|
2011-11-17 13:02:31 -08:00
|
|
|
elm_object_part_content_set(bt, "icon", ic);
|
2011-10-19 07:17:14 -07:00
|
|
|
elm_object_domain_translatable_text_set(bt, PACKAGE, N_("Up"));
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_add
|
2016-06-10 01:29:40 -07:00
|
|
|
(bt, EFL_UI_EVENT_CLICKED, _on_dir_up, obj);
|
2012-05-02 10:01:48 -07:00
|
|
|
|
2012-05-03 15:44:26 -07:00
|
|
|
priv->up_button = bt;
|
2016-03-04 15:39:29 -08:00
|
|
|
elm_object_style_set(priv->up_button, buf);
|
|
|
|
elm_object_part_content_set(obj, "elm.swallow.up", priv->up_button);
|
2009-10-22 15:10:23 -07:00
|
|
|
|
2009-08-12 09:08:53 -07:00
|
|
|
// home btn
|
2012-05-03 15:44:26 -07:00
|
|
|
ic = elm_icon_add(obj);
|
2016-04-26 16:01:08 -07:00
|
|
|
elm_icon_standard_set(ic, "go-home");
|
2012-05-03 15:44:26 -07:00
|
|
|
bt = elm_button_add(obj);
|
2017-06-14 19:12:00 -07:00
|
|
|
efl_ui_mirrored_automatic_set(bt, EINA_FALSE);
|
2011-11-17 13:02:31 -08:00
|
|
|
elm_object_part_content_set(bt, "icon", ic);
|
2011-10-19 07:17:14 -07:00
|
|
|
elm_object_domain_translatable_text_set(bt, PACKAGE, N_("Home"));
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_add
|
2016-06-10 01:29:40 -07:00
|
|
|
(bt, EFL_UI_EVENT_CLICKED, _home, obj);
|
2010-11-22 11:24:48 -08:00
|
|
|
|
2012-05-03 15:44:26 -07:00
|
|
|
priv->home_button = bt;
|
2016-03-04 15:39:29 -08:00
|
|
|
elm_object_style_set(priv->home_button, buf);
|
|
|
|
elm_object_part_content_set(obj, "elm.swallow.home", priv->home_button);
|
|
|
|
|
|
|
|
// search entry
|
|
|
|
ic = elm_icon_add(obj);
|
2016-04-26 16:01:08 -07:00
|
|
|
elm_icon_standard_set(ic, "edit-find");
|
2016-03-04 15:39:29 -08:00
|
|
|
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
|
|
|
|
en = elm_entry_add(obj);
|
|
|
|
elm_entry_scrollable_set(en, EINA_TRUE);
|
2017-06-14 19:12:00 -07:00
|
|
|
efl_ui_mirrored_automatic_set(en, EINA_FALSE);
|
2016-03-04 15:39:29 -08:00
|
|
|
elm_entry_editable_set(en, EINA_TRUE);
|
|
|
|
elm_entry_single_line_set(en, EINA_TRUE);
|
|
|
|
elm_entry_line_wrap_set(en, ELM_WRAP_CHAR);
|
|
|
|
elm_object_domain_translatable_part_text_set(en, "guide",
|
|
|
|
PACKAGE, N_("Search"));
|
|
|
|
elm_object_part_content_set(en, "icon", ic);
|
|
|
|
elm_entry_icon_visible_set(en, EINA_TRUE);
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_add
|
2016-03-04 15:39:29 -08:00
|
|
|
(en, ELM_ENTRY_EVENT_CHANGED, _preedit_cb, obj);
|
|
|
|
evas_object_data_set(obj, "search", en);
|
|
|
|
|
|
|
|
priv->search_entry = en;
|
|
|
|
elm_object_style_set(priv->search_entry, buf);
|
|
|
|
elm_object_part_content_set(obj, "elm.swallow.search", priv->search_entry);
|
2009-08-12 09:08:53 -07:00
|
|
|
|
2012-05-16 12:40:47 -07:00
|
|
|
// spinner
|
|
|
|
pb = elm_progressbar_add(obj);
|
|
|
|
priv->spinner = pb;
|
2016-03-29 07:45:12 -07:00
|
|
|
elm_progressbar_pulse_set(priv->spinner, EINA_TRUE);
|
2016-03-04 15:39:29 -08:00
|
|
|
elm_object_style_set(priv->spinner, "wheel");
|
|
|
|
elm_object_part_content_set(obj, "elm.swallow.spinner", priv->spinner);
|
2012-05-16 12:40:47 -07:00
|
|
|
|
2017-04-17 23:25:51 -07:00
|
|
|
priv->thumbnail_size.w = ITEM_SIZE_DEFAULT;
|
|
|
|
priv->thumbnail_size.h = ITEM_SIZE_DEFAULT;
|
2013-12-03 01:28:52 -08:00
|
|
|
|
2013-12-18 03:05:35 -08:00
|
|
|
priv->sort_type = ELM_FILESELECTOR_SORT_BY_FILENAME_ASC;
|
2016-06-06 00:16:57 -07:00
|
|
|
priv->sort_method = _filename_cmp;
|
2013-12-18 03:05:35 -08:00
|
|
|
|
2009-09-06 17:00:33 -07:00
|
|
|
// path entry
|
2012-05-03 15:44:26 -07:00
|
|
|
en = elm_entry_add(obj);
|
2011-06-17 02:44:31 -07:00
|
|
|
elm_entry_scrollable_set(en, EINA_TRUE);
|
2017-06-14 19:12:00 -07:00
|
|
|
efl_ui_mirrored_automatic_set(en, EINA_FALSE);
|
2011-06-17 02:44:31 -07:00
|
|
|
elm_entry_single_line_set(en, EINA_TRUE);
|
|
|
|
elm_entry_line_wrap_set(en, ELM_WRAP_CHAR);
|
2010-11-22 11:24:48 -08:00
|
|
|
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_add
|
2016-03-02 04:10:48 -08:00
|
|
|
(en, ELM_ENTRY_EVENT_ANCHOR_CLICKED, _anchor_clicked, obj);
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_add
|
2017-11-16 14:13:42 -08:00
|
|
|
(en, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED, _on_text_focus_changed, obj);
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_add
|
2016-03-02 04:10:48 -08:00
|
|
|
(en, ELM_ENTRY_EVENT_ACTIVATED, _on_text_activated, obj);
|
2010-11-22 11:24:48 -08:00
|
|
|
|
2012-05-03 15:44:26 -07:00
|
|
|
priv->path_entry = en;
|
2016-03-04 15:39:29 -08:00
|
|
|
elm_object_style_set(priv->path_entry, buf);
|
|
|
|
elm_object_part_content_set(obj, "elm.swallow.path", priv->path_entry);
|
2010-11-22 11:24:48 -08:00
|
|
|
|
2013-09-25 07:43:22 -07:00
|
|
|
// name entry
|
|
|
|
en = elm_entry_add(obj);
|
|
|
|
elm_entry_scrollable_set(en, EINA_TRUE);
|
2017-06-14 19:12:00 -07:00
|
|
|
efl_ui_mirrored_automatic_set(en, EINA_FALSE);
|
2013-09-25 07:43:22 -07:00
|
|
|
elm_entry_editable_set(en, EINA_TRUE);
|
|
|
|
elm_entry_single_line_set(en, EINA_TRUE);
|
|
|
|
elm_entry_line_wrap_set(en, ELM_WRAP_CHAR);
|
|
|
|
|
|
|
|
priv->name_entry = en;
|
2016-03-04 15:39:29 -08:00
|
|
|
elm_object_style_set(priv->name_entry, buf);
|
|
|
|
elm_object_part_content_set(obj, "elm.swallow.filename", priv->name_entry);
|
2013-09-25 07:43:22 -07:00
|
|
|
|
2016-03-04 15:39:29 -08:00
|
|
|
// ok cancel button
|
2010-11-22 11:24:48 -08:00
|
|
|
elm_fileselector_buttons_ok_cancel_set(obj, EINA_TRUE);
|
|
|
|
elm_fileselector_is_save_set(obj, EINA_FALSE);
|
|
|
|
|
2016-03-04 15:39:29 -08:00
|
|
|
// files_view
|
|
|
|
priv->files_view = _files_list_add(obj);
|
|
|
|
elm_object_part_content_set(obj, "elm.swallow.files", priv->files_view);
|
|
|
|
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2017-06-25 08:50:35 -07:00
|
|
|
|
|
|
|
_focus_chain_update(obj, priv);
|
2012-05-03 15:44:26 -07:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_fileselector_efl_canvas_group_group_del(Eo *obj, Elm_Fileselector_Data *sd)
|
2012-05-03 15:44:26 -07:00
|
|
|
{
|
2013-06-18 17:00:41 -07:00
|
|
|
Elm_Fileselector_Filter *filter;
|
2013-10-20 19:14:47 -07:00
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
if (sd->current_populate_lreq)
|
|
|
|
sd->current_populate_lreq->valid = EINA_FALSE;
|
|
|
|
sd->current_populate_lreq = NULL;
|
2012-05-03 15:44:26 -07:00
|
|
|
|
2016-06-17 12:40:49 -07:00
|
|
|
if (sd->model)
|
|
|
|
_monitoring_stop(obj, sd, sd->model);
|
|
|
|
|
2013-06-18 17:00:41 -07:00
|
|
|
EINA_LIST_FREE(sd->filter_list, filter)
|
|
|
|
{
|
|
|
|
eina_stringshare_del(filter->filter_name);
|
|
|
|
|
2013-12-28 20:23:17 -08:00
|
|
|
if (filter->filter_type == ELM_FILESELECTOR_MIME_FILTER)
|
|
|
|
{
|
|
|
|
free(filter->filter.mime_types[0]);
|
|
|
|
free(filter->filter.mime_types);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
free(filter->filter.custom);
|
2013-06-18 17:00:41 -07:00
|
|
|
|
|
|
|
free(filter);
|
|
|
|
}
|
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
sd->multi_selection = eina_list_free(sd->multi_selection);
|
|
|
|
sd->multi_selection_tmp = eina_list_free(sd->multi_selection_tmp);
|
2013-10-17 22:25:20 -07:00
|
|
|
sd->files_view = NULL;
|
2017-02-15 03:07:38 -08:00
|
|
|
_elm_fileselector_smart_del_do(obj, sd);
|
2012-05-03 15:44:26 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_fileselector_add(Evas_Object *parent)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
2017-11-06 21:00:43 -08:00
|
|
|
return elm_legacy_add(MY_CLASS, parent);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15:44:26 -07:00
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_fileselector_efl_object_constructor(Eo *obj, Elm_Fileselector_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
2018-10-22 04:39:06 -07:00
|
|
|
legacy_child_focus_handle(obj);
|
2012-11-25 22:32:53 -08:00
|
|
|
sd->obj = obj;
|
2016-06-20 21:26:15 -07:00
|
|
|
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
|
2016-06-16 22:12:02 -07:00
|
|
|
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
|
2018-04-03 04:27:30 -07:00
|
|
|
efl_access_object_role_set(obj, EFL_ACCESS_ROLE_FILE_CHOOSER);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
|
|
|
return obj;
|
2009-08-12 09:08:53 -07:00
|
|
|
}
|
|
|
|
|
2016-08-22 17:59:10 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_from_efl_event_call(Elm_Fileselector *fs, const Efl_Event_Description *evt_desc, Efl_Model *model)
|
|
|
|
{
|
2018-01-26 16:56:31 -08:00
|
|
|
Eina_Value *fetch;
|
2019-03-13 10:39:49 -07:00
|
|
|
const char *evt;
|
2018-01-26 16:56:31 -08:00
|
|
|
char *path;
|
2016-08-22 17:59:10 -07:00
|
|
|
|
|
|
|
// Call legacy smart callback with path
|
2018-01-26 16:56:31 -08:00
|
|
|
fetch = efl_model_property_get(model, "path");
|
|
|
|
path = eina_value_to_string(fetch);
|
|
|
|
|
2019-03-13 10:39:49 -07:00
|
|
|
evt = evt_desc == EFL_UI_EVENT_ITEM_SELECTED ? "selected" : evt_desc->name;
|
|
|
|
_event_to_legacy_call(fs, evt, path);
|
2016-08-22 17:59:10 -07:00
|
|
|
|
|
|
|
// Call Eo event with model
|
|
|
|
return efl_event_callback_call(fs, evt_desc, model);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_from_legacy_event_call(Elm_Fileselector *fs, Elm_Fileselector_Data *sd, const Efl_Event_Description *legacy_desc, const Efl_Event_Description *evt_desc, const char *path)
|
|
|
|
{
|
|
|
|
const Efl_Class *model_cls = NULL;
|
|
|
|
if (!sd->model)
|
efl_model : rename all efl_model based classes.
Summary:
As the result of discussion in T7458,
we need to rename all efl_model based classes with efl_XXX_Model sequence.
I've run few vote for this, see V42, V43
few classes are totally renamed as our consideration of misnaming.
| Efl.Model_Loop | Efl.Loop_Model |
| Efl.Model_Item | Efl.Generic_Model |
| Efl.Model_Container | Efl.Container_Model |
| Efl.Model_Container_Item | Efl.Container_Model_Item |
| Efl.Model_Composite | Efl.Composite_Model |
| Efl.Model_Composite_Boolean | Efl.Boolean_Model |
| Efl.Model_Composite_Boolean_Chlidren | Efl.Boolean_Model_Item |
| Efl.Model_Composite_Selection | Efl.Select_Model |
| Efl.Model_Composite_Selection_Chlidren | Efl.Select_Model_Item |
| Efl.Model_View | Efl.View_Model |
| Eio.Model | Efl.Io.Model |
| Efl.Ui.Model_State | Efl.Ui.State_Model |
| Efl.Ui.Model_Size | Efl.Ui.Size_Model |
| Efl.Ui.Model_Exact | Efl.Ui.Exact_Model |
| Efl.Ui.Model_Average | Efl.Ui.Average_Model |
| Efl.Ui.Model_Homogeneous | Efl.Ui.Homogeneous_Model |
I worried about Efl.Io.Model changes, cause it is widely used,
but as I tested, there is no issue found yet.
Eldbus.Model also may can changed Efl.Dbus.Model,
but I cannot found any class who using Efl.Dbus namespace,
so I left it future work.
Test Plan:
Run the Make Test,
it works well except Efl test about selection.
there are class inheritance problem exist in select_model,
I reported it and will fix it in another patch.
Reviewers: cedric, felipealmeida, woohyun, Hermet
Reviewed By: cedric
Subscribers: lauromoura
Tags: #efl, #do_not_merge
Differential Revision: https://phab.enlightenment.org/D7533
2019-01-30 20:35:34 -08:00
|
|
|
model_cls = EFL_IO_MODEL_CLASS;
|
2016-08-22 17:59:10 -07:00
|
|
|
else
|
|
|
|
model_cls = efl_class_get(sd->model);
|
|
|
|
|
2018-05-04 16:15:18 -07:00
|
|
|
Efl_Model *model = efl_add_ref(model_cls, fs,
|
2019-03-13 14:54:39 -07:00
|
|
|
efl_event_callback_array_add(efl_added, noref_death(), NULL),
|
|
|
|
efl_io_model_path_set(efl_added, path));
|
2016-08-22 17:59:10 -07:00
|
|
|
|
|
|
|
// Call Eo event with model
|
|
|
|
efl_event_callback_call(fs, evt_desc, model);
|
|
|
|
|
2018-05-04 16:15:18 -07:00
|
|
|
efl_unref(model);
|
2016-08-22 17:59:10 -07:00
|
|
|
|
|
|
|
// Call legacy smart callback with path
|
|
|
|
return efl_event_callback_call(fs, legacy_desc, (void *)path);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_fileselector_efl_object_event_callback_legacy_call(Eo *obj, Elm_Fileselector_Data *sd,
|
|
|
|
const Efl_Event_Description *desc, void *event_info)
|
|
|
|
{
|
|
|
|
if (desc->legacy_is)
|
|
|
|
{
|
|
|
|
const Efl_Event_Description *evt_desc = NULL;
|
|
|
|
if (strcmp(desc->name, "selected") == 0)
|
2019-03-19 13:30:19 -07:00
|
|
|
evt_desc = EFL_UI_EVENT_ITEM_SELECTED;
|
2016-08-22 17:59:10 -07:00
|
|
|
else if (strcmp(desc->name, "activated") == 0)
|
|
|
|
evt_desc = ELM_FILESELECTOR_EVENT_ACTIVATED;
|
|
|
|
else if (strcmp(desc->name, "directory,open") == 0)
|
|
|
|
evt_desc = ELM_FILESELECTOR_EVENT_DIRECTORY_OPEN;
|
|
|
|
else if (strcmp(desc->name, "done") == 0)
|
|
|
|
evt_desc = ELM_FILESELECTOR_EVENT_DONE;
|
|
|
|
else if (strcmp(desc->name, "selected,invalid") == 0)
|
|
|
|
evt_desc = ELM_FILESELECTOR_EVENT_SELECTED_INVALID;
|
|
|
|
else
|
|
|
|
return efl_event_callback_legacy_call(efl_super(obj, MY_CLASS), desc, event_info);
|
|
|
|
|
|
|
|
return _from_legacy_event_call(obj, sd, desc, evt_desc, event_info);
|
|
|
|
}
|
|
|
|
|
2019-03-19 13:30:19 -07:00
|
|
|
if (desc == EFL_UI_EVENT_ITEM_SELECTED ||
|
2016-08-22 17:59:10 -07:00
|
|
|
desc == ELM_FILESELECTOR_EVENT_ACTIVATED ||
|
|
|
|
desc == ELM_FILESELECTOR_EVENT_DIRECTORY_OPEN ||
|
|
|
|
desc == ELM_FILESELECTOR_EVENT_DONE ||
|
|
|
|
desc == ELM_FILESELECTOR_EVENT_SELECTED_INVALID)
|
|
|
|
{
|
|
|
|
return _from_efl_event_call(obj, desc, event_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
return efl_event_callback_legacy_call(efl_super(obj, MY_CLASS), desc, event_info);
|
|
|
|
}
|
|
|
|
|
2009-09-06 17:00:33 -07:00
|
|
|
EAPI void
|
2010-12-07 11:18:14 -08:00
|
|
|
elm_fileselector_is_save_set(Evas_Object *obj,
|
2012-05-03 15:44:26 -07:00
|
|
|
Eina_Bool is_save)
|
2009-09-06 17:00:33 -07:00
|
|
|
{
|
2014-01-21 05:50:35 -08:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_fileselector_is_save_set(obj, is_save);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_elm_interface_fileselector_is_save_set(Eo *obj, Elm_Fileselector_Data *sd, Eina_Bool is_save)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2013-09-25 07:43:22 -07:00
|
|
|
elm_object_disabled_set(sd->name_entry, !is_save);
|
2010-11-22 11:24:48 -08:00
|
|
|
|
2012-05-03 15:44:26 -07:00
|
|
|
if (is_save) elm_layout_signal_emit(obj, "elm,state,save,on", "elm");
|
|
|
|
else elm_layout_signal_emit(obj, "elm,state,save,off", "elm");
|
2017-06-25 08:50:35 -07:00
|
|
|
|
|
|
|
_focus_chain_update(obj, sd);
|
2009-09-06 17:00:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2010-03-23 20:06:00 -07:00
|
|
|
elm_fileselector_is_save_get(const Evas_Object *obj)
|
2009-09-06 17:00:33 -07:00
|
|
|
{
|
2014-01-21 05:50:35 -08:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj, EINA_FALSE);
|
2016-08-04 03:37:56 -07:00
|
|
|
return elm_interface_fileselector_is_save_get((Eo *) obj);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15:44:26 -07:00
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_fileselector_elm_interface_fileselector_is_save_get(const Eo *obj EINA_UNUSED, Elm_Fileselector_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-30 00:15:55 -07:00
|
|
|
return !elm_object_disabled_get(sd->name_entry);
|
2009-09-06 17:00:33 -07:00
|
|
|
}
|
|
|
|
|
2009-10-22 15:10:23 -07:00
|
|
|
EAPI void
|
2010-12-07 11:18:14 -08:00
|
|
|
elm_fileselector_folder_only_set(Evas_Object *obj,
|
2012-05-03 15:44:26 -07:00
|
|
|
Eina_Bool only)
|
2009-10-22 15:10:23 -07:00
|
|
|
{
|
2014-01-21 05:50:35 -08:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_fileselector_folder_only_set(obj, only);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_elm_interface_fileselector_folder_only_set(Eo *obj, Elm_Fileselector_Data *sd, Eina_Bool only)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-05-03 15:44:26 -07:00
|
|
|
if (sd->only_folder == only) return;
|
|
|
|
|
|
|
|
sd->only_folder = !!only;
|
2016-06-06 00:16:57 -07:00
|
|
|
if (sd->model)
|
2014-10-28 18:07:44 -07:00
|
|
|
{
|
2019-03-27 15:19:32 -07:00
|
|
|
_populate(obj, sd->model, NULL, NULL);
|
2014-10-28 18:07:44 -07:00
|
|
|
}
|
2009-10-22 15:10:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2010-03-31 13:19:55 -07:00
|
|
|
elm_fileselector_folder_only_get(const Evas_Object *obj)
|
2009-10-22 15:10:23 -07:00
|
|
|
{
|
2014-01-21 05:50:35 -08:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj, EINA_FALSE);
|
2016-08-04 03:37:56 -07:00
|
|
|
return elm_interface_fileselector_folder_only_get((Eo *) obj);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15:44:26 -07:00
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_fileselector_elm_interface_fileselector_folder_only_get(const Eo *obj EINA_UNUSED, Elm_Fileselector_Data *sd)
|
2009-10-22 15:10:23 -07:00
|
|
|
{
|
2014-03-30 00:15:55 -07:00
|
|
|
return sd->only_folder;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_buttons_ok_cancel_set(Eo *obj, Elm_Fileselector_Data *sd, Eina_Bool visible)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2010-11-25 02:01:39 -08:00
|
|
|
Evas_Object *bt;
|
2012-05-03 15:44:26 -07:00
|
|
|
|
2016-03-04 15:39:29 -08:00
|
|
|
visible = !!visible;
|
|
|
|
|
2016-03-07 02:26:15 -08:00
|
|
|
if (!visible == !sd->ok_button) return;
|
2016-03-04 15:39:29 -08:00
|
|
|
|
|
|
|
if (visible)
|
2010-11-22 11:24:48 -08:00
|
|
|
{
|
2010-03-09 19:47:33 -08:00
|
|
|
// ok btn
|
|
|
|
bt = elm_button_add(obj);
|
2017-06-14 19:12:00 -07:00
|
|
|
efl_ui_mirrored_automatic_set(bt, EINA_FALSE);
|
2011-10-19 07:17:14 -07:00
|
|
|
elm_object_domain_translatable_text_set(bt, PACKAGE, N_("OK"));
|
2010-11-22 11:24:48 -08:00
|
|
|
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_add(bt, EFL_UI_EVENT_CLICKED, _ok, obj);
|
2010-11-22 11:24:48 -08:00
|
|
|
|
2012-05-03 15:44:26 -07:00
|
|
|
sd->ok_button = bt;
|
2016-03-04 15:39:29 -08:00
|
|
|
elm_object_part_content_set(obj, "elm.swallow.ok", sd->ok_button);
|
2017-06-25 08:50:35 -07:00
|
|
|
|
|
|
|
// cancel btn
|
|
|
|
bt = elm_button_add(obj);
|
|
|
|
efl_ui_mirrored_automatic_set(bt, EINA_FALSE);
|
|
|
|
elm_object_domain_translatable_text_set(bt, PACKAGE, N_("Cancel"));
|
|
|
|
|
|
|
|
efl_event_callback_add(bt, EFL_UI_EVENT_CLICKED, _canc, obj);
|
|
|
|
|
|
|
|
sd->cancel_button = bt;
|
|
|
|
elm_object_part_content_set(obj, "elm.swallow.cancel", sd->cancel_button);
|
2009-10-22 15:10:23 -07:00
|
|
|
}
|
2016-03-04 15:39:29 -08:00
|
|
|
else
|
2009-10-22 15:10:23 -07:00
|
|
|
{
|
2014-01-21 17:38:55 -08:00
|
|
|
ELM_SAFE_FREE(sd->cancel_button, evas_object_del);
|
|
|
|
ELM_SAFE_FREE(sd->ok_button, evas_object_del);
|
2009-10-22 15:10:23 -07:00
|
|
|
}
|
2017-06-25 08:50:35 -07:00
|
|
|
|
|
|
|
_focus_chain_update(obj, sd);
|
2009-10-22 15:10:23 -07:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_fileselector_buttons_ok_cancel_get(const Eo *obj EINA_UNUSED, Elm_Fileselector_Data *sd)
|
2009-10-22 15:10:23 -07:00
|
|
|
{
|
2014-03-30 00:15:55 -07:00
|
|
|
return sd->ok_button ? EINA_TRUE : EINA_FALSE;
|
2009-10-22 15:10:23 -07:00
|
|
|
}
|
|
|
|
|
2009-08-12 09:08:53 -07:00
|
|
|
EAPI void
|
2010-12-07 11:18:14 -08:00
|
|
|
elm_fileselector_expandable_set(Evas_Object *obj,
|
2012-05-03 15:44:26 -07:00
|
|
|
Eina_Bool expand)
|
2009-08-12 09:08:53 -07:00
|
|
|
{
|
2014-01-21 05:50:35 -08:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_fileselector_expandable_set(obj, expand);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_elm_interface_fileselector_expandable_set(Eo *obj, Elm_Fileselector_Data *sd, Eina_Bool expand)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-05-03 15:44:26 -07:00
|
|
|
sd->expand = !!expand;
|
2010-04-09 10:52:55 -07:00
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
if (sd->model)
|
2014-10-28 18:07:44 -07:00
|
|
|
{
|
2019-03-27 15:19:32 -07:00
|
|
|
_populate(obj, sd->model, NULL, NULL);
|
2014-10-28 18:07:44 -07:00
|
|
|
}
|
2009-08-12 09:08:53 -07:00
|
|
|
}
|
|
|
|
|
2010-03-31 13:19:55 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_fileselector_expandable_get(const Evas_Object *obj)
|
|
|
|
{
|
2014-01-21 05:50:35 -08:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj, EINA_FALSE);
|
2016-08-04 03:37:56 -07:00
|
|
|
return elm_interface_fileselector_expandable_get((Eo *) obj);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15:44:26 -07:00
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_fileselector_elm_interface_fileselector_expandable_get(const Eo *obj EINA_UNUSED, Elm_Fileselector_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-30 00:15:55 -07:00
|
|
|
return sd->expand;
|
2010-03-31 13:19:55 -07:00
|
|
|
}
|
|
|
|
|
2009-09-06 17:00:33 -07:00
|
|
|
EAPI void
|
2010-12-07 11:18:14 -08:00
|
|
|
elm_fileselector_path_set(Evas_Object *obj,
|
2012-05-03 15:44:26 -07:00
|
|
|
const char *_path)
|
2009-09-06 17:00:33 -07:00
|
|
|
{
|
2014-01-21 05:50:35 -08:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj);
|
2016-08-15 06:44:41 -07:00
|
|
|
const Efl_Class *cls = efl_class_get(obj);
|
2016-07-22 14:43:12 -07:00
|
|
|
if (cls == ELM_FILESELECTOR_CLASS)
|
|
|
|
_elm_fileselector_path_set_internal(obj, _path);
|
|
|
|
else if (cls == ELM_FILESELECTOR_ENTRY_CLASS)
|
|
|
|
_elm_fileselector_entry_path_set_internal(obj, _path);
|
|
|
|
else if (cls == ELM_FILESELECTOR_BUTTON_CLASS)
|
|
|
|
_elm_fileselector_button_path_set_internal(obj, _path);
|
|
|
|
else
|
|
|
|
ERR("Unknown Elm.Fileselector class");
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_elm_fileselector_path_set_internal(Evas_Object *obj, const char *_path)
|
|
|
|
{
|
2019-03-13 14:54:39 -07:00
|
|
|
Efl_Io_Model *model = efl_add_ref(EFL_IO_MODEL_CLASS, obj,
|
|
|
|
efl_io_model_path_set(efl_added, _path),
|
|
|
|
efl_loop_model_volatile_make(efl_added));
|
2016-06-06 00:16:57 -07:00
|
|
|
if (!model)
|
|
|
|
{
|
|
|
|
ERR("Efl.Model allocation error");
|
|
|
|
return;
|
|
|
|
}
|
2018-02-14 18:14:52 -08:00
|
|
|
efl_ui_view_model_set(obj, model);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
EOLIAN static void
|
2019-03-27 15:19:32 -07:00
|
|
|
_elm_fileselector_efl_ui_view_model_set(Eo *obj, Elm_Fileselector_Data *sd EINA_UNUSED, Efl_Model *model)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2019-03-27 15:19:32 -07:00
|
|
|
_populate(obj, model, NULL, NULL);
|
2009-09-06 17:00:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI const char *
|
2010-03-23 20:06:00 -07:00
|
|
|
elm_fileselector_path_get(const Evas_Object *obj)
|
2009-09-06 17:00:33 -07:00
|
|
|
{
|
2014-01-21 05:50:35 -08:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj, NULL);
|
2016-08-15 06:44:41 -07:00
|
|
|
const Efl_Class *cls = efl_class_get(obj);
|
2016-07-22 14:43:12 -07:00
|
|
|
if (cls == ELM_FILESELECTOR_CLASS)
|
|
|
|
return _elm_fileselector_path_get_internal(obj);
|
|
|
|
else if (cls == ELM_FILESELECTOR_ENTRY_CLASS)
|
|
|
|
return _elm_fileselector_entry_path_get_internal(obj);
|
|
|
|
else if (cls == ELM_FILESELECTOR_BUTTON_CLASS)
|
|
|
|
return _elm_fileselector_button_path_get_internal(obj);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ERR("Unknown Elm.Fileselector class");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *
|
|
|
|
_elm_fileselector_path_get_internal(const Evas_Object *obj)
|
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
ELM_FILESELECTOR_DATA_GET(obj, sd);
|
|
|
|
return sd->path;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15:44:26 -07:00
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
EOLIAN static Efl_Model *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_fileselector_efl_ui_view_model_get(const Eo *obj EINA_UNUSED, Elm_Fileselector_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
return sd->model;
|
2009-09-06 17:00:33 -07:00
|
|
|
}
|
|
|
|
|
2010-12-10 05:01:51 -08:00
|
|
|
EAPI void
|
2012-05-03 15:44:26 -07:00
|
|
|
elm_fileselector_mode_set(Evas_Object *obj,
|
2010-12-10 05:01:51 -08:00
|
|
|
Elm_Fileselector_Mode mode)
|
|
|
|
{
|
2014-01-21 05:50:35 -08:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_fileselector_mode_set(obj, mode);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15:44:26 -07:00
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_elm_interface_fileselector_mode_set(Eo *obj, Elm_Fileselector_Data *sd, Elm_Fileselector_Mode mode)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2013-10-17 22:25:20 -07:00
|
|
|
Evas_Object *old;
|
2012-05-02 10:01:48 -07:00
|
|
|
|
2012-05-03 15:44:26 -07:00
|
|
|
if (mode == sd->mode) return;
|
2010-12-10 05:01:51 -08:00
|
|
|
|
2013-10-17 22:25:20 -07:00
|
|
|
old = elm_layout_content_unset(obj, "elm.swallow.files");
|
2010-12-10 05:01:51 -08:00
|
|
|
|
|
|
|
if (mode == ELM_FILESELECTOR_LIST)
|
2013-10-17 22:25:20 -07:00
|
|
|
{
|
|
|
|
sd->files_view = _files_list_add(obj);
|
|
|
|
if (sd->multi)
|
|
|
|
elm_genlist_multi_select_set(sd->files_view, EINA_TRUE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sd->files_view = _files_grid_add(obj);
|
|
|
|
if (sd->multi)
|
|
|
|
elm_gengrid_multi_select_set(sd->files_view, EINA_TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
elm_layout_content_set(obj, "elm.swallow.files", sd->files_view);
|
|
|
|
|
|
|
|
evas_object_del(old);
|
2010-12-10 05:01:51 -08:00
|
|
|
|
2012-05-03 15:44:26 -07:00
|
|
|
sd->mode = mode;
|
2010-12-10 05:01:51 -08:00
|
|
|
|
2017-10-23 22:03:46 -07:00
|
|
|
efl_ui_widget_theme_apply(obj);
|
2016-06-06 00:16:57 -07:00
|
|
|
if (sd->model)
|
2014-10-28 18:07:44 -07:00
|
|
|
{
|
2019-03-27 15:19:32 -07:00
|
|
|
_populate(obj, sd->model, NULL, NULL);
|
2014-10-28 18:07:44 -07:00
|
|
|
}
|
2010-12-10 05:01:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Elm_Fileselector_Mode
|
|
|
|
elm_fileselector_mode_get(const Evas_Object *obj)
|
|
|
|
{
|
2014-01-21 05:50:35 -08:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj, ELM_FILESELECTOR_LAST);
|
2016-08-04 03:37:56 -07:00
|
|
|
return elm_interface_fileselector_mode_get((Eo *) obj);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-02 18:19:05 -07:00
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
EOLIAN static Elm_Fileselector_Mode
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_fileselector_elm_interface_fileselector_mode_get(const Eo *obj EINA_UNUSED, Elm_Fileselector_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-30 00:15:55 -07:00
|
|
|
return sd->mode;
|
2010-12-10 05:01:51 -08:00
|
|
|
}
|
|
|
|
|
2013-10-16 19:04:57 -07:00
|
|
|
EAPI void
|
|
|
|
elm_fileselector_multi_select_set(Evas_Object *obj, Eina_Bool multi)
|
|
|
|
{
|
2014-01-21 05:50:35 -08:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_fileselector_multi_select_set(obj, multi);
|
2013-10-16 19:04:57 -07:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_elm_interface_fileselector_multi_select_set(Eo *obj EINA_UNUSED, Elm_Fileselector_Data *sd, Eina_Bool multi)
|
2013-10-16 19:04:57 -07:00
|
|
|
{
|
|
|
|
multi = !!multi;
|
|
|
|
if (sd->multi == multi) return;
|
|
|
|
sd->multi = multi;
|
|
|
|
|
2013-10-17 22:25:20 -07:00
|
|
|
if (sd->mode == ELM_FILESELECTOR_LIST)
|
|
|
|
elm_genlist_multi_select_set(sd->files_view, multi);
|
|
|
|
else
|
|
|
|
elm_gengrid_multi_select_set(sd->files_view, multi);
|
2013-10-16 19:04:57 -07:00
|
|
|
|
|
|
|
if (!sd->multi)
|
|
|
|
{
|
|
|
|
_clear_selections(sd, NULL);
|
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
sd->multi_selection = eina_list_free(sd->multi_selection);
|
2013-10-16 19:04:57 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const Eina_List *selected_items, *li;
|
|
|
|
const Elm_Object_Item *it;
|
|
|
|
|
|
|
|
if (sd->mode == ELM_FILESELECTOR_LIST)
|
2013-10-17 22:25:20 -07:00
|
|
|
selected_items = elm_genlist_selected_items_get(sd->files_view);
|
2013-10-16 19:04:57 -07:00
|
|
|
else
|
2013-10-17 22:25:20 -07:00
|
|
|
selected_items = elm_gengrid_selected_items_get(sd->files_view);
|
2013-10-16 19:04:57 -07:00
|
|
|
|
|
|
|
EINA_LIST_FOREACH(selected_items, li, it)
|
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
sd->multi_selection = eina_list_append(sd->multi_selection, it);
|
2013-10-16 19:04:57 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_fileselector_multi_select_get(const Evas_Object *obj)
|
|
|
|
{
|
2014-01-21 05:50:35 -08:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj, EINA_FALSE);
|
2016-08-04 03:37:56 -07:00
|
|
|
return elm_interface_fileselector_multi_select_get((Eo *) obj);
|
2013-10-16 19:04:57 -07:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_fileselector_elm_interface_fileselector_multi_select_get(const Eo *obj EINA_UNUSED, Elm_Fileselector_Data *sd)
|
2013-10-16 19:04:57 -07:00
|
|
|
{
|
2014-03-30 00:15:55 -07:00
|
|
|
return sd->multi;
|
2013-10-16 19:04:57 -07:00
|
|
|
}
|
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
static Elm_Fileselector_Item_Data *
|
|
|
|
_selected_item_data_get(Elm_Fileselector_Data *sd)
|
2009-08-12 09:08:53 -07:00
|
|
|
{
|
2012-05-03 15:44:26 -07:00
|
|
|
if (sd->mode == ELM_FILESELECTOR_LIST)
|
2010-12-10 05:01:51 -08:00
|
|
|
{
|
2013-10-17 22:25:20 -07:00
|
|
|
Elm_Object_Item *gl_it = elm_genlist_selected_item_get(sd->files_view);
|
2012-05-03 15:44:26 -07:00
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
if (gl_it) return elm_object_item_data_get(gl_it);
|
2010-12-10 05:01:51 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-10-17 22:25:20 -07:00
|
|
|
Elm_Object_Item *gg_it = elm_gengrid_selected_item_get(sd->files_view);
|
2012-05-03 15:44:26 -07:00
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
if (gg_it) return elm_object_item_data_get(gg_it);
|
2010-12-10 05:01:51 -08:00
|
|
|
}
|
2016-06-06 00:16:57 -07:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI const char *
|
|
|
|
elm_fileselector_selected_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj, NULL);
|
2016-09-14 17:02:15 -07:00
|
|
|
|
|
|
|
const Efl_Class *cls = efl_class_get(obj);
|
|
|
|
if (cls == ELM_FILESELECTOR_CLASS)
|
|
|
|
return _elm_fileselector_selected_get_internal(obj);
|
|
|
|
else if (cls == ELM_FILESELECTOR_ENTRY_CLASS)
|
|
|
|
return _elm_fileselector_entry_selected_get_internal(obj);
|
|
|
|
else if (cls == ELM_FILESELECTOR_BUTTON_CLASS)
|
|
|
|
return _elm_fileselector_button_selected_get_internal(obj);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ERR("Unknown Elm.Fileselector class");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *
|
|
|
|
_elm_fileselector_selected_get_internal(const Evas_Object *obj)
|
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
ELM_FILESELECTOR_DATA_GET(obj, sd);
|
|
|
|
if (!sd->path) return NULL;
|
2018-01-26 16:56:31 -08:00
|
|
|
if (sd->target)
|
|
|
|
{
|
efl_model : rename all efl_model based classes.
Summary:
As the result of discussion in T7458,
we need to rename all efl_model based classes with efl_XXX_Model sequence.
I've run few vote for this, see V42, V43
few classes are totally renamed as our consideration of misnaming.
| Efl.Model_Loop | Efl.Loop_Model |
| Efl.Model_Item | Efl.Generic_Model |
| Efl.Model_Container | Efl.Container_Model |
| Efl.Model_Container_Item | Efl.Container_Model_Item |
| Efl.Model_Composite | Efl.Composite_Model |
| Efl.Model_Composite_Boolean | Efl.Boolean_Model |
| Efl.Model_Composite_Boolean_Chlidren | Efl.Boolean_Model_Item |
| Efl.Model_Composite_Selection | Efl.Select_Model |
| Efl.Model_Composite_Selection_Chlidren | Efl.Select_Model_Item |
| Efl.Model_View | Efl.View_Model |
| Eio.Model | Efl.Io.Model |
| Efl.Ui.Model_State | Efl.Ui.State_Model |
| Efl.Ui.Model_Size | Efl.Ui.Size_Model |
| Efl.Ui.Model_Exact | Efl.Ui.Exact_Model |
| Efl.Ui.Model_Average | Efl.Ui.Average_Model |
| Efl.Ui.Model_Homogeneous | Efl.Ui.Homogeneous_Model |
I worried about Efl.Io.Model changes, cause it is widely used,
but as I tested, there is no issue found yet.
Eldbus.Model also may can changed Efl.Dbus.Model,
but I cannot found any class who using Efl.Dbus namespace,
so I left it future work.
Test Plan:
Run the Make Test,
it works well except Efl test about selection.
there are class inheritance problem exist in select_model,
I reported it and will fix it in another patch.
Reviewers: cedric, felipealmeida, woohyun, Hermet
Reviewed By: cedric
Subscribers: lauromoura
Tags: #efl, #do_not_merge
Differential Revision: https://phab.enlightenment.org/D7533
2019-01-30 20:35:34 -08:00
|
|
|
return efl_io_model_path_get(sd->target);
|
2018-01-26 16:56:31 -08:00
|
|
|
}
|
2010-03-31 13:19:55 -07:00
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
Elm_Fileselector_Item_Data *it_data = _selected_item_data_get(sd);
|
|
|
|
if (it_data)
|
|
|
|
return it_data->path;
|
2014-03-30 00:15:55 -07:00
|
|
|
|
|
|
|
return sd->path;
|
2009-08-12 09:08:53 -07:00
|
|
|
}
|
2010-04-08 13:36:37 -07:00
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
EOLIAN static Efl_Model *
|
2018-01-26 16:56:31 -08:00
|
|
|
_elm_fileselector_elm_interface_fileselector_selected_model_get(const Eo *fs EINA_UNUSED, Elm_Fileselector_Data *sd)
|
2016-06-06 00:16:57 -07:00
|
|
|
{
|
|
|
|
if (!sd->model)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
Elm_Fileselector_Item_Data *it_data = _selected_item_data_get(sd);
|
|
|
|
if (it_data)
|
|
|
|
return it_data->model;
|
|
|
|
|
|
|
|
return sd->model;
|
|
|
|
}
|
|
|
|
|
2010-04-08 13:36:37 -07:00
|
|
|
EAPI Eina_Bool
|
2010-12-07 11:18:14 -08:00
|
|
|
elm_fileselector_selected_set(Evas_Object *obj,
|
2012-05-03 15:44:26 -07:00
|
|
|
const char *_path)
|
2016-09-14 17:02:15 -07:00
|
|
|
{
|
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj, EINA_FALSE);
|
|
|
|
|
|
|
|
const Efl_Class *cls = efl_class_get(obj);
|
|
|
|
if (cls == ELM_FILESELECTOR_CLASS)
|
|
|
|
return _elm_fileselector_selected_set_internal(obj, _path);
|
|
|
|
else if (cls == ELM_FILESELECTOR_ENTRY_CLASS)
|
|
|
|
return _elm_fileselector_entry_selected_set_internal(obj, _path);
|
|
|
|
else if (cls == ELM_FILESELECTOR_BUTTON_CLASS)
|
|
|
|
return _elm_fileselector_button_selected_set_internal(obj, _path);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ERR("Unknown Elm.Fileselector class");
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
static void
|
|
|
|
_properties_ready(void *data, const Efl_Event *ev)
|
|
|
|
{
|
|
|
|
Evas_Object *obj = data;
|
|
|
|
Efl_Model_Property_Event *event = ev->info;
|
|
|
|
const char *property = NULL;
|
|
|
|
Eina_Array_Iterator iterator;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
ELM_FILESELECTOR_DATA_GET(obj, pd);
|
|
|
|
|
|
|
|
EINA_ARRAY_ITER_NEXT(event->changed_properties, i, property, iterator)
|
|
|
|
if (!strcmp(property, "is_dir"))
|
|
|
|
{
|
|
|
|
Eina_Value *value;
|
|
|
|
Eina_Bool is_dir = EINA_FALSE;
|
|
|
|
|
2018-05-23 20:23:48 -07:00
|
|
|
value = efl_model_property_get(ev->object, "is_dir");
|
2018-01-26 16:56:31 -08:00
|
|
|
if (eina_value_type_get(value) != EINA_VALUE_TYPE_BOOL)
|
|
|
|
{
|
|
|
|
ERR("Unexpected type for 'is_dir': '%s' with value '%s'.", eina_value_type_get(value)->name, eina_value_to_string(value));
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
2018-05-23 20:23:48 -07:00
|
|
|
efl_event_callback_del(ev->object, EFL_MODEL_EVENT_PROPERTIES_CHANGED, _properties_ready, obj);
|
2018-01-26 16:56:31 -08:00
|
|
|
|
|
|
|
eina_value_bool_get(value, &is_dir);
|
2019-03-22 10:31:52 -07:00
|
|
|
pd->target_ready = EINA_TRUE;
|
2018-01-26 16:56:31 -08:00
|
|
|
if (!is_dir)
|
|
|
|
{
|
|
|
|
Efl_Model *parent;
|
efl_model : rename all efl_model based classes.
Summary:
As the result of discussion in T7458,
we need to rename all efl_model based classes with efl_XXX_Model sequence.
I've run few vote for this, see V42, V43
few classes are totally renamed as our consideration of misnaming.
| Efl.Model_Loop | Efl.Loop_Model |
| Efl.Model_Item | Efl.Generic_Model |
| Efl.Model_Container | Efl.Container_Model |
| Efl.Model_Container_Item | Efl.Container_Model_Item |
| Efl.Model_Composite | Efl.Composite_Model |
| Efl.Model_Composite_Boolean | Efl.Boolean_Model |
| Efl.Model_Composite_Boolean_Chlidren | Efl.Boolean_Model_Item |
| Efl.Model_Composite_Selection | Efl.Select_Model |
| Efl.Model_Composite_Selection_Chlidren | Efl.Select_Model_Item |
| Efl.Model_View | Efl.View_Model |
| Eio.Model | Efl.Io.Model |
| Efl.Ui.Model_State | Efl.Ui.State_Model |
| Efl.Ui.Model_Size | Efl.Ui.Size_Model |
| Efl.Ui.Model_Exact | Efl.Ui.Exact_Model |
| Efl.Ui.Model_Average | Efl.Ui.Average_Model |
| Efl.Ui.Model_Homogeneous | Efl.Ui.Homogeneous_Model |
I worried about Efl.Io.Model changes, cause it is widely used,
but as I tested, there is no issue found yet.
Eldbus.Model also may can changed Efl.Dbus.Model,
but I cannot found any class who using Efl.Dbus namespace,
so I left it future work.
Test Plan:
Run the Make Test,
it works well except Efl test about selection.
there are class inheritance problem exist in select_model,
I reported it and will fix it in another patch.
Reviewers: cedric, felipealmeida, woohyun, Hermet
Reviewed By: cedric
Subscribers: lauromoura
Tags: #efl, #do_not_merge
Differential Revision: https://phab.enlightenment.org/D7533
2019-01-30 20:35:34 -08:00
|
|
|
const char *path = efl_io_model_path_get(ev->object);
|
2018-01-26 16:56:31 -08:00
|
|
|
char *dir = ecore_file_dir_get(path);
|
|
|
|
|
efl_model : rename all efl_model based classes.
Summary:
As the result of discussion in T7458,
we need to rename all efl_model based classes with efl_XXX_Model sequence.
I've run few vote for this, see V42, V43
few classes are totally renamed as our consideration of misnaming.
| Efl.Model_Loop | Efl.Loop_Model |
| Efl.Model_Item | Efl.Generic_Model |
| Efl.Model_Container | Efl.Container_Model |
| Efl.Model_Container_Item | Efl.Container_Model_Item |
| Efl.Model_Composite | Efl.Composite_Model |
| Efl.Model_Composite_Boolean | Efl.Boolean_Model |
| Efl.Model_Composite_Boolean_Chlidren | Efl.Boolean_Model_Item |
| Efl.Model_Composite_Selection | Efl.Select_Model |
| Efl.Model_Composite_Selection_Chlidren | Efl.Select_Model_Item |
| Efl.Model_View | Efl.View_Model |
| Eio.Model | Efl.Io.Model |
| Efl.Ui.Model_State | Efl.Ui.State_Model |
| Efl.Ui.Model_Size | Efl.Ui.Size_Model |
| Efl.Ui.Model_Exact | Efl.Ui.Exact_Model |
| Efl.Ui.Model_Average | Efl.Ui.Average_Model |
| Efl.Ui.Model_Homogeneous | Efl.Ui.Homogeneous_Model |
I worried about Efl.Io.Model changes, cause it is widely used,
but as I tested, there is no issue found yet.
Eldbus.Model also may can changed Efl.Dbus.Model,
but I cannot found any class who using Efl.Dbus namespace,
so I left it future work.
Test Plan:
Run the Make Test,
it works well except Efl test about selection.
there are class inheritance problem exist in select_model,
I reported it and will fix it in another patch.
Reviewers: cedric, felipealmeida, woohyun, Hermet
Reviewed By: cedric
Subscribers: lauromoura
Tags: #efl, #do_not_merge
Differential Revision: https://phab.enlightenment.org/D7533
2019-01-30 20:35:34 -08:00
|
|
|
parent = efl_add_ref(EFL_IO_MODEL_CLASS, obj, efl_io_model_path_set(efl_added, dir),
|
2018-05-04 16:15:18 -07:00
|
|
|
efl_event_callback_array_add(efl_added, noref_death(), NULL));
|
2018-01-26 16:56:31 -08:00
|
|
|
if (!parent)
|
|
|
|
{
|
|
|
|
ERR("Could not create model for '%s'.", dir);
|
2018-05-23 20:24:21 -07:00
|
|
|
_reset_target(pd);
|
2018-01-26 16:56:31 -08:00
|
|
|
free(dir);
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
efl_model_children_count_get(parent);
|
|
|
|
|
2019-03-27 15:19:32 -07:00
|
|
|
_populate(obj, parent, NULL, ev->object);
|
2018-05-04 16:15:18 -07:00
|
|
|
efl_unref(parent);
|
2018-01-26 16:56:31 -08:00
|
|
|
free(dir);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-05-23 20:23:48 -07:00
|
|
|
efl_model_children_count_get(ev->object);
|
2019-03-27 15:19:32 -07:00
|
|
|
_populate(obj, ev->object, NULL, NULL);
|
2018-01-26 16:56:31 -08:00
|
|
|
}
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-14 17:02:15 -07:00
|
|
|
Eina_Bool
|
2018-01-26 16:56:31 -08:00
|
|
|
_elm_fileselector_selected_set_internal(Evas_Object *obj, const char *path)
|
2010-04-08 13:36:37 -07:00
|
|
|
{
|
2018-01-26 16:56:31 -08:00
|
|
|
Eina_Value *value;
|
|
|
|
struct stat st;
|
|
|
|
|
2014-01-21 05:50:35 -08:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj, EINA_FALSE);
|
2018-01-26 16:56:31 -08:00
|
|
|
ELM_FILESELECTOR_DATA_GET(obj, pd);
|
2012-05-03 15:44:26 -07:00
|
|
|
|
2018-05-23 20:24:21 -07:00
|
|
|
_reset_target(pd);
|
2012-02-20 01:22:23 -08:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
if (stat(path, &st)) return EINA_FALSE;
|
2016-06-06 00:16:57 -07:00
|
|
|
|
2019-03-22 10:31:52 -07:00
|
|
|
pd->target_ready = EINA_FALSE;
|
efl_model : rename all efl_model based classes.
Summary:
As the result of discussion in T7458,
we need to rename all efl_model based classes with efl_XXX_Model sequence.
I've run few vote for this, see V42, V43
few classes are totally renamed as our consideration of misnaming.
| Efl.Model_Loop | Efl.Loop_Model |
| Efl.Model_Item | Efl.Generic_Model |
| Efl.Model_Container | Efl.Container_Model |
| Efl.Model_Container_Item | Efl.Container_Model_Item |
| Efl.Model_Composite | Efl.Composite_Model |
| Efl.Model_Composite_Boolean | Efl.Boolean_Model |
| Efl.Model_Composite_Boolean_Chlidren | Efl.Boolean_Model_Item |
| Efl.Model_Composite_Selection | Efl.Select_Model |
| Efl.Model_Composite_Selection_Chlidren | Efl.Select_Model_Item |
| Efl.Model_View | Efl.View_Model |
| Eio.Model | Efl.Io.Model |
| Efl.Ui.Model_State | Efl.Ui.State_Model |
| Efl.Ui.Model_Size | Efl.Ui.Size_Model |
| Efl.Ui.Model_Exact | Efl.Ui.Exact_Model |
| Efl.Ui.Model_Average | Efl.Ui.Average_Model |
| Efl.Ui.Model_Homogeneous | Efl.Ui.Homogeneous_Model |
I worried about Efl.Io.Model changes, cause it is widely used,
but as I tested, there is no issue found yet.
Eldbus.Model also may can changed Efl.Dbus.Model,
but I cannot found any class who using Efl.Dbus namespace,
so I left it future work.
Test Plan:
Run the Make Test,
it works well except Efl test about selection.
there are class inheritance problem exist in select_model,
I reported it and will fix it in another patch.
Reviewers: cedric, felipealmeida, woohyun, Hermet
Reviewed By: cedric
Subscribers: lauromoura
Tags: #efl, #do_not_merge
Differential Revision: https://phab.enlightenment.org/D7533
2019-01-30 20:35:34 -08:00
|
|
|
pd->target = efl_add_ref(EFL_IO_MODEL_CLASS, obj, efl_io_model_path_set(efl_added, path),
|
2018-05-04 16:15:18 -07:00
|
|
|
efl_event_callback_array_add(efl_added, noref_death(), NULL));
|
2018-01-26 16:56:31 -08:00
|
|
|
if (!pd->target)
|
|
|
|
{
|
|
|
|
ERR("Could not create model for '%s'.", path);
|
|
|
|
return EINA_FALSE;
|
2016-06-06 00:16:57 -07:00
|
|
|
}
|
2018-01-26 16:56:31 -08:00
|
|
|
|
|
|
|
efl_event_callback_add(pd->target, EFL_MODEL_EVENT_PROPERTIES_CHANGED, _properties_ready, obj);
|
|
|
|
value = efl_model_property_get(pd->target, "is_dir");
|
|
|
|
if (eina_value_type_get(value) == EINA_VALUE_TYPE_ERROR)
|
2010-04-08 13:36:37 -07:00
|
|
|
{
|
2018-01-26 16:56:31 -08:00
|
|
|
Eina_Error err = 0;
|
2016-06-06 00:16:57 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
eina_value_error_get(value, &err);
|
|
|
|
if (err != EAGAIN)
|
2016-06-06 00:16:57 -07:00
|
|
|
{
|
2018-01-26 16:56:31 -08:00
|
|
|
ERR("Unexpected error '%s' when setting path '%s'.", eina_value_to_string(value), path);
|
2012-02-20 01:22:23 -08:00
|
|
|
goto clean_up;
|
|
|
|
}
|
2010-09-07 20:54:42 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
return EINA_TRUE;
|
2010-04-08 13:36:37 -07:00
|
|
|
}
|
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
ERR("Unexpected value '%s' when setting path '%s'.", eina_value_to_string(value), path);
|
2014-03-30 00:15:55 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
clean_up:
|
2018-05-23 20:24:21 -07:00
|
|
|
_reset_target(pd);
|
2018-01-26 16:56:31 -08:00
|
|
|
return EINA_FALSE;
|
2010-04-08 13:36:37 -07:00
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_fileselector_elm_interface_fileselector_selected_model_set(Eo *obj, Elm_Fileselector_Data *pd, Efl_Model *model)
|
2016-06-06 00:16:57 -07:00
|
|
|
{
|
2018-01-26 16:56:31 -08:00
|
|
|
Eina_Value *value = NULL;
|
|
|
|
Eina_Bool dir = EINA_FALSE;
|
2016-06-06 00:16:57 -07:00
|
|
|
|
efl_model : rename all efl_model based classes.
Summary:
As the result of discussion in T7458,
we need to rename all efl_model based classes with efl_XXX_Model sequence.
I've run few vote for this, see V42, V43
few classes are totally renamed as our consideration of misnaming.
| Efl.Model_Loop | Efl.Loop_Model |
| Efl.Model_Item | Efl.Generic_Model |
| Efl.Model_Container | Efl.Container_Model |
| Efl.Model_Container_Item | Efl.Container_Model_Item |
| Efl.Model_Composite | Efl.Composite_Model |
| Efl.Model_Composite_Boolean | Efl.Boolean_Model |
| Efl.Model_Composite_Boolean_Chlidren | Efl.Boolean_Model_Item |
| Efl.Model_Composite_Selection | Efl.Select_Model |
| Efl.Model_Composite_Selection_Chlidren | Efl.Select_Model_Item |
| Efl.Model_View | Efl.View_Model |
| Eio.Model | Efl.Io.Model |
| Efl.Ui.Model_State | Efl.Ui.State_Model |
| Efl.Ui.Model_Size | Efl.Ui.Size_Model |
| Efl.Ui.Model_Exact | Efl.Ui.Exact_Model |
| Efl.Ui.Model_Average | Efl.Ui.Average_Model |
| Efl.Ui.Model_Homogeneous | Efl.Ui.Homogeneous_Model |
I worried about Efl.Io.Model changes, cause it is widely used,
but as I tested, there is no issue found yet.
Eldbus.Model also may can changed Efl.Dbus.Model,
but I cannot found any class who using Efl.Dbus namespace,
so I left it future work.
Test Plan:
Run the Make Test,
it works well except Efl test about selection.
there are class inheritance problem exist in select_model,
I reported it and will fix it in another patch.
Reviewers: cedric, felipealmeida, woohyun, Hermet
Reviewed By: cedric
Subscribers: lauromoura
Tags: #efl, #do_not_merge
Differential Revision: https://phab.enlightenment.org/D7533
2019-01-30 20:35:34 -08:00
|
|
|
if (!efl_isa(model, EFL_IO_MODEL_CLASS)) return EINA_FALSE;
|
2016-06-06 00:16:57 -07:00
|
|
|
|
2018-05-23 20:24:21 -07:00
|
|
|
efl_event_callback_del(pd->target, EFL_MODEL_EVENT_PROPERTIES_CHANGED, _properties_ready, obj);
|
2018-01-26 16:56:31 -08:00
|
|
|
efl_replace(&pd->target, model);
|
2016-06-06 00:16:57 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
if (!model) return EINA_TRUE;
|
2016-06-06 00:16:57 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
efl_event_callback_add(pd->target, EFL_MODEL_EVENT_PROPERTIES_CHANGED, _properties_ready, obj);
|
|
|
|
value = efl_model_property_get(pd->target, "is_dir");
|
|
|
|
if (eina_value_type_get(value) == EINA_VALUE_TYPE_ERROR)
|
|
|
|
{
|
|
|
|
Eina_Error err = 0;
|
2016-06-06 00:16:57 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
eina_value_error_get(value, &err);
|
|
|
|
if (err != EAGAIN)
|
|
|
|
{
|
efl_model : rename all efl_model based classes.
Summary:
As the result of discussion in T7458,
we need to rename all efl_model based classes with efl_XXX_Model sequence.
I've run few vote for this, see V42, V43
few classes are totally renamed as our consideration of misnaming.
| Efl.Model_Loop | Efl.Loop_Model |
| Efl.Model_Item | Efl.Generic_Model |
| Efl.Model_Container | Efl.Container_Model |
| Efl.Model_Container_Item | Efl.Container_Model_Item |
| Efl.Model_Composite | Efl.Composite_Model |
| Efl.Model_Composite_Boolean | Efl.Boolean_Model |
| Efl.Model_Composite_Boolean_Chlidren | Efl.Boolean_Model_Item |
| Efl.Model_Composite_Selection | Efl.Select_Model |
| Efl.Model_Composite_Selection_Chlidren | Efl.Select_Model_Item |
| Efl.Model_View | Efl.View_Model |
| Eio.Model | Efl.Io.Model |
| Efl.Ui.Model_State | Efl.Ui.State_Model |
| Efl.Ui.Model_Size | Efl.Ui.Size_Model |
| Efl.Ui.Model_Exact | Efl.Ui.Exact_Model |
| Efl.Ui.Model_Average | Efl.Ui.Average_Model |
| Efl.Ui.Model_Homogeneous | Efl.Ui.Homogeneous_Model |
I worried about Efl.Io.Model changes, cause it is widely used,
but as I tested, there is no issue found yet.
Eldbus.Model also may can changed Efl.Dbus.Model,
but I cannot found any class who using Efl.Dbus namespace,
so I left it future work.
Test Plan:
Run the Make Test,
it works well except Efl test about selection.
there are class inheritance problem exist in select_model,
I reported it and will fix it in another patch.
Reviewers: cedric, felipealmeida, woohyun, Hermet
Reviewed By: cedric
Subscribers: lauromoura
Tags: #efl, #do_not_merge
Differential Revision: https://phab.enlightenment.org/D7533
2019-01-30 20:35:34 -08:00
|
|
|
ERR("Unexpected error '%s' when setting path '%s'.", eina_value_to_string(value), efl_io_model_path_get(pd->target));
|
2018-01-26 16:56:31 -08:00
|
|
|
goto clean_up;
|
|
|
|
}
|
2016-06-06 00:16:57 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (eina_value_type_get(value) != EINA_VALUE_TYPE_BOOL)
|
|
|
|
{
|
|
|
|
ERR("Unexpected type for 'is_dir': '%s' with value '%s'.", eina_value_type_get(value)->name, eina_value_to_string(value));
|
|
|
|
goto clean_up;
|
|
|
|
}
|
|
|
|
|
|
|
|
efl_event_callback_del(pd->target, EFL_MODEL_EVENT_PROPERTIES_CHANGED, _properties_ready, obj);
|
|
|
|
|
|
|
|
eina_value_bool_get(value, &dir);
|
2016-06-06 00:16:57 -07:00
|
|
|
|
2018-01-26 16:56:31 -08:00
|
|
|
if (!dir)
|
|
|
|
{
|
|
|
|
Efl_Model *parent;
|
efl_model : rename all efl_model based classes.
Summary:
As the result of discussion in T7458,
we need to rename all efl_model based classes with efl_XXX_Model sequence.
I've run few vote for this, see V42, V43
few classes are totally renamed as our consideration of misnaming.
| Efl.Model_Loop | Efl.Loop_Model |
| Efl.Model_Item | Efl.Generic_Model |
| Efl.Model_Container | Efl.Container_Model |
| Efl.Model_Container_Item | Efl.Container_Model_Item |
| Efl.Model_Composite | Efl.Composite_Model |
| Efl.Model_Composite_Boolean | Efl.Boolean_Model |
| Efl.Model_Composite_Boolean_Chlidren | Efl.Boolean_Model_Item |
| Efl.Model_Composite_Selection | Efl.Select_Model |
| Efl.Model_Composite_Selection_Chlidren | Efl.Select_Model_Item |
| Efl.Model_View | Efl.View_Model |
| Eio.Model | Efl.Io.Model |
| Efl.Ui.Model_State | Efl.Ui.State_Model |
| Efl.Ui.Model_Size | Efl.Ui.Size_Model |
| Efl.Ui.Model_Exact | Efl.Ui.Exact_Model |
| Efl.Ui.Model_Average | Efl.Ui.Average_Model |
| Efl.Ui.Model_Homogeneous | Efl.Ui.Homogeneous_Model |
I worried about Efl.Io.Model changes, cause it is widely used,
but as I tested, there is no issue found yet.
Eldbus.Model also may can changed Efl.Dbus.Model,
but I cannot found any class who using Efl.Dbus namespace,
so I left it future work.
Test Plan:
Run the Make Test,
it works well except Efl test about selection.
there are class inheritance problem exist in select_model,
I reported it and will fix it in another patch.
Reviewers: cedric, felipealmeida, woohyun, Hermet
Reviewed By: cedric
Subscribers: lauromoura
Tags: #efl, #do_not_merge
Differential Revision: https://phab.enlightenment.org/D7533
2019-01-30 20:35:34 -08:00
|
|
|
const char *path = efl_io_model_path_get(pd->target);
|
2018-01-26 16:56:31 -08:00
|
|
|
char *d = ecore_file_dir_get(path);
|
|
|
|
|
efl_model : rename all efl_model based classes.
Summary:
As the result of discussion in T7458,
we need to rename all efl_model based classes with efl_XXX_Model sequence.
I've run few vote for this, see V42, V43
few classes are totally renamed as our consideration of misnaming.
| Efl.Model_Loop | Efl.Loop_Model |
| Efl.Model_Item | Efl.Generic_Model |
| Efl.Model_Container | Efl.Container_Model |
| Efl.Model_Container_Item | Efl.Container_Model_Item |
| Efl.Model_Composite | Efl.Composite_Model |
| Efl.Model_Composite_Boolean | Efl.Boolean_Model |
| Efl.Model_Composite_Boolean_Chlidren | Efl.Boolean_Model_Item |
| Efl.Model_Composite_Selection | Efl.Select_Model |
| Efl.Model_Composite_Selection_Chlidren | Efl.Select_Model_Item |
| Efl.Model_View | Efl.View_Model |
| Eio.Model | Efl.Io.Model |
| Efl.Ui.Model_State | Efl.Ui.State_Model |
| Efl.Ui.Model_Size | Efl.Ui.Size_Model |
| Efl.Ui.Model_Exact | Efl.Ui.Exact_Model |
| Efl.Ui.Model_Average | Efl.Ui.Average_Model |
| Efl.Ui.Model_Homogeneous | Efl.Ui.Homogeneous_Model |
I worried about Efl.Io.Model changes, cause it is widely used,
but as I tested, there is no issue found yet.
Eldbus.Model also may can changed Efl.Dbus.Model,
but I cannot found any class who using Efl.Dbus namespace,
so I left it future work.
Test Plan:
Run the Make Test,
it works well except Efl test about selection.
there are class inheritance problem exist in select_model,
I reported it and will fix it in another patch.
Reviewers: cedric, felipealmeida, woohyun, Hermet
Reviewed By: cedric
Subscribers: lauromoura
Tags: #efl, #do_not_merge
Differential Revision: https://phab.enlightenment.org/D7533
2019-01-30 20:35:34 -08:00
|
|
|
parent = efl_add_ref(EFL_IO_MODEL_CLASS, obj, efl_io_model_path_set(efl_added, d),
|
2018-05-04 16:15:18 -07:00
|
|
|
efl_event_callback_array_add(efl_added, noref_death(), NULL));
|
2018-01-26 16:56:31 -08:00
|
|
|
if (!parent)
|
|
|
|
{
|
|
|
|
ERR("Could not create model for '%s'.", d);
|
|
|
|
free(d);
|
|
|
|
goto clean_up;
|
|
|
|
}
|
|
|
|
efl_model_children_count_get(parent);
|
|
|
|
|
2019-03-27 15:19:32 -07:00
|
|
|
_populate(obj, parent, NULL, pd->target);
|
2018-05-04 16:15:18 -07:00
|
|
|
efl_unref(parent);
|
2018-01-26 16:56:31 -08:00
|
|
|
free(d);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
efl_model_children_count_get(pd->target);
|
2019-03-27 15:19:32 -07:00
|
|
|
_populate(obj, pd->target, NULL, NULL);
|
2018-01-26 16:56:31 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
|
|
|
|
clean_up:
|
2018-05-23 20:24:21 -07:00
|
|
|
_reset_target(pd);
|
2018-01-26 16:56:31 -08:00
|
|
|
return EINA_FALSE;
|
2016-06-06 00:16:57 -07:00
|
|
|
}
|
|
|
|
|
2013-10-16 19:04:57 -07:00
|
|
|
EAPI const Eina_List *
|
|
|
|
elm_fileselector_selected_paths_get(const Evas_Object* obj)
|
2016-09-14 17:02:15 -07:00
|
|
|
{
|
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj, NULL);
|
|
|
|
|
|
|
|
const Efl_Class *cls = efl_class_get(obj);
|
|
|
|
if (cls == ELM_FILESELECTOR_CLASS)
|
|
|
|
return _elm_fileselector_selected_paths_get_internal(obj);
|
|
|
|
else if (cls == ELM_FILESELECTOR_BUTTON_CLASS)
|
|
|
|
return _elm_fileselector_button_selected_paths_get_internal(obj);
|
|
|
|
else
|
|
|
|
ERR("Unknown Elm.Fileselector class");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
const Eina_List *
|
|
|
|
_elm_fileselector_selected_paths_get_internal(const Evas_Object* obj)
|
2013-10-16 19:04:57 -07:00
|
|
|
{
|
2014-01-21 05:50:35 -08:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj, NULL);
|
2016-06-06 00:16:57 -07:00
|
|
|
Eina_List *l;
|
|
|
|
Elm_Object_Item *item;
|
|
|
|
ELM_FILESELECTOR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (!sd->multi)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (sd->multi_selection_tmp)
|
|
|
|
{
|
|
|
|
sd->multi_selection_tmp = eina_list_free(sd->multi_selection_tmp);
|
|
|
|
}
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(sd->multi_selection, l, item)
|
|
|
|
{
|
|
|
|
Elm_Fileselector_Item_Data *it_data = elm_object_item_data_get(item);
|
|
|
|
sd->multi_selection_tmp = eina_list_append(sd->multi_selection_tmp, it_data->path);
|
|
|
|
}
|
|
|
|
return sd->multi_selection_tmp;
|
2013-10-16 19:04:57 -07:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
EOLIAN static const Eina_List*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_fileselector_elm_interface_fileselector_selected_models_get(const Eo *obj EINA_UNUSED, Elm_Fileselector_Data *sd)
|
2013-10-16 19:04:57 -07:00
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
Eina_List *l;
|
|
|
|
Elm_Object_Item *item;
|
|
|
|
if (!sd->multi)
|
2014-03-30 00:15:55 -07:00
|
|
|
return NULL;
|
2016-06-06 00:16:57 -07:00
|
|
|
|
|
|
|
if (sd->multi_selection_tmp)
|
|
|
|
{
|
|
|
|
sd->multi_selection_tmp = eina_list_free(sd->multi_selection_tmp);
|
|
|
|
}
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(sd->multi_selection, l, item)
|
|
|
|
{
|
|
|
|
Elm_Fileselector_Item_Data *it_data = elm_object_item_data_get(item);
|
|
|
|
sd->multi_selection_tmp = eina_list_append(sd->multi_selection_tmp, it_data->model);
|
|
|
|
}
|
|
|
|
return sd->multi_selection_tmp;
|
2013-10-16 19:04:57 -07:00
|
|
|
}
|
|
|
|
|
2014-10-05 16:08:24 -07:00
|
|
|
EAPI const char *
|
|
|
|
elm_fileselector_current_name_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj, NULL);
|
|
|
|
const char *ret = NULL;
|
2016-03-02 04:10:48 -08:00
|
|
|
ret = elm_interface_fileselector_current_name_get((Eo *) obj);
|
2014-10-05 16:08:24 -07:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static const char *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_fileselector_elm_interface_fileselector_current_name_get(const Eo *obj EINA_UNUSED, Elm_Fileselector_Data *sd)
|
2014-10-05 16:08:24 -07:00
|
|
|
{
|
|
|
|
return elm_object_text_get(sd->name_entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_fileselector_current_name_set(Evas_Object *obj,
|
|
|
|
const char *name)
|
|
|
|
{
|
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_fileselector_current_name_set((Eo *) obj, name);
|
2014-10-05 16:08:24 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
|
|
|
_elm_fileselector_elm_interface_fileselector_current_name_set(Eo *obj EINA_UNUSED, Elm_Fileselector_Data *sd, const char *name)
|
|
|
|
{
|
|
|
|
elm_object_text_set(sd->name_entry, name);
|
|
|
|
}
|
|
|
|
|
2013-12-28 20:23:17 -08:00
|
|
|
static Elm_Fileselector_Filter *
|
2014-04-22 05:51:46 -07:00
|
|
|
_filter_add(Elm_Fileselector_Data *sd, const char *filter_name)
|
2013-12-28 20:23:17 -08:00
|
|
|
{
|
|
|
|
Elm_Fileselector_Filter *ff;
|
2016-06-06 00:16:57 -07:00
|
|
|
ff = calloc(1, sizeof(Elm_Fileselector_Filter));
|
2015-06-12 23:45:36 -07:00
|
|
|
if (!ff) return NULL;
|
2013-12-28 20:23:17 -08:00
|
|
|
|
|
|
|
ff->filter_name = eina_stringshare_add(filter_name);
|
|
|
|
ff->sd = sd;
|
|
|
|
|
|
|
|
return ff;
|
|
|
|
}
|
|
|
|
|
2013-06-18 17:00:41 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_fileselector_mime_types_filter_append(Evas_Object *obj, const char *mime_type, const char *filter_name)
|
|
|
|
{
|
|
|
|
ELM_FILESELECTOR_CHECK(obj) EINA_FALSE;
|
2016-08-04 03:37:56 -07:00
|
|
|
return elm_interface_fileselector_mime_types_filter_append(obj, mime_type, filter_name);
|
2013-06-18 17:00:41 -07:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_elm_interface_fileselector_mime_types_filter_append(Eo *obj, Elm_Fileselector_Data *sd, const char *mime_types, const char *filter_name)
|
2013-06-18 17:00:41 -07:00
|
|
|
{
|
|
|
|
Elm_Fileselector_Filter *ff;
|
2016-03-04 15:39:29 -08:00
|
|
|
char buf[1024];
|
2013-06-18 17:00:41 -07:00
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
if (!mime_types) return EINA_FALSE;
|
2013-06-18 17:00:41 -07:00
|
|
|
|
2013-12-28 20:23:17 -08:00
|
|
|
ff = _filter_add(sd, filter_name ? filter_name : mime_types);
|
2015-06-12 23:45:36 -07:00
|
|
|
if (!ff) return EINA_FALSE;
|
|
|
|
|
2013-12-28 20:23:17 -08:00
|
|
|
ff->filter_type = ELM_FILESELECTOR_MIME_FILTER;
|
2013-06-18 17:00:41 -07:00
|
|
|
|
2013-12-28 20:23:17 -08:00
|
|
|
ff->filter.mime_types = eina_str_split(mime_types, ",", 0);
|
2013-06-18 17:00:41 -07:00
|
|
|
|
2013-12-28 20:23:17 -08:00
|
|
|
if (!sd->filter_list)
|
|
|
|
{
|
|
|
|
sd->current_filter = ff;
|
|
|
|
sd->filter_hoversel = elm_hoversel_add(obj);
|
|
|
|
elm_object_text_set(sd->filter_hoversel, ff->filter_name);
|
2016-03-04 15:39:29 -08:00
|
|
|
snprintf(buf, sizeof(buf), "fileselector/actions/%s", elm_widget_style_get(obj));
|
|
|
|
elm_widget_style_set(sd->filter_hoversel, buf);
|
|
|
|
elm_object_part_content_set(obj, "elm.swallow.filters", sd->filter_hoversel);
|
2013-12-28 20:23:17 -08:00
|
|
|
}
|
|
|
|
elm_hoversel_item_add(sd->filter_hoversel, ff->filter_name, NULL, ELM_ICON_NONE, _current_filter_changed, ff);
|
2013-06-18 17:00:41 -07:00
|
|
|
|
2013-12-28 20:23:17 -08:00
|
|
|
sd->filter_list = eina_list_append(sd->filter_list, ff);
|
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
if (sd->model)
|
2014-10-28 18:07:44 -07:00
|
|
|
{
|
2019-03-27 15:19:32 -07:00
|
|
|
_populate(obj, sd->model, NULL, NULL);
|
2014-10-28 18:07:44 -07:00
|
|
|
}
|
2013-12-28 20:23:17 -08:00
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
return EINA_TRUE;
|
2013-12-28 20:23:17 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_fileselector_custom_filter_append(Evas_Object *obj, Elm_Fileselector_Filter_Func func, void *data, const char *filter_name)
|
|
|
|
{
|
2014-01-21 05:50:35 -08:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj, EINA_FALSE);
|
2016-08-04 03:37:56 -07:00
|
|
|
return elm_interface_fileselector_custom_filter_append(obj, func, data, filter_name);
|
2013-12-28 20:23:17 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_elm_interface_fileselector_custom_filter_append(Eo *obj, Elm_Fileselector_Data *sd, Elm_Fileselector_Filter_Func func, void *data, const char *filter_name)
|
2013-12-28 20:23:17 -08:00
|
|
|
{
|
|
|
|
Elm_Fileselector_Filter *ff;
|
2015-06-12 23:45:36 -07:00
|
|
|
Elm_Fileselector_Custom_Filter *custom_filter;
|
2016-03-04 15:39:29 -08:00
|
|
|
char buf[1024];
|
2013-12-28 20:23:17 -08:00
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
if (!func) return EINA_FALSE;
|
2013-12-28 20:23:17 -08:00
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
custom_filter = calloc(1, sizeof(Elm_Fileselector_Custom_Filter));
|
2015-06-12 23:45:36 -07:00
|
|
|
if (!custom_filter) return EINA_FALSE;
|
|
|
|
|
2013-12-28 20:23:17 -08:00
|
|
|
ff = _filter_add(sd, filter_name ? filter_name : "custom");
|
2015-07-24 09:35:22 -07:00
|
|
|
if (!ff)
|
|
|
|
{
|
|
|
|
free(custom_filter);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2013-12-28 20:23:17 -08:00
|
|
|
|
2015-06-12 23:45:36 -07:00
|
|
|
ff->filter_type = ELM_FILESELECTOR_CUSTOM_FILTER;
|
|
|
|
ff->filter.custom = custom_filter;
|
2013-12-28 20:23:17 -08:00
|
|
|
ff->filter.custom->func = func;
|
|
|
|
ff->filter.custom->data = data;
|
2013-06-18 17:00:41 -07:00
|
|
|
|
|
|
|
if (!sd->filter_list)
|
|
|
|
{
|
|
|
|
sd->current_filter = ff;
|
|
|
|
sd->filter_hoversel = elm_hoversel_add(obj);
|
|
|
|
elm_object_text_set(sd->filter_hoversel, ff->filter_name);
|
2016-03-04 15:39:29 -08:00
|
|
|
snprintf(buf, sizeof(buf), "fileselector/actions/%s", elm_widget_style_get(obj));
|
|
|
|
elm_widget_style_set(sd->filter_hoversel, buf);
|
|
|
|
elm_object_part_content_set(obj, "elm.swallow.filters", sd->filter_hoversel);
|
2013-06-18 17:00:41 -07:00
|
|
|
}
|
2013-12-26 04:08:33 -08:00
|
|
|
elm_hoversel_item_add(sd->filter_hoversel, ff->filter_name, NULL, ELM_ICON_NONE, _current_filter_changed, ff);
|
2013-06-18 17:00:41 -07:00
|
|
|
|
|
|
|
sd->filter_list = eina_list_append(sd->filter_list, ff);
|
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
if (sd->model)
|
2014-10-28 18:07:44 -07:00
|
|
|
{
|
2019-03-27 15:19:32 -07:00
|
|
|
_populate(obj, sd->model, NULL, NULL);
|
2014-10-28 18:07:44 -07:00
|
|
|
}
|
2013-06-18 17:00:41 -07:00
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
return EINA_TRUE;
|
2013-06-18 17:00:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_fileselector_filters_clear(Evas_Object *obj)
|
|
|
|
{
|
2014-01-21 05:50:35 -08:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_fileselector_filters_clear(obj);
|
2013-06-18 17:00:41 -07:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_elm_interface_fileselector_filters_clear(Eo *obj, Elm_Fileselector_Data *sd)
|
2013-06-18 17:00:41 -07:00
|
|
|
{
|
|
|
|
Elm_Fileselector_Filter *filter;
|
|
|
|
|
|
|
|
EINA_LIST_FREE(sd->filter_list, filter)
|
|
|
|
{
|
|
|
|
eina_stringshare_del(filter->filter_name);
|
|
|
|
|
2013-12-28 20:23:17 -08:00
|
|
|
if (filter->filter_type == ELM_FILESELECTOR_MIME_FILTER)
|
|
|
|
{
|
|
|
|
free(filter->filter.mime_types[0]);
|
|
|
|
free(filter->filter.mime_types);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
free(filter->filter.custom);
|
2013-06-18 17:00:41 -07:00
|
|
|
|
|
|
|
free(filter);
|
|
|
|
}
|
|
|
|
|
|
|
|
ELM_SAFE_FREE(sd->filter_hoversel, evas_object_del);
|
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
if (sd->model)
|
2014-10-28 18:07:44 -07:00
|
|
|
{
|
2019-03-27 15:19:32 -07:00
|
|
|
_populate(obj, sd->model, NULL, NULL);
|
2014-10-28 18:07:44 -07:00
|
|
|
}
|
2013-06-18 17:00:41 -07:00
|
|
|
}
|
|
|
|
|
2013-10-17 20:16:54 -07:00
|
|
|
EAPI void
|
|
|
|
elm_fileselector_hidden_visible_set(Evas_Object *obj, Eina_Bool visible)
|
|
|
|
{
|
2014-01-21 05:50:35 -08:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_fileselector_hidden_visible_set(obj, visible);
|
2013-10-17 20:16:54 -07:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_elm_interface_fileselector_hidden_visible_set(Eo *obj EINA_UNUSED, Elm_Fileselector_Data *sd, Eina_Bool visible)
|
2013-10-17 20:16:54 -07:00
|
|
|
{
|
|
|
|
visible = !!visible;
|
|
|
|
if (sd->hidden_visible == visible) return;
|
|
|
|
sd->hidden_visible = visible;
|
|
|
|
|
|
|
|
_clear_selections(sd, NULL);
|
2014-10-28 18:07:44 -07:00
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
if (sd->model)
|
2014-10-28 18:07:44 -07:00
|
|
|
{
|
2019-03-27 15:19:32 -07:00
|
|
|
_populate(obj, sd->model, NULL, NULL);
|
2014-10-28 18:07:44 -07:00
|
|
|
}
|
2013-10-17 20:16:54 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_fileselector_hidden_visible_get(const Evas_Object *obj)
|
|
|
|
{
|
2014-01-21 05:50:35 -08:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj, EINA_FALSE);
|
2016-08-04 03:37:56 -07:00
|
|
|
return elm_interface_fileselector_hidden_visible_get((Eo *) obj);
|
2013-10-17 20:16:54 -07:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_fileselector_elm_interface_fileselector_hidden_visible_get(const Eo *obj EINA_UNUSED, Elm_Fileselector_Data *sd)
|
2013-10-17 20:16:54 -07:00
|
|
|
{
|
2014-03-30 00:15:55 -07:00
|
|
|
return sd->hidden_visible;
|
2013-10-17 20:16:54 -07:00
|
|
|
}
|
|
|
|
|
2013-12-03 01:28:52 -08:00
|
|
|
EAPI void
|
|
|
|
elm_fileselector_thumbnail_size_set(Evas_Object *obj,
|
|
|
|
Evas_Coord w,
|
|
|
|
Evas_Coord h)
|
|
|
|
{
|
2014-01-21 05:50:35 -08:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_fileselector_thumbnail_size_set(obj, w, h);
|
2013-12-03 01:28:52 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_elm_interface_fileselector_thumbnail_size_set(Eo *obj EINA_UNUSED, Elm_Fileselector_Data *sd, Evas_Coord w, Evas_Coord h)
|
2013-12-03 01:28:52 -08:00
|
|
|
{
|
|
|
|
if (sd->thumbnail_size.w == w && sd->thumbnail_size.h == h) return;
|
|
|
|
|
|
|
|
if (!w || !h)
|
2017-04-17 23:25:51 -07:00
|
|
|
w = h = ITEM_SIZE_DEFAULT;
|
2013-12-03 01:28:52 -08:00
|
|
|
|
|
|
|
sd->thumbnail_size.w = w;
|
|
|
|
sd->thumbnail_size.h = h;
|
|
|
|
|
|
|
|
if (sd->mode == ELM_FILESELECTOR_GRID)
|
2017-04-17 23:25:51 -07:00
|
|
|
elm_gengrid_item_size_set(sd->files_view, w, h);
|
2013-12-03 01:28:52 -08:00
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
if (sd->model)
|
2014-10-28 18:07:44 -07:00
|
|
|
{
|
2019-03-27 15:19:32 -07:00
|
|
|
_populate(obj, sd->model, NULL, NULL);
|
2014-10-28 18:07:44 -07:00
|
|
|
}
|
2013-12-03 01:28:52 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_fileselector_thumbnail_size_get(const Evas_Object *obj,
|
|
|
|
Evas_Coord *w,
|
|
|
|
Evas_Coord *h)
|
|
|
|
{
|
2014-01-21 05:50:35 -08:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_fileselector_thumbnail_size_get((Eo *) obj, w, h);
|
2013-12-03 01:28:52 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
EOLIAN static void
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_fileselector_elm_interface_fileselector_thumbnail_size_get(const Eo *obj EINA_UNUSED, Elm_Fileselector_Data *sd, Evas_Coord *w, Evas_Coord *h)
|
2013-12-03 01:28:52 -08:00
|
|
|
{
|
|
|
|
if (w) *w = sd->thumbnail_size.w;
|
|
|
|
if (h) *h = sd->thumbnail_size.h;
|
|
|
|
}
|
|
|
|
|
2013-12-18 03:05:35 -08:00
|
|
|
EAPI void
|
|
|
|
elm_fileselector_sort_method_set(Evas_Object *obj, Elm_Fileselector_Sort sort)
|
|
|
|
{
|
2014-01-21 05:50:35 -08:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_fileselector_sort_method_set(obj, sort);
|
2013-12-18 03:05:35 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_elm_interface_fileselector_sort_method_set(Eo *obj EINA_UNUSED, Elm_Fileselector_Data *sd, Elm_Fileselector_Sort sort)
|
2013-12-18 03:05:35 -08:00
|
|
|
{
|
|
|
|
if (sd->sort_type == sort) return;
|
|
|
|
sd->sort_type = sort;
|
|
|
|
|
|
|
|
switch (sd->sort_type)
|
|
|
|
{
|
|
|
|
case ELM_FILESELECTOR_SORT_BY_FILENAME_ASC:
|
2016-06-06 00:16:57 -07:00
|
|
|
sd->sort_method = _filename_cmp;
|
2013-12-18 03:05:35 -08:00
|
|
|
break;
|
|
|
|
case ELM_FILESELECTOR_SORT_BY_FILENAME_DESC:
|
2016-06-06 00:16:57 -07:00
|
|
|
sd->sort_method = _filename_cmp_rev;
|
2013-12-18 03:05:35 -08:00
|
|
|
break;
|
|
|
|
case ELM_FILESELECTOR_SORT_BY_TYPE_ASC:
|
2016-06-06 00:16:57 -07:00
|
|
|
sd->sort_method = _type_cmp;
|
2013-12-18 03:05:35 -08:00
|
|
|
break;
|
|
|
|
case ELM_FILESELECTOR_SORT_BY_TYPE_DESC:
|
2016-06-06 00:16:57 -07:00
|
|
|
sd->sort_method = _type_cmp_rev;
|
2013-12-18 03:05:35 -08:00
|
|
|
break;
|
|
|
|
case ELM_FILESELECTOR_SORT_BY_SIZE_ASC:
|
|
|
|
sd->sort_method = _size_cmp;
|
|
|
|
break;
|
|
|
|
case ELM_FILESELECTOR_SORT_BY_SIZE_DESC:
|
|
|
|
sd->sort_method = _size_cmp_rev;
|
|
|
|
break;
|
|
|
|
case ELM_FILESELECTOR_SORT_BY_MODIFIED_ASC:
|
|
|
|
sd->sort_method = _modified_cmp;
|
|
|
|
break;
|
|
|
|
case ELM_FILESELECTOR_SORT_BY_MODIFIED_DESC:
|
|
|
|
sd->sort_method = _modified_cmp_rev;
|
|
|
|
break;
|
|
|
|
case ELM_FILESELECTOR_SORT_LAST:
|
|
|
|
default:
|
2016-06-06 00:16:57 -07:00
|
|
|
sd->sort_method = _filename_cmp;
|
2013-12-18 03:05:35 -08:00
|
|
|
}
|
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
if (sd->model)
|
2014-10-28 18:07:44 -07:00
|
|
|
{
|
2019-03-27 15:19:32 -07:00
|
|
|
_populate(obj, sd->model, NULL, NULL);
|
2014-10-28 18:07:44 -07:00
|
|
|
}
|
2013-12-18 03:05:35 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Elm_Fileselector_Sort
|
|
|
|
elm_fileselector_sort_method_get(const Evas_Object *obj)
|
|
|
|
{
|
2014-01-21 05:50:35 -08:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj, ELM_FILESELECTOR_SORT_LAST);
|
2016-08-04 03:37:56 -07:00
|
|
|
return elm_interface_fileselector_sort_method_get((Eo *) obj);
|
2013-12-18 03:05:35 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
EOLIAN static Elm_Fileselector_Sort
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_fileselector_elm_interface_fileselector_sort_method_get(const Eo *obj EINA_UNUSED, Elm_Fileselector_Data *sd)
|
2013-12-18 03:05:35 -08:00
|
|
|
{
|
2014-03-30 00:15:55 -07:00
|
|
|
return sd->sort_type;
|
2013-12-18 03:05:35 -08:00
|
|
|
}
|
|
|
|
|
2017-07-05 04:06:24 -07:00
|
|
|
static Eina_Bool
|
2017-06-04 07:25:36 -07:00
|
|
|
_elm_fileselector_text_set(Eo *obj EINA_UNUSED, Elm_Fileselector_Data *sd, const char *part, const char *label)
|
2013-07-22 09:51:27 -07:00
|
|
|
{
|
2014-03-30 00:15:55 -07:00
|
|
|
if (!part) return EINA_FALSE;
|
2013-07-22 09:51:27 -07:00
|
|
|
|
|
|
|
if (sd->ok_button && !strcmp(part, "ok"))
|
|
|
|
{
|
|
|
|
elm_object_text_set(sd->ok_button, label);
|
2014-03-30 00:15:55 -07:00
|
|
|
return EINA_TRUE;
|
2013-07-22 09:51:27 -07:00
|
|
|
}
|
|
|
|
else if (sd->cancel_button && !strcmp(part, "cancel"))
|
|
|
|
{
|
|
|
|
elm_object_text_set(sd->cancel_button, label);
|
2014-03-30 00:15:55 -07:00
|
|
|
return EINA_TRUE;
|
2013-07-22 09:51:27 -07:00
|
|
|
}
|
2013-07-22 14:11:30 -07:00
|
|
|
else
|
2014-03-30 00:15:55 -07:00
|
|
|
{
|
2017-06-04 07:25:36 -07:00
|
|
|
Eina_Bool int_ret = EINA_TRUE;
|
|
|
|
efl_text_set(efl_part(efl_super(obj, MY_CLASS), part), label);
|
2014-03-30 00:15:55 -07:00
|
|
|
return int_ret;
|
|
|
|
}
|
2013-07-22 14:11:30 -07:00
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
return EINA_FALSE;
|
2013-07-22 09:51:27 -07:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
EOLIAN static void
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_fileselector_class_constructor(Efl_Class *klass)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2013-06-26 23:21:37 -07:00
|
|
|
unsigned int i;
|
|
|
|
|
2013-11-07 03:44:22 -08:00
|
|
|
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
2013-06-26 23:21:37 -07:00
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
ELM_FILESELECTOR_ERROR_UNKNOWN = eina_error_msg_static_register(ELM_FILESELECTOR_ERROR_UNKNOWN_STR);
|
|
|
|
ELM_FILESELECTOR_ERROR_INVALID_MODEL = eina_error_msg_static_register(ELM_FILESELECTOR_ERROR_INVALID_MODEL_STR);
|
|
|
|
|
2013-06-26 23:21:37 -07:00
|
|
|
for (i = 0; i < ELM_FILE_LAST; ++i)
|
|
|
|
{
|
|
|
|
list_itc[i] = elm_genlist_item_class_new();
|
|
|
|
grid_itc[i] = elm_gengrid_item_class_new();
|
|
|
|
|
|
|
|
list_itc[i]->item_style = "default";
|
|
|
|
list_itc[i]->func.text_get = grid_itc[i]->func.text_get =
|
|
|
|
_itc_text_get;
|
|
|
|
list_itc[i]->func.state_get = grid_itc[i]->func.state_get =
|
|
|
|
_itc_state_get;
|
|
|
|
list_itc[i]->func.del = grid_itc[i]->func.del = _itc_del;
|
|
|
|
}
|
2013-10-17 16:11:10 -07:00
|
|
|
|
|
|
|
list_itc[ELM_DIRECTORY]->func.content_get =
|
|
|
|
grid_itc[ELM_DIRECTORY]->func.content_get = _itc_icon_folder_get;
|
|
|
|
list_itc[ELM_FILE_IMAGE]->func.content_get =
|
|
|
|
grid_itc[ELM_FILE_IMAGE]->func.content_get = _itc_icon_image_get;
|
|
|
|
list_itc[ELM_FILE_UNKNOW]->func.content_get =
|
|
|
|
grid_itc[ELM_FILE_UNKNOW]->func.content_get = _itc_icon_file_get;
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2013-06-26 23:21:37 -07:00
|
|
|
|
2014-03-30 00:15:55 -07:00
|
|
|
EOLIAN static void
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_fileselector_class_destructor(Efl_Class *klass EINA_UNUSED)
|
2013-06-26 23:21:37 -07:00
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
for (i = 0; i < ELM_FILE_LAST; ++i)
|
|
|
|
{
|
|
|
|
elm_genlist_item_class_free(list_itc[i]);
|
|
|
|
elm_gengrid_item_class_free(grid_itc[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-15 18:55:06 -08:00
|
|
|
EOLIAN const Efl_Access_Action_Data *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_fileselector_efl_access_widget_action_elm_actions_get(const Eo *obj EINA_UNUSED, Elm_Fileselector_Data *pd EINA_UNUSED)
|
2014-07-25 01:33:19 -07:00
|
|
|
{
|
2017-11-15 18:55:06 -08:00
|
|
|
static Efl_Access_Action_Data atspi_actions[] = {
|
2014-07-25 01:33:19 -07:00
|
|
|
{ "select", "select", NULL, _key_action_select },
|
|
|
|
{ "escape", "escape", NULL, _key_action_escape},
|
2016-03-04 15:32:22 -08:00
|
|
|
{ "backspace", "backspace", NULL, _key_action_backspace},
|
2014-07-25 01:33:19 -07:00
|
|
|
{ NULL, NULL, NULL, NULL}
|
|
|
|
};
|
|
|
|
return &atspi_actions[0];
|
|
|
|
}
|
|
|
|
|
2017-08-16 23:08:00 -07:00
|
|
|
/* Internal EO APIs and hidden overrides */
|
|
|
|
|
|
|
|
ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(elm_fileselector, Elm_Fileselector_Data)
|
2017-06-04 07:25:36 -07:00
|
|
|
|
|
|
|
/* Efl.Part begin */
|
|
|
|
|
2017-09-19 04:02:26 -07:00
|
|
|
ELM_PART_OVERRIDE(elm_fileselector, ELM_FILESELECTOR, Elm_Fileselector_Data)
|
|
|
|
ELM_PART_OVERRIDE_TEXT_SET(elm_fileselector, ELM_FILESELECTOR, Elm_Fileselector_Data)
|
edje/elm: Rename _internal_ to _part_ (EO)
In Edje and Elementary, we have part objects, which are what is returned
by the interface efl_part(). Those objects can't be of an opaque type as
this doesn't work nicely with strongly typed languages such as C++ or
C#. In JS, Lua, C the types are weak and mostly runtime-based so it
doesn't matter much.
As a consequence, the documentation and the types need to look nice in
this EO API. Thus, we remove the abusive term "internal" and explicitly
call all those classes "part" something.
Eventually we want the types to be declared in the EO file so bindings
(C#, C++, ...) can generate the proper access methods, returning the
best possible types.
Note that right now a few of those part types are used in the legacy API
but don't actually need to be exposed externally.
This is kind of a mega commit that does all the renaming at once, but
it's really just a big sed operation. The power of good IDEs :)
Ref T5315
Ref T5306
2017-09-12 21:29:25 -07:00
|
|
|
#include "elm_fileselector_part.eo.c"
|
2017-06-04 07:25:36 -07:00
|
|
|
|
|
|
|
/* Efl.Part end */
|
2017-08-16 23:08:00 -07:00
|
|
|
|
2017-05-18 01:52:17 -07:00
|
|
|
/* Internal EO APIs and hidden overrides */
|
|
|
|
|
2017-04-20 09:24:38 -07:00
|
|
|
#define ELM_FILESELECTOR_EXTRA_OPS \
|
2017-05-18 01:52:17 -07:00
|
|
|
EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_fileselector), \
|
2017-04-20 09:24:38 -07:00
|
|
|
EFL_OBJECT_OP_FUNC(efl_event_callback_legacy_call, _elm_fileselector_efl_object_event_callback_legacy_call)
|
|
|
|
|
2019-03-05 14:00:37 -08:00
|
|
|
#include "elm_fileselector_eo.c"
|