Merge lp:~jeremywootten/pantheon-files/fix-count-items-selected into lp:~elementary-apps/pantheon-files/trunk

Proposed by Jeremy Wootten
Status: Merged
Approved by: PerfectCarl
Approved revision: 1714
Merged at revision: 1722
Proposed branch: lp:~jeremywootten/pantheon-files/fix-count-items-selected
Merge into: lp:~elementary-apps/pantheon-files/trunk
Diff against target: 56 lines (+4/-9)
1 file modified
src/View/OverlayBar.vala (+4/-9)
To merge this branch: bzr merge lp:~jeremywootten/pantheon-files/fix-count-items-selected
Reviewer Review Type Date Requested Status
PerfectCarl (community) Approve
Review via email: mp+246794@code.launchpad.net

Commit message

Fix item count in Overlay

Description of the change

This branch fixes a bug in the overlay causing it to show "0 items selected" when multiple files (not including folders) are selected.

To test:

FUNCTION:
1) Select different numbers of files (not including folders) in icon or Miller view. The overlay shows the appropriate number of items selected.

REGRESSIONS:
2) Select different combinations of files and folders in Icon or Miller view. The overlay shows appropriate information.

To post a comment you must log in.
Revision history for this message
PerfectCarl (name-is-carl) wrote :
review: Approve

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 2014-11-13 20:24:33 +0000
3+++ src/View/OverlayBar.vala 2015-01-16 23:47:13 +0000
4@@ -94,14 +94,11 @@
5 }
6
7 private void real_update (GLib.List<GOF.File>? files) {
8- count = 0;
9 goffile = null;
10 folders_count = 0;
11 files_count = 0;
12 files_size = 0;
13
14- /* cancel any pending subfolder scan */
15- //cancellable.cancel ();
16 if (files != null) {
17 visible = showbar;
18
19@@ -127,7 +124,7 @@
20 image_cancellable = null;
21 }
22
23- if (goffile != null) {
24+ if (goffile != null) { /* a single file is hovered or selected */
25 if (goffile.is_network_uri_scheme ()) {
26 status = goffile.get_display_target_uri ();
27 } else if (!goffile.is_folder ()) {
28@@ -143,7 +140,7 @@
29 status = "%s - %s".printf (goffile.info.get_name (), goffile.formated_type);
30
31 }
32- } else {
33+ } else { /* hovering over multiple selection */
34 string str = null;
35 if (folders_count > 1) {
36 str = _("%u folders").printf (folders_count);
37@@ -161,9 +158,8 @@
38 files_count);
39 else
40 str += _(" selected");
41- } else {
42- str = _("%u items selected (%s)").printf (count, format_size ((int64) files_size));
43- }
44+ } else /* folder_count = 0 and files_count > 0 */
45+ str = _("%u items selected (%s)").printf (files_count, format_size ((int64) files_size));
46
47 status = str;
48
49@@ -177,7 +173,6 @@
50 foreach (var gof in files) {
51 if (gof.is_folder ()) {
52 folders_count++;
53- //scan_folder (gof.location);
54 } else {
55 files_count++;
56 files_size += PropertiesWindow.file_real_size (gof);

Subscribers

People subscribed via source and target branches

to all changes: