[gnome-photos/wip/rishi/de-dup: 2/6] base-item: Add a metadata_add_shared virtual method



commit 1e1cb1d8eea57e956c636ce94633259bf5cb505a
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Sep 6 20:45:46 2016 +0200

    base-item: Add a metadata_add_shared virtual method
    
    Once an item has been shared, we want to add some metadata identifying
    the shared copy inside the original. This will let us re-create the
    nie:links and nie:relatedTo properties in Tracker if we ever lose the
    database, or if the user changes computers.
    
    Different BaseItem sub-classes can implement this virtual method to
    have different mechanisms for adding this metadata. For LocalItems, we
    are going to embed it into the XMP metadata. The default implementation
    is a no-op.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=770267

 src/photos-base-item.c |   13 +++++++++++++
 src/photos-base-item.h |    6 ++++++
 2 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 1e9a678..18d9823 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -494,6 +494,18 @@ photos_base_item_default_set_favorite (PhotosBaseItem *self, gboolean favorite)
 }
 
 
+static gboolean
+photos_base_item_default_metadata_add_shared (PhotosBaseItem  *self,
+                                              const gchar     *provider_type,
+                                              const gchar     *account_identity,
+                                              const gchar     *shared_id,
+                                              GCancellable    *cancellable,
+                                              GError         **error)
+{
+  return TRUE;
+}
+
+
 static void
 photos_base_item_default_open (PhotosBaseItem *self, GdkScreen *screen, guint32 timestamp)
 {
@@ -2296,6 +2308,7 @@ photos_base_item_class_init (PhotosBaseItemClass *class)
   object_class->finalize = photos_base_item_finalize;
   object_class->get_property = photos_base_item_get_property;
   object_class->set_property = photos_base_item_set_property;
+  class->metadata_add_shared = photos_base_item_default_metadata_add_shared;
   class->open = photos_base_item_default_open;
   class->set_favorite = photos_base_item_default_set_favorite;
   class->update_type_description = photos_base_item_default_update_type_description;
diff --git a/src/photos-base-item.h b/src/photos-base-item.h
index 69ed550..5366360 100644
--- a/src/photos-base-item.h
+++ b/src/photos-base-item.h
@@ -63,6 +63,12 @@ struct _PhotosBaseItemClass
   gboolean    (*create_thumbnail)           (PhotosBaseItem *self, GCancellable *cancellable, GError 
**error);
   gchar      *(*download)                   (PhotosBaseItem *self, GCancellable *cancellable, GError 
**error);
   GtkWidget  *(*get_source_widget)          (PhotosBaseItem *self);
+  gboolean    (*metadata_add_shared)        (PhotosBaseItem  *self,
+                                             const gchar     *provider_type,
+                                             const gchar     *account_identity,
+                                             const gchar     *shared_id,
+                                             GCancellable    *cancellable,
+                                             GError         **error);
   void        (*open)                       (PhotosBaseItem *self, GdkScreen *screen, guint32 timestamp);
   void        (*set_favorite)               (PhotosBaseItem *self, gboolean favorite);
   void        (*trash)                      (PhotosBaseItem *self);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]