Merge lp:~jeremywootten/pantheon-files/fix-1604300-merge-find-functionalities-part1 into lp:~elementary-apps/pantheon-files/trunk

Proposed by Jeremy Wootten
Status: Merged
Approved by: Danielle Foré
Approved revision: 2415
Merged at revision: 2445
Proposed branch: lp:~jeremywootten/pantheon-files/fix-1604300-merge-find-functionalities-part1
Merge into: lp:~elementary-apps/pantheon-files/trunk
Diff against target: 199 lines (+21/-50)
6 files modified
libwidgets/Interfaces/SearchableInterface.vala (+0/-2)
libwidgets/View/SearchResults.vala (+4/-29)
src/View/AbstractDirectoryView.vala (+2/-1)
src/View/Widgets/LocationBar.vala (+6/-3)
src/View/Widgets/TopMenu.vala (+2/-2)
src/View/Window.vala (+7/-13)
To merge this branch: bzr merge lp:~jeremywootten/pantheon-files/fix-1604300-merge-find-functionalities-part1
Reviewer Review Type Date Requested Status
Danielle Foré Approve
Review via email: mp+313861@code.launchpad.net

Commit message

Combine the two search modes. Ctrl + F and Type-ahead now do the same thing

Description of the change

This branch removes the two modes of search (current folder/begins-with and global/contains) - search now always performs the full search.

To post a comment you must log in.
Revision history for this message
Danielle Foré (danrabbit) wrote :

As far as I can tell, this branch makes the full search appear when typing but it:

* Makes Ctrl + F not do anything at all. This is probably unexpected.
* Breaks the type-ahead filter feature by not prioritizing results from the pwd.

I think I would consider merging this as is to introduce regressions

review: Needs Fixing
2414. By Jeremy Wootten

Fix Ctrl-F

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

I have fixed the problem with Ctrl-F.

The sorting of the results is dealt with in part2 of this series, in order to keep the diff size down.

2415. By Jeremy Wootten

Merge trunk to r2444 and resolve conflicts

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

It still seems that there are two modes. A difference I noticed:

With Ctrl + F:
* Starting in home, typing "Down" and pressing enter takes me to "Downloads

With Typing:
* Starting in home, typing "Down" and pressing enter takes me to the non-existent folder "Down"

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

