diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2021-11-21 11:00:25 +0100 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2021-11-21 11:01:30 +0100 |
commit | c77bccccb817dd5cfddeb8eda5466ad953164749 (patch) | |
tree | 7842a9feba6ae74d58ee211c8642591202d413c9 /fastiv-browser.c | |
parent | 6dd0414d0a16bc4674985613cef4a8f7ff315825 (diff) | |
download | fiv-c77bccccb817dd5cfddeb8eda5466ad953164749.tar.gz fiv-c77bccccb817dd5cfddeb8eda5466ad953164749.tar.xz fiv-c77bccccb817dd5cfddeb8eda5466ad953164749.zip |
Implement filtering by supported extensions
Diffstat (limited to 'fastiv-browser.c')
-rw-r--r-- | fastiv-browser.c | 8 |
1 files changed, 5 insertions, 3 deletions
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)})); |