From c77bccccb817dd5cfddeb8eda5466ad953164749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= Date: Sun, 21 Nov 2021 11:00:25 +0100 Subject: Implement filtering by supported extensions --- fastiv-browser.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'fastiv-browser.c') diff --git a/fastiv-browser.c b/fastiv-browser.c index 984632e..feb4ca3 100644 --- a/fastiv-browser.c +++ b/fastiv-browser.c @@ -644,7 +644,8 @@ entry_add_thumbnail(gpointer data, G_GNUC_UNUSED gpointer user_data) } void -fastiv_browser_load(FastivBrowser *self, const char *path) +fastiv_browser_load( + FastivBrowser *self, FastivBrowserFilterCallback cb, const char *path) { g_array_set_size(self->entries, 0); g_array_set_size(self->layouted_rows, 0); @@ -666,8 +667,9 @@ fastiv_browser_load(FastivBrowser *self, const char *path) if (g_file_info_get_file_type(info) == G_FILE_TYPE_DIRECTORY) continue; - // TODO(p): Support being passed filter/sort functions. - g_file_info_get_name(info); + // TODO(p): Support being passed a sort function. + if (cb && !cb(g_file_info_get_name(info))) + continue; g_array_append_val(self->entries, ((Entry) {.thumbnail = NULL, .filename = g_file_get_path(child)})); -- cgit v1.2.3