I'm going to approve since it's a minor issue. We have a few more branches to go through that might solve it along the way :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libwidgets/Interfaces/SearchableInterface.vala'
2--- libwidgets/Interfaces/SearchableInterface.vala 2016-12-31 19:42:09 +0000
3+++ libwidgets/Interfaces/SearchableInterface.vala 2017-01-13 13:31:29 +0000
4@@ -26,8 +26,6 @@
5
6 public abstract void cancel ();
7 public abstract void search (string txt, GLib.File search_location);
8- public abstract void set_search_current_directory_only (bool only);
9- public abstract void set_begins_with_only (bool only);
10 public abstract bool has_popped_up ();
11 }
12 }
13
14=== modified file 'libwidgets/View/SearchResults.vala'
15--- libwidgets/View/SearchResults.vala 2016-12-31 19:42:09 +0000
16+++ libwidgets/View/SearchResults.vala 2017-01-13 13:31:29 +0000
17@@ -83,8 +83,6 @@
18
19 bool local_search_finished = false;
20 bool global_search_finished = false;
21- protected bool search_current_directory_only = false;
22- protected bool begins_with_only = false;
23
24 bool is_grabbing = false;
25 Gdk.Device? device = null;
26@@ -288,7 +286,6 @@
27 return null;
28 });
29
30- if (!search_current_directory_only) {
31 get_zg_results.begin (search_term);
32
33 var bookmarks_matched = new Gee.LinkedList<Match> ();
34@@ -300,16 +297,6 @@
35 }
36
37 add_results (bookmarks_matched, bookmark_results);
38- } else {
39- global_search_finished = true;
40- }
41- }
42-
43- public void set_search_current_directory_only (bool only) {
44- search_current_directory_only = only;
45- }
46- public void set_begins_with_only (bool only) {
47- begins_with_only = only;
48 }
49
50 /** Signal handlers **/
51@@ -365,12 +352,7 @@
52
53 if (mods != 0 && !only_shift_pressed) {
54 if (only_control_pressed) {
55- if (event.keyval == Gdk.Key.f) {
56- search_current_directory_only = false;
57- begins_with_only = false;
58- search (search_term, current_root);
59- return true;
60- } else if (event.keyval == Gdk.Key.l) {
61+ if (event.keyval == Gdk.Key.l) {
62 cancel (); /* release any grab */
63 exit (false); /* Do not exit navigate mode */
64 return true;
65@@ -842,7 +824,7 @@
66 depth++;
67 }
68
69- if ((search_current_directory_only && depth > 1) || depth > MAX_DEPTH) {
70+ if (depth > MAX_DEPTH) {
71 return;
72 }
73
74@@ -861,7 +843,7 @@
75 continue;
76 }
77
78- if (info.get_file_type () == FileType.DIRECTORY && !search_current_directory_only) {
79+ if (info.get_file_type () == FileType.DIRECTORY) {
80 directory_queue.add (folder.resolve_relative_path (info.get_name ()));
81 }
82
83@@ -978,15 +960,8 @@
84 bool term_matches (string term, string name)
85 {
86 /**TODO** improve */
87-
88 /* term is assumed to be down */
89- bool res;
90- if (begins_with_only)
91- res = name.normalize ().casefold ().has_prefix (term);
92- else
93- res = name.normalize ().casefold ().contains (term);
94-
95- return res;
96+ return name.normalize ().casefold ().contains (term);
97 }
98
99 string get_category_header (string title)
100
101=== modified file 'src/View/AbstractDirectoryView.vala'
102--- src/View/AbstractDirectoryView.vala 2016-12-31 19:42:09 +0000
103+++ src/View/AbstractDirectoryView.vala 2017-01-13 13:31:29 +0000
104@@ -2867,7 +2867,8 @@
105 if (no_mods || only_shift_pressed) {
106 /* Use printable characters to initiate search */
107 if (((unichar)(Gdk.keyval_to_unicode (keyval))).isprint ()) {
108- window.win_actions.activate_action ("find", "CURRENT_DIRECTORY_ONLY");
109+ window.win_actions.activate_action ("find", null);
110+
111 window.key_press_event (event);
112 return true;
113 }
114
115=== modified file 'src/View/Widgets/LocationBar.vala'
116--- src/View/Widgets/LocationBar.vala 2016-12-27 18:19:20 +0000
117+++ src/View/Widgets/LocationBar.vala 2017-01-13 13:31:29 +0000
118@@ -183,14 +183,17 @@
119 bread.set_placeholder ("");
120 }
121
122- public bool enter_search_mode (bool local_only, bool begins_with_only) {
123+ public bool enter_search_mode () {
124 if (!sensitive) {
125 return false;
126 }
127
128- search_results.set_search_current_directory_only (local_only);
129- search_results.set_begins_with_only (begins_with_only);
130+//~ <<<<<<< TREE
131+//~ =======
132+//~ search_results.set_search_current_directory_only (local_only);
133+//~ search_results.set_begins_with_only (begins_with_only);
134
135+//~ >>>>>>> MERGE-SOURCE
136 if (!search_mode) {
137 /* Initialise search mode but do not search until first character has been received */
138 if (set_focussed ()) {
139
140=== modified file 'src/View/Widgets/TopMenu.vala'
141--- src/View/Widgets/TopMenu.vala 2016-12-27 18:19:20 +0000
142+++ src/View/Widgets/TopMenu.vala 2017-01-13 13:31:29 +0000
143@@ -112,8 +112,8 @@
144 location_bar.escape.connect (() => {escape ();});
145 }
146
147- public bool enter_search_mode (bool local_only, bool begins_with_only) {
148- return location_bar.enter_search_mode (local_only, begins_with_only);
149+ public bool enter_search_mode () {
150+ return location_bar.enter_search_mode ();
151 }
152
153 public bool enter_navigate_mode () {
154
155=== modified file 'src/View/Window.vala'
156--- src/View/Window.vala 2016-12-26 17:17:11 +0000
157+++ src/View/Window.vala 2017-01-13 13:31:29 +0000
158@@ -32,7 +32,7 @@
159 {"undo", action_undo},
160 {"redo", action_redo},
161 {"bookmark", action_bookmark},
162- {"find", action_find, "s"},
163+ {"find", action_find},
164 {"tab", action_tab, "s"},
165 {"go_to", action_go_to, "s"},
166 {"zoom", action_zoom, "s"},
167@@ -515,18 +515,12 @@
168 }
169
170 private void action_find (GLib.SimpleAction action, GLib.Variant? param) {
171- string search_scope = param.get_string ();
172- if (search_scope == "CURRENT_DIRECTORY_ONLY") {
173- /* Do not initiate search while slot is frozen e.g. during loading */
174- if (current_tab == null || current_tab.is_frozen) {
175- return;
176- }
177- /* Just search current directory for filenames beginning with term */
178- top_menu.enter_search_mode (true, true);
179- } else {
180- /* Slot is frozen, but only because already searching */
181- top_menu.enter_search_mode (false, false);
182+ /* Do not initiate search while slot is frozen e.g. during loading */
183+ if (current_tab == null || current_tab.is_frozen) {
184+ return;
185 }
186+
187+ top_menu.enter_search_mode ();
188 }
189
190 private bool adding_window = false;
191@@ -1077,7 +1071,7 @@
192 application.set_accels_for_action ("win.redo", {"<Ctrl><Shift>Z"});
193 application.set_accels_for_action ("win.select_all", {"<Ctrl>A"});
194 application.set_accels_for_action ("win.bookmark", {"<Ctrl>D"});
195- application.set_accels_for_action ("win.find::GLOBAL", {"<Ctrl>F"});
196+ application.set_accels_for_action ("win.find", {"<Ctrl>F"});
197 application.set_accels_for_action ("win.tab::NEW", {"<Ctrl>T"});
198 application.set_accels_for_action ("win.tab::CLOSE", {"<Ctrl>W"});
199 application.set_accels_for_action ("win.tab::NEXT", {"<Ctrl>Page_Down"});

Subscribers

People subscribed via source and target branches

to all changes: