[gnome-photos/wip/rishi/share-point: 1/16] filterable, source: Add get_builtin



commit c9316ec81cdc3e27fb139aab87c189da52de1a57
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Jul 27 18:42:55 2016 +0200

    filterable, source: Add get_builtin
    
    Better than having to use g_object_get to know whether it is a built-in
    object or not.

 src/photos-filterable.c |   16 ++++++++++++++++
 src/photos-filterable.h |    3 +++
 src/photos-source.c     |    9 +++++++++
 3 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-filterable.c b/src/photos-filterable.c
index b369060..edb5fa3 100644
--- a/src/photos-filterable.c
+++ b/src/photos-filterable.c
@@ -33,9 +33,25 @@
 G_DEFINE_INTERFACE (PhotosFilterable, photos_filterable, G_TYPE_INVALID);
 
 
+static gboolean
+photos_filterable_default_get_builtin (PhotosFilterable *self)
+{
+  return FALSE;
+}
+
+
 static void
 photos_filterable_default_init (PhotosFilterableInterface *iface)
 {
+  iface->get_builtin = photos_filterable_default_get_builtin;
+}
+
+
+gboolean
+photos_filterable_get_builtin (PhotosFilterable *self)
+{
+  g_return_val_if_fail (PHOTOS_IS_FILTERABLE (self), FALSE);
+  return PHOTOS_FILTERABLE_GET_INTERFACE (self)->get_builtin (self);
 }
 
 
diff --git a/src/photos-filterable.h b/src/photos-filterable.h
index 43a4e7d..56dbae2 100644
--- a/src/photos-filterable.h
+++ b/src/photos-filterable.h
@@ -50,6 +50,7 @@ struct _PhotosFilterableInterface
 {
   GTypeInterface parent_iface;
 
+  gboolean (*get_builtin) (PhotosFilterable *self);
   gchar *(*get_filter) (PhotosFilterable *self);
   const gchar *(*get_id) (PhotosFilterable *self);
   gchar *(*get_where) (PhotosFilterable *self);
@@ -57,6 +58,8 @@ struct _PhotosFilterableInterface
 
 GType               photos_filterable_get_type           (void) G_GNUC_CONST;
 
+gboolean            photos_filterable_get_builtin        (PhotosFilterable *self);
+
 gchar              *photos_filterable_get_filter         (PhotosFilterable *iface);
 
 const gchar        *photos_filterable_get_id             (PhotosFilterable *self);
diff --git a/src/photos-source.c b/src/photos-source.c
index 08bd63f..159a1bf 100644
--- a/src/photos-source.c
+++ b/src/photos-source.c
@@ -80,6 +80,14 @@ photos_source_build_filter_resource (PhotosSource *self)
 }
 
 
+static gboolean
+photos_source_get_builtin (PhotosFilterable *iface)
+{
+  PhotosSource *self = PHOTOS_SOURCE (iface);
+  return self->builtin;
+}
+
+
 static gchar *
 photos_source_get_filter (PhotosFilterable *iface)
 {
@@ -259,6 +267,7 @@ photos_source_class_init (PhotosSourceClass *class)
 static void
 photos_filterable_interface_init (PhotosFilterableInterface *iface)
 {
+  iface->get_builtin = photos_source_get_builtin;
   iface->get_filter = photos_source_get_filter;
   iface->get_id = photos_source_get_id;
 }


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