[gnome-photos/wip/rishi/collection: 9/33] Support skipping some children while generating the "all" filter
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/collection: 9/33] Support skipping some children while generating the "all" filter
- Date: Sun, 21 Jan 2018 23:48:10 +0000 (UTC)
commit c8b06bc79f84df5a95bef817fe7d7c8d6ab37f1c
Author: Debarshi Ray <debarshir gnome org>
Date: Sun Jan 21 19:37:19 2018 +0100
Support skipping some children while generating the "all" filter
A subsequent commit will add support for GMount-backed sources to
represent attached devices. These sources shouldn't contribute to the
SourceManager's "all" filter. This demands finer control over the
filter generation process.
https://bugzilla.gnome.org/show_bug.cgi?id=751212
src/photos-base-manager.c | 5 ++++-
src/photos-base-manager.h | 5 ++++-
src/photos-search-match-manager.c | 2 +-
src/photos-source-manager.c | 2 +-
4 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/photos-base-manager.c b/src/photos-base-manager.c
index f437681f..2f8f9e39 100644
--- a/src/photos-base-manager.c
+++ b/src/photos-base-manager.c
@@ -596,7 +596,7 @@ photos_base_manager_get_active_object (PhotosBaseManager *self)
gchar *
-photos_base_manager_get_all_filter (PhotosBaseManager *self)
+photos_base_manager_get_all_filter (PhotosBaseManager *self, PhotosBaseManagerGetAllFilterCallback callback)
{
PhotosBaseManagerPrivate *priv;
GHashTableIter iter;
@@ -625,6 +625,9 @@ photos_base_manager_get_all_filter (PhotosBaseManager *self)
if (g_strcmp0 (id, "all") == 0)
continue;
+ if (callback != NULL && !(*callback) (object_data->object))
+ continue;
+
str = photos_filterable_get_filter (PHOTOS_FILTERABLE (object_data->object));
if (g_strcmp0 (str, blank) == 0)
g_free (str);
diff --git a/src/photos-base-manager.h b/src/photos-base-manager.h
index 1a673661..3a4d7814 100644
--- a/src/photos-base-manager.h
+++ b/src/photos-base-manager.h
@@ -54,6 +54,8 @@ struct _PhotosBaseManagerClass
void (*object_removed) (PhotosBaseManager *self, GObject *object);
};
+typedef gboolean (*PhotosBaseManagerGetAllFilterCallback) (GObject *);
+
PhotosBaseManager *photos_base_manager_new (GCompareDataFunc sort_func, gpointer
sort_data);
void photos_base_manager_add_object (PhotosBaseManager *self, GObject *object);
@@ -64,7 +66,8 @@ const gchar *photos_base_manager_get_action_id (PhotosBaseMana
GObject *photos_base_manager_get_active_object (PhotosBaseManager *self);
-gchar *photos_base_manager_get_all_filter (PhotosBaseManager *self);
+gchar *photos_base_manager_get_all_filter (PhotosBaseManager *self,
+ PhotosBaseManagerGetAllFilterCallback
callback);
gchar *photos_base_manager_get_filter (PhotosBaseManager *self, gint flags);
diff --git a/src/photos-search-match-manager.c b/src/photos-search-match-manager.c
index 97b3be3f..5c048ab7 100644
--- a/src/photos-search-match-manager.c
+++ b/src/photos-search-match-manager.c
@@ -89,7 +89,7 @@ photos_search_match_manager_get_filter (PhotosBaseManager *mngr, gint flags)
search_match = PHOTOS_SEARCH_MATCH (photos_base_manager_get_active_object (PHOTOS_BASE_MANAGER
(self)));
id = photos_filterable_get_id (PHOTOS_FILTERABLE (search_match));
if (g_strcmp0 (id, PHOTOS_SEARCH_MATCH_STOCK_ALL) == 0)
- filter = photos_base_manager_get_all_filter (PHOTOS_BASE_MANAGER (self));
+ filter = photos_base_manager_get_all_filter (PHOTOS_BASE_MANAGER (self), NULL);
else
filter = photos_filterable_get_filter (PHOTOS_FILTERABLE (search_match));
diff --git a/src/photos-source-manager.c b/src/photos-source-manager.c
index 9d76b625..14f4fc4d 100644
--- a/src/photos-source-manager.c
+++ b/src/photos-source-manager.c
@@ -78,7 +78,7 @@ photos_source_manager_get_filter (PhotosBaseManager *mngr, gint flags)
id = photos_filterable_get_id (PHOTOS_FILTERABLE (source));
if (g_strcmp0 (id, PHOTOS_SOURCE_STOCK_ALL) == 0)
- filter = photos_base_manager_get_all_filter (mngr);
+ filter = photos_base_manager_get_all_filter (mngr, NULL);
else
filter = photos_filterable_get_filter (PHOTOS_FILTERABLE (source));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]