GNOME Bugzilla – Bug 770899
Support inserting a single shared item
Last modified: 2016-09-22 11:22:22 UTC
Now that gnome-photos supports sharing (bug 751181), we need to insert some properties/relations to the database to link a shared item to its source. This will let the application avoid showing duplicated entries in the UI. We can do this directly inside the application, but since gnome-online-miners already has the code to insert remote objects into the Tracker database, I would like to re-use that. I am thinking of adding a new D-Bus method (say InsertSharedContent) that would look like this: <method name='InsertSharedContent'> <arg name='account_id' type='s' direction='in'/> <arg name='shared_id' type='s' direction='in'/> <arg name='shared_type' type='s' direction='in'/> <arg name='source_urn' type='s' direction='in'/> </method> Currently libgdata doesn't expose the API to de/serialize a GDataEntry to XML, so the miner will have to do an extra network call based on the shared_id (and account_id) to get GDataEntry from the server. If there was a way to de/serialize to XML, the application could pass the XML (maybe after compression) to the miner over D-Bus, since it already has it as a by-product of sharing/upload operation. (I am thinking that the idea of passing the XML would also be useful when we have a sharing portal, even if one is not using tracker/gnome-online-miners. The portal would be a OS component (ie. a D-Bus service), and it would be nice if it could hand over a rich description of the shared item back to the application. But that would need libgdata work, so not really relevant here. For the time being, we can live with an extra network call.)
> Currently libgdata doesn't expose the API to de/serialize a GDataEntry to XML Sure it does: gdata_parsable_get_xml (GDATA_PARSABLE (my_entry))
(In reply to Philip Withnall from comment #1) > > Currently libgdata doesn't expose the API to de/serialize a GDataEntry to XML > > Sure it does: gdata_parsable_get_xml (GDATA_PARSABLE (my_entry)) Oh, that's right. How did I miss that? Thanks! I have some patches in gnome-online-miners:wip/rishi/insert-share, which I will attach shortly.
Created attachment 334833 [details] [review] src: Pass the TrackerSparqlConnection separately to the query vfunc
Created attachment 334834 [details] [review] src: Pass 'previous_resources' separately to the query vfunc
Created attachment 334835 [details] [review] src: Pass 'datasource_urn' separately to the query vfunc
Created attachment 334836 [details] [review] miner: Rename a private function and shuffle the parameters around
Created attachment 334837 [details] [review] dbus: Add InsertSharedContent
Created attachment 334838 [details] [review] miner: Add gom_miner_insert_shared_content_async
Created attachment 334839 [details] [review] application: Handle InsertSharedContent
Created attachment 334840 [details] [review] gdata: Accept a NULL 'previous_resources'
Created attachment 334841 [details] [review] gdata: Accept a NULL 'parent_resource_urn'
Created attachment 334842 [details] [review] gdata: Remove the unused GomAccountMinerJob parameters
Created attachment 334843 [details] [review] gdata: Let account_miner_job_process_photo return the URN
Created attachment 334844 [details] [review] gdata: Implement the vfuncs for inserting a shared photo
So far, these patches seem to work as intended. They don't serialize the GDataEntry, so there is an extra network call made by the miner. Seeing how stupid I was to miss the serialization API, and how close we are to the final release, I am leaning towards going with this for 3.22. We can improve this post-3.22. I am going to test them a bit more, and unless someone finds something wrong with them, I will merge them tomorrow.
Pushed everything to master. Let me know if something breaks.
(In reply to Debarshi Ray from comment #15) > They don't serialize the > GDataEntry, so there is an extra network call made by the miner. Seeing how > stupid I was to miss the serialization API, and how close we are to the > final release, I am leaning towards going with this for 3.22. We can improve > this post-3.22. I filed bug 771823 for adding the de/serialization.