Merge lp:~jeremywootten/pantheon-files/fix-backspace-in-columnv-view into lp:~elementary-apps/pantheon-files/trunk
- fix-backspace-in-columnv-view
- Merge into trunk
Proposed by
Jeremy Wootten
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Approved by: | Cody Garver | ||||||||
Approved revision: | 2031 | ||||||||
Merged at revision: | 2215 | ||||||||
Proposed branch: | lp:~jeremywootten/pantheon-files/fix-backspace-in-columnv-view | ||||||||
Merge into: | lp:~elementary-apps/pantheon-files/trunk | ||||||||
Diff against target: |
456 lines (+152/-52) 9 files modified
libcore/AbstractSlot.vala (+7/-2) src/View/AbstractDirectoryView.vala (+11/-3) src/View/AbstractTreeView.vala (+1/-1) src/View/ColumnView.vala (+5/-2) src/View/IconView.vala (+3/-3) src/View/Miller.vala (+103/-27) src/View/Slot.vala (+15/-8) src/View/ViewContainer.vala (+6/-5) src/View/Window.vala (+1/-1) |
||||||||
To merge this branch: | bzr merge lp:~jeremywootten/pantheon-files/fix-backspace-in-columnv-view | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Zisu Andrei (community) | Approve | ||
Review via email: mp+290832@code.launchpad.net |
Commit message
Fix behaviour of Miller View on pressing BackSpace and history buttons (lp:1074664 lp:1393053)
Description of the change
This branch changes the behaviour of Miller view in response to BackSpace key press and pressing the "Back" button. Instead of always making a new root view, if possible sub-folders are closed until the specified folder is reached.
To post a comment you must log in.
Revision history for this message
Cody Garver (codygarver) wrote : | # |
- 2029. By Jeremy Wootten
-
Merge trunk to r2130
- 2030. By Jeremy Wootten
-
Close slots before destroying their container in Miller View to silence terminal warnings
Revision history for this message
Jeremy Wootten (jeremywootten) wrote : | # |
Merged trunk and fixed subsequently noticed terminal warnings when truncating Miller View.
Revision history for this message
Cody Garver (codygarver) wrote : | # |
Commented some code style issues in the diff
- 2031. By Jeremy Wootten
-
Fix code style
Revision history for this message
Jeremy Wootten (jeremywootten) wrote : | # |
Code style fixed
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'libcore/AbstractSlot.vala' | |||
2 | --- libcore/AbstractSlot.vala 2015-12-30 12:21:30 +0000 | |||
3 | +++ libcore/AbstractSlot.vala 2016-05-02 11:14:36 +0000 | |||
4 | @@ -32,11 +32,15 @@ | |||
5 | 32 | 32 | ||
6 | 33 | protected set {_directory = value;} | 33 | protected set {_directory = value;} |
7 | 34 | } | 34 | } |
8 | 35 | |||
9 | 36 | public GOF.File file { | ||
10 | 37 | get {return directory.file;} | ||
11 | 38 | } | ||
12 | 35 | public GLib.File location { | 39 | public GLib.File location { |
13 | 36 | get {return directory.location;} | 40 | get {return directory.location;} |
14 | 37 | } | 41 | } |
15 | 38 | public string uri { | 42 | public string uri { |
17 | 39 | get { return directory.file.uri;} | 43 | get {return directory.file.uri;} |
18 | 40 | } | 44 | } |
19 | 41 | public bool can_create {get {return directory != null && !directory.is_trash;}} | 45 | public bool can_create {get {return directory != null && !directory.is_trash;}} |
20 | 42 | public virtual bool locked_focus { | 46 | public virtual bool locked_focus { |
21 | @@ -70,7 +74,8 @@ | |||
22 | 70 | public abstract unowned AbstractSlot? get_current_slot (); | 74 | public abstract unowned AbstractSlot? get_current_slot (); |
23 | 71 | public abstract void reload (bool non_local_only = false); | 75 | public abstract void reload (bool non_local_only = false); |
24 | 72 | public abstract void grab_focus (); | 76 | public abstract void grab_focus (); |
26 | 73 | public abstract void user_path_change_request (GLib.File loc, bool allow_mode_change = true); | 77 | public abstract void user_path_change_request (GLib.File loc, bool allow_mode_change, bool make_root); |
27 | 78 | |||
28 | 74 | public abstract void select_first_for_empty_selection (); | 79 | public abstract void select_first_for_empty_selection (); |
29 | 75 | public abstract void select_glib_files (GLib.List<GLib.File> locations, GLib.File? focus_location); | 80 | public abstract void select_glib_files (GLib.List<GLib.File> locations, GLib.File? focus_location); |
30 | 76 | protected abstract void make_view (); | 81 | protected abstract void make_view (); |
31 | 77 | 82 | ||
32 | === modified file 'src/View/AbstractDirectoryView.vala' | |||
33 | --- src/View/AbstractDirectoryView.vala 2016-05-02 07:46:06 +0000 | |||
34 | +++ src/View/AbstractDirectoryView.vala 2016-05-02 11:14:36 +0000 | |||
35 | @@ -374,8 +374,16 @@ | |||
36 | 374 | } | 374 | } |
37 | 375 | 375 | ||
38 | 376 | public void select_first_for_empty_selection () { | 376 | public void select_first_for_empty_selection () { |
41 | 377 | if (selected_files == null) | 377 | if (selected_files == null) { |
42 | 378 | set_cursor (new Gtk.TreePath.from_indices (0), false, true, true); | 378 | Idle.add_full (GLib.Priority.LOW, () => { |
43 | 379 | if (!tree_frozen) { | ||
44 | 380 | set_cursor (new Gtk.TreePath.from_indices (0), false, true, true); | ||
45 | 381 | return false; | ||
46 | 382 | } else { | ||
47 | 383 | return true; | ||
48 | 384 | } | ||
49 | 385 | }); | ||
50 | 386 | } | ||
51 | 379 | } | 387 | } |
52 | 380 | public void select_glib_files (GLib.List<GLib.File> location_list, GLib.File? focus_location) { | 388 | public void select_glib_files (GLib.List<GLib.File> location_list, GLib.File? focus_location) { |
53 | 381 | unselect_all (); | 389 | unselect_all (); |
54 | @@ -553,7 +561,7 @@ | |||
55 | 553 | } | 561 | } |
56 | 554 | } | 562 | } |
57 | 555 | 563 | ||
59 | 556 | protected void select_gof_file (GOF.File file) { | 564 | public void select_gof_file (GOF.File file) { |
60 | 557 | var iter = Gtk.TreeIter (); | 565 | var iter = Gtk.TreeIter (); |
61 | 558 | if (!model.get_first_iter_for_file (file, out iter)) | 566 | if (!model.get_first_iter_for_file (file, out iter)) |
62 | 559 | return; /* file not in model */ | 567 | return; /* file not in model */ |
63 | 560 | 568 | ||
64 | === modified file 'src/View/AbstractTreeView.vala' | |||
65 | --- src/View/AbstractTreeView.vala 2016-04-27 11:49:47 +0000 | |||
66 | +++ src/View/AbstractTreeView.vala 2016-05-02 11:14:36 +0000 | |||
67 | @@ -251,7 +251,7 @@ | |||
68 | 251 | } | 251 | } |
69 | 252 | 252 | ||
70 | 253 | protected override void scroll_to_cell (Gtk.TreePath? path, bool scroll_to_top) { | 253 | protected override void scroll_to_cell (Gtk.TreePath? path, bool scroll_to_top) { |
72 | 254 | if (tree == null || path == null || slot.directory.permission_denied) | 254 | if (tree == null || path == null || slot.directory.permission_denied || slot.directory.is_empty ()) |
73 | 255 | return; | 255 | return; |
74 | 256 | 256 | ||
75 | 257 | tree.scroll_to_cell (path, name_column, scroll_to_top, 0.5f, 0.5f); | 257 | tree.scroll_to_cell (path, name_column, scroll_to_top, 0.5f, 0.5f); |
76 | 258 | 258 | ||
77 | === modified file 'src/View/ColumnView.vala' | |||
78 | --- src/View/ColumnView.vala 2015-08-17 09:30:23 +0000 | |||
79 | +++ src/View/ColumnView.vala 2016-05-02 11:14:36 +0000 | |||
80 | @@ -94,9 +94,12 @@ | |||
81 | 94 | /* Do not emit alert sound on left and right cursor keys in Miller View */ | 94 | /* Do not emit alert sound on left and right cursor keys in Miller View */ |
82 | 95 | case Gdk.Key.Left: | 95 | case Gdk.Key.Left: |
83 | 96 | case Gdk.Key.Right: | 96 | case Gdk.Key.Right: |
85 | 97 | if (no_mods) | 97 | case Gdk.Key.BackSpace: |
86 | 98 | if (no_mods) { | ||
87 | 99 | /* Pass event to MillerView */ | ||
88 | 100 | slot.colpane.key_press_event (event); | ||
89 | 98 | return true; | 101 | return true; |
91 | 99 | 102 | } | |
92 | 100 | break; | 103 | break; |
93 | 101 | 104 | ||
94 | 102 | default: | 105 | default: |
95 | 103 | 106 | ||
96 | === modified file 'src/View/IconView.vala' | |||
97 | --- src/View/IconView.vala 2016-04-30 11:18:13 +0000 | |||
98 | +++ src/View/IconView.vala 2016-05-02 11:14:36 +0000 | |||
99 | @@ -129,7 +129,7 @@ | |||
100 | 129 | } | 129 | } |
101 | 130 | 130 | ||
102 | 131 | public override void unselect_all () { | 131 | public override void unselect_all () { |
104 | 132 | tree.unselect_all (); | 132 | tree.unselect_all (); |
105 | 133 | } | 133 | } |
106 | 134 | 134 | ||
107 | 135 | public override void select_path (Gtk.TreePath? path) { | 135 | public override void select_path (Gtk.TreePath? path) { |
108 | @@ -250,7 +250,7 @@ | |||
109 | 250 | } | 250 | } |
110 | 251 | 251 | ||
111 | 252 | protected override void scroll_to_cell (Gtk.TreePath? path, bool scroll_to_top) { | 252 | protected override void scroll_to_cell (Gtk.TreePath? path, bool scroll_to_top) { |
113 | 253 | if (tree == null || path == null || slot.directory.permission_denied) | 253 | if (tree == null || path == null || slot.directory.permission_denied || slot.directory.is_empty ()) |
114 | 254 | return; | 254 | return; |
115 | 255 | 255 | ||
116 | 256 | tree.scroll_to_path (path, scroll_to_top, 0.5f, 0.5f); | 256 | tree.scroll_to_path (path, scroll_to_top, 0.5f, 0.5f); |
117 | @@ -260,7 +260,7 @@ | |||
118 | 260 | Gtk.CellRenderer renderer, | 260 | Gtk.CellRenderer renderer, |
119 | 261 | bool start_editing, | 261 | bool start_editing, |
120 | 262 | bool scroll_to_top) { | 262 | bool scroll_to_top) { |
122 | 263 | scroll_to_cell(path, scroll_to_top); | 263 | scroll_to_cell (path, scroll_to_top); |
123 | 264 | tree.set_cursor (path, renderer, start_editing); | 264 | tree.set_cursor (path, renderer, start_editing); |
124 | 265 | } | 265 | } |
125 | 266 | 266 | ||
126 | 267 | 267 | ||
127 | === modified file 'src/View/Miller.vala' | |||
128 | --- src/View/Miller.vala 2015-12-30 12:21:30 +0000 | |||
129 | +++ src/View/Miller.vala 2016-05-02 11:14:36 +0000 | |||
130 | @@ -55,8 +55,6 @@ | |||
131 | 55 | content_box.pack_start (scrolled_window); | 55 | content_box.pack_start (scrolled_window); |
132 | 56 | content_box.show_all (); | 56 | content_box.show_all (); |
133 | 57 | 57 | ||
134 | 58 | colpane.add_events (Gdk.EventMask.KEY_RELEASE_MASK); | ||
135 | 59 | colpane.key_release_event.connect (on_key_released); | ||
136 | 60 | make_view (); | 58 | make_view (); |
137 | 61 | } | 59 | } |
138 | 62 | 60 | ||
139 | @@ -98,6 +96,7 @@ | |||
140 | 98 | 96 | ||
141 | 99 | if (host != null) { | 97 | if (host != null) { |
142 | 100 | truncate_list_after_slot (host); | 98 | truncate_list_after_slot (host); |
143 | 99 | host.select_gof_file (slot.file); | ||
144 | 101 | host.colpane.add (hpane1); | 100 | host.colpane.add (hpane1); |
145 | 102 | slot.directory.init (); | 101 | slot.directory.init (); |
146 | 103 | } else | 102 | } else |
147 | @@ -108,11 +107,6 @@ | |||
148 | 108 | if (slot_list.length () <= 0) | 107 | if (slot_list.length () <= 0) |
149 | 109 | return; | 108 | return; |
150 | 110 | 109 | ||
151 | 111 | /* destroy the nested slots */ | ||
152 | 112 | ((Marlin.View.Slot)(slot)).colpane.@foreach ((w) => { | ||
153 | 113 | w.destroy (); | ||
154 | 114 | }); | ||
155 | 115 | |||
156 | 116 | uint n = slot.slot_number; | 110 | uint n = slot.slot_number; |
157 | 117 | 111 | ||
158 | 118 | slot_list.@foreach ((s) => { | 112 | slot_list.@foreach ((s) => { |
159 | @@ -122,6 +116,10 @@ | |||
160 | 122 | } | 116 | } |
161 | 123 | }); | 117 | }); |
162 | 124 | 118 | ||
163 | 119 | ((Marlin.View.Slot)(slot)).colpane.@foreach ((w) => { | ||
164 | 120 | w.destroy (); | ||
165 | 121 | }); | ||
166 | 122 | |||
167 | 125 | slot_list.nth (n).next = null; | 123 | slot_list.nth (n).next = null; |
168 | 126 | calculate_total_width (); | 124 | calculate_total_width (); |
169 | 127 | current_slot = slot; | 125 | current_slot = slot; |
170 | @@ -144,13 +142,79 @@ | |||
171 | 144 | /** Signal handling **/ | 142 | /** Signal handling **/ |
172 | 145 | /*********************/ | 143 | /*********************/ |
173 | 146 | 144 | ||
181 | 147 | public override void user_path_change_request (GLib.File loc, bool allow_mode_change = false) { | 145 | public override void user_path_change_request (GLib.File loc, bool allow_mode_change = false, bool make_root = false) { |
182 | 148 | /* user request always make new root */ | 146 | /* Requests from history buttons, pathbar come here with make_root = false. |
183 | 149 | var slot = slot_list.first().data; | 147 | * These do not create a new root and automatic mode change for icon directories is not allowed. |
184 | 150 | assert (slot != null); | 148 | * Requests from the sidebar have make_root = true |
185 | 151 | truncate_list_after_slot (slot); /* Sets current slot */ | 149 | */ |
186 | 152 | root_location = loc; | 150 | change_path (loc, make_root); |
187 | 153 | slot.user_path_change_request (loc, false); | 151 | } |
188 | 152 | |||
189 | 153 | private void change_path (GLib.File loc, bool make_root) { | ||
190 | 154 | var first_slot = slot_list.first ().data; | ||
191 | 155 | string root_uri = first_slot.uri; | ||
192 | 156 | string target_uri = loc.get_uri (); | ||
193 | 157 | bool found = false; | ||
194 | 158 | |||
195 | 159 | if (!make_root && target_uri.has_prefix (root_uri) && target_uri != root_uri) { | ||
196 | 160 | /* Try to add location relative to each slot in turn, starting at end */ | ||
197 | 161 | var copy_slot_list = slot_list.copy (); | ||
198 | 162 | copy_slot_list.reverse (); | ||
199 | 163 | foreach (Marlin.View.Slot s in copy_slot_list) { | ||
200 | 164 | if (add_relative_path (s, loc)) { | ||
201 | 165 | found = true; | ||
202 | 166 | break; | ||
203 | 167 | } | ||
204 | 168 | } | ||
205 | 169 | } | ||
206 | 170 | |||
207 | 171 | /* If requested location is not a child of any slot, start a new tree */ | ||
208 | 172 | if (!found) { | ||
209 | 173 | truncate_list_after_slot (first_slot); | ||
210 | 174 | if (loc.get_uri () != first_slot.uri) { | ||
211 | 175 | first_slot.user_path_change_request (loc, false, true); | ||
212 | 176 | root_location = loc; | ||
213 | 177 | /* Sidebar requests make_root true - first directory will be selected; | ||
214 | 178 | * Go_up requests make_root false - previous directory will be selected | ||
215 | 179 | */ | ||
216 | 180 | if (make_root) { | ||
217 | 181 | first_slot.select_first_for_empty_selection (); | ||
218 | 182 | } | ||
219 | 183 | } | ||
220 | 184 | } | ||
221 | 185 | } | ||
222 | 186 | |||
223 | 187 | private bool add_relative_path (Marlin.View.Slot root, GLib.File loc) { | ||
224 | 188 | if (root.location.get_uri () == loc.get_uri ()) { | ||
225 | 189 | truncate_list_after_slot (root); | ||
226 | 190 | return true; | ||
227 | 191 | } | ||
228 | 192 | string? relative_path = PF.FileUtils.escape_uri (root.location.get_relative_path (loc), false); | ||
229 | 193 | if (relative_path != null && relative_path.length > 0) { | ||
230 | 194 | truncate_list_after_slot (root); | ||
231 | 195 | string [] dirs = relative_path.split (Path.DIR_SEPARATOR_S); | ||
232 | 196 | string last_uri = root.uri; | ||
233 | 197 | if (last_uri.has_suffix (Path.DIR_SEPARATOR_S)) | ||
234 | 198 | last_uri = last_uri.slice (0, -1); | ||
235 | 199 | |||
236 | 200 | foreach (string d in dirs) { | ||
237 | 201 | if (d.length > 0) { | ||
238 | 202 | last_uri = GLib.Path.build_path (Path.DIR_SEPARATOR_S, last_uri, d); | ||
239 | 203 | |||
240 | 204 | var last_slot = slot_list.last ().data; | ||
241 | 205 | var file = GLib.File.new_for_uri (last_uri); | ||
242 | 206 | var list = new List<File> (); | ||
243 | 207 | list.prepend (file); | ||
244 | 208 | last_slot.select_glib_files (list, file); | ||
245 | 209 | Thread.usleep (100000); | ||
246 | 210 | add_location (file, last_slot); | ||
247 | 211 | |||
248 | 212 | } | ||
249 | 213 | } | ||
250 | 214 | } else { | ||
251 | 215 | return false; | ||
252 | 216 | } | ||
253 | 217 | return true; | ||
254 | 154 | } | 218 | } |
255 | 155 | 219 | ||
256 | 156 | private void connect_slot_signals (Slot slot) { | 220 | private void connect_slot_signals (Slot slot) { |
257 | @@ -160,6 +224,7 @@ | |||
258 | 160 | slot.miller_slot_request.connect (on_miller_slot_request); | 224 | slot.miller_slot_request.connect (on_miller_slot_request); |
259 | 161 | slot.size_change.connect (update_total_width); | 225 | slot.size_change.connect (update_total_width); |
260 | 162 | slot.folder_deleted.connect (on_slot_folder_deleted); | 226 | slot.folder_deleted.connect (on_slot_folder_deleted); |
261 | 227 | slot.colpane.key_press_event.connect (on_key_pressed); | ||
262 | 163 | slot.path_changed.connect (on_slot_path_changed); | 228 | slot.path_changed.connect (on_slot_path_changed); |
263 | 164 | } | 229 | } |
264 | 165 | 230 | ||
265 | @@ -170,14 +235,18 @@ | |||
266 | 170 | slot.miller_slot_request.disconnect (on_miller_slot_request); | 235 | slot.miller_slot_request.disconnect (on_miller_slot_request); |
267 | 171 | slot.size_change.disconnect (update_total_width); | 236 | slot.size_change.disconnect (update_total_width); |
268 | 172 | slot.folder_deleted.disconnect (on_slot_folder_deleted); | 237 | slot.folder_deleted.disconnect (on_slot_folder_deleted); |
269 | 238 | slot.colpane.key_press_event.disconnect (on_key_pressed); | ||
270 | 173 | slot.path_changed.disconnect (on_slot_path_changed); | 239 | slot.path_changed.disconnect (on_slot_path_changed); |
271 | 174 | } | 240 | } |
272 | 175 | 241 | ||
273 | 176 | private void on_miller_slot_request (Marlin.View.Slot slot, GLib.File loc, bool make_root) { | 242 | private void on_miller_slot_request (Marlin.View.Slot slot, GLib.File loc, bool make_root) { |
277 | 177 | if (make_root) | 243 | if (make_root) { |
278 | 178 | user_path_change_request (loc); | 244 | /* Start a new tree with root at loc */ |
279 | 179 | else | 245 | change_path (loc, true); |
280 | 246 | } else { | ||
281 | 247 | /* Just add another column to the end. */ | ||
282 | 180 | add_location (loc, slot); | 248 | add_location (loc, slot); |
283 | 249 | } | ||
284 | 181 | } | 250 | } |
285 | 182 | 251 | ||
286 | 183 | private bool on_slot_horizontal_scroll_event (double delta_x) { | 252 | private bool on_slot_horizontal_scroll_event (double delta_x) { |
287 | @@ -251,7 +320,7 @@ | |||
288 | 251 | } | 320 | } |
289 | 252 | } | 321 | } |
290 | 253 | 322 | ||
292 | 254 | private bool on_key_released (Gtk.Widget box, Gdk.EventKey event) { | 323 | private bool on_key_pressed (Gtk.Widget box, Gdk.EventKey event) { |
293 | 255 | /* Only handle unmodified keys */ | 324 | /* Only handle unmodified keys */ |
294 | 256 | if ((event.state & Gtk.accelerator_get_default_mod_mask ()) > 0) | 325 | if ((event.state & Gtk.accelerator_get_default_mod_mask ()) > 0) |
295 | 257 | return false; | 326 | return false; |
296 | @@ -292,23 +361,30 @@ | |||
297 | 292 | return true; | 361 | return true; |
298 | 293 | } | 362 | } |
299 | 294 | break; | 363 | break; |
300 | 364 | |||
301 | 365 | case Gdk.Key.BackSpace: | ||
302 | 366 | if (current_position > 0) | ||
303 | 367 | truncate_list_after_slot (slot_list.nth_data (current_position - 1)); | ||
304 | 368 | else { | ||
305 | 369 | ctab.go_up (); | ||
306 | 370 | return true; | ||
307 | 371 | } | ||
308 | 372 | break; | ||
309 | 373 | |||
310 | 374 | default: | ||
311 | 375 | break; | ||
312 | 295 | } | 376 | } |
313 | 296 | 377 | ||
314 | 297 | if (to_activate != null) { | 378 | if (to_activate != null) { |
315 | 298 | to_activate.active (); | 379 | to_activate.active (); |
316 | 299 | to_activate.select_first_for_empty_selection (); | 380 | to_activate.select_first_for_empty_selection (); |
320 | 300 | return true; | 381 | } |
321 | 301 | } else | 382 | |
322 | 302 | return false; | 383 | return false; |
323 | 303 | } | 384 | } |
324 | 304 | 385 | ||
325 | 305 | private void on_slot_frozen_changed (Slot slot, bool frozen) { | 386 | private void on_slot_frozen_changed (Slot slot, bool frozen) { |
332 | 306 | /* Ensure all slots synchronise the frozen state and | 387 | /* Ensure all slots synchronise the frozen state */ |
327 | 307 | * suppress key press event processing when frozen */ | ||
328 | 308 | if (frozen) | ||
329 | 309 | this.colpane.key_release_event.disconnect (on_key_released); | ||
330 | 310 | else | ||
331 | 311 | this.colpane.key_release_event.connect (on_key_released); | ||
333 | 312 | 388 | ||
334 | 313 | slot_list.@foreach ((abstract_slot) => { | 389 | slot_list.@foreach ((abstract_slot) => { |
335 | 314 | var s = abstract_slot as Marlin.View.Slot; | 390 | var s = abstract_slot as Marlin.View.Slot; |
336 | 315 | 391 | ||
337 | === modified file 'src/View/Slot.vala' | |||
338 | --- src/View/Slot.vala 2016-04-19 10:32:22 +0000 | |||
339 | +++ src/View/Slot.vala 2016-05-02 11:14:36 +0000 | |||
340 | @@ -186,25 +186,27 @@ | |||
341 | 186 | directory.track_longest_name = true; | 186 | directory.track_longest_name = true; |
342 | 187 | } | 187 | } |
343 | 188 | 188 | ||
344 | 189 | /* This delay in passing on the path change request is necessary to prevent occasional crashes | ||
345 | 190 | * due to undiagnosed bug. | ||
346 | 191 | */ | ||
347 | 189 | private void schedule_path_change_request (GLib.File loc, int flag, bool make_root) { | 192 | private void schedule_path_change_request (GLib.File loc, int flag, bool make_root) { |
348 | 190 | if (path_change_timeout_id > 0) { | 193 | if (path_change_timeout_id > 0) { |
349 | 191 | warning ("Path change request received too rapidly"); | 194 | warning ("Path change request received too rapidly"); |
350 | 192 | return; | 195 | return; |
351 | 193 | } | 196 | } |
352 | 194 | path_change_timeout_id = GLib.Timeout.add (20, () => { | 197 | path_change_timeout_id = GLib.Timeout.add (20, () => { |
354 | 195 | on_path_change_request (loc, flag, make_root); | 198 | on_dir_view_path_change_request (loc, flag, make_root); |
355 | 196 | path_change_timeout_id = 0; | 199 | path_change_timeout_id = 0; |
356 | 197 | return false; | 200 | return false; |
357 | 198 | }); | 201 | }); |
358 | 199 | } | 202 | } |
359 | 200 | 203 | ||
361 | 201 | private void on_path_change_request (GLib.File loc, int flag, bool make_root) { | 204 | private void on_dir_view_path_change_request (GLib.File loc, int flag, bool make_root) { |
362 | 202 | if (flag == 0) { /* make view in existing container */ | 205 | if (flag == 0) { /* make view in existing container */ |
368 | 203 | if (dir_view is FM.ColumnView) { | 206 | if (mode == Marlin.ViewMode.MILLER_COLUMNS) |
369 | 204 | miller_slot_request (loc, make_root); | 207 | miller_slot_request (loc, make_root); /* signal to parent MillerView */ |
370 | 205 | } else { | 208 | else |
371 | 206 | user_path_change_request (loc); | 209 | user_path_change_request (loc, false, make_root); /* Handle ourselves */ |
367 | 207 | } | ||
372 | 208 | } else | 210 | } else |
373 | 209 | ctab.new_container_request (loc, flag); | 211 | ctab.new_container_request (loc, flag); |
374 | 210 | } | 212 | } |
375 | @@ -251,8 +253,8 @@ | |||
376 | 251 | has_autosized = true; | 253 | has_autosized = true; |
377 | 252 | } | 254 | } |
378 | 253 | 255 | ||
379 | 256 | public override void user_path_change_request (GLib.File loc, bool allow_mode_change = true, bool make_root = true) { | ||
380 | 254 | /** Only this function must be used to change or reload the path **/ | 257 | /** Only this function must be used to change or reload the path **/ |
381 | 255 | public override void user_path_change_request (GLib.File loc, bool allow_mode_change = true) { | ||
382 | 256 | assert (loc != null); | 258 | assert (loc != null); |
383 | 257 | var old_dir = directory; | 259 | var old_dir = directory; |
384 | 258 | set_up_directory (loc); | 260 | set_up_directory (loc); |
385 | @@ -325,6 +327,11 @@ | |||
386 | 325 | dir_view.select_glib_files (files, focus_location); | 327 | dir_view.select_glib_files (files, focus_location); |
387 | 326 | } | 328 | } |
388 | 327 | 329 | ||
389 | 330 | public void select_gof_file (GOF.File gof) { | ||
390 | 331 | if (dir_view != null) | ||
391 | 332 | dir_view.select_gof_file (gof); | ||
392 | 333 | } | ||
393 | 334 | |||
394 | 328 | public override void select_first_for_empty_selection () { | 335 | public override void select_first_for_empty_selection () { |
395 | 329 | if (dir_view != null) | 336 | if (dir_view != null) |
396 | 330 | dir_view.select_first_for_empty_selection (); | 337 | dir_view.select_first_for_empty_selection (); |
397 | 331 | 338 | ||
398 | === modified file 'src/View/ViewContainer.vala' | |||
399 | --- src/View/ViewContainer.vala 2016-04-24 17:37:30 +0000 | |||
400 | +++ src/View/ViewContainer.vala 2016-05-02 11:14:36 +0000 | |||
401 | @@ -148,9 +148,10 @@ | |||
402 | 148 | var parent_path = PF.FileUtils.get_parent_path_from_path (location.get_uri ()); | 148 | var parent_path = PF.FileUtils.get_parent_path_from_path (location.get_uri ()); |
403 | 149 | parent = PF.FileUtils.get_file_for_path (parent_path); | 149 | parent = PF.FileUtils.get_file_for_path (parent_path); |
404 | 150 | } | 150 | } |
405 | 151 | |||
406 | 151 | /* Certain parents such as ftp:// will be returned as null as they are not browsable */ | 152 | /* Certain parents such as ftp:// will be returned as null as they are not browsable */ |
407 | 152 | if (parent != null) { | 153 | if (parent != null) { |
409 | 153 | user_path_change_request (parent); | 154 | user_path_change_request (parent, false, false); |
410 | 154 | } | 155 | } |
411 | 155 | } | 156 | } |
412 | 156 | 157 | ||
413 | @@ -159,7 +160,7 @@ | |||
414 | 159 | 160 | ||
415 | 160 | if (loc != null) { | 161 | if (loc != null) { |
416 | 161 | selected_locations.append (this.location); | 162 | selected_locations.append (this.location); |
418 | 162 | user_path_change_request (File.new_for_commandline_arg (loc)); | 163 | user_path_change_request (File.new_for_commandline_arg (loc), false, false); |
419 | 163 | } | 164 | } |
420 | 164 | } | 165 | } |
421 | 165 | 166 | ||
422 | @@ -167,7 +168,7 @@ | |||
423 | 167 | string? loc = browser.go_forward (n); | 168 | string? loc = browser.go_forward (n); |
424 | 168 | 169 | ||
425 | 169 | if (loc != null) | 170 | if (loc != null) |
427 | 170 | user_path_change_request (File.new_for_commandline_arg (loc)); | 171 | user_path_change_request (File.new_for_commandline_arg (loc), false, false); |
428 | 171 | } | 172 | } |
429 | 172 | 173 | ||
430 | 173 | public void add_view (Marlin.ViewMode mode, GLib.File loc) { | 174 | public void add_view (Marlin.ViewMode mode, GLib.File loc) { |
431 | @@ -232,11 +233,11 @@ | |||
432 | 232 | refresh_slot_info (slot.location); | 233 | refresh_slot_info (slot.location); |
433 | 233 | } | 234 | } |
434 | 234 | 235 | ||
436 | 235 | private void user_path_change_request (GLib.File loc) { | 236 | public void user_path_change_request (GLib.File loc, bool allow_mode_change = true, bool make_root = true) { |
437 | 236 | /* Ony call directly if it is known that a change of folder is required | 237 | /* Ony call directly if it is known that a change of folder is required |
438 | 237 | * otherwise call focus_location. | 238 | * otherwise call focus_location. |
439 | 238 | */ | 239 | */ |
441 | 239 | view.user_path_change_request (loc); | 240 | view.user_path_change_request (loc, allow_mode_change, make_root); |
442 | 240 | } | 241 | } |
443 | 241 | 242 | ||
444 | 242 | public void new_container_request (GLib.File loc, int flag = 1) { | 243 | public void new_container_request (GLib.File loc, int flag = 1) { |
445 | 243 | 244 | ||
446 | === modified file 'src/View/Window.vala' | |||
447 | --- src/View/Window.vala 2016-04-30 11:18:13 +0000 | |||
448 | +++ src/View/Window.vala 2016-05-02 11:14:36 +0000 | |||
449 | @@ -1001,7 +1001,7 @@ | |||
450 | 1001 | mwcols.add_location (gfile, mwcols.current_slot); | 1001 | mwcols.add_location (gfile, mwcols.current_slot); |
451 | 1002 | } | 1002 | } |
452 | 1003 | } else { | 1003 | } else { |
454 | 1004 | warning ("Invalid tip uri for Miller View"); | 1004 | warning ("Invalid tip uri for Miller View %s", unescaped_tip_uri); |
455 | 1005 | } | 1005 | } |
456 | 1006 | } | 1006 | } |
457 | 1007 | 1007 |
Conflicts with trunk