[gnome-photos/wip/rishi/collection: 7/43] Add Filterable::is_search_criterion



commit 2333eeccd81e94888d89782e8261aabb01b8c9bc
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Jan 11 18:42:28 2018 +0100

    Add Filterable::is_search_criterion
    
    Not every instance of a Filterable implementation is supposed to be
    offered as a search criterion through the Dropdown. So far, this
    distinction was simple - all instances of a certain implemention were
    either offered or not, and determined by Dropdown through the
    corresponding BaseManager.
    
    However, a subsequent commit will introduce GMount-backed
    PhotosSources, which shouldn't be presented through the Dropdown,
    while other Sources should be. This method will help with that.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=751212

 src/photos-base-item.c          | 8 ++++++++
 src/photos-filterable.c         | 8 ++++++++
 src/photos-filterable.h         | 3 +++
 src/photos-search-match.c       | 8 ++++++++
 src/photos-search-type.c        | 8 ++++++++
 src/photos-share-point-email.c  | 8 ++++++++
 src/photos-share-point-online.c | 8 ++++++++
 src/photos-source.c             | 8 ++++++++
 8 files changed, 59 insertions(+)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 7711886a..5bab0ab2 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -992,6 +992,13 @@ photos_base_item_filterable_get_id (PhotosFilterable *filterable)
 }
 
 
+static gboolean
+photos_base_item_filterable_is_search_criterion (PhotosFilterable *filterable)
+{
+  return FALSE;
+}
+
+
 static cairo_surface_t *
 photos_base_item_main_box_item_get_icon (GdMainBoxItem *box_item)
 {
@@ -3041,6 +3048,7 @@ static void
 photos_base_item_filterable_iface_init (PhotosFilterableInterface *iface)
 {
   iface->get_id = photos_base_item_filterable_get_id;
+  iface->is_search_criterion = photos_base_item_filterable_is_search_criterion;
 }
 
 
diff --git a/src/photos-filterable.c b/src/photos-filterable.c
index 590bedaf..3bf01c93 100644
--- a/src/photos-filterable.c
+++ b/src/photos-filterable.c
@@ -75,3 +75,11 @@ photos_filterable_get_where (PhotosFilterable *self)
   g_return_val_if_fail (PHOTOS_IS_FILTERABLE (self), NULL);
   return PHOTOS_FILTERABLE_GET_IFACE (self)->get_where (self);
 }
+
+
+gboolean
+photos_filterable_is_search_criterion (PhotosFilterable *self)
+{
+  g_return_val_if_fail (PHOTOS_IS_FILTERABLE (self), FALSE);
+  return PHOTOS_FILTERABLE_GET_IFACE (self)->is_search_criterion (self);
+}
diff --git a/src/photos-filterable.h b/src/photos-filterable.h
index a9ad3780..0bb24f24 100644
--- a/src/photos-filterable.h
+++ b/src/photos-filterable.h
@@ -38,6 +38,7 @@ struct _PhotosFilterableInterface
   gchar *(*get_filter) (PhotosFilterable *self);
   const gchar *(*get_id) (PhotosFilterable *self);
   gchar *(*get_where) (PhotosFilterable *self);
+  gboolean (*is_search_criterion) (PhotosFilterable *self);
 };
 
 gboolean            photos_filterable_get_builtin        (PhotosFilterable *self);
@@ -48,6 +49,8 @@ const gchar        *photos_filterable_get_id             (PhotosFilterable *self
 
 gchar              *photos_filterable_get_where          (PhotosFilterable *self);
 
+gboolean            photos_filterable_is_search_criterion  (PhotosFilterable *self);
+
 G_END_DECLS
 
 #endif /* PHOTOS_FILTERABLE_H */
diff --git a/src/photos-search-match.c b/src/photos-search-match.c
index d96a4f9d..0c4a1a6f 100644
--- a/src/photos-search-match.c
+++ b/src/photos-search-match.c
@@ -77,6 +77,13 @@ photos_search_match_get_id (PhotosFilterable *filterable)
 }
 
 
+static gboolean
+photos_search_match_is_search_criterion (PhotosFilterable *filterable)
+{
+  return TRUE;
+}
+
+
 static void
 photos_search_match_finalize (GObject *object)
 {
@@ -186,6 +193,7 @@ photos_search_match_filterable_iface_init (PhotosFilterableInterface *iface)
 {
   iface->get_filter = photos_search_match_get_filter;
   iface->get_id = photos_search_match_get_id;
+  iface->is_search_criterion = photos_search_match_is_search_criterion;
 }
 
 
diff --git a/src/photos-search-type.c b/src/photos-search-type.c
index 853d1627..5a39df00 100644
--- a/src/photos-search-type.c
+++ b/src/photos-search-type.c
@@ -77,6 +77,13 @@ photos_search_type_get_where (PhotosFilterable *iface)
 }
 
 
+static gboolean
+photos_search_type_is_search_criterion (PhotosFilterable *iface)
+{
+  return TRUE;
+}
+
+
 static void
 photos_search_type_finalize (GObject *object)
 {
@@ -198,6 +205,7 @@ photos_search_type_filterable_iface_init (PhotosFilterableInterface *iface)
   iface->get_filter = photos_search_type_get_filter;
   iface->get_id = photos_search_type_get_id;
   iface->get_where = photos_search_type_get_where;
+  iface->is_search_criterion = photos_search_type_is_search_criterion;
 }
 
 
diff --git a/src/photos-share-point-email.c b/src/photos-share-point-email.c
index 4a82448b..c47a2ab9 100644
--- a/src/photos-share-point-email.c
+++ b/src/photos-share-point-email.c
@@ -79,6 +79,13 @@ photos_share_point_email_get_name (PhotosSharePoint *share_point)
 }
 
 
+static gboolean
+photos_share_point_email_is_search_criterion (PhotosFilterable *filterable)
+{
+  return FALSE;
+}
+
+
 static gboolean
 photos_share_point_email_needs_notification (PhotosSharePoint *share_point)
 {
@@ -273,6 +280,7 @@ static void
 photos_share_point_email_filterable_iface_init (PhotosFilterableInterface *iface)
 {
   iface->get_id = photos_share_point_email_get_id;
+  iface->is_search_criterion = photos_share_point_email_is_search_criterion;
 }
 
 
diff --git a/src/photos-share-point-online.c b/src/photos-share-point-online.c
index 3c393160..3d03866b 100644
--- a/src/photos-share-point-online.c
+++ b/src/photos-share-point-online.c
@@ -83,6 +83,13 @@ photos_share_point_online_get_name (PhotosSharePoint *share_point)
 }
 
 
+static gboolean
+photos_share_point_online_is_search_criterion (PhotosFilterable *filterable)
+{
+  return FALSE;
+}
+
+
 static void
 photos_share_point_online_dispose (GObject *object)
 {
@@ -205,6 +212,7 @@ static void
 photos_share_point_online_filterable_iface_init (PhotosFilterableInterface *iface)
 {
   iface->get_id = photos_share_point_online_get_id;
+  iface->is_search_criterion = photos_share_point_online_is_search_criterion;
 }
 
 
diff --git a/src/photos-source.c b/src/photos-source.c
index 24e0706c..dec7fe08 100644
--- a/src/photos-source.c
+++ b/src/photos-source.c
@@ -107,6 +107,13 @@ photos_source_get_id (PhotosFilterable *filterable)
 }
 
 
+static gboolean
+photos_source_is_search_criterion (PhotosFilterable *filterable)
+{
+  return TRUE;
+}
+
+
 static void
 photos_source_dispose (GObject *object)
 {
@@ -270,6 +277,7 @@ photos_source_filterable_iface_init (PhotosFilterableInterface *iface)
   iface->get_builtin = photos_source_get_builtin;
   iface->get_filter = photos_source_get_filter;
   iface->get_id = photos_source_get_id;
+  iface->is_search_criterion = photos_source_is_search_criterion;
 }
 
 


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