summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyuan Choi <ryuan.choi@gmail.com>2013-06-19 09:00:41 +0900
committerRyuan Choi <ryuan.choi@gmail.com>2013-06-24 15:42:51 +0900
commit2cfa0ce7db933c334655180465a198df9db2c02e (patch)
tree0b91550747247210895424bce1ed1966b8e31c45
parent8ad4a7f904a0b18dbc1951ddc5362eee8212fe0d (diff)
file selector:Add support mime type filter
-rw-r--r--legacy/elementary/ChangeLog4
-rw-r--r--legacy/elementary/NEWS1
-rw-r--r--legacy/elementary/data/themes/widgets/fileselector.edc19
-rw-r--r--legacy/elementary/src/bin/test_fileselector.c4
-rw-r--r--legacy/elementary/src/lib/elc_fileselector.c170
-rw-r--r--legacy/elementary/src/lib/elc_fileselector_eo.h28
-rw-r--r--legacy/elementary/src/lib/elc_fileselector_legacy.h33
-rw-r--r--legacy/elementary/src/lib/elm_widget_fileselector.h42
8 files changed, 284 insertions, 17 deletions
diff --git a/legacy/elementary/ChangeLog b/legacy/elementary/ChangeLog
index f3f38d1bb7..a5d36f2080 100644
--- a/legacy/elementary/ChangeLog
+++ b/legacy/elementary/ChangeLog
@@ -1450,3 +1450,7 @@
14502013-06-23 ChunEon Park (Hermet) 14502013-06-23 ChunEon Park (Hermet)
1451 1451
1452 * Apply current ctxpopup style to the list in the ctxpopup. 1452 * Apply current ctxpopup style to the list in the ctxpopup.
1453
14542013-06-24 Ryuan Choi (ryuan)
1455
1456 * fileselector : Add support mime type filter
diff --git a/legacy/elementary/NEWS b/legacy/elementary/NEWS
index 50a252d5d5..8fb389f0ff 100644
--- a/legacy/elementary/NEWS
+++ b/legacy/elementary/NEWS
@@ -75,6 +75,7 @@ Additions:
75 * Add magnifier to entry. 75 * Add magnifier to entry.
76 * Add "focused" and "unfocused" smart callback for panel, video, web, web2, genlist, hover, index, list, map, photocam, progressbar, radio, scroller, slider, slideshow, spinner, toolbar, win, calendar, check, clock, colorselector, datetime, diskselector, flipselector, gengrid, ctxpopup, fileselector_button, naviframe, player, popup, bubble, button. 76 * Add "focused" and "unfocused" smart callback for panel, video, web, web2, genlist, hover, index, list, map, photocam, progressbar, radio, scroller, slider, slideshow, spinner, toolbar, win, calendar, check, clock, colorselector, datetime, diskselector, flipselector, gengrid, ctxpopup, fileselector_button, naviframe, player, popup, bubble, button.
77 * Add elm_web_url_set(), elm_web_url_get() and "url,changed" signal for web, web2. 77 * Add elm_web_url_set(), elm_web_url_get() and "url,changed" signal for web, web2.
78 * Add elm_fileselector_mime_type_filter_append and elm_fileselector_filters_clear to support mime type filter.
78 79
79Improvements: 80Improvements:
80 81
diff --git a/legacy/elementary/data/themes/widgets/fileselector.edc b/legacy/elementary/data/themes/widgets/fileselector.edc
index ccd9e6ec27..f8d158cf93 100644
--- a/legacy/elementary/data/themes/widgets/fileselector.edc
+++ b/legacy/elementary/data/themes/widgets/fileselector.edc
@@ -110,11 +110,28 @@ group { name: "elm/fileselector/base/default";
110 align: 0.5 1.0; 110 align: 0.5 1.0;
111 fixed: 1 1; 111 fixed: 1 1;
112 rel1 { 112 rel1 {
113 to_y: "elm.swallow.ok"; 113 to_y: "elm.swallow.filters";
114 relative: 0.0 0.0; 114 relative: 0.0 0.0;
115 offset: 0 -1; 115 offset: 0 -1;
116 } 116 }
117 rel2 { 117 rel2 {
118 to_y: "elm.swallow.filters";
119 relative: 1.0 0.0;
120 offset: -1 -1;
121 }
122 }
123 }
124 part { name: "elm.swallow.filters";
125 type: SWALLOW;
126 description { state: "default" 0.0;
127 align: 1.0 1.0;
128 fixed: 1 1;
129 rel1 {
130 to_y: "elm.swallow.ok";
131 relative: 1.0 0.0;
132 offset: 0 -1;
133 }
134 rel2 {
118 to_y: "elm.swallow.ok"; 135 to_y: "elm.swallow.ok";
119 relative: 1.0 0.0; 136 relative: 1.0 0.0;
120 offset: -1 -1; 137 offset: -1 -1;
diff --git a/legacy/elementary/src/bin/test_fileselector.c b/legacy/elementary/src/bin/test_fileselector.c
index dd532ff511..dfa7f02ec8 100644
--- a/legacy/elementary/src/bin/test_fileselector.c
+++ b/legacy/elementary/src/bin/test_fileselector.c
@@ -141,6 +141,7 @@ test_fileselector(void *data __UNUSED__,
141 setlocale(LC_ALL, ""); 141 setlocale(LC_ALL, "");
142 142
143 elm_need_ethumb(); 143 elm_need_ethumb();
144 elm_need_efreet();
144 145
145 win = elm_win_util_standard_add("fileselector", "File Selector"); 146 win = elm_win_util_standard_add("fileselector", "File Selector");
146 elm_win_autodel_set(win, EINA_TRUE); 147 elm_win_autodel_set(win, EINA_TRUE);
@@ -157,6 +158,9 @@ test_fileselector(void *data __UNUSED__,
157 elm_fileselector_expandable_set(fs, EINA_FALSE); 158 elm_fileselector_expandable_set(fs, EINA_FALSE);
158 /* start the fileselector in the home dir */ 159 /* start the fileselector in the home dir */
159 elm_fileselector_path_set(fs, getenv("HOME")); 160 elm_fileselector_path_set(fs, getenv("HOME"));
161 elm_fileselector_mime_types_filter_append(fs, "text/*", "Text Files");
162 elm_fileselector_mime_types_filter_append(fs, "image/*", "Image Files");
163
160 /* allow fs to expand in x & y */ 164 /* allow fs to expand in x & y */
161 evas_object_size_hint_weight_set(fs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 165 evas_object_size_hint_weight_set(fs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
162 evas_object_size_hint_align_set(fs, EVAS_HINT_FILL, EVAS_HINT_FILL); 166 evas_object_size_hint_align_set(fs, EVAS_HINT_FILL, EVAS_HINT_FILL);
diff --git a/legacy/elementary/src/lib/elc_fileselector.c b/legacy/elementary/src/lib/elc_fileselector.c
index 7aafda512f..c7742187cf 100644
--- a/legacy/elementary/src/lib/elc_fileselector.c
+++ b/legacy/elementary/src/lib/elc_fileselector.c
@@ -7,7 +7,8 @@
7 * - double click to choose a file 7 * - double click to choose a file
8 * - multi-selection 8 * - multi-selection
9 * - make variable/function names that are sensible 9 * - make variable/function names that are sensible
10 * - Filter support 10 * - Pattern Filter support
11 * - Custom Filter support
11 */ 12 */
12#ifdef HAVE_CONFIG_H 13#ifdef HAVE_CONFIG_H
13# include "elementary_config.h" 14# include "elementary_config.h"
@@ -127,6 +128,7 @@ _elm_fileselector_smart_theme(Eo *obj, void *_pd, va_list *list)
127 SWALLOW("elm.swallow.path", sd->path_entry); 128 SWALLOW("elm.swallow.path", sd->path_entry);
128 129
129 snprintf(buf, sizeof(buf), "fileselector/actions/%s", style); 130 snprintf(buf, sizeof(buf), "fileselector/actions/%s", style);
131 SWALLOW("elm.swallow.filters", sd->filter_hoversel);
130 SWALLOW("elm.swallow.cancel", sd->cancel_button); 132 SWALLOW("elm.swallow.cancel", sd->cancel_button);
131 SWALLOW("elm.swallow.ok", sd->ok_button); 133 SWALLOW("elm.swallow.ok", sd->ok_button);
132 134
@@ -253,6 +255,50 @@ _anchors_do(Evas_Object *obj,
253 elm_object_text_set(sd->path_entry, buf); 255 elm_object_text_set(sd->path_entry, buf);
254} 256}
255 257
258static Eina_Bool
259_mime_type_matched(const char *mime_filter, const char *mime_type)
260{
261 int i = 0;
262
263 while (mime_filter[i] != '\0')
264 {
265 if (mime_filter[i] != mime_type[i])
266 {
267 if (mime_filter[i] == '*' && mime_filter[i + 1] == '\0')
268 return EINA_TRUE;
269
270 return EINA_FALSE;
271 }
272 i++;
273 }
274
275 if (mime_type[i] != '\0') return EINA_FALSE;
276
277 return EINA_TRUE;
278}
279
280static Eina_Bool
281_check_filters(const Elm_Fileselector_Filter *filter, const char *file_name)
282{
283 const char *mime_type = NULL;
284 int i;
285
286 if (!filter) return EINA_TRUE;
287
288#ifdef ELM_EFREET
289 mime_type = efreet_mime_type_get(file_name);
290#endif
291
292 if (!mime_type) return EINA_FALSE;
293
294 for (i = 0; filter->mime_types[i]; ++i)
295 {
296 if (_mime_type_matched(filter->mime_types[i], mime_type))
297 return EINA_TRUE;
298 }
299 return EINA_FALSE;
300}
301
256#ifdef HAVE_EIO 302#ifdef HAVE_EIO
257static Eina_Bool 303static Eina_Bool
258_ls_filter_cb(void *data, 304_ls_filter_cb(void *data,
@@ -267,6 +313,9 @@ _ls_filter_cb(void *data,
267 if (lreq->sd->only_folder && info->type != EINA_FILE_DIR) 313 if (lreq->sd->only_folder && info->type != EINA_FILE_DIR)
268 return EINA_FALSE; 314 return EINA_FALSE;
269 315
316 if (info->type != EINA_FILE_DIR && !_check_filters(lreq->sd->current_filter, info->path))
317 return EINA_FALSE;
318
270 return EINA_TRUE; 319 return EINA_TRUE;
271} 320}
272 321
@@ -452,7 +501,7 @@ _populate(Evas_Object *obj,
452 filename = eina_stringshare_add(file->path); 501 filename = eina_stringshare_add(file->path);
453 if (file->type == EINA_FILE_DIR) 502 if (file->type == EINA_FILE_DIR)
454 dirs = eina_list_append(dirs, filename); 503 dirs = eina_list_append(dirs, filename);
455 else if (!sd->only_folder) 504 else if (!sd->only_folder && _check_filters(sd->current_filter, filename))
456 files = eina_list_append(files, filename); 505 files = eina_list_append(files, filename);
457 } 506 }
458 eina_iterator_free(it); 507 eina_iterator_free(it);
@@ -674,6 +723,21 @@ _home(void *data,
674} 723}
675 724
676static void 725static void
726_current_filer_changed(void *data,
727 Evas_Object *obj,
728 void *event_info __UNUSED__)
729{
730 Elm_Fileselector_Filter *filter = data;
731
732 if (filter->sd->current_filter == filter) return;
733
734 elm_object_text_set(obj, filter->filter_name);
735 filter->sd->current_filter = filter;
736
737 _populate(filter->sd->obj, filter->sd->path, NULL);
738}
739
740static void
677_ok(void *data, 741_ok(void *data,
678 Evas_Object *obj __UNUSED__, 742 Evas_Object *obj __UNUSED__,
679 void *event_info __UNUSED__) 743 void *event_info __UNUSED__)
@@ -881,6 +945,7 @@ _elm_fileselector_smart_del(Eo *obj EINA_UNUSED, void *_pd, va_list *list EINA_U
881 int i; 945 int i;
882 946
883 Elm_Fileselector_Smart_Data *sd = _pd; 947 Elm_Fileselector_Smart_Data *sd = _pd;
948 Elm_Fileselector_Filter *filter;
884 949
885 for (i = 0; i < ELM_FILE_LAST; ++i) 950 for (i = 0; i < ELM_FILE_LAST; ++i)
886 { 951 {
@@ -892,6 +957,16 @@ _elm_fileselector_smart_del(Eo *obj EINA_UNUSED, void *_pd, va_list *list EINA_U
892 if (sd->current) eio_file_cancel(sd->current); 957 if (sd->current) eio_file_cancel(sd->current);
893#endif 958#endif
894 959
960 EINA_LIST_FREE(sd->filter_list, filter)
961 {
962 eina_stringshare_del(filter->filter_name);
963
964 free(filter->mime_types[0]);
965 free(filter->mime_types);
966
967 free(filter);
968 }
969
895 sd->files_list = NULL; 970 sd->files_list = NULL;
896 sd->files_grid = NULL; 971 sd->files_grid = NULL;
897 972
@@ -1265,6 +1340,93 @@ clean_up:
1265 free(path); 1340 free(path);
1266} 1341}
1267 1342
1343EAPI Eina_Bool
1344elm_fileselector_mime_types_filter_append(Evas_Object *obj, const char *mime_type, const char *filter_name)
1345{
1346 ELM_FILESELECTOR_CHECK(obj) EINA_FALSE;
1347 Eina_Bool ret = EINA_FALSE;
1348 eo_do(obj, elm_obj_fileselector_mime_types_filter_append(mime_type, filter_name, &ret));
1349 return ret;
1350}
1351
1352static void
1353_mime_types_filter_append(Eo *obj, void *_pd, va_list *list)
1354{
1355 const char *mime_types = va_arg(*list, const char *);
1356 const char *filter_name = va_arg(*list, const char *);
1357 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
1358
1359 Elm_Fileselector_Smart_Data *sd;
1360 Elm_Fileselector_Filter *ff;
1361 Eina_Bool int_ret = EINA_FALSE;
1362 Eina_Bool need_theme = EINA_FALSE;
1363
1364 if (!mime_types) goto end;
1365
1366 sd = _pd;
1367
1368 ff = malloc(sizeof(Elm_Fileselector_Filter));
1369 if (!ff) goto end;
1370
1371 if (filter_name)
1372 ff->filter_name = eina_stringshare_add(filter_name);
1373 else
1374 ff->filter_name = eina_stringshare_add(mime_types);
1375
1376 ff->sd = sd;
1377
1378 ff->mime_types = eina_str_split(mime_types, ",", 0);
1379
1380 if (!sd->filter_list)
1381 {
1382 sd->current_filter = ff;
1383 sd->filter_hoversel = elm_hoversel_add(obj);
1384 elm_object_text_set(sd->filter_hoversel, ff->filter_name);
1385 need_theme = EINA_TRUE;
1386 }
1387 elm_hoversel_item_add(sd->filter_hoversel, ff->filter_name, NULL, ELM_ICON_NONE, _current_filer_changed, ff);
1388
1389 sd->filter_list = eina_list_append(sd->filter_list, ff);
1390
1391 _populate(obj, sd->path, NULL);
1392
1393 if (need_theme)
1394 eo_do(obj, elm_wdg_theme(NULL));
1395
1396 int_ret = EINA_TRUE;
1397
1398end:
1399 if (ret) *ret = int_ret;
1400}
1401
1402EAPI void
1403elm_fileselector_filters_clear(Evas_Object *obj)
1404{
1405 ELM_FILESELECTOR_CHECK(obj);
1406 eo_do(obj, elm_obj_fileselector_filters_clear());
1407}
1408
1409static void
1410_filters_clear(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
1411{
1412 Elm_Fileselector_Smart_Data *sd = _pd;
1413 Elm_Fileselector_Filter *filter;
1414
1415 EINA_LIST_FREE(sd->filter_list, filter)
1416 {
1417 eina_stringshare_del(filter->filter_name);
1418
1419 free(filter->mime_types[0]);
1420 free(filter->mime_types);
1421
1422 free(filter);
1423 }
1424
1425 ELM_SAFE_FREE(sd->filter_hoversel, evas_object_del);
1426
1427 _populate(obj, sd->path, NULL);
1428}
1429
1268static void 1430static void
1269_elm_fileselector_smart_focus_next_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list) 1431_elm_fileselector_smart_focus_next_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
1270{ 1432{
@@ -1308,6 +1470,8 @@ _class_constructor(Eo_Class *klass)
1308 EO_OP_FUNC(ELM_OBJ_FILESELECTOR_ID(ELM_OBJ_FILESELECTOR_SUB_ID_MODE_GET), _mode_get), 1470 EO_OP_FUNC(ELM_OBJ_FILESELECTOR_ID(ELM_OBJ_FILESELECTOR_SUB_ID_MODE_GET), _mode_get),
1309 EO_OP_FUNC(ELM_OBJ_FILESELECTOR_ID(ELM_OBJ_FILESELECTOR_SUB_ID_SELECTED_GET), _selected_get), 1471 EO_OP_FUNC(ELM_OBJ_FILESELECTOR_ID(ELM_OBJ_FILESELECTOR_SUB_ID_SELECTED_GET), _selected_get),
1310 EO_OP_FUNC(ELM_OBJ_FILESELECTOR_ID(ELM_OBJ_FILESELECTOR_SUB_ID_SELECTED_SET), _selected_set), 1472 EO_OP_FUNC(ELM_OBJ_FILESELECTOR_ID(ELM_OBJ_FILESELECTOR_SUB_ID_SELECTED_SET), _selected_set),
1473 EO_OP_FUNC(ELM_OBJ_FILESELECTOR_ID(ELM_OBJ_FILESELECTOR_SUB_ID_MIME_TYPES_FILTER_APPEND), _mime_types_filter_append),
1474 EO_OP_FUNC(ELM_OBJ_FILESELECTOR_ID(ELM_OBJ_FILESELECTOR_SUB_ID_FILTERS_CLEAR), _filters_clear),
1311 EO_OP_FUNC_SENTINEL 1475 EO_OP_FUNC_SENTINEL
1312 }; 1476 };
1313 eo_class_funcs_set(klass, func_desc); 1477 eo_class_funcs_set(klass, func_desc);
@@ -1329,6 +1493,8 @@ static const Eo_Op_Description op_desc[] = {
1329 EO_OP_DESCRIPTION(ELM_OBJ_FILESELECTOR_SUB_ID_MODE_GET, "Get the mode in which a given file selector widget is displaying (layouting) file system entries in its view."), 1493 EO_OP_DESCRIPTION(ELM_OBJ_FILESELECTOR_SUB_ID_MODE_GET, "Get the mode in which a given file selector widget is displaying (layouting) file system entries in its view."),
1330 EO_OP_DESCRIPTION(ELM_OBJ_FILESELECTOR_SUB_ID_SELECTED_GET, "Get the currently selected item's (full) path, in the given file selector widget."), 1494 EO_OP_DESCRIPTION(ELM_OBJ_FILESELECTOR_SUB_ID_SELECTED_GET, "Get the currently selected item's (full) path, in the given file selector widget."),
1331 EO_OP_DESCRIPTION(ELM_OBJ_FILESELECTOR_SUB_ID_SELECTED_SET, "Set, programmatically, the currently selected file/directory in the given file selector widget."), 1495 EO_OP_DESCRIPTION(ELM_OBJ_FILESELECTOR_SUB_ID_SELECTED_SET, "Set, programmatically, the currently selected file/directory in the given file selector widget."),
1496 EO_OP_DESCRIPTION(ELM_OBJ_FILESELECTOR_SUB_ID_MIME_TYPES_FILTER_APPEND, "Append mime type filter"),
1497 EO_OP_DESCRIPTION(ELM_OBJ_FILESELECTOR_SUB_ID_FILTERS_CLEAR, "Clear filters"),
1332 EO_OP_DESCRIPTION_SENTINEL 1498 EO_OP_DESCRIPTION_SENTINEL
1333}; 1499};
1334static const Eo_Class_Description class_desc = { 1500static const Eo_Class_Description class_desc = {
diff --git a/legacy/elementary/src/lib/elc_fileselector_eo.h b/legacy/elementary/src/lib/elc_fileselector_eo.h
index 06eba98698..38485d1e57 100644
--- a/legacy/elementary/src/lib/elc_fileselector_eo.h
+++ b/legacy/elementary/src/lib/elc_fileselector_eo.h
@@ -25,6 +25,8 @@ enum
25 ELM_OBJ_FILESELECTOR_SUB_ID_MODE_GET, 25 ELM_OBJ_FILESELECTOR_SUB_ID_MODE_GET,
26 ELM_OBJ_FILESELECTOR_SUB_ID_SELECTED_GET, 26 ELM_OBJ_FILESELECTOR_SUB_ID_SELECTED_GET,
27 ELM_OBJ_FILESELECTOR_SUB_ID_SELECTED_SET, 27 ELM_OBJ_FILESELECTOR_SUB_ID_SELECTED_SET,
28 ELM_OBJ_FILESELECTOR_SUB_ID_MIME_TYPES_FILTER_APPEND,
29 ELM_OBJ_FILESELECTOR_SUB_ID_FILTERS_CLEAR,
28 ELM_OBJ_FILESELECTOR_SUB_ID_LAST 30 ELM_OBJ_FILESELECTOR_SUB_ID_LAST
29}; 31};
30 32
@@ -206,6 +208,32 @@ enum
206 * @see elm_fileselector_selected_set 208 * @see elm_fileselector_selected_set
207 */ 209 */
208#define elm_obj_fileselector_selected_set(_path, ret) ELM_OBJ_FILESELECTOR_ID(ELM_OBJ_FILESELECTOR_SUB_ID_SELECTED_SET), EO_TYPECHECK(const char *, _path), EO_TYPECHECK(Eina_Bool *, ret) 210#define elm_obj_fileselector_selected_set(_path, ret) ELM_OBJ_FILESELECTOR_ID(ELM_OBJ_FILESELECTOR_SUB_ID_SELECTED_SET), EO_TYPECHECK(const char *, _path), EO_TYPECHECK(Eina_Bool *, ret)
211
212/**
213 * @def elm_obj_fileselector_mime_type_filter_append
214 * @since 1.8
215 *
216 * Append mime type based filter into filter list
217 *
218 * @param[in] mime_types
219 * @param[in] filter_name
220 * @param[out] ret
221 *
222 * @see elm_fileselector_mime_type_filter_append
223 */
224#define elm_obj_fileselector_mime_types_filter_append(mime_types, filter_name, ret) ELM_OBJ_FILESELECTOR_ID(ELM_OBJ_FILESELECTOR_SUB_ID_MIME_TYPES_FILTER_APPEND), EO_TYPECHECK(const char *, mime_types), EO_TYPECHECK(const char *, filter_name), EO_TYPECHECK(Eina_Bool *, ret)
225
226/**
227 * @def elm_obj_fileselector_filters_clear
228 * @since 1.8
229 *
230 * Clear all filters registered
231 *
232 *
233 * @see elm_fileselector_mime_type_filter_append
234 */
235#define elm_obj_fileselector_filters_clear() ELM_OBJ_FILESELECTOR_ID(ELM_OBJ_FILESELECTOR_SUB_ID_FILTERS_CLEAR)
236
209/** 237/**
210 * @} 238 * @}
211 */ 239 */
diff --git a/legacy/elementary/src/lib/elc_fileselector_legacy.h b/legacy/elementary/src/lib/elc_fileselector_legacy.h
index 505b787988..52edeea591 100644
--- a/legacy/elementary/src/lib/elc_fileselector_legacy.h
+++ b/legacy/elementary/src/lib/elc_fileselector_legacy.h
@@ -242,3 +242,36 @@ EAPI Eina_Bool elm_fileselector_selected_set(Evas_Object *obj, const
242 * @ingroup Fileselector 242 * @ingroup Fileselector
243 */ 243 */
244EAPI const char *elm_fileselector_selected_get(const Evas_Object *obj); 244EAPI const char *elm_fileselector_selected_get(const Evas_Object *obj);
245
246/**
247 * Append mime types filter into filter list
248 *
249 * @param obj The file selector object
250 * @param mime_types comma(,) separated mime types to be allowed.
251 * @param filter_name The name to be displayed, @p mime_types will be displayed if NULL
252 * @return @c EINA_TRUE on success, @c EINA_FALSE on failure.
253 *
254 * @note a sub type of mime can be asterisk(*)
255 * @note mime type filter is only working with efreet now.
256 * @note first added filter will be the default filter at the moment.
257 *
258 * @see elm_need_efreet()
259 * @see elm_fileselector_filters_clear()
260 *
261 * @ingroup Fileselector
262 */
263EAPI Eina_Bool elm_fileselector_mime_types_filter_append(Evas_Object *obj, const char *mime_types, const char *filter_name);
264
265/**
266 * Clear all filters registered
267 *
268 * @param obj The file selector object
269 *
270 * @note If filter list is empty, file selector assume that all
271 * files are matched.
272 *
273 * @see elm_fileselector_mime_type_filter_append()
274 *
275 * @ingroup Fileselector
276 */
277EAPI void elm_fileselector_filters_clear(Evas_Object *obj);
diff --git a/legacy/elementary/src/lib/elm_widget_fileselector.h b/legacy/elementary/src/lib/elm_widget_fileselector.h
index d656d0a731..ad8c35ae68 100644
--- a/legacy/elementary/src/lib/elm_widget_fileselector.h
+++ b/legacy/elementary/src/lib/elm_widget_fileselector.h
@@ -14,6 +14,8 @@
14 * widgets which are a fileselector with some more logic on top. 14 * widgets which are a fileselector with some more logic on top.
15 */ 15 */
16 16
17typedef struct _Elm_Fileselector_Filter Elm_Fileselector_Filter;
18
17/** 19/**
18 * Base layout smart data extended with fileselector instance data. 20 * Base layout smart data extended with fileselector instance data.
19 */ 21 */
@@ -22,24 +24,28 @@ struct _Elm_Fileselector_Smart_Data
22{ 24{
23 EINA_REFCOUNT; 25 EINA_REFCOUNT;
24 26
25 Evas_Object *obj; 27 Evas_Object *obj;
26 Evas_Object *path_entry; 28 Evas_Object *path_entry;
27 Evas_Object *files_list; 29 Evas_Object *files_list;
28 Evas_Object *files_grid; 30 Evas_Object *files_grid;
29 Evas_Object *up_button; 31 Evas_Object *up_button;
30 Evas_Object *home_button; 32 Evas_Object *home_button;
31 Evas_Object *spinner; 33 Evas_Object *spinner;
32 Evas_Object *ok_button; 34 Evas_Object *filter_hoversel;
33 Evas_Object *cancel_button; 35 Evas_Object *ok_button;
36 Evas_Object *cancel_button;
37
38 Eina_List *filter_list;
39 Elm_Fileselector_Filter *current_filter;
34 40
35 const char *path; 41 const char *path;
36 const char *selection; 42 const char *selection;
37 Ecore_Idler *sel_idler; 43 Ecore_Idler *sel_idler;
38 44
39 const char *path_separator; 45 const char *path_separator;
40 46
41#ifdef HAVE_EIO 47#ifdef HAVE_EIO
42 Eio_File *current; 48 Eio_File *current;
43#endif 49#endif
44 50
45 Elm_Fileselector_Mode mode; 51 Elm_Fileselector_Mode mode;
@@ -72,6 +78,14 @@ typedef enum {
72 ELM_FILE_LAST 78 ELM_FILE_LAST
73} Elm_Fileselector_Type; 79} Elm_Fileselector_Type;
74 80
81struct _Elm_Fileselector_Filter
82{
83 const char *filter_name;
84 Elm_Fileselector_Smart_Data *sd;
85
86 char **mime_types;
87};
88
75/** 89/**
76 * @} 90 * @}
77 */ 91 */