After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 770899 - Support inserting a single shared item
Support inserting a single shared item
Status: RESOLVED FIXED
Product: gnome-online-miners
Classification: Applications
Component: general
unspecified
Other All
: Normal enhancement
: ---
Assigned To: GNOME Online Miners maintainer(s)
GNOME Online Miners maintainer(s)
Depends on: 770889
Blocks: 770267
 
 
Reported: 2016-09-05 14:42 UTC by Debarshi Ray
Modified: 2016-09-22 11:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
src: Pass the TrackerSparqlConnection separately to the query vfunc (51.72 KB, patch)
2016-09-05 18:05 UTC, Debarshi Ray
committed Details | Review
src: Pass 'previous_resources' separately to the query vfunc (23.35 KB, patch)
2016-09-05 18:05 UTC, Debarshi Ray
committed Details | Review
src: Pass 'datasource_urn' separately to the query vfunc (47.61 KB, patch)
2016-09-05 18:06 UTC, Debarshi Ray
committed Details | Review
miner: Rename a private function and shuffle the parameters around (2.76 KB, patch)
2016-09-05 18:06 UTC, Debarshi Ray
committed Details | Review
dbus: Add InsertSharedContent (930 bytes, patch)
2016-09-05 18:07 UTC, Debarshi Ray
committed Details | Review
miner: Add gom_miner_insert_shared_content_async (8.56 KB, patch)
2016-09-05 18:08 UTC, Debarshi Ray
committed Details | Review
application: Handle InsertSharedContent (3.10 KB, patch)
2016-09-05 18:09 UTC, Debarshi Ray
committed Details | Review
gdata: Accept a NULL 'previous_resources' (2.14 KB, patch)
2016-09-05 18:09 UTC, Debarshi Ray
committed Details | Review
gdata: Accept a NULL 'parent_resource_urn' (1.36 KB, patch)
2016-09-05 18:10 UTC, Debarshi Ray
committed Details | Review
gdata: Remove the unused GomAccountMinerJob parameters (3.36 KB, patch)
2016-09-05 18:11 UTC, Debarshi Ray
committed Details | Review
gdata: Let account_miner_job_process_photo return the URN (2.71 KB, patch)
2016-09-05 18:12 UTC, Debarshi Ray
committed Details | Review
gdata: Implement the vfuncs for inserting a shared photo (6.34 KB, patch)
2016-09-05 18:12 UTC, Debarshi Ray
committed Details | Review

Description Debarshi Ray 2016-09-05 14:42:11 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.)
Comment 1 Philip Withnall 2016-09-05 14:51:05 UTC
> 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))
Comment 2 Debarshi Ray 2016-09-05 15:05:52 UTC
(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.
Comment 3 Debarshi Ray 2016-09-05 18:05:07 UTC
Created attachment 334833 [details] [review]
src: Pass the TrackerSparqlConnection separately to the query vfunc
Comment 4 Debarshi Ray 2016-09-05 18:05:41 UTC
Created attachment 334834 [details] [review]
src: Pass 'previous_resources' separately to the query vfunc
Comment 5 Debarshi Ray 2016-09-05 18:06:15 UTC
Created attachment 334835 [details] [review]
src: Pass 'datasource_urn' separately to the query vfunc
Comment 6 Debarshi Ray 2016-09-05 18:06:56 UTC
Created attachment 334836 [details] [review]
miner: Rename a private function and shuffle the parameters around
Comment 7 Debarshi Ray 2016-09-05 18:07:28 UTC
Created attachment 334837 [details] [review]
dbus: Add InsertSharedContent
Comment 8 Debarshi Ray 2016-09-05 18:08:11 UTC
Created attachment 334838 [details] [review]
miner: Add gom_miner_insert_shared_content_async
Comment 9 Debarshi Ray 2016-09-05 18:09:02 UTC
Created attachment 334839 [details] [review]
application: Handle InsertSharedContent
Comment 10 Debarshi Ray 2016-09-05 18:09:38 UTC
Created attachment 334840 [details] [review]
gdata: Accept a NULL 'previous_resources'
Comment 11 Debarshi Ray 2016-09-05 18:10:34 UTC
Created attachment 334841 [details] [review]
gdata: Accept a NULL 'parent_resource_urn'
Comment 12 Debarshi Ray 2016-09-05 18:11:38 UTC
Created attachment 334842 [details] [review]
gdata: Remove the unused GomAccountMinerJob parameters
Comment 13 Debarshi Ray 2016-09-05 18:12:15 UTC
Created attachment 334843 [details] [review]
gdata: Let account_miner_job_process_photo return the URN
Comment 14 Debarshi Ray 2016-09-05 18:12:45 UTC
Created attachment 334844 [details] [review]
gdata: Implement the vfuncs for inserting a shared photo
Comment 15 Debarshi Ray 2016-09-05 18:21:35 UTC
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.
Comment 16 Debarshi Ray 2016-09-06 05:24:10 UTC
Pushed everything to master. Let me know if something breaks.
Comment 17 Debarshi Ray 2016-09-22 11:22:22 UTC
(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.