Infrastructure for allowing a device to "synchronize" data with calibre's database. The exact meaning of "synchronize" is left to the device. This implementation adds almost zero overhead (nanoseconds per book) if the device driver does not do any synchronization.

During book matching in gui2.device, whenever a book on the device is matched to a book in the DB, the (new) device method synchronize_with_db is called. It can copy information from the device to calibre's db or vice versa. If it returns True then the book's metadata is updated from calibre's DB even if it otherwise would not be. This permits the synchronization process to request that data in calibre be unconditionally sent to the device.

Note that the synchronize_with_db method is called on the GUI thread. It is the device driver's responsibility to be threadsafe with respect to the device manager thread.

A lightly-tested implementation in the wireless driver is included to show how the new method might be used. It implements syncing a yes/no "is read" column and a "read date" column from the device to calibre.
1) Change the new sync method to return a list of changed book ids instead of a simple boolean.

2) Make the wireless device driver synchronization more robust in the face of multiple libraries where the sync column might not always exist.
Pass the current row to refresh_ids so that the book_data signal is emitted.
...
Make the set of books to refresh into a local variable buy using it as an object instance instead of by assignment.
Add a mechanism for device drivers to update books in the calibre database

Merge branch 'master' of https://github.com/cbhaley/calibre