Le 31/01/2012 02:04, Lex Trotman a écrit :
On Tue, Jan 31, 2012 at 11:30 AM, Colomban Wendling lists.ban@herbesfolles.org wrote:
Hey Nick, Matthew, Lex, Frank, Enrico, whoever cares,
https://github.com/b4n/geany/commit/01fd682674286dada6d6b77d0e3064c89a28df64
I wrote this patch that adds automatic mounting of volumes needed to open a GIO URI, so one don't have to first mount the corresponding volume in Nautilus/whatever. This make opening arbitrary URIs from the CLI easier, though it's probably not needed when using a file manager (who would've already mounted the volume to browse it).
I'm quite confident mounting the volume is a good idea in theory, but there is a small thing making it a bit tricky: GIO doesn't seem to provide a synchronous API to do that.
My only problem with making uri operations easier is that the incidence of remote data loss or performance complaints will increase.
Hum, while I don't like the reason why it is a good point (remote support not being perfect), it still IS a good point. Though, I don't think that we shouldn't mount the volume to make things harder, if we really want to stop getting boring reports of users messing with their data remotely, we should probably simply drop the remote support and let the user do the mounts AND opens manually. But do we want that?
So, it either requires the calling code to be asynchronous (which we don't have yet and that don't fit well with current code), or to hack around to make the asynchronous code look synchronous.
I did the latter, and that's basically the reason why I post this mail: do you think it's too ugly, too useless, too something?
Well, shrug, what else can you do?
But if the mainloop is still running while waiting, does that mean the UI is still available and the user can trigger another open? Will that work since AFAIK none of Geany is intended to be re-entrant.
Good point. Just two things to note:
1) It's not actually any worst than gtk_dialog_run() which does the same, now I added a modal progress dialog [1]. We use gtk_dialog_run() in many places and don't worry much, so maybe it's enough.
2) The only (easy) way to trigger the volume mounting code is currently to open an URI pointing to an unmounted volume from the CLI. All other ways of of opening remote files (File->Open, URI list DnD, ..) almost surely needs the volume to be already mounted. OK, this only makes a buggy behavior less likely, it doesn't prevent it completely.
The sad story is that GLib/GIO actually HAS the API needed to make this work completely fine (g_main_context_push/pop_thread_default(), g_file_supports_thread_contexts()), but GVfsDaemon doesn't support it. BTW, GVfsDaemon seems to lack plenty of things, see the other mail...
Its a pity our old friend g_replace_contents doesn't work safely, otherwise we could g_file_new_from_uri, g_file_read to read it and g_file_replace_contents to write it, and let GIO do what it is meant to, sigh.
I think you're a bit too optimistic/naive. AFAIK, GIO won't ever mount you a volume implicitly just because you want to read from it. Actually it's unlikely it can, because it might require user interaction, like asking an username or a password. And GEdit itself does call g_file_mount_enclosing_volume().
Basically, points I see in a pros/cons:
- allows to open URIs on unmounted volumes;
- as a cause, makes Geany handle URIs more naturally;
- mount is tried only as a last resort, so doesn't impact already
working situations;
- code is a bit hackish (the loop thing), though it works fine [1];
- may be slow if mounting the volume is slow (since it is synchronous);
- may not be really useful in practice (since people probably open URI
through the file manager, who will mount the volume).
Well I can't comment on its utility since I never edit anything remotely anyway. (but I guess that was a comment anyway).
I don't edit much remote files myself and prefer either local edit + upload or simply Git :) -- but yes, was a useful comment, thanks :)
Cheers, Colomban
[1] https://github.com/b4n/geany/commit/540e6b28d8ce461b44f6fd4dce32c38167bca99b
Cheers Lex
So... thoughts?
Cheers, Colomban
[1] only problem might be that idle/timeout callbacks (e.g. main loop sources) can still run during the mount -- though, I don't see why it'd be an actual problem for us
See question above
Geany-devel mailing list Geany-devel@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
Geany-devel mailing list Geany-devel@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel