GNOME Bugzilla – Bug 771823
Offer a InsertSharedContent variant that accepts a serialized representation of the remote item
Last modified: 2021-06-05 16:35:54 UTC
In bug 770899 we added the InsertSharedContent D-Bus method. It lets an application insert a remote item that was created due to sharing. Unfortunately, it expects an ID that identifies the remote item, and then uses the network to query all the metadata from the server. This is wasteful if the application already has the item as a by-product of the sharing/upload operation. This is the case with the Google share-point in gnome-photos. It will be nice to have a variant of the InsertSharedContent D-Bus method that accepts a rich description of a remote item instead of just an ID. In case of gnome-photos and Google, it will be some XML describing the GDataEntry. The application will serialize the GDataEntry to XML and the miner would de-serialize it. I am thinking of something like this: <method name='InsertSharedContent2'> <arg name='account_id' type='s' direction='in'/> <arg name='shared_text' type='s' direction='in'/> <arg name='shared_text_content_type' type='s' direction='in'/> <arg name='shared_type' type='s' direction='in'/> <arg name='source_urn' type='s' direction='in'/> </method> 'shared_text' is the serialized item, and 'shared_text_content_type' is the serialization format in case we want to change the format between successive versions. Everything else is the same as InsertSharedContent.
Created attachment 345257 [details] [review] dbus: Add InsertSharedContentSerialized
We can hardcode GType used with gdata_parsable_new_from_xml as GDATA_TYPE_PICASAWEB_FILE, as we do currently in the InsertSharedContent code path. However, this is not future proof, so I am thinking that we can do better. With GObject, every class is represented by a GType, which is a numerical data type. We can pass a string repsentation of the GType of the GDataPicasaWebFile using G_OBJECT_TYPE_NAME from gnome-photos as a 'const gchar *'. Then in gnome-online-miners we can use this string to get the right GType. To do that we need the following: (a) In gom_gdata_miner_class_init, we have to create the GTypes for all the possible GTypes that we might need. Right now, it can be simply done as: g_type_ensure (GDATA_TYPE_DOCUMENTS_ENTRY); g_type_ensure (GDATA_TYPE_PICASAWEB_FILE); (b) When you handle the InsertSharedContentSerialized call, you have to use g_type_from_name to convert the string passed by gnome-photos to a GType.
Review of attachment 345257 [details] [review]: Looks nice. Some minor comments: ::: src/gom-dbus.xml @@ +33,3 @@ + <arg name='account_id' type='s' direction='in'/> + <arg name='shared_text' type='s' direction='in'/> + <arg name='shared_text_content_type' type='s' direction='in'/> We'll need to pass another string parameter: <arg name='shared_gtype_name' type='s' direction='in'/> While you are at it, could you please rename shared_text and shared_text_content_type as shared_blob or shared_blob_content_type? The word 'text' makes it sound as it's a user-visible string, whereas it is something that's meant to be parsed programmatically.
Created attachment 345342 [details] [review] dbus: Add InsertSharedContentSerialized
Created attachment 345359 [details] [review] miner: Add gom_miner_insert_shared_content_serialized_async
Created attachment 345360 [details] [review] application: Handle InsertSharedContentSerialized
Created attachment 345361 [details] [review] gdata: Implement the vfuncs for inserting a shared photo with serialized entry
Review of attachment 345361 [details] [review]: This leads to a crash: ::: src/gom-gdata-miner.c @@ +944,3 @@ + + local_error = NULL; + photo_resource_urn = account_miner_job_process_photo (connection, gdata_picasaweb_file_get_contents is still returning NULL. Did you look into libgdata/gdata/services/picasaweb/gdata-picasaweb-file.c to figure out what's wrong?
(In reply to Debarshi Ray from comment #8) > Review of attachment 345361 [details] [review] [review]: > gdata_picasaweb_file_get_contents is still returning NULL. Did you look into > libgdata/gdata/services/picasaweb/gdata-picasaweb-file.c to figure out > what's wrong? maybe something is wrong with parsing/generating xml. I am not able to figure out anything there
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new enhancement request ticket at https://gitlab.gnome.org/GNOME/gnome-online-miners/-/issues/ Thank you for your understanding and your help.