[gnome-photos/wip/rishi/collection: 13/17] 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: 13/17] embed, source-manager: Show notifications for mounts present at startup
- Date: Fri, 12 Jan 2018 16:24:35 +0000 (UTC)
commit cff8146136b3f22c67f3931aa8879fb67d8bd33d
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://bugzilla.gnome.org/show_bug.cgi?id=751212
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 216ffb9e..88686015 100644
--- a/src/photos-embed.c
+++ b/src/photos-embed.c
@@ -695,6 +695,8 @@ static void
photos_embed_init (PhotosEmbed *self)
{
GApplication *app;
+ GList *l;
+ GList *sources_notified = NULL;
GList *windows;
PhotosSearchbar *searchbar;
PhotosSearchContextState *state;
@@ -799,6 +801,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_mngr = g_object_ref (state->srch_typ_mngr);
g_signal_connect_object (self->srch_mngr,
"active-changed",
@@ -815,6 +824,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 59f427f9..7a7db9b3 100644
--- a/src/photos-source-manager.c
+++ b/src/photos-source-manager.c
@@ -341,6 +341,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 e55718f6..4a2138f9 100644
--- a/src/photos-source-manager.h
+++ b/src/photos-source-manager.h
@@ -37,6 +37,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]