Merge lp:~elementary-apps/pantheon-files/find-function-more-style-fixes into lp:~elementary-apps/pantheon-files/trunk

Proposed by Danielle Foré
Status: Merged
Approved by: Jeremy Wootten
Approved revision: 2556
Merged at revision: 2556
Proposed branch: lp:~elementary-apps/pantheon-files/find-function-more-style-fixes
Merge into: lp:~elementary-apps/pantheon-files/trunk
Diff against target: 122 lines (+34/-20)
1 file modified
libwidgets/View/SearchResults.vala (+34/-20)
To merge this branch: bzr merge lp:~elementary-apps/pantheon-files/find-function-more-style-fixes
Reviewer Review Type Date Requested Status
Jeremy Wootten code format Approve
Review via email: mp+323719@code.launchpad.net

Commit message

SearchResults.vala: Code style, white space, and indentation fixes

Description of the change

This implements a bunch of minor changes and style fixes from https://code.launchpad.net/~elementary-apps/pantheon-files/find-function-part2

The purpose of merging these separately is to make that branch a smaller diff that's easier to review

To post a comment you must log in.
Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

Queried extra indentation of three lines (see inline comments).

Revision history for this message
Danielle Foré (danrabbit) wrote :

Fixed :)

2555. By Danielle Foré

fix indentation

2556. By Danielle Foré

merge master

Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

Stylistic changes only, no impact on function or appearance.

review: Approve (code format)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libwidgets/View/SearchResults.vala'
2--- libwidgets/View/SearchResults.vala 2017-05-07 12:10:38 +0000
3+++ libwidgets/View/SearchResults.vala 2017-05-07 16:16:35 +0000
4@@ -154,9 +154,15 @@
5
6 view.append_column (column);
7
8- list = new Gtk.TreeStore (5, typeof (string), typeof (GLib.Icon),
9- typeof (string), typeof (File), typeof (bool));
10+ list = new Gtk.TreeStore (5,
11+ typeof (string), /*0 file basename or category name */
12+ typeof (GLib.Icon), /*1 file icon */
13+ typeof (string), /*2 file location */
14+ typeof (File), /*3 file object */
15+ typeof (bool)); /*4 icon is visible */
16+
17 filter = new Gtk.TreeModelFilter (list, null);
18+
19 filter.set_visible_func ((model, iter) => {
20 if (iter == no_results_label)
21 return n_results < 1;
22@@ -164,6 +170,7 @@
23 /* hide empty category headers */
24 return list.iter_depth (iter) != 0 || list.iter_has_child (iter);
25 });
26+
27 view.model = filter;
28
29 list.row_changed.connect ((path, iter) => {
30@@ -176,11 +183,16 @@
31 });
32
33 list.append (out local_results, null);
34- list.@set (local_results, 0, get_category_header (_("In This Folder")));
35+ list.@set (local_results,
36+ 0, get_category_header (_("In This Folder")));
37+
38 list.append (out bookmark_results, null);
39- list.@set (bookmark_results, 0, get_category_header (_("Bookmarks")));
40+ list.@set (bookmark_results,
41+ 0, get_category_header (_("Bookmarks")));
42+
43 list.append (out global_results, null);
44- list.@set (global_results, 0, get_category_header (_("Everywhere Else")));
45+ list.@set (global_results,
46+ 0, get_category_header (_("Everywhere Else")));
47
48 scroll.add (view);
49 frame.add (scroll);
50@@ -287,17 +299,17 @@
51 return null;
52 });
53
54- get_zg_results.begin (search_term);
55-
56- var bookmarks_matched = new Gee.LinkedList<Match> ();
57-
58- foreach (var bookmark in BookmarkList.get_instance ().list) {
59- if (term_matches (search_term, bookmark.label)) {
60- bookmarks_matched.add (new Match.from_bookmark (bookmark));
61- }
62+ get_zg_results.begin (search_term);
63+
64+ var bookmarks_matched = new Gee.LinkedList<Match> ();
65+
66+ foreach (var bookmark in BookmarkList.get_instance ().list) {
67+ if (term_matches (search_term, bookmark.label)) {
68+ bookmarks_matched.add (new Match.from_bookmark (bookmark));
69 }
70+ }
71
72- add_results (bookmarks_matched, bookmark_results);
73+ add_results (bookmarks_matched, bookmark_results);
74 }
75
76 /** Signal handlers **/
77@@ -649,10 +661,9 @@
78 return;
79 }
80
81- Gtk.TreeIter iter;
82- File file;
83-
84 foreach (var match in new_results) {
85+ Gtk.TreeIter iter;
86+ File file;
87 /* prevent results from showing in both global and local results */
88 if (parent == global_results) {
89 var already_added = false;
90@@ -825,6 +836,7 @@
91
92 File f = folder;
93 var path_string = "";
94+
95 while (!f.equal (current_root)) {
96 path_string = f.get_basename () + (path_string == "" ? "" : Path.DIR_SEPARATOR_S + path_string);
97 f = f.get_parent ();
98@@ -844,8 +856,11 @@
99 var new_results = new Gee.LinkedList<Match> ();
100
101 FileInfo info = null;
102+
103 try {
104- while (!cancel.is_cancelled () && (info = enumerator.next_file (null)) != null) {
105+ while (!cancel.is_cancelled () &&
106+ (info = enumerator.next_file (null)) != null) {
107+
108 if (info.get_is_hidden () && !include_hidden) {
109 continue;
110 }
111@@ -918,10 +933,9 @@
112 return;
113 }
114
115- var i = 0;
116-
117 var matches = new Gee.LinkedList<Match> ();
118 var home = File.new_for_path (Environment.get_home_dir ());
119+ var i = 0;
120 while (results.has_next () && !current_operation.is_cancelled ()) {
121 var result = results.next_value ();
122 foreach (var subject in result.subjects.data) {

Subscribers

People subscribed via source and target branches