forked from enlightenment/efl
elm fileselector: fix legacy methods for Entry and Button
Some legacy functions that works with string paths were not redirecting for the correct code when called with Elm.Fileselector.Button or Elm.Fileselector.Entry. This commit fixes this problem. @fix
This commit is contained in:
parent
93d7b480fd
commit
35ecfcd650
|
@ -2487,6 +2487,24 @@ EAPI const char *
|
||||||
elm_fileselector_selected_get(const Evas_Object *obj)
|
elm_fileselector_selected_get(const Evas_Object *obj)
|
||||||
{
|
{
|
||||||
ELM_FILESELECTOR_INTERFACE_CHECK(obj, NULL);
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj, NULL);
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
ELM_FILESELECTOR_DATA_GET(obj, sd);
|
ELM_FILESELECTOR_DATA_GET(obj, sd);
|
||||||
if (!sd->path) return NULL;
|
if (!sd->path) return NULL;
|
||||||
|
|
||||||
|
@ -2515,6 +2533,25 @@ _elm_fileselector_elm_interface_fileselector_selected_model_get(Eo *fs EINA_UNUS
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
elm_fileselector_selected_set(Evas_Object *obj,
|
elm_fileselector_selected_set(Evas_Object *obj,
|
||||||
const char *_path)
|
const char *_path)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Eina_Bool
|
||||||
|
_elm_fileselector_selected_set_internal(Evas_Object *obj, const char *_path)
|
||||||
{
|
{
|
||||||
ELM_FILESELECTOR_INTERFACE_CHECK(obj, EINA_FALSE);
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj, EINA_FALSE);
|
||||||
Eina_Bool ret = EINA_FALSE;
|
Eina_Bool ret = EINA_FALSE;
|
||||||
|
@ -2650,6 +2687,21 @@ _elm_fileselector_elm_interface_fileselector_selected_model_set(Eo *obj, Elm_Fil
|
||||||
|
|
||||||
EAPI const Eina_List *
|
EAPI const Eina_List *
|
||||||
elm_fileselector_selected_paths_get(const Evas_Object* obj)
|
elm_fileselector_selected_paths_get(const Evas_Object* obj)
|
||||||
|
{
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
ELM_FILESELECTOR_INTERFACE_CHECK(obj, NULL);
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj, NULL);
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
|
|
|
@ -239,6 +239,7 @@ _elm_fileselector_button_efl_canvas_group_group_del(Eo *obj, Elm_Fileselector_Bu
|
||||||
eina_stringshare_del(sd->fsd.path);
|
eina_stringshare_del(sd->fsd.path);
|
||||||
if (sd->fsd.selection)
|
if (sd->fsd.selection)
|
||||||
efl_unref(sd->fsd.selection);
|
efl_unref(sd->fsd.selection);
|
||||||
|
eina_stringshare_del(sd->fsd.selection_path);
|
||||||
evas_object_del(sd->fsw);
|
evas_object_del(sd->fsw);
|
||||||
|
|
||||||
efl_canvas_group_del(efl_super(obj, MY_CLASS));
|
efl_canvas_group_del(efl_super(obj, MY_CLASS));
|
||||||
|
@ -334,7 +335,7 @@ EINA_DEPRECATED EAPI void
|
||||||
elm_fileselector_button_path_set(Evas_Object *obj, const char *path)
|
elm_fileselector_button_path_set(Evas_Object *obj, const char *path)
|
||||||
{
|
{
|
||||||
ELM_FILESELECTOR_INTERFACE_CHECK(obj);
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj);
|
||||||
_elm_fileselector_button_path_set_internal(obj, path);
|
elm_fileselector_path_set(obj, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
|
@ -370,7 +371,7 @@ EINA_DEPRECATED EAPI const char *
|
||||||
elm_fileselector_button_path_get(const Evas_Object *obj)
|
elm_fileselector_button_path_get(const Evas_Object *obj)
|
||||||
{
|
{
|
||||||
ELM_FILESELECTOR_INTERFACE_CHECK(obj, NULL);
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj, NULL);
|
||||||
return _elm_fileselector_button_path_get_internal(obj);
|
return elm_fileselector_path_get(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static Efl_Model *
|
EOLIAN static Efl_Model *
|
||||||
|
@ -514,6 +515,16 @@ _elm_fileselector_button_elm_interface_fileselector_multi_select_get(Eo *obj EIN
|
||||||
return sd->fsd.multi;
|
return sd->fsd.multi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Eina_List *
|
||||||
|
_elm_fileselector_button_selected_paths_get_internal(const Evas_Object *obj)
|
||||||
|
{
|
||||||
|
ELM_FILESELECTOR_BUTTON_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
|
||||||
|
|
||||||
|
if (sd->fs) return elm_fileselector_selected_paths_get(sd->fs);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
EOLIAN static const Eina_List*
|
EOLIAN static const Eina_List*
|
||||||
_elm_fileselector_button_elm_interface_fileselector_selected_models_get(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd)
|
_elm_fileselector_button_elm_interface_fileselector_selected_models_get(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd)
|
||||||
{
|
{
|
||||||
|
@ -522,12 +533,45 @@ _elm_fileselector_button_elm_interface_fileselector_selected_models_get(Eo *obj
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
_elm_fileselector_button_selected_get_internal(const Evas_Object *obj)
|
||||||
|
{
|
||||||
|
ELM_FILESELECTOR_BUTTON_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
|
||||||
|
|
||||||
|
if (sd->fs) return elm_fileselector_selected_get(sd->fs);
|
||||||
|
|
||||||
|
return sd->fsd.selection_path;
|
||||||
|
}
|
||||||
|
|
||||||
EOLIAN static Efl_Model *
|
EOLIAN static Efl_Model *
|
||||||
_elm_fileselector_button_elm_interface_fileselector_selected_model_get(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd)
|
_elm_fileselector_button_elm_interface_fileselector_selected_model_get(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd)
|
||||||
{
|
{
|
||||||
if (sd->fs) return elm_interface_fileselector_selected_model_get(sd->fs);
|
if (sd->fs) return elm_interface_fileselector_selected_model_get(sd->fs);
|
||||||
|
|
||||||
return NULL;
|
return sd->fsd.selection;
|
||||||
|
}
|
||||||
|
|
||||||
|
Eina_Bool
|
||||||
|
_elm_fileselector_button_selected_set_internal(Evas_Object *obj, const char *_path)
|
||||||
|
{
|
||||||
|
ELM_FILESELECTOR_BUTTON_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
|
||||||
|
Eina_Bool ret = EINA_TRUE;
|
||||||
|
|
||||||
|
if (sd->fs) ret = elm_fileselector_selected_set(sd->fs, _path);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char *path = ecore_file_realpath(_path);
|
||||||
|
if (!ecore_file_is_dir(path) && !ecore_file_exists(path))
|
||||||
|
{
|
||||||
|
free(path);
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
free(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
eina_stringshare_replace(&sd->fsd.selection_path, _path);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -399,8 +399,15 @@ EINA_DEPRECATED EAPI void
|
||||||
elm_fileselector_entry_selected_set(Evas_Object *obj, const char *path)
|
elm_fileselector_entry_selected_set(Evas_Object *obj, const char *path)
|
||||||
{
|
{
|
||||||
ELM_FILESELECTOR_INTERFACE_CHECK(obj);
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj);
|
||||||
ELM_FILESELECTOR_ENTRY_DATA_GET_OR_RETURN(obj, sd);
|
elm_fileselector_selected_set(obj, path);
|
||||||
_elm_fileselector_button_path_set_internal(sd->button, path);
|
}
|
||||||
|
|
||||||
|
Eina_Bool
|
||||||
|
_elm_fileselector_entry_selected_set_internal(Evas_Object *obj, const char *path)
|
||||||
|
{
|
||||||
|
ELM_FILESELECTOR_ENTRY_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
|
||||||
|
elm_fileselector_path_set(sd->button, path);
|
||||||
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
|
@ -417,8 +424,14 @@ EINA_DEPRECATED EAPI const char *
|
||||||
elm_fileselector_entry_selected_get(const Evas_Object *obj)
|
elm_fileselector_entry_selected_get(const Evas_Object *obj)
|
||||||
{
|
{
|
||||||
ELM_FILESELECTOR_INTERFACE_CHECK(obj, NULL);
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj, NULL);
|
||||||
|
return elm_fileselector_selected_get((Eo *) obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
_elm_fileselector_entry_selected_get_internal(const Evas_Object *obj)
|
||||||
|
{
|
||||||
ELM_FILESELECTOR_ENTRY_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
|
ELM_FILESELECTOR_ENTRY_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
|
||||||
return _elm_fileselector_button_path_get_internal(sd->button);
|
return elm_fileselector_path_get(sd->button);
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static Efl_Model *
|
EOLIAN static Efl_Model *
|
||||||
|
@ -466,21 +479,23 @@ elm_fileselector_entry_path_set(Evas_Object *obj,
|
||||||
const char *path)
|
const char *path)
|
||||||
{
|
{
|
||||||
ELM_FILESELECTOR_INTERFACE_CHECK(obj);
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj);
|
||||||
_elm_fileselector_entry_path_set_internal(obj, path);
|
elm_fileselector_path_set(obj, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_elm_fileselector_entry_path_set_internal(Evas_Object *obj, const char *path)
|
_elm_fileselector_entry_path_set_internal(Evas_Object *obj, const char *path)
|
||||||
{
|
{
|
||||||
ELM_FILESELECTOR_ENTRY_DATA_GET_OR_RETURN(obj, sd);
|
ELM_FILESELECTOR_ENTRY_DATA_GET_OR_RETURN(obj, sd);
|
||||||
char *s = elm_entry_utf8_to_markup(path);
|
char *s;
|
||||||
|
|
||||||
|
elm_fileselector_path_set(sd->button, path);
|
||||||
|
|
||||||
|
s = elm_entry_utf8_to_markup(path);
|
||||||
if (s)
|
if (s)
|
||||||
{
|
{
|
||||||
elm_object_text_set(sd->entry, s);
|
elm_object_text_set(sd->entry, s);
|
||||||
free(s);
|
free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
_elm_fileselector_button_path_set_internal(sd->button, path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -516,7 +531,7 @@ EINA_DEPRECATED EAPI const char *
|
||||||
elm_fileselector_entry_path_get(const Evas_Object *obj)
|
elm_fileselector_entry_path_get(const Evas_Object *obj)
|
||||||
{
|
{
|
||||||
ELM_FILESELECTOR_INTERFACE_CHECK(obj, NULL);
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj, NULL);
|
||||||
return _elm_fileselector_entry_path_get_internal(obj);
|
return elm_fileselector_path_get(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
|
|
|
@ -23,18 +23,45 @@ _elm_fileselector_path_set_internal(Evas_Object *obj, const char *path);
|
||||||
const char *
|
const char *
|
||||||
_elm_fileselector_path_get_internal(const Evas_Object *obj);
|
_elm_fileselector_path_get_internal(const Evas_Object *obj);
|
||||||
|
|
||||||
|
Eina_Bool
|
||||||
|
_elm_fileselector_selected_set_internal(Evas_Object *obj, const char *_path);
|
||||||
|
|
||||||
|
const char *
|
||||||
|
_elm_fileselector_selected_get_internal(const Evas_Object *obj);
|
||||||
|
|
||||||
|
const Eina_List *
|
||||||
|
_elm_fileselector_selected_paths_get_internal(const Evas_Object* obj);
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_elm_fileselector_entry_path_set_internal(Evas_Object *obj, const char *path);
|
_elm_fileselector_entry_path_set_internal(Evas_Object *obj, const char *path);
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
_elm_fileselector_entry_path_get_internal(const Evas_Object *obj);
|
_elm_fileselector_entry_path_get_internal(const Evas_Object *obj);
|
||||||
|
|
||||||
|
Eina_Bool
|
||||||
|
_elm_fileselector_entry_selected_set_internal(Evas_Object *obj, const char *path);
|
||||||
|
|
||||||
|
const char *
|
||||||
|
_elm_fileselector_entry_selected_get_internal(const Evas_Object *obj);
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_elm_fileselector_button_path_set_internal(Evas_Object *obj, const char *path);
|
_elm_fileselector_button_path_set_internal(Evas_Object *obj, const char *path);
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
_elm_fileselector_button_path_get_internal(const Evas_Object *obj);
|
_elm_fileselector_button_path_get_internal(const Evas_Object *obj);
|
||||||
|
|
||||||
|
Eina_Bool
|
||||||
|
_elm_fileselector_button_selected_set_internal(Evas_Object *obj, const char *_path);
|
||||||
|
|
||||||
|
const char *
|
||||||
|
_elm_fileselector_button_selected_get_internal(const Evas_Object *obj);
|
||||||
|
|
||||||
|
const Eina_List *
|
||||||
|
_elm_fileselector_button_selected_paths_get_internal(const Evas_Object *obj);
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_event_to_legacy_call(Eo *obj, const Efl_Event_Description *evt_desc, void *event_info);
|
_event_to_legacy_call(Eo *obj, const Efl_Event_Description *evt_desc, void *event_info);
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ struct _Elm_Fileselector_Button_Data
|
||||||
Efl_Model *model;
|
Efl_Model *model;
|
||||||
const char *path;
|
const char *path;
|
||||||
Efl_Model *selection;
|
Efl_Model *selection;
|
||||||
|
const char *selection_path;
|
||||||
Evas_Coord_Size thumbnail_size;
|
Evas_Coord_Size thumbnail_size;
|
||||||
Elm_Fileselector_Mode mode;
|
Elm_Fileselector_Mode mode;
|
||||||
Elm_Fileselector_Sort sort_type;
|
Elm_Fileselector_Sort sort_type;
|
||||||
|
|
Loading…
Reference in New Issue