test_fileselector: Added edje custom filter example to show the real use case of...
authorDaniel Juyung Seo <seojuyung2@gmail.com>
Sun, 29 Dec 2013 15:21:55 +0000 (00:21 +0900)
committerDaniel Juyung Seo <seojuyung2@gmail.com>
Sun, 29 Dec 2013 15:22:18 +0000 (00:22 +0900)
This feature is really good. Thanks Ryuan!

src/bin/test_fileselector.c

index aeae9b2..3af3089 100644 (file)
@@ -482,6 +482,18 @@ _all_filter(const char *path  EINA_UNUSED,
    return EINA_TRUE;
 }
 
+static Eina_Bool
+_edje_filter(const char *path, Eina_Bool dir,
+             void *data EINA_UNUSED)
+{
+   if (dir) return EINA_TRUE;
+
+   if (eina_str_has_extension(path, ".edc") ||
+       eina_str_has_extension(path, ".edj"))
+     return EINA_TRUE;
+   return EINA_FALSE;
+}
+
 void
 test_fileselector(void *data       EINA_UNUSED,
                   Evas_Object *obj EINA_UNUSED,
@@ -523,6 +535,7 @@ test_fileselector(void *data       EINA_UNUSED,
    elm_fileselector_mime_types_filter_append(fs, "text/*", "Text Files");
    elm_fileselector_mime_types_filter_append(fs, "image/*", "Image Files");
    elm_fileselector_custom_filter_append(fs, _all_filter, NULL, "All Files");
+   elm_fileselector_custom_filter_append(fs, _edje_filter, NULL, "Edje Files");
 
    evas_object_smart_callback_add(fs, "done", my_fileselector_done, win);
    evas_object_smart_callback_add(fs, "selected", my_fileselector_selected,