Merge lp:~jeremywootten/pantheon-files/reload-icon-in-pathbar into lp:~elementary-apps/pantheon-files/trunk
- reload-icon-in-pathbar
- Merge into trunk
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Approved by: | Cody Garver | ||||||||
Approved revision: | 1689 | ||||||||
Merged at revision: | 1730 | ||||||||
Proposed branch: | lp:~jeremywootten/pantheon-files/reload-icon-in-pathbar | ||||||||
Merge into: | lp:~elementary-apps/pantheon-files/trunk | ||||||||
Diff against target: |
532 lines (+148/-80) 6 files modified
libcore/gof-directory-async.vala (+32/-15) libcore/tests/marlincore-tests-file.c (+3/-3) libwidgets/LocationBar.vala (+88/-41) src/View/LocationBar.vala (+12/-13) src/View/ViewContainer.vala (+5/-1) src/View/Window.vala (+8/-7) |
||||||||
To merge this branch: | bzr merge lp:~jeremywootten/pantheon-files/reload-icon-in-pathbar | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Danielle Foré | Approve | ||
PerfectCarl (community) | Needs Fixing | ||
Cody Garver (community) | Needs Fixing | ||
Review via email: mp+246055@code.launchpad.net |
Commit message
Add a refresh icon to the pathbar
Description of the change
This branch places a refresh icon at the right hand end of the pathbar while in browsing mode. Clicking on the icon refreshes the current view.
To test:
FOR FUNCTION
1) Click on the refresh icon (either button) at the right-hand end of the pathbar. The current view refreshes (reloads). In Miller view, the active slot refreshes.
2) Hover over the icon - a tooltip appears (review wording).
3) Enter edit mode - the icon changes to the Navigate to icon.
4) Enter search mode - the icon disappears
FOR POSSIBLE REGRESSIONS
1) All pathbar functions work as normal.
2) All other ways of refreshing the view work as normal
3) Nothing bad happens if the icon is clicked when the view is not displaying a normal accessible folder.
Cody Garver (codygarver) wrote : | # |
Cody Garver (codygarver) wrote : | # |
UX Team confirms that the icon should be "view-refresh-
And the tooltip should be "Reload this folder"
- 1683. By Jeremy Wootten
-
Use 'view-refresh-
symblic' icon and amend tooltip to 'Reload this folder' - 1684. By Jeremy Wootten
-
Correct spelling mistake
Jeremy Wootten (jeremywootten) wrote : | # |
The icon is now "view-refresh-
Danielle Foré (danrabbit) wrote : | # |
Okay so if you do this:
this.set_
Instead of this:
secondary_
It doesn't get that weird screwed up hover effect
- 1685. By Jeremy Wootten
-
Do not use pixbufs for secondary icon, fix disappearing tooltip on secondary icon
Jeremy Wootten (jeremywootten) wrote : | # |
Thanks Dan, I have implemented your fix for both secondary icons and removed unused code. Also fixed a bug I noticed where the tooltip on the secondary icon did not appear if you first hovered over the blank part of the pathbar. It appears calling set_tooltip_text ("") has the effect of turning off ALL the tooltips. Not sure if this is expected or a Gtk.Entry bug.
Danielle Foré (danrabbit) wrote : | # |
* We shouldn't offer reload while the directory is currently reloading.
* There is a minor regression where the "go" arrow shows immediately instead of only after you've made a change to the path
- 1686. By Jeremy Wootten
-
Fix enter key press, hide reload icon if path unchanged, fix keyboard reload while in edit mode, fix regression in completion
- 1687. By Jeremy Wootten
-
Fix error message re atk_object, remove unneeded entry icon code
PerfectCarl (name-is-carl) wrote : | # |
Is this branch related/touching code pertaining to https:/
Also there is MERGE strings in the code: bzr merge failed it seems.
Please add a comment when hiding inherited methods (instead of overriding) as it is unusual and could be viewed as an error.
- 1688. By Jeremy Wootten
-
Merge trunk to rev 1723
- 1689. By Jeremy Wootten
-
Avoid hiding Gtk.Widget.
key_press_ event
Jeremy Wootten (jeremywootten) wrote : | # |
1) Trunk merged and conflict resolved
2) Code refactored to avoid hiding Gtk Widget method.
Danielle Foré (danrabbit) : | # |
Preview Diff
1 | === modified file 'libcore/gof-directory-async.vala' | |||
2 | --- libcore/gof-directory-async.vala 2014-12-26 12:01:20 +0000 | |||
3 | +++ libcore/gof-directory-async.vala 2015-01-26 10:59:47 +0000 | |||
4 | @@ -129,7 +129,16 @@ | |||
5 | 129 | state = State.NOT_LOADED; | 129 | state = State.NOT_LOADED; |
6 | 130 | } | 130 | } |
7 | 131 | 131 | ||
9 | 132 | public void load () { | 132 | public delegate void GOFFileLoadedFunc (GOF.File file); |
10 | 133 | |||
11 | 134 | /** Views call the following function with null parameter - file_loaded and done_loading | ||
12 | 135 | * signals are emitted and cause the view and view container to update. | ||
13 | 136 | * | ||
14 | 137 | * LocationBar calls this function, with a callback, on its own Async instances in order | ||
15 | 138 | * to perform filename completion.- Emitting a done_loaded signal in that case would cause | ||
16 | 139 | * the premature ending of text entry. | ||
17 | 140 | **/ | ||
18 | 141 | public void load (GOFFileLoadedFunc? file_loaded_func = null) { | ||
19 | 133 | cancellable.reset (); | 142 | cancellable.reset (); |
20 | 134 | longest_file_name = ""; | 143 | longest_file_name = ""; |
21 | 135 | 144 | ||
22 | @@ -141,15 +150,17 @@ | |||
23 | 141 | if (state == State.LOADING) | 150 | if (state == State.LOADING) |
24 | 142 | clear_directory_info (); | 151 | clear_directory_info (); |
25 | 143 | 152 | ||
27 | 144 | list_directory.begin (); | 153 | list_directory.begin (file_loaded_func); |
28 | 145 | 154 | ||
36 | 146 | try { | 155 | if (file_loaded_func == null) { |
37 | 147 | monitor = location.monitor_directory (0); | 156 | try { |
38 | 148 | monitor.rate_limit = 100; | 157 | monitor = location.monitor_directory (0); |
39 | 149 | monitor.changed.connect (directory_changed); | 158 | monitor.rate_limit = 100; |
40 | 150 | } catch (IOError e) { | 159 | monitor.changed.connect (directory_changed); |
41 | 151 | if (!(e is IOError.NOT_MOUNTED)) { | 160 | } catch (IOError e) { |
42 | 152 | warning ("directory monitor failed: %s %s", e.message, file.uri); | 161 | if (!(e is IOError.NOT_MOUNTED)) { |
43 | 162 | warning ("directory monitor failed: %s %s", e.message, file.uri); | ||
44 | 163 | } | ||
45 | 153 | } | 164 | } |
46 | 154 | } | 165 | } |
47 | 155 | } else { | 166 | } else { |
48 | @@ -164,12 +175,15 @@ | |||
49 | 164 | if (track_longest_name) | 175 | if (track_longest_name) |
50 | 165 | update_longest_file_name (gof); | 176 | update_longest_file_name (gof); |
51 | 166 | 177 | ||
53 | 167 | file_loaded (gof); | 178 | if (file_loaded_func == null) |
54 | 179 | file_loaded (gof); | ||
55 | 180 | else | ||
56 | 181 | file_loaded_func (gof); | ||
57 | 168 | } | 182 | } |
58 | 169 | } | 183 | } |
59 | 170 | } | 184 | } |
60 | 171 | 185 | ||
62 | 172 | if (!cancellable.is_cancelled ()) | 186 | if (file_loaded_func == null && !cancellable.is_cancelled ()) |
63 | 173 | done_loading (); | 187 | done_loading (); |
64 | 174 | } | 188 | } |
65 | 175 | } | 189 | } |
66 | @@ -234,7 +248,7 @@ | |||
67 | 234 | yield query_info_async (file, file_info_available); | 248 | yield query_info_async (file, file_info_available); |
68 | 235 | } | 249 | } |
69 | 236 | 250 | ||
71 | 237 | private async void list_directory () { | 251 | private async void list_directory (GOFFileLoadedFunc? file_loaded_func = null) { |
72 | 238 | file.exists = true; | 252 | file.exists = true; |
73 | 239 | files_count = 0; | 253 | files_count = 0; |
74 | 240 | state = State.LOADING; | 254 | state = State.LOADING; |
75 | @@ -267,12 +281,16 @@ | |||
76 | 267 | if (track_longest_name) | 281 | if (track_longest_name) |
77 | 268 | update_longest_file_name (gof); | 282 | update_longest_file_name (gof); |
78 | 269 | 283 | ||
80 | 270 | file_loaded (gof); | 284 | if (file_loaded_func == null) |
81 | 285 | file_loaded (gof); | ||
82 | 286 | else | ||
83 | 287 | file_loaded_func (gof); | ||
84 | 271 | } | 288 | } |
85 | 272 | 289 | ||
86 | 273 | files_count++; | 290 | files_count++; |
87 | 274 | } | 291 | } |
88 | 275 | } | 292 | } |
89 | 293 | |||
90 | 276 | if (state == State.LOADING) { | 294 | if (state == State.LOADING) { |
91 | 277 | file.exists = true; | 295 | file.exists = true; |
92 | 278 | state = State.LOADED; | 296 | state = State.LOADED; |
93 | @@ -293,8 +311,7 @@ | |||
94 | 293 | else if (err is IOError.NOT_MOUNTED) | 311 | else if (err is IOError.NOT_MOUNTED) |
95 | 294 | file.is_mounted = false; | 312 | file.is_mounted = false; |
96 | 295 | } | 313 | } |
99 | 296 | 314 | if (file_loaded_func == null && !cancellable.is_cancelled ()) | |
98 | 297 | if (!cancellable.is_cancelled ()) | ||
100 | 298 | done_loading (); | 315 | done_loading (); |
101 | 299 | } | 316 | } |
102 | 300 | 317 | ||
103 | 301 | 318 | ||
104 | === modified file 'libcore/tests/marlincore-tests-file.c' | |||
105 | --- libcore/tests/marlincore-tests-file.c 2014-08-05 22:40:12 +0000 | |||
106 | +++ libcore/tests/marlincore-tests-file.c 2015-01-26 10:59:47 +0000 | |||
107 | @@ -89,7 +89,7 @@ | |||
108 | 89 | GOFDirectoryAsync *dir2; | 89 | GOFDirectoryAsync *dir2; |
109 | 90 | dir2 = gof_directory_async_from_file(dir->file); | 90 | dir2 = gof_directory_async_from_file(dir->file); |
110 | 91 | g_signal_connect(dir2, "done_loading", (GCallback) second_load_done, NULL); | 91 | g_signal_connect(dir2, "done_loading", (GCallback) second_load_done, NULL); |
112 | 92 | gof_directory_async_load(dir2); | 92 | gof_directory_async_load(dir2, NULL, NULL); |
113 | 93 | 93 | ||
114 | 94 | /* free previously allocated dir */ | 94 | /* free previously allocated dir */ |
115 | 95 | g_object_unref (dir); | 95 | g_object_unref (dir); |
116 | @@ -107,11 +107,11 @@ | |||
117 | 107 | 107 | ||
118 | 108 | dir = gof_directory_async_from_gfile(g_file_new_for_path("/tmp/marlin-test")); | 108 | dir = gof_directory_async_from_gfile(g_file_new_for_path("/tmp/marlin-test")); |
119 | 109 | g_signal_connect(dir, "done_loading", (GCallback) first_load_done, NULL); | 109 | g_signal_connect(dir, "done_loading", (GCallback) first_load_done, NULL); |
121 | 110 | gof_directory_async_load(dir); | 110 | gof_directory_async_load(dir, NULL, NULL); |
122 | 111 | 111 | ||
123 | 112 | /*dir2 = gof_directory_async_from_gfile(g_file_new_for_path("/tmp/marlin-test")); | 112 | /*dir2 = gof_directory_async_from_gfile(g_file_new_for_path("/tmp/marlin-test")); |
124 | 113 | g_signal_connect(dir2, "done_loading", (GCallback) second_load_done, NULL); | 113 | g_signal_connect(dir2, "done_loading", (GCallback) second_load_done, NULL); |
126 | 114 | gof_directory_async_load(dir2);*/ | 114 | gof_directory_async_load(dir2, NULL, NULL);*/ |
127 | 115 | 115 | ||
128 | 116 | //GOFFile *f1 = gof_file_get (g_file_new_for_path("/tmp/marlin-test/a")); | 116 | //GOFFile *f1 = gof_file_get (g_file_new_for_path("/tmp/marlin-test/a")); |
129 | 117 | 117 | ||
130 | 118 | 118 | ||
131 | === modified file 'libwidgets/LocationBar.vala' | |||
132 | --- libwidgets/LocationBar.vala 2014-11-21 10:02:45 +0000 | |||
133 | +++ libwidgets/LocationBar.vala 2015-01-26 10:59:47 +0000 | |||
134 | @@ -57,7 +57,11 @@ | |||
135 | 57 | 57 | ||
136 | 58 | _search_mode = value; | 58 | _search_mode = value; |
137 | 59 | 59 | ||
139 | 60 | primary_icon_name = _search_mode ? "edit-find-symbolic" : null; | 60 | if (_search_mode) { |
140 | 61 | primary_icon_name = "edit-find-symbolic"; | ||
141 | 62 | show_refresh_icon (false); | ||
142 | 63 | } else | ||
143 | 64 | primary_icon_name = null; | ||
144 | 61 | 65 | ||
145 | 62 | grab_focus (); | 66 | grab_focus (); |
146 | 63 | } | 67 | } |
147 | @@ -66,10 +70,8 @@ | |||
148 | 66 | protected string text_completion = ""; | 70 | protected string text_completion = ""; |
149 | 67 | protected bool multiple_completions = false; | 71 | protected bool multiple_completions = false; |
150 | 68 | protected bool text_changed = false; | 72 | protected bool text_changed = false; |
151 | 69 | protected bool arrow_hovered = false; | ||
152 | 70 | protected bool ignore_focus_in = false; | 73 | protected bool ignore_focus_in = false; |
153 | 71 | protected bool ignore_change = false; | 74 | protected bool ignore_change = false; |
154 | 72 | private Gdk.Pixbuf arrow_img; | ||
155 | 73 | 75 | ||
156 | 74 | /* if we must display the BreadcrumbsElement which are in newbreads. */ | 76 | /* if we must display the BreadcrumbsElement which are in newbreads. */ |
157 | 75 | bool view_old = false; | 77 | bool view_old = false; |
158 | @@ -97,10 +99,12 @@ | |||
159 | 97 | public signal void path_changed (File file); | 99 | public signal void path_changed (File file); |
160 | 98 | public signal void need_completion (); | 100 | public signal void need_completion (); |
161 | 99 | public signal void search_changed (string text); | 101 | public signal void search_changed (string text); |
162 | 102 | public signal void reload (); | ||
163 | 100 | 103 | ||
164 | 101 | List<IconDirectory?> icons; | 104 | List<IconDirectory?> icons; |
165 | 102 | 105 | ||
166 | 103 | string current_path = ""; | 106 | string current_path = ""; |
167 | 107 | string refresh_tip = _("Reload this folder"); | ||
168 | 104 | 108 | ||
169 | 105 | int selected = -1; | 109 | int selected = -1; |
170 | 106 | int space_breads = 12; | 110 | int space_breads = 12; |
171 | @@ -123,13 +127,6 @@ | |||
172 | 123 | construct { | 127 | construct { |
173 | 124 | icon_factory = Granite.Services.IconFactory.get_default (); | 128 | icon_factory = Granite.Services.IconFactory.get_default (); |
174 | 125 | icons = new List<IconDirectory?> (); | 129 | icons = new List<IconDirectory?> (); |
175 | 126 | |||
176 | 127 | /* Load arrow image */ | ||
177 | 128 | try { | ||
178 | 129 | arrow_img = Gtk.IconTheme.get_default ().load_icon ("go-jump-symbolic", 16, Gtk.IconLookupFlags.GENERIC_FALLBACK); | ||
179 | 130 | } catch (Error err) { | ||
180 | 131 | stderr.printf ("Unable to load home icon: %s", err.message); | ||
181 | 132 | } | ||
182 | 133 | 130 | ||
183 | 134 | button_context = get_style_context (); | 131 | button_context = get_style_context (); |
184 | 135 | button_context.add_class ("button"); | 132 | button_context.add_class ("button"); |
185 | @@ -155,8 +152,10 @@ | |||
186 | 155 | secondary_icon_sensitive = true; | 152 | secondary_icon_sensitive = true; |
187 | 156 | truncate_multiline = true; | 153 | truncate_multiline = true; |
188 | 157 | activate.connect (on_activate); | 154 | activate.connect (on_activate); |
191 | 158 | icon_press.connect (on_activate); | 155 | button_press_event.connect (on_button_press_event); |
192 | 159 | motion_notify_event.connect (on_motion_notify); | 156 | button_release_event.connect (on_button_release_event); |
193 | 157 | icon_press.connect (on_icon_press); | ||
194 | 158 | motion_notify_event.connect_after (after_motion_notify); | ||
195 | 160 | focus_in_event.connect (on_focus_in); | 159 | focus_in_event.connect (on_focus_in); |
196 | 161 | focus_out_event.connect (on_focus_out); | 160 | focus_out_event.connect (on_focus_out); |
197 | 162 | grab_focus.connect_after (on_grab_focus); | 161 | grab_focus.connect_after (on_grab_focus); |
198 | @@ -170,8 +169,8 @@ | |||
199 | 170 | drag_data_received.connect (on_drag_data_received); | 169 | drag_data_received.connect (on_drag_data_received); |
200 | 171 | drag_drop.connect (on_drag_drop); | 170 | drag_drop.connect (on_drag_drop); |
201 | 172 | } | 171 | } |
204 | 173 | 172 | ||
205 | 174 | public override bool key_press_event (Gdk.EventKey event) { | 173 | public bool on_key_press_event (Gdk.EventKey event) { |
206 | 175 | switch (event.keyval) { | 174 | switch (event.keyval) { |
207 | 176 | case Gdk.Key.KP_Tab: | 175 | case Gdk.Key.KP_Tab: |
208 | 177 | case Gdk.Key.Tab: | 176 | case Gdk.Key.Tab: |
209 | @@ -195,7 +194,12 @@ | |||
210 | 195 | return base.key_press_event (event); | 194 | return base.key_press_event (event); |
211 | 196 | } | 195 | } |
212 | 197 | 196 | ||
214 | 198 | public override bool button_press_event (Gdk.EventButton event) { | 197 | public bool on_button_press_event (Gdk.EventButton event) { |
215 | 198 | /* We need to distinguish whether the event comes from one of the icons. | ||
216 | 199 | * There doesn't seem to be a way of doing this directly so we check the window width */ | ||
217 | 200 | if (event.window.get_width () < 24) | ||
218 | 201 | return false; | ||
219 | 202 | |||
220 | 199 | if (is_focus) | 203 | if (is_focus) |
221 | 200 | return base.button_press_event (event); | 204 | return base.button_press_event (event); |
222 | 201 | 205 | ||
223 | @@ -233,7 +237,12 @@ | |||
224 | 233 | return true; | 237 | return true; |
225 | 234 | } | 238 | } |
226 | 235 | 239 | ||
228 | 236 | public override bool button_release_event (Gdk.EventButton event) { | 240 | public bool on_button_release_event (Gdk.EventButton event) { |
229 | 241 | /* We need to distinguish whether the event comes from one of the icons. | ||
230 | 242 | * There doesn't seem to be a way of doing this directly so we check the window width */ | ||
231 | 243 | if (event.window.get_width () < 24) | ||
232 | 244 | return false; | ||
233 | 245 | |||
234 | 237 | reset_elements_states (); | 246 | reset_elements_states (); |
235 | 238 | 247 | ||
236 | 239 | if (timeout != -1) { | 248 | if (timeout != -1) { |
237 | @@ -244,6 +253,7 @@ | |||
238 | 244 | if (is_focus) | 253 | if (is_focus) |
239 | 245 | return base.button_release_event (event); | 254 | return base.button_release_event (event); |
240 | 246 | 255 | ||
241 | 256 | |||
242 | 247 | if (event.button == 1) { | 257 | if (event.button == 1) { |
243 | 248 | var el = get_element_from_coordinates ((int) event.x, (int) event.y); | 258 | var el = get_element_from_coordinates ((int) event.x, (int) event.y); |
244 | 249 | if (el != null) { | 259 | if (el != null) { |
245 | @@ -256,7 +266,16 @@ | |||
246 | 256 | 266 | ||
247 | 257 | return base.button_release_event (event); | 267 | return base.button_release_event (event); |
248 | 258 | } | 268 | } |
250 | 259 | 269 | ||
251 | 270 | public void on_icon_press (Gtk.EntryIconPosition pos, Gdk.Event event) { | ||
252 | 271 | if (pos == Gtk.EntryIconPosition.SECONDARY) { | ||
253 | 272 | if (is_focus) | ||
254 | 273 | on_activate (); | ||
255 | 274 | else | ||
256 | 275 | reload (); | ||
257 | 276 | } | ||
258 | 277 | } | ||
259 | 278 | |||
260 | 260 | void on_change () { | 279 | void on_change () { |
261 | 261 | if (search_mode) { | 280 | if (search_mode) { |
262 | 262 | search_changed (text); | 281 | search_changed (text); |
263 | @@ -268,19 +287,24 @@ | |||
264 | 268 | return; | 287 | return; |
265 | 269 | } | 288 | } |
266 | 270 | 289 | ||
268 | 271 | set_entry_icon (true, (text.length > 0) ? "Navigate to: " + text : ""); | 290 | show_navigate_icon (); |
269 | 272 | text_completion = ""; | 291 | text_completion = ""; |
270 | 273 | need_completion (); | 292 | need_completion (); |
271 | 274 | } | 293 | } |
272 | 275 | 294 | ||
274 | 276 | bool on_motion_notify (Gdk.EventMotion event) { | 295 | bool after_motion_notify (Gdk.EventMotion event) { |
275 | 296 | |||
276 | 297 | if (is_focus) | ||
277 | 298 | return false; | ||
278 | 299 | |||
279 | 277 | int x = (int) event.x; | 300 | int x = (int) event.x; |
280 | 278 | double x_render = 0; | 301 | double x_render = 0; |
281 | 279 | double x_previous = -10; | 302 | double x_previous = -10; |
282 | 280 | set_tooltip_text (""); | 303 | set_tooltip_text (""); |
286 | 281 | 304 | /* We must reset the icon tooltip as the above line turns all tooltips off */ | |
287 | 282 | if (is_focus) | 305 | set_icon_tooltip_text (Gtk.EntryIconPosition.SECONDARY, refresh_tip); |
288 | 283 | return base.motion_notify_event (event); | 306 | |
289 | 307 | |||
290 | 284 | 308 | ||
291 | 285 | foreach (BreadcrumbsElement element in elements) { | 309 | foreach (BreadcrumbsElement element in elements) { |
292 | 286 | if (element.display) { | 310 | if (element.display) { |
293 | @@ -299,22 +323,25 @@ | |||
294 | 299 | set_entry_cursor (new Gdk.Cursor (Gdk.CursorType.ARROW)); | 323 | set_entry_cursor (new Gdk.Cursor (Gdk.CursorType.ARROW)); |
295 | 300 | else | 324 | else |
296 | 301 | set_entry_cursor (null); | 325 | set_entry_cursor (null); |
299 | 302 | 326 | ||
300 | 303 | return base.motion_notify_event (event); | 327 | return false; |
301 | 304 | } | 328 | } |
302 | 305 | 329 | ||
303 | 306 | bool on_focus_out (Gdk.EventFocus event) { | 330 | bool on_focus_out (Gdk.EventFocus event) { |
305 | 307 | if (is_focus) { | 331 | if (is_focus) |
306 | 308 | ignore_focus_in = true; | 332 | ignore_focus_in = true; |
308 | 309 | return base.focus_out_event (event); | 333 | else { |
309 | 334 | reset (); | ||
310 | 335 | show_refresh_icon (true); | ||
311 | 310 | } | 336 | } |
313 | 311 | 337 | ||
314 | 338 | return base.focus_out_event (event); | ||
315 | 339 | } | ||
316 | 340 | |||
317 | 341 | void reset () { | ||
318 | 312 | ignore_focus_in = false; | 342 | ignore_focus_in = false; |
319 | 313 | set_entry_icon (false); | ||
320 | 314 | set_entry_text (""); | 343 | set_entry_text (""); |
321 | 315 | search_mode = false; | 344 | search_mode = false; |
322 | 316 | |||
323 | 317 | return base.focus_out_event (event); | ||
324 | 318 | } | 345 | } |
325 | 319 | 346 | ||
326 | 320 | bool on_focus_in (Gdk.EventFocus event) { | 347 | bool on_focus_in (Gdk.EventFocus event) { |
327 | @@ -323,10 +350,11 @@ | |||
328 | 323 | 350 | ||
329 | 324 | if (search_mode) | 351 | if (search_mode) |
330 | 325 | set_entry_text (""); | 352 | set_entry_text (""); |
335 | 326 | else | 353 | else { |
336 | 327 | set_entry_text (sanitise_path (GLib.Uri.unescape_string (get_elements_path ()))); | 354 | current_path = sanitise_path (GLib.Uri.unescape_string (get_elements_path ())); |
337 | 328 | 355 | set_entry_text (current_path); | |
338 | 329 | 356 | show_navigate_icon (); | |
339 | 357 | } | ||
340 | 330 | return base.focus_in_event (event); | 358 | return base.focus_in_event (event); |
341 | 331 | } | 359 | } |
342 | 332 | 360 | ||
343 | @@ -343,10 +371,25 @@ | |||
344 | 343 | } | 371 | } |
345 | 344 | 372 | ||
346 | 345 | void on_activate () { | 373 | void on_activate () { |
348 | 346 | path_changed (get_file_for_path (text + text_completion)); | 374 | string path = text + text_completion; |
349 | 375 | path_changed (get_file_for_path (path)); | ||
350 | 347 | text_completion = ""; | 376 | text_completion = ""; |
351 | 348 | } | 377 | } |
352 | 349 | 378 | ||
353 | 379 | public void show_refresh_icon (bool show = true) { | ||
354 | 380 | /* Cancel any editing or search if refresh icon is to be shown */ | ||
355 | 381 | if (show) { | ||
356 | 382 | reset (); | ||
357 | 383 | escape (); | ||
358 | 384 | } | ||
359 | 385 | |||
360 | 386 | set_entry_secondary_icon (false, show); | ||
361 | 387 | } | ||
362 | 388 | |||
363 | 389 | public void show_navigate_icon (bool show = true) { | ||
364 | 390 | set_entry_secondary_icon (true, show && text != current_path); | ||
365 | 391 | } | ||
366 | 392 | |||
367 | 350 | protected abstract void on_drag_leave (Gdk.DragContext drag_context, uint time); | 393 | protected abstract void on_drag_leave (Gdk.DragContext drag_context, uint time); |
368 | 351 | 394 | ||
369 | 352 | protected abstract void on_drag_data_received (Gdk.DragContext context, | 395 | protected abstract void on_drag_data_received (Gdk.DragContext context, |
370 | @@ -406,12 +449,16 @@ | |||
371 | 406 | get_window ().get_children ().nth_data (13).set_cursor (cursor ?? new Gdk.Cursor (Gdk.CursorType.XTERM)); | 449 | get_window ().get_children ().nth_data (13).set_cursor (cursor ?? new Gdk.Cursor (Gdk.CursorType.XTERM)); |
372 | 407 | } | 450 | } |
373 | 408 | 451 | ||
376 | 409 | public void set_entry_icon (bool active, string? tooltip = null) { | 452 | public void set_entry_secondary_icon (bool active, bool visible) { |
377 | 410 | if (!active) | 453 | if (!visible) |
378 | 411 | secondary_icon_pixbuf = null; | 454 | secondary_icon_pixbuf = null; |
382 | 412 | else { | 455 | else if (!active) { |
383 | 413 | secondary_icon_pixbuf = arrow_img; | 456 | set_icon_from_icon_name (Gtk.EntryIconPosition.SECONDARY, "view-refresh-symbolic"); |
384 | 414 | secondary_icon_tooltip_text = tooltip; | 457 | set_icon_tooltip_text (Gtk.EntryIconPosition.SECONDARY, refresh_tip); |
385 | 458 | } else { | ||
386 | 459 | set_icon_from_icon_name (Gtk.EntryIconPosition.SECONDARY, "go-jump-symbolic"); | ||
387 | 460 | var tooltip = (text.length > 0) ? (_("Navigate to %s")).printf (text) : ""; | ||
388 | 461 | set_icon_tooltip_text (Gtk.EntryIconPosition.SECONDARY, tooltip); | ||
389 | 415 | } | 462 | } |
390 | 416 | } | 463 | } |
391 | 417 | 464 | ||
392 | @@ -809,7 +856,7 @@ | |||
393 | 809 | Pango.cairo_show_layout (cr, layout); | 856 | Pango.cairo_show_layout (cr, layout); |
394 | 810 | } | 857 | } |
395 | 811 | } | 858 | } |
397 | 812 | 859 | ||
398 | 813 | return true; | 860 | return true; |
399 | 814 | } | 861 | } |
400 | 815 | 862 | ||
401 | 816 | 863 | ||
402 | === modified file 'src/View/LocationBar.vala' | |||
403 | --- src/View/LocationBar.vala 2014-12-01 12:20:37 +0000 | |||
404 | +++ src/View/LocationBar.vala 2015-01-26 10:59:47 +0000 | |||
405 | @@ -62,8 +62,12 @@ | |||
406 | 62 | this.win = win; | 62 | this.win = win; |
407 | 63 | bread = new Breadcrumbs (win); | 63 | bread = new Breadcrumbs (win); |
408 | 64 | bread.escape.connect (() => { escape(); }); | 64 | bread.escape.connect (() => { escape(); }); |
409 | 65 | |||
410 | 66 | bread.path_changed.connect (on_path_changed); | 65 | bread.path_changed.connect (on_path_changed); |
411 | 66 | |||
412 | 67 | bread.reload.connect (() => { | ||
413 | 68 | win.win_actions.activate_action ("refresh", null); | ||
414 | 69 | }); | ||
415 | 70 | |||
416 | 67 | bread.activate_alternate.connect ((file) => { activate_alternate(file); }); | 71 | bread.activate_alternate.connect ((file) => { activate_alternate(file); }); |
417 | 68 | bread.notify["search-mode"].connect (() => { | 72 | bread.notify["search-mode"].connect (() => { |
418 | 69 | if (!bread.search_mode) { | 73 | if (!bread.search_mode) { |
419 | @@ -78,6 +82,7 @@ | |||
420 | 78 | margin_bottom = 4; | 82 | margin_bottom = 4; |
421 | 79 | margin_left = 3; | 83 | margin_left = 3; |
422 | 80 | 84 | ||
423 | 85 | bread.set_entry_secondary_icon (false, true); | ||
424 | 81 | pack_start (bread, true, true, 0); | 86 | pack_start (bread, true, true, 0); |
425 | 82 | } | 87 | } |
426 | 83 | 88 | ||
427 | @@ -331,17 +336,10 @@ | |||
428 | 331 | file = file.get_parent (); | 336 | file = file.get_parent (); |
429 | 332 | else | 337 | else |
430 | 333 | return; | 338 | return; |
431 | 334 | |||
432 | 335 | var directory = file; | ||
433 | 336 | var files_cache = files; | ||
434 | 337 | 339 | ||
436 | 338 | files = GOF.Directory.Async.from_gfile (directory); | 340 | files = GOF.Directory.Async.from_gfile (file); |
437 | 339 | if (files.file.exists) { | 341 | if (files.file.exists) { |
443 | 340 | /* Verify that we got a new instance of files so we do not double up events */ | 342 | files.load (on_file_loaded); |
439 | 341 | if (files_cache != files) | ||
440 | 342 | files.file_loaded.connect (on_file_loaded); | ||
441 | 343 | |||
442 | 344 | files.load (); | ||
444 | 345 | } | 343 | } |
445 | 346 | } | 344 | } |
446 | 347 | 345 | ||
447 | @@ -406,7 +404,6 @@ | |||
448 | 406 | menu_open_with.set_submenu (submenu_open_with); | 404 | menu_open_with.set_submenu (submenu_open_with); |
449 | 407 | menu.append (new Gtk.SeparatorMenuItem ()); | 405 | menu.append (new Gtk.SeparatorMenuItem ()); |
450 | 408 | 406 | ||
451 | 409 | |||
452 | 410 | unowned List<GOF.File>? sorted_dirs = files_menu.get_sorted_dirs (); | 407 | unowned List<GOF.File>? sorted_dirs = files_menu.get_sorted_dirs (); |
453 | 411 | foreach (var gof in sorted_dirs) { | 408 | foreach (var gof in sorted_dirs) { |
454 | 412 | var menuitem = new Gtk.MenuItem.with_label(gof.get_display_name ()); | 409 | var menuitem = new Gtk.MenuItem.with_label(gof.get_display_name ()); |
455 | @@ -418,6 +415,9 @@ | |||
456 | 418 | }); | 415 | }); |
457 | 419 | } | 416 | } |
458 | 420 | menu.show_all (); | 417 | menu.show_all (); |
459 | 418 | /* Release the Async directory as soon as possible */ | ||
460 | 419 | files_menu.done_loading.disconnect (on_files_loaded_menu); | ||
461 | 420 | files_menu = null; | ||
462 | 421 | } | 421 | } |
463 | 422 | 422 | ||
464 | 423 | private void launch_uri_with_app (AppInfo app, string uri) { | 423 | private void launch_uri_with_app (AppInfo app, string uri) { |
465 | @@ -437,9 +437,8 @@ | |||
466 | 437 | menu = new Gtk.Menu (); | 437 | menu = new Gtk.Menu (); |
467 | 438 | menu.cancel.connect (() => { reset_elements_states (); }); | 438 | menu.cancel.connect (() => { reset_elements_states (); }); |
468 | 439 | menu.deactivate.connect (() => { reset_elements_states (); }); | 439 | menu.deactivate.connect (() => { reset_elements_states (); }); |
469 | 440 | /* current_right_click_root is parent of the directory named on the breadcrumb. */ | ||
470 | 440 | var directory = File.new_for_uri (current_right_click_root); | 441 | var directory = File.new_for_uri (current_right_click_root); |
471 | 441 | if (files_menu != null) | ||
472 | 442 | files_menu.done_loading.disconnect (on_files_loaded_menu); | ||
473 | 443 | files_menu = GOF.Directory.Async.from_gfile (directory); | 442 | files_menu = GOF.Directory.Async.from_gfile (directory); |
474 | 444 | files_menu.done_loading.connect (on_files_loaded_menu); | 443 | files_menu.done_loading.connect (on_files_loaded_menu); |
475 | 445 | files_menu.load (); | 444 | files_menu.load (); |
476 | 446 | 445 | ||
477 | === modified file 'src/View/ViewContainer.vala' | |||
478 | --- src/View/ViewContainer.vala 2014-12-28 09:23:52 +0000 | |||
479 | +++ src/View/ViewContainer.vala 2015-01-26 10:59:47 +0000 | |||
480 | @@ -331,6 +331,10 @@ | |||
481 | 331 | if (file == null || location.equal (file)) | 331 | if (file == null || location.equal (file)) |
482 | 332 | return; | 332 | return; |
483 | 333 | 333 | ||
484 | 334 | var filetype = file.query_file_type (0); | ||
485 | 335 | if (filetype == FileType.UNKNOWN) | ||
486 | 336 | return; | ||
487 | 337 | |||
488 | 334 | GLib.File? loc = null; | 338 | GLib.File? loc = null; |
489 | 335 | File? parent = file.get_parent (); | 339 | File? parent = file.get_parent (); |
490 | 336 | if (parent != null && location.equal (file.get_parent ())) { | 340 | if (parent != null && location.equal (file.get_parent ())) { |
491 | @@ -341,7 +345,7 @@ | |||
492 | 341 | } else | 345 | } else |
493 | 342 | loc = file; | 346 | loc = file; |
494 | 343 | } else if (!select_in_current_only) { | 347 | } else if (!select_in_current_only) { |
496 | 344 | if (file.query_file_type (0) == FileType.DIRECTORY) | 348 | if (filetype == FileType.DIRECTORY) |
497 | 345 | loc = file; | 349 | loc = file; |
498 | 346 | else if (parent != null) { | 350 | else if (parent != null) { |
499 | 347 | loc = parent; | 351 | loc = parent; |
500 | 348 | 352 | ||
501 | === modified file 'src/View/Window.vala' | |||
502 | --- src/View/Window.vala 2015-01-17 18:42:21 +0000 | |||
503 | +++ src/View/Window.vala 2015-01-26 10:59:47 +0000 | |||
504 | @@ -214,13 +214,6 @@ | |||
505 | 214 | 214 | ||
506 | 215 | undo_manager.request_menu_update.connect (undo_redo_menu_update_callback); | 215 | undo_manager.request_menu_update.connect (undo_redo_menu_update_callback); |
507 | 216 | 216 | ||
508 | 217 | key_press_event.connect ((event) => { | ||
509 | 218 | if (top_menu.location_bar.bread.is_focus) | ||
510 | 219 | return top_menu.location_bar.bread.key_press_event (event); | ||
511 | 220 | |||
512 | 221 | return false; | ||
513 | 222 | }); | ||
514 | 223 | |||
515 | 224 | button_press_event.connect (on_button_press_event); | 217 | button_press_event.connect (on_button_press_event); |
516 | 225 | 218 | ||
517 | 226 | window_state_event.connect ((event) => { | 219 | window_state_event.connect ((event) => { |
518 | @@ -375,6 +368,14 @@ | |||
519 | 375 | 368 | ||
520 | 376 | content.loading.connect ((is_loading) => { | 369 | content.loading.connect ((is_loading) => { |
521 | 377 | tab.working = is_loading; | 370 | tab.working = is_loading; |
522 | 371 | top_menu.location_bar.bread.show_refresh_icon (!is_loading); | ||
523 | 372 | }); | ||
524 | 373 | |||
525 | 374 | key_press_event.connect ((event) => { | ||
526 | 375 | if (top_menu.location_bar.bread.is_focus) | ||
527 | 376 | return top_menu.location_bar.bread.on_key_press_event (event); | ||
528 | 377 | |||
529 | 378 | return false; | ||
530 | 378 | }); | 379 | }); |
531 | 379 | 380 | ||
532 | 380 | change_tab ((int)tabs.insert_tab (tab, -1)); | 381 | change_tab ((int)tabs.insert_tab (tab, -1)); |
Icon should probably be view-refresh- symbolic
String should probably be "Reload the current folder" if we want to match the wording of Midori's reload tooltip