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 680000 - Back button: skip intermediate collections
Back button: skip intermediate collections
Status: RESOLVED FIXED
Product: gnome-documents
Classification: Core
Component: general
0.5.x
Other Linux
: Normal normal
: ---
Assigned To: GNOME documents maintainer(s)
GNOME documents maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2012-07-16 12:40 UTC by Anna Zacchi
Modified: 2012-09-12 21:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
add navigation for inner collections: (1.94 KB, patch)
2012-08-06 21:16 UTC, Anna Zacchi
needs-work Details | Review
fixed problem of skipping some collections (1.04 KB, patch)
2012-08-07 11:41 UTC, Anna Zacchi
needs-work Details | Review
DocumentManager: Use a stack to navigate collections (2.86 KB, patch)
2012-09-12 13:31 UTC, Volker Sobek (weld)
committed Details | Review

Description Anna Zacchi 2012-07-16 12:40:35 UTC
If there is one collection (B) inside another collection (A), when I am in the innermost collection (B), the back button brings back to the main overview window instead of the upper collection (A).
Comment 1 Anna Zacchi 2012-08-06 21:16:36 UTC
Created attachment 220498 [details] [review]
add navigation for inner collections: 

Added a stack to keep track of navigation in inner collections.
Back button goes back to previous collection, instead of going to main view directly.
Comment 2 Anna Zacchi 2012-08-07 11:41:42 UTC
Created attachment 220541 [details] [review]
fixed problem of skipping some collections

fixed problem of skipping some collections while navigating back from other collections.
Comment 3 Cosimo Cecchi 2012-08-08 12:09:46 UTC
Review of attachment 220498 [details] [review]:

::: src/documents.js
@@ +628,3 @@
+    
+    isCollection: function(){
+        return this.collection;

This appears to be useless...you can just use the value of "collection", since it's a public field of Document.

::: src/manager.js
@@ +42,3 @@
         if (title)
             this._title = title;
+        this.stack = new Array(); //keeps track of navigation within collections

I think the BaseManager class is not the best place for this, since the history stack is only useful for documents, (but not for all the other things we use BaseManager for).
I would probably put it into the DocumentsManager object instead.

@@ +70,3 @@
+            this.stack.pop(); //removes the current one
+            item = this.stack.pop(); //get the next one in the stack
+        }

I'd rather explicitly have a method to go back in the history list rather than relying on setting NULL meaning going back.
Comment 4 Cosimo Cecchi 2012-08-08 12:10:24 UTC
Review of attachment 220541 [details] [review]:

Should be squashed with the previous patch, but has the problems mentioned in the previous review.
Comment 5 Volker Sobek (weld) 2012-09-12 13:31:42 UTC
Created attachment 224108 [details] [review]
DocumentManager: Use a stack to navigate collections

This patch only applies on top of the patch I attached to bug #680001.

I don't know If I got it all right. Questions:

+    activatePreviousCollection: function() {
+        Global.collectionManager.setActiveItem(this._collectionPath.pop());
+    },
+
Should this method also call this._clearActiveDocModel();?


Another implementation of activatePreviousCollection() that I thought of was:

activatePreviousCollection: function() {
    this._collectionPath.pop()
    this.setActiveItem(this._collectionPath.pop())
},

where this._collectionPath array would also include the active collection (like in the previous patches). Would this approach be better?
Comment 6 Volker Sobek (weld) 2012-09-12 14:12:31 UTC
(In reply to comment #5)

> Another implementation of activatePreviousCollection() that I thought of was:
> 
> activatePreviousCollection: function() {
>     this._collectionPath.pop()
>     this.setActiveItem(this._collectionPath.pop())
> },

Oh, sorry, it's not that simple, there must be added a check for null to set the active collection to null, since setActiveItem does just return when its argument is null.
Comment 7 Cosimo Cecchi 2012-09-12 21:35:43 UTC
Attachment 224108 [details] pushed as 9420a42 - DocumentManager: Use a stack to navigate collections

Thanks, works great here! I pushed this to git master now. I think calling _clearActiveDocModel() is indeed a good idea, so I modified the patch to do so.
I think this bug can be closed now.