URI scheme checkers need to be streamlined
Spun off from !1247 (comment 1793346)
We should rid of these eel_uri_*()
functions! But rebranding them to nautilus_path_*()
barely changes anything.
Observe:
eel-vfs-extensions.h | nautilus-file-utilities.h | nautilus-file.h | nautilus-directory.h |
---|---|---|---|
eel_uri_is_other_locations | nautilus_is_other_locations_directory | nautilus_file_is_other_locations | |
eel_uri_is_recent | nautilus_is_recent_directory | nautilus_file_is_in_recent | nautilus_directory_is_in_recent |
eel_uri_is_search | nautilus_is_search_directory | nautilus_file_is_in_search | |
eel_uri_is_starred | nautilus_is_starred_directory | nautilus_file_is_in_starred, nautilus_file_is_starred_location | nautilus_directory_is_in_starred |
eel_uri_is_trash | nautilus_is_trash_directory | nautilus_file_is_in_trash | nauutilus_directory_is_in_trash |
eel_uri_is_trash_root | |||
nautilus_file_is_in_admin | nautilus_directory_is_in_admin |
II think we should get rid of the first and second columns altogether, as for both cases, GLib provides simple API already:
- for URIs, we can use
g_str_has_prefix()
(g_uri_peek_scheme()
would be even more correct, but less convenient); - for
GFile
, we can useg_file_has_uri_scheme()
.
In both cases, the only moving parts we may want to reuse are the scheme strings. For that, @p3732 suggested a minimal standalone nautilus-schemes.h
.
Actually, in some cases, we are checking uris or GFiles obtained returned from nautilus_file_get_uri()
or nautilus_file_get_location()
... in such cases we might just use the nautilus-file.h methods directly, if it's not part of a performance critical code path.