[gnome-photos/wip/rishi/collection: 5/27] embed, source-manager: Show notifications for mounts present at startup
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/collection: 5/27] embed, source-manager: Show notifications for mounts present at startup
- Date: Mon, 12 Feb 2018 18:01:40 +0000 (UTC)
commit 0e6df5d1921dadf82da0a96f121a13bc3bffee8d
Author: Debarshi Ray <debarshir gnome org>
Date: Fri Jan 12 09:52:21 2018 +0100
embed, source-manager: Show notifications for mounts present at startup
Unlike GoaObject-backed sources, GMount-backed sources can be
synchronously enumerated during start-up. However, this means that
SourceManager::notification-show will be emitted too early for Embed to
catch it.
https://gitlab.gnome.org/GNOME/gnome-photos/issues/29
src/photos-embed.c | 11 +++++++++++
src/photos-source-manager.c | 17 +++++++++++++++++
src/photos-source-manager.h | 2 ++
3 files changed, 30 insertions(+)
---
diff --git a/src/photos-embed.c b/src/photos-embed.c
index 09f5bf50..4cc2c15b 100644
--- a/src/photos-embed.c
+++ b/src/photos-embed.c
@@ -722,6 +722,8 @@ static void
photos_embed_init (PhotosEmbed *self)
{
GApplication *app;
+ GList *l;
+ GList *sources_notified = NULL;
GList *windows;
PhotosSearchbar *searchbar;
PhotosSearchContextState *state;
@@ -826,6 +828,13 @@ photos_embed_init (PhotosEmbed *self)
self,
G_CONNECT_SWAPPED);
+ sources_notified = photos_source_manager_get_notified (PHOTOS_SOURCE_MANAGER (self->src_mngr));
+ for (l = sources_notified; l != NULL; l = l->next)
+ {
+ PhotosSource *source = PHOTOS_SOURCE (l->data);
+ photos_embed_source_manager_notification_show (self, source);
+ }
+
self->srch_mtch_mngr = g_object_ref (state->srch_mtch_mngr);
self->srch_typ_mngr = g_object_ref (state->srch_typ_mngr);
@@ -844,6 +853,8 @@ photos_embed_init (PhotosEmbed *self)
G_CALLBACK (photos_embed_search_changed),
self,
G_CONNECT_SWAPPED);
+
+ g_list_free_full (sources_notified, g_object_unref);
}
diff --git a/src/photos-source-manager.c b/src/photos-source-manager.c
index e24a0409..1bf23b7e 100644
--- a/src/photos-source-manager.c
+++ b/src/photos-source-manager.c
@@ -355,6 +355,23 @@ photos_source_manager_get_for_provider_type (PhotosSourceManager *self, const gc
}
+GList *
+photos_source_manager_get_notified (PhotosSourceManager *self)
+{
+ GHashTableIter iter;
+ GList *sources = NULL;
+ PhotosSource *source;
+
+ g_return_val_if_fail (PHOTOS_IS_SOURCE_MANAGER (self), NULL);
+
+ g_hash_table_iter_init (&iter, self->sources_notified);
+ while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &source))
+ sources = g_list_prepend (sources, g_object_ref (source));
+
+ return sources;
+}
+
+
gboolean
photos_source_manager_has_online_sources (PhotosSourceManager *self)
{
diff --git a/src/photos-source-manager.h b/src/photos-source-manager.h
index 92d38dce..54777074 100644
--- a/src/photos-source-manager.h
+++ b/src/photos-source-manager.h
@@ -35,6 +35,8 @@ PhotosBaseManager *photos_source_manager_new (void);
GList *photos_source_manager_get_for_provider_type (PhotosSourceManager *self,
const gchar *provider_type);
+GList *photos_source_manager_get_notified (PhotosSourceManager *self);
+
gboolean photos_source_manager_has_online_sources (PhotosSourceManager *self);
gboolean photos_source_manager_has_provider_type (PhotosSourceManager *self,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]