[gnome-photos/wip/rishi/collection: 13/24] Add Filterable::is_search_criterion
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/collection: 13/24] Add Filterable::is_search_criterion
- Date: Wed, 17 Jan 2018 13:33:53 +0000 (UTC)
commit 1c8135fa137a8cc3d3d72eced680abac460a9a16
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, the introduction of GMount-backed PhotosSources demands finer
control. A GMount-backed Source shouldn't be presented through the
Dropdown, while other Sources should be.
This method is meant to address 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 | 12 ++++++++++++
8 files changed, 63 insertions(+)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 7c6197c1..bf72fd05 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -675,6 +675,13 @@ photos_base_item_filterable_get_id (PhotosFilterable *filterable)
}
+static gboolean
+photos_base_item_filterable_is_search_criterion (PhotosFilterable *filterable)
+{
+ return FALSE;
+}
+
+
static void
photos_base_item_icon_updated (PhotosBaseItem *self, GIcon *icon)
{
@@ -3038,6 +3045,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 31a20110..e5c73014 100644
--- a/src/photos-filterable.c
+++ b/src/photos-filterable.c
@@ -77,3 +77,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 992de82e..73974f46 100644
--- a/src/photos-filterable.h
+++ b/src/photos-filterable.h
@@ -40,6 +40,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);
@@ -50,6 +51,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 993e287b..bb677658 100644
--- a/src/photos-search-match.c
+++ b/src/photos-search-match.c
@@ -79,6 +79,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)
{
@@ -188,6 +195,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 3a7b10e1..e65ae9f9 100644
--- a/src/photos-search-type.c
+++ b/src/photos-search-type.c
@@ -79,6 +79,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)
{
@@ -200,6 +207,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 a5ac56bf..73813e4f 100644
--- a/src/photos-share-point-email.c
+++ b/src/photos-share-point-email.c
@@ -81,6 +81,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)
{
@@ -271,6 +278,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 b321ccaf..522085be 100644
--- a/src/photos-share-point-online.c
+++ b/src/photos-share-point-online.c
@@ -85,6 +85,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)
{
@@ -207,6 +214,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 2d9c308c..fa2464e3 100644
--- a/src/photos-source.c
+++ b/src/photos-source.c
@@ -108,6 +108,17 @@ photos_source_get_id (PhotosFilterable *filterable)
}
+static gboolean
+photos_source_is_search_criterion (PhotosFilterable *filterable)
+{
+ PhotosSource *self = PHOTOS_SOURCE (filterable);
+ gboolean ret_val;
+
+ ret_val = self->mount == NULL;
+ return ret_val;
+}
+
+
static void
photos_source_dispose (GObject *object)
{
@@ -322,6 +333,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]