summaryrefslogtreecommitdiff
path: root/src/lib/elementary/elc_fileselector_entry.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/elementary/elc_fileselector_entry.c')
-rw-r--r--src/lib/elementary/elc_fileselector_entry.c131
1 files changed, 38 insertions, 93 deletions
diff --git a/src/lib/elementary/elc_fileselector_entry.c b/src/lib/elementary/elc_fileselector_entry.c
index 8b0c4238b0..d2b3b380f2 100644
--- a/src/lib/elementary/elc_fileselector_entry.c
+++ b/src/lib/elementary/elc_fileselector_entry.c
@@ -3,9 +3,12 @@
# include "elementary_config.h"
#endif
-#define EFL_ACCESS_PROTECTED
+#define EFL_ACCESS_OBJECT_PROTECTED
+#define ELM_INTERFACE_FILESELECTOR_BETA
+#define EFL_PART_PROTECTED
#include <Elementary.h>
+#include "Eio_Eo.h"
#include "elm_priv.h"
#include "elm_fileselector_button.eo.h"
#include "elm_fileselector_entry.eo.h"
@@ -66,53 +69,25 @@ SIG_FWD(UNPRESSED, EFL_UI_EVENT_UNPRESSED)
#undef SIG_FWD
static void
-_file_chosen_path_then(void *data, Efl_Event const* event)
+_FILE_CHOSEN_fwd(void *data, const Efl_Event *event)
{
- Eina_Array *args = data;
- const char *file = NULL;
- char *s;
- Eo *fs = eina_array_data_get(args, 0);
- Efl_Model *model = eina_array_data_get(args, 1);
-
- eina_array_free(args);
-
- eina_value_get((Eina_Value*)((Efl_Future_Event_Success*)event->info)->value, &file);
-
- if (!file) return;
+ Efl_Model *model = event->info;
+ Eo *fs = data;
+ Eina_Value *path;
+ char *file = NULL;
ELM_FILESELECTOR_ENTRY_DATA_GET(fs, sd);
- s = elm_entry_utf8_to_markup(file);
- elm_object_text_set(sd->entry, s);
- free(s);
+ efl_ui_view_model_set(sd->entry, model);
+ efl_ui_model_connect(sd->entry, "default", "path");
+
+ path = efl_model_property_get(model, "path");
+ file = eina_value_to_string(path);
_model_event_call
(fs, ELM_FILESELECTOR_ENTRY_EVENT_FILE_CHOSEN, model, file);
-}
-
-static void
-_file_chosen_path_then_error(void *data, Efl_Event const* event)
-{
- Eina_Error err = ((Efl_Future_Event_Failure*)event->info)->error;
- ERR("Efl.Model property \"path\" error: %s", eina_error_msg_get(err));
- eina_array_free(data);
-}
-
-static void
-_FILE_CHOSEN_fwd(void *data, const Efl_Event *event)
-{
- Efl_Model *model = event->info;
- Efl_Future *future = NULL;
- Eina_Array *args = NULL;
-
- if (!model) return;
- args = eina_array_new(2);
- eina_array_push(args, data);
- eina_array_push(args, model);
-
- future = efl_model_property_get(model, "path");
- efl_future_then
- (future, _file_chosen_path_then, _file_chosen_path_then_error, NULL, args);
+ eina_value_free(path);
+ free(file);
}
static void
@@ -126,7 +101,7 @@ _ACTIVATED_fwd(void *data, const Efl_Event *event)
file = elm_object_text_get(sd->entry);
- bmodel = elm_interface_fileselector_model_get(sd->button);
+ bmodel = efl_ui_view_model_get(sd->button);
if (bmodel)
{
model = efl_add(efl_class_get(bmodel), NULL);
@@ -134,19 +109,13 @@ _ACTIVATED_fwd(void *data, const Efl_Event *event)
eina_value_set(&path, file);
efl_model_property_set(model, "path", &path);
eina_value_flush(&path);
- elm_interface_fileselector_model_set(sd->button, model);
+ efl_ui_view_model_set(sd->button, model);
}
efl_event_callback_legacy_call
(data, ELM_FILESELECTOR_ENTRY_EVENT_ACTIVATED, event->info);
}
-static void
-_model_free_eo_cb(void *eo)
-{
- efl_unref(eo);
-}
-
EOLIAN static void
_elm_fileselector_entry_elm_layout_sizing_eval(Eo *obj, Elm_Fileselector_Entry_Data *sd EINA_UNUSED)
{
@@ -160,7 +129,7 @@ _elm_fileselector_entry_elm_layout_sizing_eval(Eo *obj, Elm_Fileselector_Entry_D
}
EOLIAN static Efl_Ui_Theme_Apply
-_elm_fileselector_entry_elm_widget_theme_apply(Eo *obj, Elm_Fileselector_Entry_Data *sd)
+_elm_fileselector_entry_efl_ui_widget_theme_apply(Eo *obj, Elm_Fileselector_Entry_Data *sd)
{
const char *style;
char buf[1024];
@@ -191,7 +160,7 @@ _elm_fileselector_entry_elm_widget_theme_apply(Eo *obj, Elm_Fileselector_Entry_D
}
EOLIAN static Eina_Bool
-_elm_fileselector_entry_elm_widget_on_disabled_update(Eo *obj, Elm_Fileselector_Entry_Data *sd, Eina_Bool disabled)
+_elm_fileselector_entry_efl_ui_widget_on_disabled_update(Eo *obj, Elm_Fileselector_Entry_Data *sd, Eina_Bool disabled)
{
if (!efl_ui_widget_on_disabled_update(efl_super(obj, MY_CLASS), disabled))
return EINA_FALSE;
@@ -205,7 +174,7 @@ _elm_fileselector_entry_elm_widget_on_disabled_update(Eo *obj, Elm_Fileselector_
static Eina_Bool
_elm_fileselector_entry_text_set(Eo *obj, Elm_Fileselector_Entry_Data *sd, const char *part, const char *label)
{
- if (part && strcmp(part, "default"))
+ if (part && strcmp(part, "elm.text"))
{
efl_text_set(efl_part(efl_super(obj, MY_CLASS), part), label);
}
@@ -217,7 +186,7 @@ _elm_fileselector_entry_text_set(Eo *obj, Elm_Fileselector_Entry_Data *sd, const
static const char *
_elm_fileselector_entry_text_get(Eo *obj, Elm_Fileselector_Entry_Data *sd, const char *part)
{
- if (part && strcmp(part, "default"))
+ if (part && strcmp(part, "elm.text"))
{
const char *text = NULL;
text = efl_text_get(efl_part(efl_super(obj, MY_CLASS), part));
@@ -338,7 +307,7 @@ _elm_fileselector_entry_efl_object_constructor(Eo *obj, Elm_Fileselector_Entry_D
obj = efl_constructor(efl_super(obj, MY_CLASS));
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
- efl_access_role_set(obj, EFL_ACCESS_ROLE_GROUPING);
+ efl_access_object_role_set(obj, EFL_ACCESS_ROLE_GROUPING);
return obj;
}
@@ -358,16 +327,14 @@ _elm_fileselector_entry_selected_set_internal(Evas_Object *obj, const char *path
return EINA_TRUE;
}
-EOLIAN static Efl_Future*
+EOLIAN static Eina_Bool
_elm_fileselector_entry_elm_interface_fileselector_selected_model_set(Eo *obj EINA_UNUSED,
Elm_Fileselector_Entry_Data *sd,
Efl_Model *model)
{
- Efl_Promise* promise = efl_add(EFL_PROMISE_CLASS, obj);
- Efl_Future* future = efl_promise_future_get(promise);
- elm_interface_fileselector_model_set(sd->button, model);
- efl_promise_value_set(promise, efl_ref(model), _model_free_eo_cb);
- return future;
+ efl_ui_view_model_set(sd->button, model);
+
+ return EINA_TRUE;
}
EINA_DEPRECATED EAPI const char *
@@ -385,9 +352,9 @@ _elm_fileselector_entry_selected_get_internal(const Evas_Object *obj)
}
EOLIAN static Efl_Model *
-_elm_fileselector_entry_elm_interface_fileselector_selected_model_get(Eo *obj EINA_UNUSED, Elm_Fileselector_Entry_Data *sd)
+_elm_fileselector_entry_elm_interface_fileselector_selected_model_get(const Eo *obj EINA_UNUSED, Elm_Fileselector_Entry_Data *sd)
{
- return elm_interface_fileselector_model_get(sd->button);
+ return efl_ui_view_model_get(sd->button);
}
EAPI void
@@ -448,34 +415,12 @@ _elm_fileselector_entry_path_set_internal(Evas_Object *obj, const char *path)
}
}
-static void
-_fs_entry_model_path_get_then(void *data, Efl_Event const *event)
-{
- Elm_Fileselector_Entry_Data *sd = data;
- char *path = NULL;
- char *s;
- Eina_Value* v = (Eina_Value*)((Efl_Future_Event_Success*)event->info)->value;
-
- if (!v)
- return;
-
- eina_value_get(v, &path);
- s = elm_entry_utf8_to_markup(path);
- if (s)
- {
- elm_object_text_set(sd->entry, s);
- free(s);
- }
-}
-
EOLIAN static void
-_elm_fileselector_entry_elm_interface_fileselector_model_set(Eo *obj EINA_UNUSED, Elm_Fileselector_Entry_Data *sd, Efl_Model *model)
+_elm_fileselector_entry_efl_ui_view_model_set(Eo *obj EINA_UNUSED, Elm_Fileselector_Entry_Data *sd, Efl_Model *model)
{
- Efl_Future *p = NULL;
- elm_interface_fileselector_model_set(sd->button, model);
-
- p = efl_model_property_get(model, "path");
- efl_future_then(p, _fs_entry_model_path_get_then, NULL, NULL, sd);
+ efl_ui_view_model_set(sd->button, model);
+ efl_ui_view_model_set(sd->entry, model);
+ efl_ui_model_connect(sd->entry, "default", "path");
}
EINA_DEPRECATED EAPI const char *
@@ -495,11 +440,11 @@ _elm_fileselector_entry_path_get_internal(const Evas_Object *obj)
}
EOLIAN static Efl_Model *
-_elm_fileselector_entry_elm_interface_fileselector_model_get(Eo *obj EINA_UNUSED, Elm_Fileselector_Entry_Data *sd)
+_elm_fileselector_entry_efl_ui_view_model_get(const Eo *obj EINA_UNUSED, Elm_Fileselector_Entry_Data *sd)
{
Efl_Model *bmodel, *ret;
Eina_Value path;
- bmodel = elm_interface_fileselector_model_get(sd->button);
+ bmodel = efl_ui_view_model_get(sd->button);
if (!bmodel)
{
WRN("no base Efl.Model");
@@ -539,7 +484,7 @@ elm_fileselector_entry_expandable_get(const Evas_Object *obj)
}
EOLIAN static Eina_Bool
-_elm_fileselector_entry_elm_interface_fileselector_expandable_get(Eo *obj EINA_UNUSED, Elm_Fileselector_Entry_Data *sd)
+_elm_fileselector_entry_elm_interface_fileselector_expandable_get(const Eo *obj EINA_UNUSED, Elm_Fileselector_Entry_Data *sd)
{
return elm_fileselector_expandable_get(sd->button);
}
@@ -566,7 +511,7 @@ elm_fileselector_entry_folder_only_get(const Evas_Object *obj)
}
EOLIAN static Eina_Bool
-_elm_fileselector_entry_elm_interface_fileselector_folder_only_get(Eo *obj EINA_UNUSED, Elm_Fileselector_Entry_Data *sd)
+_elm_fileselector_entry_elm_interface_fileselector_folder_only_get(const Eo *obj EINA_UNUSED, Elm_Fileselector_Entry_Data *sd)
{
return elm_fileselector_folder_only_get(sd->button);
}
@@ -593,7 +538,7 @@ elm_fileselector_entry_is_save_get(const Evas_Object *obj)
}
EOLIAN static Eina_Bool
-_elm_fileselector_entry_elm_interface_fileselector_is_save_get(Eo *obj EINA_UNUSED, Elm_Fileselector_Entry_Data *sd)
+_elm_fileselector_entry_elm_interface_fileselector_is_save_get(const Eo *obj EINA_UNUSED, Elm_Fileselector_Entry_Data *sd)
{
return elm_fileselector_is_save_get(sd->button);
}