[gnome-photos/wip/rishi/collection: 2/25] application: Don't miss changes to the current child BaseManager
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/collection: 2/25] application: Don't miss changes to the current child BaseManager
- Date: Tue, 16 Jan 2018 21:53:36 +0000 (UTC)
commit 33f307c24640baf748517c0dc607023acfed9079
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Jan 16 19:24:52 2018 +0100
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.
src/photos-application.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index b22e8d5c..c78959c9 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -1623,9 +1623,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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]