Conversation
| return ZATHURA_EXPLORER_TYPE_FILE_INVALID; | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
We handle file type detection via mime types. Please check the open auto completion and follow the same pattern.
There was a problem hiding this comment.
Using MIME types here is proving to be very buggy and slow no matter what I do. Is there an edge case I'm not accounting for when simply checking the file extensions?
There was a problem hiding this comment.
We support more than PDF files (depending on the installed plugins). So the common pattern to check whether a file can be displayed or not is to check the mimetype and then match it with the registered types. Please look at list_files as a template.
| // takes a dir and gets its children and adds it to the parent | ||
| bool zathura_explorer_generate_r(zathura_error_t* error, girara_tree_node_t* root, char *path, int trace){ | ||
| /* Only 3 recursive calls to prevent it from getting too big */ | ||
| if (trace > 5){ |
There was a problem hiding this comment.
Instead of building everything in the beginning, child nodes of directories could be computed on demand when a directory is opened.
There was a problem hiding this comment.
The way it's built now, it would require the GTK Tree to continually be rebuilt and re-rendered on each expansion. I can do this, but without rewriting all changes from scratch, this would be less memory-efficient than simply building everything in the beginning.
| struct dirent *dp; | ||
|
|
||
|
|
||
| dir = opendir(path); |
There was a problem hiding this comment.
Please check list_files from zathura/completion.c.
There was a problem hiding this comment.
list_files instead of my implementation would be hard to string together because the file tree nodes have their own data type that zathura_explorer_generate uses.
There was a problem hiding this comment.
I know, but in any case it is the template to follow. It handles all file types supported by zathura (which is more than PDF).
There was a problem hiding this comment.
Gotcha. I'll work on it when I get back. Sorry for the confusion
|
@sebastinas I implemented most of the changes you suggested. Everything is working fine, but I could not get the unresolved changes implemented without major bugs or reworking the entire PR. Thank you! |
I implemented a working file explorer using GLTK! Everything seems to be working, but one bug that needs to be fixed is that the index, when enter is pressed, does not exit out of the index screen immediately. I plan to fix that, but let me know what you think.