File gnome-photos-application-fixes.patch of Package gnome-photos.9281
From b5c57b71a888c1dd531192bf6b5f3b3030c60d93 Mon Sep 17 00:00:00 2001
From: Debarshi Ray <debarshir@gnome.org>
Date: Tue, 16 Jan 2018 19:24:52 +0100
Subject: [PATCH] application: Don't miss changes to the current child BaseManager
ItemManager::items-changed is only emitted if a BaseItem was added or
removed from the union of all the child BaseManagers (ie. the 0th
child). Therefore, due to a mode change, if the current child is
cleared and populated with new items, the addition of new items won't
lead to ItemManager::items-changed if they were already present in one
of the other children. In that case, various GSimpleActions that were
disabled by the clearing of the child BaseManager won't be re-enabled
after the addition of new items.
This is easily observed while searching because entering SEARCH clears
the corresponding BaseManager. eg., if the first 50 items in OVERVIEW
are all LocalItems, and searching for local content would lead to the
same 50 LocalItems to be shown in SEARCH.
---
src/photos-application.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/src/photos-application.c b/src/photos-application.c
index 21b61a8..468dc7c 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -1589,9 +1589,25 @@ photos_application_theme_changed (GtkSettings *settings)
static void
-photos_application_window_mode_changed (PhotosApplication *self)
+photos_application_window_mode_changed (PhotosApplication *self, PhotosWindowMode mode, PhotosWindowMode old_mode)
{
+ PhotosBaseManager *item_mngr_chld;
+
+ g_return_if_fail (mode != PHOTOS_WINDOW_MODE_NONE);
+
+ if (old_mode != PHOTOS_WINDOW_MODE_NONE)
+ {
+ item_mngr_chld = photos_item_manager_get_for_mode (PHOTOS_ITEM_MANAGER (self->state->item_mngr), old_mode);
+ g_signal_handlers_disconnect_by_func (item_mngr_chld, photos_application_items_changed, self);
+ }
+
photos_application_actions_update (self);
+
+ item_mngr_chld = photos_item_manager_get_for_mode (PHOTOS_ITEM_MANAGER (self->state->item_mngr), mode);
+ g_signal_connect_swapped (item_mngr_chld,
+ "items-changed",
+ G_CALLBACK (photos_application_items_changed),
+ self);
}
@@ -2037,10 +2053,6 @@ photos_application_startup (GApplication *application)
gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.zoom-out(-1.0)", zoom_out_accels);
g_signal_connect_swapped (self->state->item_mngr,
- "items-changed",
- G_CALLBACK (photos_application_items_changed),
- self);
- g_signal_connect_swapped (self->state->item_mngr,
"load-finished",
G_CALLBACK (photos_application_load_changed),
self);
--
libgit2 0.26.0
From 0ded49556c4c7ec3b8b78d051b466e4181b90386 Mon Sep 17 00:00:00 2001
From: Debarshi Ray <debarshir@gnome.org>
Date: Thu, 18 Jan 2018 18:07:15 +0100
Subject: [PATCH] application: Avoid CRITICALs when going to EDIT and PREVIEW
There are no child BaseManagers for the EDIT and PREVIEW modes. Hence
it lead to:
CRITICAL **: photos_item_manager_get_for_mode: assertion
'mode != PHOTOS_WINDOW_MODE_PREVIEW' failed
Fallout from d5d28be0e85adaa521c11a0c05ee317c8a3a2a54
---
src/photos-application.c | 43 +++++++++++++++++++++++++++++++++++++------
1 file changed, 37 insertions(+), 6 deletions(-)
diff --git a/src/photos-application.c b/src/photos-application.c
index 468dc7c..8b34971 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -1595,19 +1595,50 @@ photos_application_window_mode_changed (PhotosApplication *self, PhotosWindowMod
g_return_if_fail (mode != PHOTOS_WINDOW_MODE_NONE);
- if (old_mode != PHOTOS_WINDOW_MODE_NONE)
+ switch (old_mode)
{
+ case PHOTOS_WINDOW_MODE_NONE:
+ case PHOTOS_WINDOW_MODE_EDIT:
+ case PHOTOS_WINDOW_MODE_PREVIEW:
+ break;
+
+ case PHOTOS_WINDOW_MODE_COLLECTIONS:
+ case PHOTOS_WINDOW_MODE_FAVORITES:
+ case PHOTOS_WINDOW_MODE_OVERVIEW:
+ case PHOTOS_WINDOW_MODE_SEARCH:
item_mngr_chld = photos_item_manager_get_for_mode (PHOTOS_ITEM_MANAGER (self->state->item_mngr), old_mode);
g_signal_handlers_disconnect_by_func (item_mngr_chld, photos_application_items_changed, self);
+ break;
+
+ default:
+ g_assert_not_reached ();
+ break;
}
photos_application_actions_update (self);
- item_mngr_chld = photos_item_manager_get_for_mode (PHOTOS_ITEM_MANAGER (self->state->item_mngr), mode);
- g_signal_connect_swapped (item_mngr_chld,
- "items-changed",
- G_CALLBACK (photos_application_items_changed),
- self);
+ switch (mode)
+ {
+ case PHOTOS_WINDOW_MODE_COLLECTIONS:
+ case PHOTOS_WINDOW_MODE_FAVORITES:
+ case PHOTOS_WINDOW_MODE_OVERVIEW:
+ case PHOTOS_WINDOW_MODE_SEARCH:
+ item_mngr_chld = photos_item_manager_get_for_mode (PHOTOS_ITEM_MANAGER (self->state->item_mngr), mode);
+ g_signal_connect_swapped (item_mngr_chld,
+ "items-changed",
+ G_CALLBACK (photos_application_items_changed),
+ self);
+ break;
+
+ case PHOTOS_WINDOW_MODE_EDIT:
+ case PHOTOS_WINDOW_MODE_PREVIEW:
+ break;
+
+ case PHOTOS_WINDOW_MODE_NONE:
+ default:
+ g_assert_not_reached ();
+ break;
+ }
}
--
libgit2 0.26.0