Le 31/01/2012 20:14, Enrico Tröger a écrit :
On Tue, 31 Jan 2012 01:30:58 +0100, Colomban wrote:
Ho Colomban and the rest,
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
whatever = Gigolo!
:)
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.
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?
I basically like the idea. If I remember correctly, the relevant code is also called when starting Geany and the main GUI isn't yet shown. If so, I see one big problem:
Actually opening from CLI is ~ the only way to trigger the code since most other would need the volume to be already mounted. So startup and remote control.
if the mount won't finish in a short time, the user doesn't know what's happening and probably only notices that Geany doesn't start because no GUI is shown. So, I think at the very least we would need some sort of timeout, a short timeout, to cancel the mount operation if it takes too long. Not sure what exactly is 'too long', maybe a few seconds. Or even better (and more complex) we would show the user a dialog with a pulsing progressbar or so stating that a mount operation is in progress. A cancel button would be a big bonus but probabaly not necessarily needed.
Good point, here you go with a dialog, pulse & cancel: https://github.com/b4n/geany/commit/540e6b28d8ce461b44f6fd4dce32c38167bca99b
Having a modal dialog also has the advantage of blocking user interaction on the main window, addressing a part of Lex's worries.
Just as a funny note, implementing all this required some more hackery because GVfsDaemon (bridge of all remote FS) doesn't actually honor cancellation even though the API is supposed to provide it.
So, here it is with a progress dialog & cancellation support. I tested it a bit, particularly the opening a second URI from the CLI while waiting to mount a first one, and it looked like it worked fine: mounted the stuff and/or asked for details, each after the other, no weird concurrency. Though, if anyone wants to test it a bit more, it can't be wrong.
Comments still welcome of course :)
Cheers, Colomban
Regards, Enrico