You can share files on your N900 via Bluetooth, E-Mail and web services (Flickr and Facebook) thanks to libsharing-dialog. But there is no file transfers to a contact through instant messaging.
The sharing dialog with Bluetooth, E-Mail and web services features
But look, the sharing dialog is obviously missing a fourth button named “Share via IM”!
Jonny Lamb wrote Monorail, a file transfer application for the N900. Monorail is a standalone application using the Telepathy framework but so far it does not integrate with libsharing-dialog. Libsharing-dialog is supposed to be extensible by plugins (see the Sharing Plug-in documentation). Unfortunately the API is more suitable for web services than for file transfers through instant messenging so it makes the work more difficult.
So I implemented that fourth button with some hacks to workaround the limitations of the libsharing-dialog API:
- The Monorail package dpkg-diverts libsharingdialog.so into /var/lib/funsharing/
- Monorail implements a new library (aka libfunsharing) replacing libsharingdialog.so with the same ABI
- Libfunsharing calls dlopen() on the real libsharingdialog.so
- It also patches the class GtkTable in memory (see struct GObjectClass->constructed) just before calling the real function from libsharingdialog.so, and restore it after the call. I use this hack to get a reference to the GtkDialog and the GtkTable containing the three buttons (the libsharing-dialog API does not give us any reference to these objects)
- In the constructed function of GtkTable, it adds a 4th button “Share via IM” which sends the filenames to share via D-Bus to Monorail
- Monorail receives the filenames from libfunsharing via D-Bus, shows the contact selector and send the files as usual.
The sharing dialog after installing Monorail 0.3
It works fine in the file manager and the image viewer. Do you know any other application with a file sharing feature?
The address book can share contact cards via SMS, Bluetooth and E-Mail but it does not use libsharing-dialog, so Monorail does not automatically add my “Share via IM” button.
Send a contact card from the address book
But since PR1.2, the address book has a new plugin API and it automatically links to your plugins installed in /usr/lib/osso-addressbook/plugins. The plugin API is designed for menu extensions and does not have helper functions for the sharing dialog. But with Marco’s help, I replaced OssoABookSendContactsDialog’s constructed function to add the fourth button:
Send a contact card from the address book after installing Monorail 0.3