summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/elementary/elc_fileselector.c198
-rw-r--r--src/lib/elementary/elc_fileselector_button.c37
-rw-r--r--src/lib/elementary/elc_fileselector_entry.c47
-rw-r--r--src/lib/elementary/elm_fileselector.eo1
-rw-r--r--src/lib/elementary/elm_interface_fileselector.h6
5 files changed, 194 insertions, 95 deletions
diff --git a/src/lib/elementary/elc_fileselector.c b/src/lib/elementary/elc_fileselector.c
index 21bf9c4f65..99ec2654c4 100644
--- a/src/lib/elementary/elc_fileselector.c
+++ b/src/lib/elementary/elc_fileselector.c
@@ -25,6 +25,12 @@
25/* FIXME: need a way to find a gap between the size of item and thumbnail */ 25/* FIXME: need a way to find a gap between the size of item and thumbnail */
26#define GENGRID_PADDING 16 26#define GENGRID_PADDING 16
27 27
28typedef struct _Legacy_Event_Path_Then_Data
29{
30 Eo *eo_obj;
31 const Efl_Event_Description *evt_desc;
32} Legacy_Event_Path_Then_Data;
33
28static Elm_Genlist_Item_Class *list_itc[ELM_FILE_LAST]; 34static Elm_Genlist_Item_Class *list_itc[ELM_FILE_LAST];
29static Elm_Gengrid_Item_Class *grid_itc[ELM_FILE_LAST]; 35static Elm_Gengrid_Item_Class *grid_itc[ELM_FILE_LAST];
30 36
@@ -39,11 +45,22 @@ EAPI Eina_Error ELM_FILESELECTOR_ERROR_INVALID_MODEL = 0;
39static const char ELM_FILESELECTOR_ERROR_UNKNOWN_STR[] = "Unknown Error"; 45static const char ELM_FILESELECTOR_ERROR_UNKNOWN_STR[] = "Unknown Error";
40static const char ELM_FILESELECTOR_ERROR_INVALID_MODEL_STR[] = "Model not set"; 46static const char ELM_FILESELECTOR_ERROR_INVALID_MODEL_STR[] = "Model not set";
41 47
48#define ELM_PRIV_FILESELECTOR_SIGNALS(cmd) \
49 cmd(SIG_ACTIVATED, "activated", "s") \
50 cmd(SIG_DIRECTORY_OPEN, "directory,open", "s") \
51 cmd(SIG_DONE, "done", "s") \
52 cmd(SIG_SELECTED, "selected", "s") \
53 cmd(SIG_SELECTED_INVALID, "selected,invalid", "s")
54
55ELM_PRIV_FILESELECTOR_SIGNALS(ELM_PRIV_STATIC_VARIABLE_DECLARE);
56
42static const Evas_Smart_Cb_Description _smart_callbacks[] = { 57static const Evas_Smart_Cb_Description _smart_callbacks[] = {
58 ELM_PRIV_FILESELECTOR_SIGNALS(ELM_PRIV_SMART_CALLBACKS_DESC)
43 {SIG_LAYOUT_FOCUSED, ""}, /**< handled by elm_layout */ 59 {SIG_LAYOUT_FOCUSED, ""}, /**< handled by elm_layout */
44 {SIG_LAYOUT_UNFOCUSED, ""}, /**< handled by elm_layout */ 60 {SIG_LAYOUT_UNFOCUSED, ""}, /**< handled by elm_layout */
45 {NULL, NULL} 61 {NULL, NULL}
46}; 62};
63#undef ELM_PRIV_FILESELECTOR_SIGNALS
47 64
48static Eina_Bool _key_action_select(Evas_Object *obj, const char *params); 65static Eina_Bool _key_action_select(Evas_Object *obj, const char *params);
49static Eina_Bool _key_action_escape(Evas_Object *obj, const char *params); 66static Eina_Bool _key_action_escape(Evas_Object *obj, const char *params);
@@ -77,6 +94,21 @@ _model_free_eo_cb(void *data)
77 efl_unref(eo); 94 efl_unref(eo);
78} 95}
79 96
97
98void
99_event_to_legacy_call(Eo *obj, const Efl_Event_Description *evt_desc, void *event_info)
100{
101 const Efl_Event_Description *legacy_desc = efl_object_legacy_only_event_description_get(evt_desc->name);
102 efl_event_callback_call(obj, legacy_desc, event_info);
103}
104
105void
106_model_event_call(Eo *obj, const Efl_Event_Description *evt_desc, Efl_Model *model, const char *path)
107{
108 _event_to_legacy_call(obj, evt_desc, (void *)path);
109 efl_event_callback_call(obj, evt_desc, model);
110}
111
80static void 112static void
81_monitoring_start(Elm_Fileselector *fs, Elm_Fileselector_Data *sd, Efl_Model *model) 113_monitoring_start(Elm_Fileselector *fs, Elm_Fileselector_Data *sd, Efl_Model *model)
82{ 114{
@@ -623,11 +655,8 @@ _signal_first(Listing_Request *lreq)
623 sd->multi_selection = eina_list_free(sd->multi_selection); 655 sd->multi_selection = eina_list_free(sd->multi_selection);
624 } 656 }
625 657
626 // EVENTS: should not call legacy 658 _model_event_call
627 //efl_event_callback_legacy_call 659 (lreq->obj, ELM_FILESELECTOR_EVENT_DIRECTORY_OPEN, lreq->model, lreq->path);
628 // (lreq->obj, ELM_FILESELECTOR_EVENT_DIRECTORY_OPEN, (void *)lreq->model);
629
630 evas_object_smart_callback_call(lreq->obj, "directory,open", (void *)lreq->path);
631 660
632 if (!lreq->parent_it) 661 if (!lreq->parent_it)
633 { 662 {
@@ -1072,10 +1101,8 @@ _on_item_activated(void *data, const Eo_Event *event)
1072 1101
1073 if (!it_data->is_dir) 1102 if (!it_data->is_dir)
1074 { 1103 {
1075 // EVENTS: should not call legacy 1104 _model_event_call
1076 //efl_event_callback_legacy_call 1105 (data, ELM_FILESELECTOR_EVENT_ACTIVATED, it_data->model, it_data->path);
1077 // (data, ELM_FILESELECTOR_EVENT_ACTIVATED, (void *)it_data->model);
1078 evas_object_smart_callback_call(data, "activated", (void *)it_data->path);
1079 return; 1106 return;
1080 } 1107 }
1081 1108
@@ -1158,10 +1185,8 @@ _on_item_selected(void *data, const Eo_Event *event)
1158 else 1185 else
1159 elm_object_text_set(sd->name_entry, it_data->filename); 1186 elm_object_text_set(sd->name_entry, it_data->filename);
1160 1187
1161 // EVENTS: should not call legacy 1188 _model_event_call
1162 //efl_event_callback_legacy_call 1189 (data, EFL_UI_EVENT_SELECTED, it_data->model, it_data->path);
1163 // (data, EFL_UI_EVENT_SELECTED, (void *)it_data->model);
1164 evas_object_smart_callback_call(data, "selected", (void *)it_data->path);
1165 } 1190 }
1166 else if (sd->multi && it_data->is_dir && sd->double_tap_navigation) 1191 else if (sd->multi && it_data->is_dir && sd->double_tap_navigation)
1167 { 1192 {
@@ -1302,9 +1327,7 @@ _ok(void *data, const Eo_Event *event EINA_UNUSED)
1302 1327
1303 if (!sd->model || !sd->path) 1328 if (!sd->model || !sd->path)
1304 { 1329 {
1305 // EVENTS: should not call legacy 1330 _model_event_call(fs, ELM_FILESELECTOR_EVENT_DONE, NULL, NULL);
1306 //efl_event_callback_legacy_call(fs, ELM_FILESELECTOR_EVENT_DONE, NULL);
1307 evas_object_smart_callback_call(fs, "done", NULL);
1308 return; 1331 return;
1309 } 1332 }
1310 1333
@@ -1321,10 +1344,8 @@ _ok(void *data, const Eo_Event *event EINA_UNUSED)
1321 selected_model = efl_add(efl_class_get(sd->model), NULL); 1344 selected_model = efl_add(efl_class_get(sd->model), NULL);
1322 _model_str_property_set(selected_model, "path", selection, NULL); 1345 _model_str_property_set(selected_model, "path", selection, NULL);
1323 1346
1324 // EVENTS: should not call legacy 1347 _model_event_call
1325 //efl_event_callback_legacy_call 1348 (fs, ELM_FILESELECTOR_EVENT_DONE, selected_model, selection);
1326 // (fs, ELM_FILESELECTOR_EVENT_DONE, selected_model);
1327 evas_object_smart_callback_call(fs, "done", (void *) selection);
1328 1349
1329 efl_unref(selected_model); 1350 efl_unref(selected_model);
1330 eina_stringshare_del(selection); 1351 eina_stringshare_del(selection);
@@ -1334,15 +1355,14 @@ _ok(void *data, const Eo_Event *event EINA_UNUSED)
1334 Elm_Fileselector_Item_Data *it_data = _selected_item_data_get(sd); 1355 Elm_Fileselector_Item_Data *it_data = _selected_item_data_get(sd);
1335 if (it_data) 1356 if (it_data)
1336 { 1357 {
1337 // EVENTS: should not call legacy 1358 _model_event_call
1338 //efl_event_callback_legacy_call 1359 (fs, ELM_FILESELECTOR_EVENT_DONE, it_data->model, it_data->path);
1339 // (fs, ELM_FILESELECTOR_EVENT_DONE, it_data->model); 1360 }
1340 evas_object_smart_callback_call(fs, "done", (void *) it_data->path); 1361 else
1362 {
1363 _model_event_call
1364 (fs, ELM_FILESELECTOR_EVENT_DONE, sd->model, sd->path);
1341 } 1365 }
1342 // EVENTS: should not call legacy
1343 //efl_event_callback_legacy_call
1344 // (fs, ELM_FILESELECTOR_EVENT_DONE, sd->model);
1345 evas_object_smart_callback_call(fs, "done", (void *) sd->path);
1346 } 1366 }
1347} 1367}
1348 1368
@@ -1351,9 +1371,7 @@ _canc(void *data, const Eo_Event *event EINA_UNUSED)
1351{ 1371{
1352 Evas_Object *fs = data; 1372 Evas_Object *fs = data;
1353 1373
1354 // EVENTS: should not call legacy 1374 _model_event_call(fs, ELM_FILESELECTOR_EVENT_DONE, NULL, NULL);
1355 //efl_event_callback_legacy_call(fs, ELM_FILESELECTOR_EVENT_DONE, NULL);
1356 evas_object_smart_callback_call(fs, "done", NULL);
1357} 1375}
1358 1376
1359static void 1377static void
@@ -1388,10 +1406,8 @@ _text_activated_is_dir_then(void *data, void *value)
1388 1406
1389 if (sd->only_folder) 1407 if (sd->only_folder)
1390 { 1408 {
1391 // EVENTS: should not call legacy 1409 _model_event_call
1392 //efl_event_callback_legacy_call 1410 (fs, EFL_UI_EVENT_SELECTED, model, str);
1393 // (fs, EFL_UI_EVENT_SELECTED, (void *)model);
1394 evas_object_smart_callback_call(fs, "selected", (void *) str);
1395 } 1411 }
1396 } 1412 }
1397 else 1413 else
@@ -1407,10 +1423,8 @@ _text_activated_is_dir_then(void *data, void *value)
1407 1423
1408 if (sd->only_folder) 1424 if (sd->only_folder)
1409 { 1425 {
1410 // EVENTS: should not call legacy 1426 _model_event_call
1411 //efl_event_callback_legacy_call 1427 (fs, EFL_UI_EVENT_SELECTED, model, str);
1412 // (fs, EFL_UI_EVENT_SELECTED, (void *)model);
1413 evas_object_smart_callback_call(fs, "selected", (void *) str);
1414 } 1428 }
1415 } 1429 }
1416 } 1430 }
@@ -1443,18 +1457,14 @@ static void
1443_on_text_activated_set_path_then_error(void *data, Eina_Error err EINA_UNUSED) 1457_on_text_activated_set_path_then_error(void *data, Eina_Error err EINA_UNUSED)
1444{ 1458{
1445 Evas_Object *fs = data; 1459 Evas_Object *fs = data;
1446 /* Efl_Model *model = efl_key_data_get(fs, _text_activated_model_key); */ 1460 Efl_Model *model = efl_key_data_get(fs, _text_activated_model_key);
1447 Eina_Stringshare *str = efl_key_data_get(fs, _text_activated_path_key); 1461 Eina_Stringshare *str = efl_key_data_get(fs, _text_activated_path_key);
1448 1462
1449 // EVENTS: should not call legacy 1463 _model_event_call
1450 //efl_event_callback_legacy_call 1464 (fs, EFL_UI_EVENT_SELECTED, model, str);
1451 // (fs, EFL_UI_EVENT_SELECTED, (void *)model);
1452 evas_object_smart_callback_call(fs, "selected", (void *)str);
1453 1465
1454 // EVENTS: should not call legacy 1466 _model_event_call
1455 //efl_event_callback_legacy_call 1467 (fs, ELM_FILESELECTOR_EVENT_SELECTED_INVALID, model, str);
1456 // (fs, ELM_FILESELECTOR_EVENT_SELECTED_INVALID, (void *)model);
1457 evas_object_smart_callback_call(fs, "selected,invalid", (void *)str);
1458 1468
1459 _text_activated_free_fs_data(fs); 1469 _text_activated_free_fs_data(fs);
1460} 1470}
@@ -2048,6 +2058,98 @@ _elm_fileselector_efl_object_constructor(Eo *obj, Elm_Fileselector_Data *sd)
2048 return obj; 2058 return obj;
2049} 2059}
2050 2060
2061static void
2062_legacy_smart_callback_caller_path_then(void *data, void *value)
2063{
2064 Legacy_Event_Path_Then_Data *evt_data = data;
2065 _event_to_legacy_call(evt_data->eo_obj, evt_data->evt_desc, value);
2066 free(data);
2067}
2068
2069static void
2070_legacy_smart_callback_caller_path_then_error(void *data, Eina_Error err)
2071{
2072 ERR("Efl.Model property \"path\" error: %s", eina_error_msg_get(err));
2073 free(data);
2074}
2075
2076static Eina_Bool
2077_from_efl_event_call(Elm_Fileselector *fs, const Efl_Event_Description *evt_desc, Efl_Model *model)
2078{
2079 Eina_Promise *promise;
2080 Legacy_Event_Path_Then_Data *evt_data;
2081
2082 evt_data = calloc(1, sizeof(Legacy_Event_Path_Then_Data));
2083 evt_data->eo_obj = fs;
2084 evt_data->evt_desc = evt_desc;
2085
2086 // Call legacy smart callback with path
2087 promise = efl_model_property_get(model, "path");
2088 eina_promise_then(promise,
2089 _legacy_smart_callback_caller_path_then,
2090 _legacy_smart_callback_caller_path_then_error,
2091 evt_data);
2092
2093 // Call Eo event with model
2094 return efl_event_callback_call(fs, evt_desc, model);
2095}
2096
2097static Eina_Bool
2098_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)
2099{
2100 const Efl_Class *model_cls = NULL;
2101 if (!sd->model)
2102 model_cls = EIO_MODEL_CLASS;
2103 else
2104 model_cls = efl_class_get(sd->model);
2105
2106 Efl_Model *model = efl_add(model_cls, NULL);
2107 _model_str_property_set(model, "path", path, NULL);
2108
2109 // Call Eo event with model
2110 efl_event_callback_call(fs, evt_desc, model);
2111
2112 efl_unref(model);
2113
2114 // Call legacy smart callback with path
2115 return efl_event_callback_call(fs, legacy_desc, (void *)path);
2116}
2117
2118EOLIAN static Eina_Bool
2119_elm_fileselector_efl_object_event_callback_legacy_call(Eo *obj, Elm_Fileselector_Data *sd,
2120 const Efl_Event_Description *desc, void *event_info)
2121{
2122 if (desc->legacy_is)
2123 {
2124 const Efl_Event_Description *evt_desc = NULL;
2125 if (strcmp(desc->name, "selected") == 0)
2126 evt_desc = EFL_UI_EVENT_SELECTED;
2127 else if (strcmp(desc->name, "activated") == 0)
2128 evt_desc = ELM_FILESELECTOR_EVENT_ACTIVATED;
2129 else if (strcmp(desc->name, "directory,open") == 0)
2130 evt_desc = ELM_FILESELECTOR_EVENT_DIRECTORY_OPEN;
2131 else if (strcmp(desc->name, "done") == 0)
2132 evt_desc = ELM_FILESELECTOR_EVENT_DONE;
2133 else if (strcmp(desc->name, "selected,invalid") == 0)
2134 evt_desc = ELM_FILESELECTOR_EVENT_SELECTED_INVALID;
2135 else
2136 return efl_event_callback_legacy_call(efl_super(obj, MY_CLASS), desc, event_info);
2137
2138 return _from_legacy_event_call(obj, sd, desc, evt_desc, event_info);
2139 }
2140
2141 if (desc == EFL_UI_EVENT_SELECTED ||
2142 desc == ELM_FILESELECTOR_EVENT_ACTIVATED ||
2143 desc == ELM_FILESELECTOR_EVENT_DIRECTORY_OPEN ||
2144 desc == ELM_FILESELECTOR_EVENT_DONE ||
2145 desc == ELM_FILESELECTOR_EVENT_SELECTED_INVALID)
2146 {
2147 return _from_efl_event_call(obj, desc, event_info);
2148 }
2149
2150 return efl_event_callback_legacy_call(efl_super(obj, MY_CLASS), desc, event_info);
2151}
2152
2051EAPI void 2153EAPI void
2052elm_fileselector_is_save_set(Evas_Object *obj, 2154elm_fileselector_is_save_set(Evas_Object *obj,
2053 Eina_Bool is_save) 2155 Eina_Bool is_save)
diff --git a/src/lib/elementary/elc_fileselector_button.c b/src/lib/elementary/elc_fileselector_button.c
index f7a173bf53..1a4a69d6ac 100644
--- a/src/lib/elementary/elc_fileselector_button.c
+++ b/src/lib/elementary/elc_fileselector_button.c
@@ -74,6 +74,8 @@ _replace_path_then(void *data, void *value)
74 const char *path = NULL; 74 const char *path = NULL;
75 eina_value_get(value, &path); 75 eina_value_get(value, &path);
76 eina_stringshare_replace(&sd->fsd.path, path); 76 eina_stringshare_replace(&sd->fsd.path, path);
77 _event_to_legacy_call
78 (sd->obj, ELM_FILESELECTOR_BUTTON_EVENT_FILE_CHOSEN, (void *)path);
77} 79}
78 80
79static void 81static void
@@ -82,6 +84,8 @@ _replace_path_then_error(void *data, Eina_Error err EINA_UNUSED)
82 Elm_Fileselector_Button_Data *sd = data; 84 Elm_Fileselector_Button_Data *sd = data;
83 ERR("could not get information from Efl.Model"); 85 ERR("could not get information from Efl.Model");
84 eina_stringshare_replace(&sd->fsd.path, NULL); 86 eina_stringshare_replace(&sd->fsd.path, NULL);
87 _event_to_legacy_call
88 (sd->obj, ELM_FILESELECTOR_BUTTON_EVENT_FILE_CHOSEN, NULL);
85} 89}
86 90
87static void 91static void
@@ -99,32 +103,19 @@ _selection_done(void *data, const Eo_Event *event)
99 sd->fsd.model = efl_ref(model); 103 sd->fsd.model = efl_ref(model);
100 promise = efl_model_property_get(model, "path"); 104 promise = efl_model_property_get(model, "path");
101 eina_promise_then(promise, _replace_path_then, _replace_path_then_error, sd); 105 eina_promise_then(promise, _replace_path_then, _replace_path_then_error, sd);
106 efl_event_callback_call
107 (sd->obj, ELM_FILESELECTOR_BUTTON_EVENT_FILE_CHOSEN, model);
108 }
109 else
110 {
111 _model_event_call
112 (sd->obj, ELM_FILESELECTOR_BUTTON_EVENT_FILE_CHOSEN, NULL, NULL);
102 } 113 }
103 114
104 del = sd->fsw; 115 del = sd->fsw;
105 sd->fs = NULL; 116 sd->fs = NULL;
106 sd->fsw = NULL; 117 sd->fsw = NULL;
107 evas_object_del(del); 118 evas_object_del(del);
108
109 // EVENTS: should not call legacy
110 //efl_event_callback_legacy_call
111 // (sd->obj, ELM_FILESELECTOR_BUTTON_EVENT_FILE_CHOSEN, (void *)model);
112}
113
114
115static void
116_selection_done_path(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
117{
118 Elm_Fileselector_Button_Data *sd = data;
119 const char *path = event_info;
120
121 evas_object_smart_callback_call(sd->obj, "file,chosen", (void *) path);
122
123 // EVENTS: code above should not be needed
124 Eo_Event e = { NULL, NULL, NULL };
125 if (path)
126 e.info = efl_add(EIO_MODEL_CLASS, NULL, eio_model_path_set(efl_self, path));
127 _selection_done(data, &e);
128} 119}
129 120
130static Evas_Object * 121static Evas_Object *
@@ -189,10 +180,8 @@ _activate(Elm_Fileselector_Button_Data *sd)
189 evas_object_size_hint_weight_set 180 evas_object_size_hint_weight_set
190 (sd->fs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 181 (sd->fs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
191 evas_object_size_hint_align_set(sd->fs, EVAS_HINT_FILL, EVAS_HINT_FILL); 182 evas_object_size_hint_align_set(sd->fs, EVAS_HINT_FILL, EVAS_HINT_FILL);
192 // EVENTS: should not call legacy 183 efl_event_callback_add
193 //efl_event_callback_add 184 (sd->fs, ELM_FILESELECTOR_EVENT_DONE, _selection_done, sd);
194 // (sd->fs, ELM_FILESELECTOR_EVENT_DONE, _selection_done, sd);
195 evas_object_smart_callback_add(sd->fs, "done", _selection_done_path, sd);
196 evas_object_show(sd->fs); 185 evas_object_show(sd->fs);
197 186
198 if (is_inwin) 187 if (is_inwin)
diff --git a/src/lib/elementary/elc_fileselector_entry.c b/src/lib/elementary/elc_fileselector_entry.c
index c062ec341f..5ffcab5067 100644
--- a/src/lib/elementary/elc_fileselector_entry.c
+++ b/src/lib/elementary/elc_fileselector_entry.c
@@ -33,6 +33,7 @@ EAPI const char ELM_FILESELECTOR_ENTRY_SMART_NAME[] = "elm_fileselector_entry";
33 cmd(SIG_SELECTION_COPY, "selection,copy", "") \ 33 cmd(SIG_SELECTION_COPY, "selection,copy", "") \
34 cmd(SIG_SELECTION_CUT, "selection,cut", "") \ 34 cmd(SIG_SELECTION_CUT, "selection,cut", "") \
35 cmd(SIG_UNPRESSED, "unpressed", "") \ 35 cmd(SIG_UNPRESSED, "unpressed", "") \
36 cmd(SIG_FILE_CHOSEN, "file,chosen", "s") \
36 37
37ELM_PRIV_FILESELECTOR_ENTRY_SIGNALS(ELM_PRIV_STATIC_VARIABLE_DECLARE); 38ELM_PRIV_FILESELECTOR_ENTRY_SIGNALS(ELM_PRIV_STATIC_VARIABLE_DECLARE);
38 39
@@ -67,19 +68,32 @@ SIG_FWD(UNPRESSED, EFL_UI_EVENT_UNPRESSED)
67static void 68static void
68_file_chosen_path_then(void *data, void *v) 69_file_chosen_path_then(void *data, void *v)
69{ 70{
71 Eina_Array *args = data;
70 const char *file = NULL; 72 const char *file = NULL;
71 char *s; 73 char *s;
74 Eo *fs = eina_array_data_get(args, 0);
75 Efl_Model *model = eina_array_data_get(args, 1);
76
77 eina_array_free(args);
72 78
73 eina_value_get(v, &file); 79 eina_value_get(v, &file);
74 80
75 if (!file) return; 81 if (!file) return;
76 ELM_FILESELECTOR_ENTRY_DATA_GET(data, sd); 82 ELM_FILESELECTOR_ENTRY_DATA_GET(fs, sd);
77 83
78 s = elm_entry_utf8_to_markup(file); 84 s = elm_entry_utf8_to_markup(file);
79 elm_object_text_set(sd->entry, s); 85 elm_object_text_set(sd->entry, s);
80 free(s); 86 free(s);
81 87
82 evas_object_smart_callback_call(data, "file,chosen", (void *) file); 88 _model_event_call
89 (fs, ELM_FILESELECTOR_ENTRY_EVENT_FILE_CHOSEN, model, file);
90}
91
92static void
93_file_chosen_path_then_error(void *data, Eina_Error err)
94{
95 ERR("Efl.Model property \"path\" error: %s", eina_error_msg_get(err));
96 eina_array_free(data);
83} 97}
84 98
85static void 99static void
@@ -87,27 +101,17 @@ _FILE_CHOSEN_fwd(void *data, const Eo_Event *event)
87{ 101{
88 Efl_Model *model = event->info; 102 Efl_Model *model = event->info;
89 Eina_Promise *promise = NULL; 103 Eina_Promise *promise = NULL;
104 Eina_Array *args = NULL;
90 105
91 if (!model) return; 106 if (!model) return;
92 107
93 promise = efl_model_property_get(model, "path"); 108 args = eina_array_new(2);
94 eina_promise_then(promise, _file_chosen_path_then, NULL, data); 109 eina_array_push(args, data);
110 eina_array_push(args, model);
95 111
96 // EVENTS: should not call legacy 112 promise = efl_model_property_get(model, "path");
97 //efl_event_callback_legacy_call 113 eina_promise_then
98 // (data, ELM_FILESELECTOR_ENTRY_EVENT_FILE_CHOSEN, event->info); 114 (promise, _file_chosen_path_then, _file_chosen_path_then_error, args);
99}
100
101// EVENTS: should not need this function
102static void
103_FILE_CHOSEN_fwd_path(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
104{
105 const char *path = event_info;
106
107 Eo_Event e = { NULL, NULL, NULL };
108 if (path)
109 e.info = efl_add(EIO_MODEL_CLASS, NULL, eio_model_path_set(efl_self, path));
110 _FILE_CHOSEN_fwd(data, &e);
111} 115}
112 116
113static void 117static void
@@ -328,11 +332,8 @@ _elm_fileselector_entry_efl_canvas_group_group_add(Eo *obj, Elm_Fileselector_Ent
328 efl_event_callback_add(priv->button, event, _##name##_fwd, obj) 332 efl_event_callback_add(priv->button, event, _##name##_fwd, obj)
329 SIG_FWD(CLICKED, EFL_UI_EVENT_CLICKED); 333 SIG_FWD(CLICKED, EFL_UI_EVENT_CLICKED);
330 SIG_FWD(UNPRESSED, EFL_UI_EVENT_UNPRESSED); 334 SIG_FWD(UNPRESSED, EFL_UI_EVENT_UNPRESSED);
331 // EVENTS: should not call legacy 335 SIG_FWD(FILE_CHOSEN, ELM_FILESELECTOR_BUTTON_EVENT_FILE_CHOSEN);
332 //SIG_FWD(FILE_CHOSEN, ELM_FILESELECTOR_BUTTON_EVENT_FILE_CHOSEN);
333#undef SIG_FWD 336#undef SIG_FWD
334 // EVENTS: should not need this "callback_add"
335 evas_object_smart_callback_add(priv->button, "file,chosen", _FILE_CHOSEN_fwd_path, obj);
336 337
337 priv->entry = elm_entry_add(obj); 338 priv->entry = elm_entry_add(obj);
338 elm_entry_scrollable_set(priv->entry, EINA_TRUE); 339 elm_entry_scrollable_set(priv->entry, EINA_TRUE);
diff --git a/src/lib/elementary/elm_fileselector.eo b/src/lib/elementary/elm_fileselector.eo
index bad9635f7f..f6f0bb5ef4 100644
--- a/src/lib/elementary/elm_fileselector.eo
+++ b/src/lib/elementary/elm_fileselector.eo
@@ -34,6 +34,7 @@ class Elm.Fileselector (Elm.Layout, Elm.Interface.Fileselector,
34 class.constructor; 34 class.constructor;
35 class.destructor; 35 class.destructor;
36 Efl.Object.constructor; 36 Efl.Object.constructor;
37 Efl.Object.event_callback_legacy_call;
37 Efl.Canvas.Group.group_add; 38 Efl.Canvas.Group.group_add;
38 Efl.Canvas.Group.group_del; 39 Efl.Canvas.Group.group_del;
39 Elm.Widget.focus_next; 40 Elm.Widget.focus_next;
diff --git a/src/lib/elementary/elm_interface_fileselector.h b/src/lib/elementary/elm_interface_fileselector.h
index 1c9b05c57d..1ce059552c 100644
--- a/src/lib/elementary/elm_interface_fileselector.h
+++ b/src/lib/elementary/elm_interface_fileselector.h
@@ -35,4 +35,10 @@ _elm_fileselector_button_path_set_internal(Evas_Object *obj, const char *path);
35const char * 35const char *
36_elm_fileselector_button_path_get_internal(const Evas_Object *obj); 36_elm_fileselector_button_path_get_internal(const Evas_Object *obj);
37 37
38void
39_event_to_legacy_call(Eo *obj, const Efl_Event_Description *evt_desc, void *event_info);
40
41void
42_model_event_call(Eo *obj, const Efl_Event_Description *evt_desc, Efl_Model *model, const char *path);
43
38#endif 44#endif