After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 786936 - Have a separate PhotosWindowMode for viewing the contents of collections
Have a separate PhotosWindowMode for viewing the contents of collections
Status: RESOLVED FIXED
Product: gnome-photos
Classification: Applications
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: GNOME photos maintainer(s)
GNOME photos maintainer(s)
: 787099 (view as bug list)
Depends on:
Blocks: 771038
 
 
Reported: 2017-08-28 18:53 UTC by Debarshi Ray
Modified: 2018-02-14 22:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
searchbar: Use the more appropriate GAction API (2.94 KB, patch)
2017-08-28 18:55 UTC, Debarshi Ray
committed Details | Review
embed: Remove redundant code (1.50 KB, patch)
2017-08-28 18:55 UTC, Debarshi Ray
committed Details | Review
embed, overview-searchbar: Simplify code (1.79 KB, patch)
2017-08-28 18:56 UTC, Debarshi Ray
committed Details | Review
embed: Simplify code (3.00 KB, patch)
2017-08-28 18:56 UTC, Debarshi Ray
committed Details | Review
embed: Untangle the notify::visible-child & window-mode-changed logic (3.70 KB, patch)
2017-08-28 18:56 UTC, Debarshi Ray
committed Details | Review
Simplify Searchbar handling and don't show it on key presses in PREVIEW (7.24 KB, patch)
2017-08-28 18:57 UTC, Debarshi Ray
none Details | Review
embed: Don't keep the searchbar active merely because it has the focus (1.94 KB, patch)
2017-08-28 18:57 UTC, Debarshi Ray
committed Details | Review
Consolidate code to update MainToolbar on ItemManager::items-changed (7.97 KB, patch)
2017-08-28 18:57 UTC, Debarshi Ray
none Details | Review
Add a new mode for viewing the contents of a collection (60.74 KB, patch)
2017-08-28 18:57 UTC, Debarshi Ray
none Details | Review
Simplify Searchbar handling and don't show it on key presses in PREVIEW (8.50 KB, patch)
2017-08-30 18:27 UTC, Debarshi Ray
none Details | Review
Simplify Searchbar handling and don't show it on key presses in PREVIEW (8.83 KB, patch)
2017-08-30 18:34 UTC, Debarshi Ray
committed Details | Review
Consolidate code to update MainToolbar on ItemManager::items-changed (8.55 KB, patch)
2017-09-02 22:26 UTC, Debarshi Ray
none Details | Review
Consolidate code to update MainToolbar on ItemManager::items-changed (8.73 KB, patch)
2017-09-04 13:20 UTC, Debarshi Ray
committed Details | Review
Listen to ItemManager::active-collection-changed only when needed (2.60 KB, patch)
2017-09-12 12:07 UTC, Debarshi Ray
committed Details | Review
main-toolbar: Remove redundant cod (3.71 KB, patch)
2017-09-12 12:08 UTC, Debarshi Ray
committed Details | Review
Add a new mode for viewing the contents of a collection (59.14 KB, patch)
2017-09-12 12:09 UTC, Debarshi Ray
committed Details | Review
item-manager: Remove pre-COLLECTION_VIEW workaround (1003 bytes, patch)
2018-01-21 11:25 UTC, Debarshi Ray
committed Details | Review
view-container: Unbreak progressive loading of collection contents (1.19 KB, patch)
2018-02-14 22:22 UTC, Debarshi Ray
committed Details | Review

Description Debarshi Ray 2017-08-28 18:53:09 UTC
Showing the contents of a collection doesn't use the usual WindowMode transitions via ModeController::window-mode-changed, etc.. It is special-cased as "sub-modes" of the COLLECTIONS and SEARCH modes. This makes it harder to ensure the correctness of the internal state machine, and makes it harder to fix things like bug 771038.

Let's regularize this by introducing a separate WindowMode.

It will also make our lives easier when implementing support for importing from a removable device because the contents of the device are to be presented as a collection. We'll have to treat the device as a special collection, so let's not have two layers of special-casing.
Comment 1 Debarshi Ray 2017-08-28 18:55:33 UTC
Created attachment 358614 [details] [review]
searchbar: Use the more appropriate GAction API
Comment 2 Debarshi Ray 2017-08-28 18:55:50 UTC
Created attachment 358615 [details] [review]
embed: Remove redundant code
Comment 3 Debarshi Ray 2017-08-28 18:56:09 UTC
Created attachment 358616 [details] [review]
embed, overview-searchbar: Simplify code
Comment 4 Debarshi Ray 2017-08-28 18:56:24 UTC
Created attachment 358617 [details] [review]
embed: Simplify code
Comment 5 Debarshi Ray 2017-08-28 18:56:40 UTC
Created attachment 358618 [details] [review]
embed: Untangle the notify::visible-child & window-mode-changed logic
Comment 6 Debarshi Ray 2017-08-28 18:57:04 UTC
Created attachment 358619 [details] [review]
Simplify Searchbar handling and don't show it on key presses in PREVIEW
Comment 7 Debarshi Ray 2017-08-28 18:57:27 UTC
Created attachment 358620 [details] [review]
embed: Don't keep the searchbar active merely because it has the focus
Comment 8 Debarshi Ray 2017-08-28 18:57:41 UTC
Created attachment 358621 [details] [review]
Consolidate code to update MainToolbar on ItemManager::items-changed
Comment 9 Debarshi Ray 2017-08-28 18:57:56 UTC
Created attachment 358622 [details] [review]
Add a new mode for viewing the contents of a collection
Comment 10 Alessandro Bono 2017-08-30 16:12:42 UTC
Review of attachment 358614 [details] [review]:

ok
Comment 11 Alessandro Bono 2017-08-30 16:13:02 UTC
Review of attachment 358615 [details] [review]:

ok
Comment 12 Alessandro Bono 2017-08-30 16:13:16 UTC
Review of attachment 358616 [details] [review]:

ok
Comment 13 Alessandro Bono 2017-08-30 16:16:32 UTC
Review of attachment 358617 [details] [review]:

ok
Comment 14 Alessandro Bono 2017-08-30 16:16:56 UTC
Review of attachment 358618 [details] [review]:

ok
Comment 15 Alessandro Bono 2017-08-30 16:19:46 UTC
Review of attachment 358619 [details] [review]:

::: src/photos-main-toolbar.c
@@ +651,2 @@
   self->searchbar = g_object_ref_sink (photos_overview_searchbar_new ());
+  gtk_container_add (GTK_CONTAINER (self), self->searchbar);

Since the searchbar now is always present, is it possible to move it in photos-main-toolbar.ui?
Comment 16 Alessandro Bono 2017-08-30 16:20:13 UTC
Review of attachment 358620 [details] [review]:

ok
Comment 17 Alessandro Bono 2017-08-30 16:20:42 UTC
Review of attachment 358621 [details] [review]:

ok
Comment 18 Debarshi Ray 2017-08-30 17:57:42 UTC
Thanks for the reviews!
Comment 19 Debarshi Ray 2017-08-30 18:27:20 UTC
Created attachment 358787 [details] [review]
Simplify Searchbar handling and don't show it on key presses in PREVIEW

Use the XML template to add the OverviewSearchbar.
Comment 20 Debarshi Ray 2017-08-30 18:34:52 UTC
Created attachment 358788 [details] [review]
Simplify Searchbar handling and don't show it on key presses in PREVIEW
Comment 21 Debarshi Ray 2017-08-31 21:12:57 UTC
*** Bug 787099 has been marked as a duplicate of this bug. ***
Comment 22 Umang Jain 2017-08-31 22:29:59 UTC
Review of attachment 358621 [details] [review]:

::: src/photos-application.c
@@ +2018,3 @@
+                            "items-changed",
+                            G_CALLBACK (photos_application_items_changed),
+                            self);

One of the case I hit upon is of photos_base_item_trash here (refer criticals below). Deleting(which is hiding initially) the item will emit "item-changed" signal and subsequently will lead to the 'for' loop in photos_application_items_changed (photos-application.c:408)

photos_item_manager_hide_item will remove the item from the base manager and in the 'for' loop, we try to get_object_by_id the item (which now is absent in the base manager), hence giving the criticals.

--
(gnome-photos:23926): gnome-photos-CRITICAL **: photos_base_item_can_trash: assertion 'PHOTOS_IS_BASE_ITEM (self)' failed

(gnome-photos:23926): gnome-photos-CRITICAL **: photos_base_item_get_default_app_name: assertion 'PHOTOS_IS_BASE_ITEM (self)' failed

Getting a few criticals while trying out wip/rishi/collection branch

Steps to reproduce:

1) Select an image by right-click
2) Click "Trash" icon in the bar present below.

Criticals triggered.
Comment 23 Debarshi Ray 2017-09-02 22:26:56 UTC
Created attachment 359007 [details] [review]
Consolidate code to update MainToolbar on ItemManager::items-changed

Avoid the CRITICALs by adding a NULL-check.
Comment 24 Debarshi Ray 2017-09-04 13:20:34 UTC
Created attachment 359076 [details] [review]
Consolidate code to update MainToolbar on ItemManager::items-changed

Added a comment to explain the NULL check.
Comment 25 Debarshi Ray 2017-09-12 12:07:47 UTC
Created attachment 359616 [details] [review]
Listen to ItemManager::active-collection-changed only when needed

This splits out some hunks from attachment 358622 [details] [review].
Comment 26 Debarshi Ray 2017-09-12 12:08:28 UTC
Created attachment 359617 [details] [review]
main-toolbar: Remove redundant cod

Some more splitting.
Comment 27 Debarshi Ray 2017-09-12 12:09:07 UTC
Created attachment 359618 [details] [review]
Add a new mode for viewing the contents of a collection
Comment 28 Debarshi Ray 2017-09-12 12:11:53 UTC
Comment on attachment 359616 [details] [review]
Listen to ItemManager::active-collection-changed only when needed

I self-reviewed these once more, and couldn't spot any bugs. Of course, I could be wrong. However, we are at the start of a new development cycle, so it is better to push these sooner than later. That way we will get some extra testing in the wild.
Comment 29 Debarshi Ray 2018-01-21 11:25:51 UTC
Created attachment 367167 [details] [review]
item-manager: Remove pre-COLLECTION_VIEW workaround

Found another workaround from the time when collections and their contents shared the same view and mode.
Comment 30 Umang Jain 2018-01-21 21:21:12 UTC
Review of attachment 367167 [details] [review]:

++
Comment 31 Debarshi Ray 2018-02-14 22:22:39 UTC
Created attachment 368362 [details] [review]
view-container: Unbreak progressive loading of collection contents