[gnome-photos] base-item: Add a pure virtual method for getting the source name



commit 5513a74f5bb4afb9925f0bbe1091104f9bd5e9fe
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Jul 22 17:42:43 2013 +0200

    base-item: Add a pure virtual method for getting the source name

 src/photos-base-item.c   |    7 +++++++
 src/photos-base-item.h   |    3 +++
 src/photos-flickr-item.c |    9 +++++++++
 src/photos-local-item.c  |    9 +++++++++
 4 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 443295d..d7ebcd8 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -956,6 +956,13 @@ photos_base_item_get_resource_urn (PhotosBaseItem *self)
 
 
 const gchar *
+photos_base_item_get_source_name (PhotosBaseItem *self)
+{
+  return PHOTOS_BASE_ITEM_GET_CLASS (self)->get_source_name(self);
+}
+
+
+const gchar *
 photos_base_item_get_type_description (PhotosBaseItem *self)
 {
   return self->priv->type_description;
diff --git a/src/photos-base-item.h b/src/photos-base-item.h
index 216da96..60fdca6 100644
--- a/src/photos-base-item.h
+++ b/src/photos-base-item.h
@@ -70,6 +70,7 @@ struct _PhotosBaseItemClass
 
   gboolean (*create_thumbnail) (PhotosBaseItem *self, GCancellable *cancellable, GError **error);
   gchar *(*download) (PhotosBaseItem *self, GCancellable *cancellable, GError **error);
+  const gchar *(*get_source_name) (PhotosBaseItem *self);
   void (*set_favorite) (PhotosBaseItem *self, gboolean favorite);
   void (*update_type_description) (PhotosBaseItem *self);
 
@@ -107,6 +108,8 @@ GdkPixbuf          *photos_base_item_get_pristine_icon  (PhotosBaseItem *self);
 
 const gchar        *photos_base_item_get_resource_urn   (PhotosBaseItem *self);
 
+const gchar        *photos_base_item_get_source_name    (PhotosBaseItem *self);
+
 const gchar        *photos_base_item_get_type_description (PhotosBaseItem *self);
 
 const gchar        *photos_base_item_get_uri            (PhotosBaseItem *self);
diff --git a/src/photos-flickr-item.c b/src/photos-flickr-item.c
index a475c78..48c3690 100644
--- a/src/photos-flickr-item.c
+++ b/src/photos-flickr-item.c
@@ -28,6 +28,7 @@
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <gio/gio.h>
 #include <glib.h>
+#include <glib/gi18n.h>
 #include <libgnome-desktop/gnome-desktop-thumbnail.h>
 
 #include "photos-base-item.h"
@@ -97,6 +98,13 @@ photos_flickr_item_download (PhotosBaseItem *item, GCancellable *cancellable, GE
 }
 
 
+static const gchar *
+photos_flickr_item_get_source_name (PhotosBaseItem *item)
+{
+  return _("Flickr");
+}
+
+
 static void
 photos_flickr_item_constructed (GObject *object)
 {
@@ -137,6 +145,7 @@ photos_flickr_item_class_init (PhotosFlickrItemClass *class)
   object_class->constructed= photos_flickr_item_constructed;
   base_item_class->create_thumbnail = photos_flickr_item_create_thumbnail;
   base_item_class->download = photos_flickr_item_download;
+  base_item_class->get_source_name = photos_flickr_item_get_source_name;
 }
 
 
diff --git a/src/photos-local-item.c b/src/photos-local-item.c
index 035313f..d15fe5a 100644
--- a/src/photos-local-item.c
+++ b/src/photos-local-item.c
@@ -27,6 +27,7 @@
 
 #include <gio/gio.h>
 #include <glib.h>
+#include <glib/gi18n.h>
 
 #include "photos-local-item.h"
 #include "photos-utils.h"
@@ -67,6 +68,13 @@ photos_local_item_download (PhotosBaseItem *item, GCancellable *cancellable, GEr
 }
 
 
+static const gchar *
+photos_local_item_get_source_name (PhotosBaseItem *item)
+{
+  return _("Local");
+}
+
+
 static void
 photos_local_item_constructed (GObject *object)
 {
@@ -107,6 +115,7 @@ photos_local_item_class_init (PhotosLocalItemClass *class)
   object_class->constructed= photos_local_item_constructed;
   base_item_class->create_thumbnail = photos_local_item_create_thumbnail;
   base_item_class->download = photos_local_item_download;
+  base_item_class->get_source_name = photos_local_item_get_source_name;
 }
 
 


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