Merge lp:~jeremywootten/pantheon-files/fix-1641682-overlay-info-for-individually-selected into lp:~elementary-apps/pantheon-files/trunk

Proposed by Jeremy Wootten
Status: Merged
Approved by: Corentin Noël
Approved revision: 2387
Merged at revision: 2401
Proposed branch: lp:~jeremywootten/pantheon-files/fix-1641682-overlay-info-for-individually-selected
Merge into: lp:~elementary-apps/pantheon-files/trunk
Diff against target: 118 lines (+27/-12)
2 files modified
src/View/OverlayBar.vala (+26/-11)
src/View/ViewContainer.vala (+1/-1)
To merge this branch: bzr merge lp:~jeremywootten/pantheon-files/fix-1641682-overlay-info-for-individually-selected
Reviewer Review Type Date Requested Status
elementary Apps team Pending
Review via email: mp+311897@code.launchpad.net

Commit message

Do not cancel selection update on hover change

Description of the change

This branch fixes a bug in OverlayBar where the updating of "selected_files" is cancelled unnecessarily, causing the linked bug.

The opportunity is taken to fix some code formatting in functions touched and to remove a redundant, unused parameter.

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 'src/View/OverlayBar.vala'
2--- src/View/OverlayBar.vala 2016-07-31 17:59:58 +0000
3+++ src/View/OverlayBar.vala 2016-11-27 19:11:42 +0000
4@@ -33,13 +33,14 @@
5 private GLib.FileInputStream? stream;
6 private Gdk.PixbufLoader loader;
7 private uint update_timeout_id = 0;
8+ private uint hover_timeout_id = 0;
9 private Marlin.DeepCount? deep_counter = null;
10 private uint deep_count_timeout_id = 0;
11 private Gtk.Spinner spinner;
12
13 public bool showbar = false;
14
15- public OverlayBar (Marlin.View.Window win, Gtk.Overlay overlay) {
16+ public OverlayBar (Gtk.Overlay overlay) {
17 base (overlay); /* this adds the overlaybar to the overlay (ViewContainer) */
18
19 buffer = new uint8[IMAGE_LOADER_BUFFER_SIZE];
20@@ -77,14 +78,16 @@
21 cancel ();
22 visible = false;
23
24- if (!showbar)
25+ if (!showbar) {
26 return;
27+ }
28
29 update_timeout_id = GLib.Timeout.add_full (GLib.Priority.LOW, STATUS_UPDATE_DELAY, () => {
30- if (files != null)
31+ if (files != null) {
32 selected_files = files.copy ();
33- else
34+ } else {
35 selected_files = null;
36+ }
37
38 real_update (selected_files);
39 update_timeout_id = 0;
40@@ -97,7 +100,7 @@
41 }
42
43 public void update_hovered (GOF.File? file) {
44- cancel (); /* This will stop and hide spinner */
45+ hover_cancel (); /* This will stop and hide spinner, and reset the hover timeout */
46
47 if (!showbar)
48 return;
49@@ -106,20 +109,21 @@
50 visible = false;
51 }
52
53- update_timeout_id = GLib.Timeout.add_full (GLib.Priority.LOW, STATUS_UPDATE_DELAY, () => {
54+ hover_timeout_id = GLib.Timeout.add_full (GLib.Priority.LOW, STATUS_UPDATE_DELAY, () => {
55 GLib.List<GOF.File> list = null;
56 if (file != null) {
57 bool matched = false;
58 if (selected_files != null) {
59 selected_files.@foreach ((f) => {
60- if (f == file)
61+ if (f == file) {
62 matched = true;
63+ }
64 });
65 }
66
67- if (matched)
68+ if (matched) {
69 real_update (selected_files);
70- else {
71+ } else {
72 list.prepend (file);
73 real_update (list);
74 }
75@@ -127,17 +131,28 @@
76 real_update (null);
77 }
78
79- update_timeout_id = 0;
80+ hover_timeout_id = 0;
81 return false;
82 });
83 }
84
85- public void cancel() {
86+ /** Function to be called when view is going to be destroyed or going to show another folder
87+ * * and on a selection change.
88+* **/
89+ public void cancel () {
90+ hover_cancel ();
91 if (update_timeout_id > 0) {
92 GLib.Source.remove (update_timeout_id);
93 update_timeout_id = 0;
94 }
95+ }
96
97+ private void hover_cancel() {
98+ /* Do not cancel updating of selected files when hovered file changes */
99+ if (hover_timeout_id > 0) {
100+ GLib.Source.remove (hover_timeout_id);
101+ hover_timeout_id = 0;
102+ }
103 if (deep_count_timeout_id > 0) {
104 GLib.Source.remove (deep_count_timeout_id);
105 deep_count_timeout_id = 0;
106
107=== modified file 'src/View/ViewContainer.vala'
108--- src/View/ViewContainer.vala 2016-11-08 19:15:21 +0000
109+++ src/View/ViewContainer.vala 2016-11-27 19:11:42 +0000
110@@ -94,7 +94,7 @@
111 /* Initial location now set by Window.make_tab after connecting signals */
112 public ViewContainer (Marlin.View.Window win) {
113 window = win;
114- overlay_statusbar = new OverlayBar (win, this);
115+ overlay_statusbar = new OverlayBar (this);
116 browser = new Browser ();
117
118 /* Override background color to support transparency on overlay widgets */

Subscribers

People subscribed via source and target branches

to all changes: