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 760124 - Can't go back from preview
Can't go back from preview
Status: RESOLVED FIXED
Product: gnome-documents
Classification: Core
Component: general
3.18.x
Other All
: Normal normal
: ---
Assigned To: GNOME documents maintainer(s)
GNOME documents maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2016-01-04 16:09 UTC by Alessandro Bono
Modified: 2016-01-08 11:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
windowMode: Go back from preview when launched from search provider (777 bytes, patch)
2016-01-04 16:17 UTC, Alessandro Bono
none Details | Review
windowMode: Go back from preview when launched from search provider (1.20 KB, patch)
2016-01-04 19:32 UTC, Alessandro Bono
none Details | Review
windowMode: Go back from preview when launched from search provider (1.39 KB, patch)
2016-01-04 19:36 UTC, Alessandro Bono
committed Details | Review

Description Alessandro Bono 2016-01-04 16:09:01 UTC
Going back from preview doesn't work if the document was opened from the search provider.
Comment 1 Alessandro Bono 2016-01-04 16:17:34 UTC
Created attachment 318217 [details] [review]
windowMode: Go back from preview when launched from search provider
Comment 2 Cosimo Cecchi 2016-01-04 17:53:50 UTC
Review of attachment 318217 [details] [review]:

Looks good to me, thanks.
Comment 3 Debarshi Ray 2016-01-04 18:07:31 UTC
Review of attachment 318217 [details] [review]:

Thanks for working on this, Alessandro. I see that it regressed in commit cf1a4173a75f

::: src/windowMode.js
@@ +53,3 @@
         for (let i = 0; i < steps; i++) {
             oldMode = this._history.pop();
+            if (oldMode == null)

I would prefer to keep the WindowMode.NONE check. It's nice to assert the invariants because it provides a certain degree of sanity checking and prevents us from shooting ourselves in the foot.

One option would be to split the if condition as:
if (!oldMode)
  return;
// <comment about why we allow this>
if (this._mode == WindowMode.PREVIEW && oldMode == WindowMode.NONE)
  oldMode = WindowMode.OVERVIEW;
if (oldMode == WindowMode.NONE)
  return;

The !oldMode check is basically a sanity check to ensure that we have enough items in our history as the number of steps that have been requested. It might be more readable to move that check out of the for loop towards the top of the function, and just check if this._history.length >= steps.

The other checks could similarly move out of the for loop.
Comment 4 Alessandro Bono 2016-01-04 19:32:42 UTC
Created attachment 318226 [details] [review]
windowMode: Go back from preview when launched from search provider
Comment 5 Alessandro Bono 2016-01-04 19:36:42 UTC
Created attachment 318228 [details] [review]
windowMode: Go back from preview when launched from search provider
Comment 6 Debarshi Ray 2016-01-07 18:12:34 UTC
Review of attachment 318228 [details] [review]:

Looks good to me. Please push to master, gnome-3-18 and gnome-3-16.
Comment 7 Alessandro Bono 2016-01-08 11:07:20 UTC
Attachment 318228 [details] pushed as 2048481 - windowMode: Go back from preview when launched from search provider