Improved File Dialog

The original dialog wasn’t very easy to use or install, and was rather buggy, so I’ve been making some improvements.

Turns out, as a part of an upload, SL opens the file multiple times. That resulted in the file dialog popping up twice for an image upload. This was fixed by adding a table to upload_hook.c, with the filename to expect, and the number of times to ignore further matches.

This introduced a new problem: If the dialog was cancelled, or the script somehow failed, the next few attempts to upload something would be ignored. So now upload_hook.c also checks the return code, and if it’s not 0 assumes it didn’t go well, and doesn’t do the ignoring part.

sl_upload.sh has been greatly improved, and now handles images, sound files and .bhv files (not tested). Support for Zenity (gnome dialog) has been added as well.

The Makefile has been improved to do all the installation parts automatically, so that you only need to run ‘make’, and add the line it tells you in the secondlife script.

One problem remains: If you accept a file in the dialog, then cancel the upload in SL it will not work correctly. I’m not sure how to fix that yet, but I think it’s a nice improvement over no dialog at all anyway 🙂

Here’s the source. Of course, comments, suggestions and patches are welcome.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: