20 Jul 2003 funrecords   » (Journeyer)

Open Applet Runs Into API Snags

For those not in the know, the open applet is a simple panel applet that allows you to open web address, file system files and folders, remote ftp files and folders, or search the web.

Well my originally simple panel applet has run into some issues. The function it uses to open a url with is gnome_vfs_url_show from GNOME VFS. The main issue is that mime-sniffing remote files is costly [1] and the sync i/o leads to a noticeable lockup in the ui. My original solution was to set application handlers for common schemes like http:// and ftp://. This works all fine and dandy until you consider the fact that opening a web browser to view a pdf file that just happens to be stored on a webserver doesn't really make sense nor does it make sense to open webdav directories in a web browser either [2].

What to do, what to do?

UI wise I have it all figured out in my head. For the most part mime-sniffing single remote files does not take that terribly long. On average I'd guess its taking about 5 seconds for the average website. I'd need to take a look at the GNOME HIG, but afair if an operation takes more than around 3-5 seconds some sort of visual affordance that work is being done should be provided. In the case of the open applet poping up a dialog which informs the user that the file is being loaded along with a button to cancel the operation would suffice [3]. However the key here is to not block the main ui so that the user can open other urls at the same time that he/she is waiting for the blocked one/s.

One idea I had to avoid the worst of the UI locking was to fork off gnome-open processes instead of directly opening the url with gnome_vfs_url_show in my app. This would work but obviously wouldn't scale very well :/

[1] Especially for those of us in the majority who still use dialup.

[2] I believe kde uses webdav:// in this case, but to the best of my knowledge gnome's use of http:// is more correct. It doesn't really matter though, even in the webdav case you need to be able to sniff out the mime-type of the file to open.

[3] Libifying functions to provide UI would be useful to other apps that can open hyperlinked data such as irc clients, word processors etc.

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!