This pull request aims to be a complete support for systems without gvfs-fuse or fuse installed. It supersedes #963 (I'm creating a new pull request because there are some changes to the used approach, not just addressing issues from the original pull request).
The main changes of this pull request compared to #963 are: 1. More fine-grained approach to GIO usage - previously I for instance replaced all g_file_test() usages with GIO (depending on the configuration) but now it's done only for files which can possibly be remote (i.e. not for config files etc.). If not remote, g_file_...() is still used. 2. Got less crazy about USE_GIO_FILE_OPERATIONS Geany configuration and use this one only when opening/closing documents is involved in the IO. This is when things can go wrong when mixing IO methods. But for other things there's no need to maintain both g_file_...() implementation and GIO implementation and only one of them is used (depending on whether the file can be remote). 3. There's no new plugin API - basically I think plugins don't need to know the value of USE_GIO_FILE_OPERATIONS as they aren't involved in opening/closing documents. If a plugin wants to support remote files, it should use GIO. All existing API functions that could possibly involve file IO have been converted to use GIO. It's not completely black and white as some functions are also used by Geany for opening documents so these still test the USE_GIO_FILE_OPERATIONS value. Not having the file IO functions in the API leads to some duplication of code in plugins but it's not that bad and probably better than adding more and more utility functions to the API. 4. It now works not only when gvfs-fuse is uninstalled, but also when fuse is uninstalled. I was still getting the remote location mounted before I uninstalled fuse and discovered more problems on the way. I recommend testing with fuse uninstalled. 5. Some things like file properties of remote files, TM or saveactions support were missing in the previous pull request. Everything should work now. 6. TM works only for parsing edited file's buffers - there's no support for parsing remote files (we'd have to change ctags for this). I think this is OK as loading complete projects over network could take ages and everything would be frozen as we use blocking GIO. For the same reason I don't plan support for remote projects in my projectorganizer plugin. I haven't really checked how other plugins behave but I don't expect big problems. doc->file_name and doc->real_path can now be URI and if plugins do some reasonable error checking, there should be no problem and they should fail gracefully if they don't use GIO. (I haven't checked but IMO plugins shouldn't read/write doc->file_name as this would interfere with the opened buffer in Geany. Most of the checks I've seen were like if (doc->file_name != NULL) {...}). 7. I didn't get too crazy about saveactions plugin GIO support - it now only supports saving backups into a local directory and not to a remote one. I think nobody will really use remote URI as a location for backups - it would be rather impractical and slow. But can easily add this if someone thinks the opposite.
Apart from the minor limitations I mentioned, I'm not aware of anything missing - I believe this pull request ticks all checkboxes from #1145 with the exception of Windows support which I probably won't do myself and which can be done later independently of this pull request. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/1414
-- Commit Summary --
* Replace g_file_test() with a GIO variant when needed * Update utils_get_path_from_uri() to return URI when using GIO * Keep URIs in utils_tidy_path() * Use g_file_new_for_uri() when needed * Don't create separate tagmanager library * Preserve URIs in tm_get_real_path() * Allow parsing remote files opened in the editor * Merge implementations of write_data_to_disk() and utils_write_file() * Use gtk_file_chooser_get_uri() in file opening/saving dialogs * Add GIO version of document_rename_file() * Use GIO in utils_get_file_list_full() * Add file reading utils function * Load project config files using the new utility function * Remove unnecessary utils functions * Use g_file_set_contents() instead of utils_write_file() for local files * Use GIO in utils_mkdir() * Add GIO implementation to utils_is_file_writable() * Use GIO for filetypes_detect_from_file() * Eliminate g_path_is_absolute() direct calls * Use GIO for file properties dialog * saveactions: Make backups work for remote files * Document that document file_name and real_path can be URIs
-- File Changes --
M configure.ac (1) M plugins/export.c (23) M plugins/filebrowser.c (74) M plugins/htmlchars.c (2) M plugins/saveactions.c (108) M src/Makefile.am (25) M src/callbacks.c (10) M src/dialogs.c (78) M src/document.c (137) M src/document.h (4) M src/filetypes.c (31) M src/keybindings.c (8) M src/keyfile.c (8) M src/libmain.c (13) M src/msgwindow.c (8) M src/osx.c (2) M src/project.c (74) M src/sidebar.c (2) M src/stash.c (3) M src/symbols.c (1) D src/tagmanager/Makefile.am (32) M src/tagmanager/tm_source_file.c (54) M src/tagmanager/tm_source_file.h (3) M src/toolbar.c (2) M src/ui_utils.c (8) M src/utils.c (351) M src/utils.h (24) M src/win32.c (4)
-- Patch Links --
https://github.com/geany/geany/pull/1414.patch https://github.com/geany/geany/pull/1414.diff
techee commented on this pull request.
I'll need some help for this patch - it places the installed tagmanager headers directly inside the Geany include directory instead of the 'tagmanager' subdirectory (plugins work fine as they don't include TM headers directly). It's probably super-easy to fix, it's just out of scope my "copy/paste"-based knowledge of autotools.
Forgot to mention how I was testing - I uninstalled gvfs-fuse and fuse, created the smallest $5 linode instance (without any configuration), entered
``` sftp://root@server_ip/root/ ```
into Thunar on my linux mint where I logged in and then tested document creation, editing, project creation etc. with the remote location. I can create a new account for anyone who wants to test.
kugel- commented on this pull request.
I'm not sure this change is required at all.
Yes, there may be a circular dependency. But this is not a problem since tagmanager is build statically only.
Are their other projects that have a tagmanager or fork or has it become more or less geany-specific?
geany_includedir = $(includedir)/geany
geany_include_HEADERS = \ + $(TM_HDRS) \
You want to create a separate variable like this:
tagmanager_includedir = $(includedir)/geany/tagmanager tagmanager_include_HEADERS = $(TM_HDRS)
Then headers will be installed in the subdirectory.
I'm not sure this change is required at all.
Yes, you are right, I've just tried and the circular dependency is no problem. Still I prefer to think of tag manager as just one specific part of geany and not a separate library so I kept the patch. But I have no problem to remove it if others disagree.
Are their other projects that have a tagmanager or fork or has it become more or less geany-specific?
It's basically completely Geany-specific. It was originally based on this
https://sourceforge.net/projects/tagmanager/
which got abandoned 14 years ago, then picked and modified by Anjuta, then the Anjuta version got picked and modified by Geany (Anjuta dropped tagmanager in the meantime) and then heavily modified by me in the past years. So while the overall logic of maintaining tags is similar to the original one, the sources are very different. There's no living upstream version of what we have in Geany.
techee commented on this pull request.
geany_includedir = $(includedir)/geany
geany_include_HEADERS = \ + $(TM_HDRS) \
Ah, thanks, I could have thought of this :-(. I've modified the commit and repushed it with this modification.
Closed #1414.
github-comments@lists.geany.org