Merge lp:~jonathon-waterhouse/pantheon-files/fix-1325214 into lp:~elementary-apps/pantheon-files/trunk

Proposed by Jonathon Waterhouse
Status: Merged
Merged at revision: 1528
Proposed branch: lp:~jonathon-waterhouse/pantheon-files/fix-1325214
Merge into: lp:~elementary-apps/pantheon-files/trunk
Diff against target: 336 lines (+46/-42)
2 files modified
libwidgets/LocationBar.vala (+41/-41)
src/View/Window.vala (+5/-1)
To merge this branch: bzr merge lp:~jonathon-waterhouse/pantheon-files/fix-1325214
Reviewer Review Type Date Requested Status
elementary Apps team Pending
Review via email: mp+226626@code.launchpad.net
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 'libwidgets/LocationBar.vala'
2--- libwidgets/LocationBar.vala 2014-06-14 19:17:34 +0000
3+++ libwidgets/LocationBar.vala 2014-07-14 05:03:50 +0000
4@@ -38,7 +38,7 @@
5
6 public string current_right_click_path;
7 public string current_right_click_root;
8-
9+
10 protected string text_completion = "";
11 protected bool multiple_completions = false;
12 protected bool text_changed = false;
13@@ -98,7 +98,7 @@
14 construct {
15 icon_factory = Granite.Services.IconFactory.get_default ();
16 icons = new List<IconDirectory?> ();
17-
18+
19 /* Load arrow image */
20 try {
21 arrow_img = Gtk.IconTheme.get_default ().load_icon ("go-jump-symbolic", 16, Gtk.IconLookupFlags.GENERIC_FALLBACK);
22@@ -125,7 +125,7 @@
23 y = 0;
24
25 elements = new Gee.ArrayList<BreadcrumbsElement> ();
26-
27+
28 secondary_icon_activatable = true;
29 secondary_icon_sensitive = true;
30 truncate_multiline = true;
31@@ -145,7 +145,7 @@
32 drag_motion.connect (on_drag_motion);
33 drag_data_received.connect (on_drag_data_received);
34 }
35-
36+
37 public override bool key_press_event (Gdk.EventKey event) {
38 switch (event.keyval) {
39 case Gdk.Key.KP_Tab:
40@@ -162,19 +162,19 @@
41 case Gdk.Key.Up:
42 up ();
43 return true;
44-
45+
46 case Gdk.Key.Escape:
47 escape ();
48 return true;
49 }
50-
51+
52 return base.key_press_event (event);
53 }
54
55 public override bool button_press_event (Gdk.EventButton event) {
56- if (is_focus)
57+ if (is_focus)
58 return base.button_press_event (event);
59-
60+
61 foreach (BreadcrumbsElement element in elements)
62 element.pressed = false;
63
64@@ -199,7 +199,7 @@
65 var newpath = get_path_from_element (el);
66 activate_alternate (get_file_for_path (newpath));
67 }
68-
69+
70 return true;
71 }
72
73@@ -216,7 +216,7 @@
74 Source.remove ((uint) timeout);
75 timeout = -1;
76 }
77-
78+
79 if (is_focus)
80 return base.button_release_event (event);
81
82@@ -229,27 +229,27 @@
83 } else
84 grab_focus ();
85 }
86-
87+
88 return base.button_release_event (event);
89 }
90-
91+
92 void on_change () {
93 if (ignore_change) {
94 ignore_change = false;
95 return;
96 }
97-
98+
99 set_entry_icon (true, (text.length > 0) ? "Navigate to: " + text : "");
100 text_completion = "";
101 need_completion ();
102 }
103-
104+
105 bool on_motion_notify (Gdk.EventMotion event) {
106 int x = (int) event.x;
107 double x_render = 0;
108 double x_previous = -10;
109 set_tooltip_text ("");
110-
111+
112 if (is_focus)
113 return base.motion_notify_event (event);
114
115@@ -270,7 +270,7 @@
116 set_entry_cursor (new Gdk.Cursor (Gdk.CursorType.ARROW));
117 else
118 set_entry_cursor (null);
119-
120+
121 return base.motion_notify_event (event);
122 }
123
124@@ -279,11 +279,11 @@
125 ignore_focus_in = true;
126 return base.focus_out_event (event);
127 }
128-
129+
130 ignore_focus_in = false;
131 set_entry_icon (false);
132 set_entry_text ("");
133-
134+
135 return base.focus_out_event (event);
136 }
137
138@@ -296,10 +296,10 @@
139 .replace ("file:///", "/")
140 .replace ("trash:///", "")
141 .replace ("network:///", "")));
142-
143+
144 return base.focus_in_event (event);
145 }
146-
147+
148 void on_grab_focus () {
149 select_region (0, 0);
150 set_position (-1);
151@@ -361,7 +361,7 @@
152
153 return false;
154 }
155-
156+
157 protected void add_icon (IconDirectory icon) {
158 if (icon.gicon != null)
159 icon.icon = icon_factory.load_symbolic_icon_from_gicon (button_context, icon.gicon, 16);
160@@ -370,13 +370,13 @@
161
162 icons.append (icon);
163 }
164-
165- public void complete () {
166+
167+ public void complete () {
168 if (text_completion.length == 0)
169 return;
170
171 string path = text + text_completion;
172-
173+
174 /* If there are multiple results, tab as far as we can, otherwise do the entire result */
175 if (!multiple_completions) {
176 set_entry_text (path + "/");
177@@ -384,26 +384,26 @@
178 } else
179 set_entry_text (path);
180 }
181-
182+
183 public void reset_elements_states () {
184 foreach (BreadcrumbsElement element in elements)
185 element.pressed = false;
186
187 queue_draw ();
188 }
189-
190+
191 public void set_entry_text (string text) {
192 ignore_change = true;
193 text_completion = "";
194 this.text = text;
195 set_position (-1);
196 }
197-
198+
199 public void set_entry_cursor (Gdk.Cursor? cursor) {
200 /* Only child 13 needs to be modified for the cursor - there may be a better way to do this */
201 get_window ().get_children ().nth_data (13).set_cursor (cursor ?? new Gdk.Cursor (Gdk.CursorType.XTERM));
202 }
203-
204+
205 public void set_entry_icon (bool active, string? tooltip = null) {
206 if (!active)
207 secondary_icon_pixbuf = null;
208@@ -412,7 +412,7 @@
209 secondary_icon_tooltip_text = tooltip;
210 }
211 }
212-
213+
214 public double get_all_breadcrumbs_width (out int breadcrumbs_count) {
215 double total_width = 0.0;
216 breadcrumbs_count = 0;
217@@ -469,7 +469,7 @@
218
219 return strpath;
220 }
221-
222+
223 /**
224 * Gets a properly escaped GLib.File for the given path
225 **/
226@@ -480,20 +480,20 @@
227 /* Format our path so its valid */
228 if (newpath == "")
229 newpath = "/";
230-
231+
232 if (newpath[0] == '~')
233 newpath = newpath.replace("~", Environment.get_home_dir ());
234
235 if (!newpath.contains("://"))
236 newpath = Marlin.ROOT_FS_URI + newpath;
237-
238+
239 newpath = newpath.replace("ssh:", "sftp:");
240 newpath = GLib.Uri.escape_string (newpath, reserved_chars, true);
241-
242+
243 File file = File.new_for_commandline_arg (newpath);
244 return file;
245 }
246-
247+
248 /**
249 * Select the breadcrumb to make a right click. This function check
250 * where the user click, then, it loads a context menu with the others
251@@ -503,7 +503,7 @@
252 * @param event a button event to compute the coords of the new menu.
253 *
254 **/
255- private bool select_bread_from_coord (Gdk.EventButton event) {
256+ private bool select_bread_from_coord (Gdk.EventButton event) {
257 var el = get_element_from_coordinates ((int) event.x, (int) event.y);
258
259 if (el != null) {
260@@ -523,7 +523,7 @@
261 }
262
263 return false;
264- }
265+ }
266
267 public virtual string? update_breadcrumbs (string newpath, string breadpath) {
268 string strloc;
269@@ -654,7 +654,7 @@
270 animate_old_breads ();
271 } else {
272 /* This is to make sure breadcrumbs are rendered properly when switching to a duplicate tab */
273- newbreads = newelements;
274+ newbreads = newelements.slice (max_path, newelements.size);
275 animate_new_breads ();
276 }
277
278@@ -748,7 +748,7 @@
279 button_context_active.set_path(button_context.get_path ());
280 button_context_active.set_state (Gtk.StateFlags.ACTIVE);
281 }
282-
283+
284 base.draw (cr);
285 double height = get_allocated_height ();
286 double width = get_allocated_width ();
287@@ -794,13 +794,13 @@
288 foreach (BreadcrumbsElement element in newbreads)
289 if (element.display)
290 x_render = element.draw(cr, x_render, margin, height_marged, button_context, this);
291-
292+
293 cr.restore ();
294 } else {
295 if (text_completion != "") {
296 int layout_width, layout_height;
297 double text_width, text_height;
298-
299+
300 cr.set_source_rgba (0, 0, 0, 0.4);
301 Pango.Layout layout = create_pango_layout (text);
302 layout.get_size (out layout_width, out layout_height);
303@@ -811,7 +811,7 @@
304 Pango.cairo_show_layout (cr, layout);
305 }
306 }
307-
308+
309 return true;
310 }
311
312
313=== modified file 'src/View/Window.vala'
314--- src/View/Window.vala 2014-07-13 23:14:40 +0000
315+++ src/View/Window.vala 2014-07-14 05:03:50 +0000
316@@ -320,7 +320,7 @@
317 return null;
318 }
319
320- public new void set_title(string title){
321+ public new void set_title(string title) {
322 this.title = title;
323 }
324
325@@ -339,7 +339,11 @@
326 if (current_tab != null) {
327 var cur_slot = current_tab.get_active_slot ();
328 if (cur_slot != null) {
329+ /* disable animation when switching tabs */
330+ top_menu.location_bar.bread.animation_visible = false;
331 cur_slot.active();
332+ top_menu.location_bar.bread.animation_visible = true;
333+
334 current_tab.update_location_state(false);
335 /* update radio action view state */
336 update_action_radio_view(current_tab.view_mode);

Subscribers

People subscribed via source and target branches