Merge lp:~unity-team/unity/browser-stack-fixes into lp:~unity-team/unity/file-browsing

Proposed by Mikkel Kamstrup Erlandsen
Status: Merged
Merge reported by: Mikkel Kamstrup Erlandsen
Merged at revision: not available
Proposed branch: lp:~unity-team/unity/browser-stack-fixes
Merge into: lp:~unity-team/unity/file-browsing
Diff against target: 115 lines (+23/-9)
3 files modified
tests/unit/Makefile.am (+1/-0)
tests/unit/test-unit.vala (+2/-0)
unity/unity-place-browser.vala (+20/-9)
To merge this branch: bzr merge lp:~unity-team/unity/browser-stack-fixes
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+31516@code.launchpad.net

Description of the change

Fixes some the browsing back/forward stacks in libunity used by the place daemons (notable the files place's folder browsing mode) and adds unit tests for said feature

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/unit/Makefile.am'
2--- tests/unit/Makefile.am 2010-07-29 11:48:06 +0000
3+++ tests/unit/Makefile.am 2010-08-02 07:43:51 +0000
4@@ -59,6 +59,7 @@
5 test-places-place.vala \
6 test-places.vala \
7 test-place.vala \
8+ test-place-browser.vala \
9 test-io.vala \
10 test-appinfo-manager.vala \
11 test-unity-pixbuf-cache.vala \
12
13=== modified file 'tests/unit/test-unit.vala'
14--- tests/unit/test-unit.vala 2010-07-15 13:19:02 +0000
15+++ tests/unit/test-unit.vala 2010-08-02 07:43:51 +0000
16@@ -36,6 +36,7 @@
17 PlacesPlaceSuite places_place;
18 PlacesSuite places;
19 PlaceSuite place;
20+ PlaceBrowserSuite place_browser;
21 IOSuite io;
22 AppInfoManagerSuite appinfo_manager;
23
24@@ -59,6 +60,7 @@
25 /* Places tests */
26 places = new PlacesSuite ();
27 place = new PlaceSuite ();
28+ place_browser = new PlaceBrowserSuite ();
29
30 /* IO utility tests */
31 io = new IOSuite ();
32
33=== modified file 'unity/unity-place-browser.vala'
34--- unity/unity-place-browser.vala 2010-07-02 10:17:22 +0000
35+++ unity/unity-place-browser.vala 2010-08-02 07:43:51 +0000
36@@ -122,6 +122,8 @@
37 private BrowserServiceImpl service;
38 private Stack<State<E>> back_stack;
39 private Stack<State<E>> forward_stack;
40+
41+ private State<E> current_state = null;
42
43 public string dbus_path { get; private set; }
44
45@@ -136,8 +138,8 @@
46 forward_stack = new Stack<State<E>> ();
47
48 /* Relay signals from backend service */
49- service.back.connect (on_back);
50- service.forward.connect (on_forward);
51+ service.back.connect (go_back);
52+ service.forward.connect (go_forward);
53
54 update_service_state ();
55 }
56@@ -148,10 +150,15 @@
57 */
58 public void record_state (E state, string comment)
59 {
60+ if (current_state != null)
61+ {
62+ back_stack.push (current_state);
63+ }
64+
65 var s = new State<E>();
66 s.state = state;
67- s.comment = comment;
68- back_stack.push (s);
69+ s.comment = comment;
70+ current_state = s;
71 update_service_state ();
72 }
73
74@@ -159,25 +166,29 @@
75 {
76 back_stack.clear ();
77 forward_stack.clear ();
78+ current_state = null;
79 }
80
81- private void on_back ()
82+ public void go_back ()
83 {
84 var state = back_stack.pop();
85 if (state != null)
86 {
87- forward_stack.push (state);
88+ if (current_state != null)
89+ forward_stack.push (current_state);
90+ current_state = state;
91 update_service_state ();
92 this.back (state.state, state.comment);
93 }
94 }
95
96- private void on_forward ()
97+ public void go_forward ()
98 {
99 var state = forward_stack.pop();
100 if (state != null)
101 {
102- back_stack.push (state);
103+ if (current_state != null)
104+ back_stack.push (current_state);
105 update_service_state ();
106 this.forward (state.state, state.comment);
107 }
108@@ -213,7 +224,7 @@
109 /**
110 * Private shim class to have a propor stack api
111 */
112- private class Stack<E>
113+ public class Stack<E>
114 {
115 private LinkedList<E> list;
116

Subscribers

People subscribed via source and target branches