Merge ~3v1n0/ubuntu/+source/nautilus:ubuntu/master into ~ubuntu-desktop/ubuntu/+source/nautilus:ubuntu/master

Proposed by Marco Trevisan (Treviño) on 2018-07-26
Status: Merged
Merged at revision: 6513d3e3bf92c3219d408eab4bedaccd80573669
Proposed branch: ~3v1n0/ubuntu/+source/nautilus:ubuntu/master
Merge into: ~ubuntu-desktop/ubuntu/+source/nautilus:ubuntu/master
Diff against target: 842 lines (+347/-148)
8 files modified
debian/changelog (+19/-0)
debian/patches/0015-tracker-search-engine-don-t-start-it-if-not-availabl.patch (+7/-7)
debian/patches/0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch (+18/-10)
debian/patches/0018-search-engine-add-locate-based-search-engine.patch (+7/-7)
debian/patches/file-view-Always-unset-pending_selection-after-freeing-it.patch (+80/-0)
debian/patches/nautilusgtkplacesview-show-error-if-volume-is-not-mo.patch (+45/-0)
debian/patches/query-add-recursive-flags-and-use-it-in-search-engines.patch (+168/-123)
debian/patches/series (+3/-1)
Reviewer Review Type Date Requested Status
Sebastien Bacher 2018-07-26 Approve on 2018-08-01
Review via email: mp+351021@code.launchpad.net

Description of the change

Re-added a patch that disappeared on rebase, added one more fix.

To post a comment you must log in.
Sebastien Bacher (seb128) wrote :

looks fine to me, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 47f5ac4..9f61c50 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,22 @@
6+nautilus (1:3.26.4-0ubuntu2) UNRELEASED; urgency=medium
7+
8+ * debian/patches/nautilusgtkplacesview-show-error-if-volume-is-not-mo.patch:
9+ - don't crash if selecting a volume that is not mounted (LP: #1764779)
10+ + patch re-added after gbp deleted on importing new upstream release
11+ * debian/patches/file-view-Always-unset-pending_selection-after-freeing-it.patch:
12+ - don't crash when try to select a file multiple times in a single run
13+ (LP: #1713581)
14+ * debian/patches/query-add-recursive-flags-and-use-it-in-search-engines.patch:
15+ - Apply the upstream version of it (with 3.26 changes)
16+ * debian/patches/0015-tracker-search-engine-don-t-start-it-if-not-availabl.patch,
17+ debian/patches/0018-search-engine-add-locate-based-search-engine.patch,
18+ debian/patches/file-view-Always-unset-pending_selection-after-freeing-it.patch,
19+ - Refresh as per recursive-query patch update
20+ * 0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch:
21+ - Refresh with upstream merged-description
22+
23+ -- Marco Trevisan (Treviño) <marco@ubuntu.com> Thu, 26 Jul 2018 03:22:41 +0200
24+
25 nautilus (1:3.26.4-0ubuntu1) cosmic; urgency=medium
26
27 * New upstream release: 3.26.4 (LP: #1782681, LP: #1765776)
28diff --git a/debian/patches/0015-tracker-search-engine-don-t-start-it-if-not-availabl.patch b/debian/patches/0015-tracker-search-engine-don-t-start-it-if-not-availabl.patch
29index 4fd9909..4cc55ed 100644
30--- a/debian/patches/0015-tracker-search-engine-don-t-start-it-if-not-availabl.patch
31+++ b/debian/patches/0015-tracker-search-engine-don-t-start-it-if-not-availabl.patch
32@@ -7,7 +7,7 @@ Subject: tracker-search-engine: don't start it if not available on system
33 1 file changed, 20 insertions(+), 4 deletions(-)
34
35 diff --git a/src/nautilus-search-engine-tracker.c b/src/nautilus-search-engine-tracker.c
36-index 4c917dd..8218ea3 100644
37+index 8885ca4..050716d 100644
38 --- a/src/nautilus-search-engine-tracker.c
39 +++ b/src/nautilus-search-engine-tracker.c
40 @@ -42,6 +42,7 @@ struct _NautilusSearchEngineTracker
41@@ -18,7 +18,7 @@ index 4c917dd..8218ea3 100644
42 gboolean recursive;
43 gboolean fts_enabled;
44
45-@@ -305,8 +306,15 @@ nautilus_search_engine_tracker_start (NautilusSearchProvider *provider)
46+@@ -304,8 +305,15 @@ nautilus_search_engine_tracker_start (NautilusSearchProvider *provider)
47 return;
48 }
49
50@@ -35,16 +35,16 @@ index 4c917dd..8218ea3 100644
51 tracker->query_pending = TRUE;
52
53 g_object_notify (G_OBJECT (provider), "running");
54-@@ -472,6 +480,9 @@ nautilus_search_engine_tracker_set_query (NautilusSearchProvider *provider,
55+@@ -471,6 +479,9 @@ nautilus_search_engine_tracker_set_query (NautilusSearchProvider *provider,
56
57- tracker = NAUTILUS_SEARCH_ENGINE_TRACKER (provider);
58+ g_clear_object (&tracker->query);
59
60 + if (!tracker->available)
61 + return;
62 +
63- g_object_ref (query);
64- g_clear_object (&tracker->query);
65- tracker->query = query;
66+ tracker->query = g_object_ref (query);
67+ tracker->recursive = is_recursive_search (NAUTILUS_SEARCH_ENGINE_TYPE_INDEXED,
68+ nautilus_query_get_recursive (query),
69 @@ -539,16 +550,21 @@ static void
70 nautilus_search_engine_tracker_init (NautilusSearchEngineTracker *engine)
71 {
72diff --git a/debian/patches/0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch b/debian/patches/0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch
73index 9011e04..f80997f 100644
74--- a/debian/patches/0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch
75+++ b/debian/patches/0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch
76@@ -1,9 +1,19 @@
77 From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
78 Date: Wed, 21 Feb 2018 17:05:51 +0100
79 Subject: search-engine: add a recent-search-engine listing GtkRecentManager
80- stuff
81+ entries
82
83-Using GtkRecent items as search engine source in nautilus
84+Using GtkRecent items as search engine source in nautilus.
85+The main reason for this, is being able to get fast results on recently-used
86+files from the shell search provider.
87+
88+This is disabled when recursive searches are disabled, as there's no need to go
89+through for recent files if no recursive (or indexed) search is enabled as the
90+simple engine will be already fast enough, while running this engine could be
91+just a waste.
92+
93+Origin: upstream
94+Applied-Upstream: https://gitlab.gnome.org/GNOME/nautilus/commit/69686372fd6e6
95 ---
96 src/meson.build | 2 +
97 src/nautilus-search-engine-recent.c | 427 ++++++++++++++++++++++++++++++++++++
98@@ -502,18 +512,16 @@ index 0000000..bcd73b9
99 +
100 +#endif /* __NAUTILUS_SEARCH_ENGINE_RECENT_H__ */
101 diff --git a/src/nautilus-search-engine.c b/src/nautilus-search-engine.c
102-index a545160..68b6a4d 100644
103+index 3a0c9d4..793b831 100644
104 --- a/src/nautilus-search-engine.c
105 +++ b/src/nautilus-search-engine.c
106-@@ -21,6 +21,7 @@
107-
108- #include <config.h>
109- #include "nautilus-search-engine.h"
110-+#include "nautilus-search-engine-recent.h"
111+@@ -30,11 +30,13 @@
112+ #define DEBUG_FLAG NAUTILUS_DEBUG_SEARCH
113+ #include "nautilus-debug.h"
114 #include "nautilus-search-engine-simple.h"
115- #include "nautilus-search-engine-private.h"
116++#include "nautilus-search-engine-recent.h"
117+ #include "nautilus-search-engine-tracker.h"
118
119-@@ -35,6 +36,7 @@
120 typedef struct
121 {
122 NautilusSearchEngineTracker *tracker;
123diff --git a/debian/patches/0018-search-engine-add-locate-based-search-engine.patch b/debian/patches/0018-search-engine-add-locate-based-search-engine.patch
124index c0d37b9..91a7ec0 100644
125--- a/debian/patches/0018-search-engine-add-locate-based-search-engine.patch
126+++ b/debian/patches/0018-search-engine-add-locate-based-search-engine.patch
127@@ -678,17 +678,17 @@ index 0000000..ac5e3fc
128 +
129 +#endif /* __NAUTILUS_SEARCH_ENGINE_LOCATE_H__ */
130 diff --git a/src/nautilus-search-engine.c b/src/nautilus-search-engine.c
131-index 68b6a4d..84a88fa 100644
132+index 793b831..902d483 100644
133 --- a/src/nautilus-search-engine.c
134 +++ b/src/nautilus-search-engine.c
135-@@ -22,6 +22,7 @@
136- #include <config.h>
137- #include "nautilus-search-engine.h"
138- #include "nautilus-search-engine-recent.h"
139+@@ -29,6 +29,7 @@
140+ #include <glib/gi18n.h>
141+ #define DEBUG_FLAG NAUTILUS_DEBUG_SEARCH
142+ #include "nautilus-debug.h"
143 +#include "nautilus-search-engine-locate.h"
144 #include "nautilus-search-engine-simple.h"
145- #include "nautilus-search-engine-private.h"
146-
147+ #include "nautilus-search-engine-recent.h"
148+ #include "nautilus-search-engine-tracker.h"
149 @@ -37,6 +38,7 @@ typedef struct
150 {
151 NautilusSearchEngineTracker *tracker;
152diff --git a/debian/patches/file-view-Always-unset-pending_selection-after-freeing-it.patch b/debian/patches/file-view-Always-unset-pending_selection-after-freeing-it.patch
153new file mode 100644
154index 0000000..4191e7e
155--- /dev/null
156+++ b/debian/patches/file-view-Always-unset-pending_selection-after-freeing-it.patch
157@@ -0,0 +1,80 @@
158+From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
159+Date: Thu, 26 Jul 2018 04:55:19 +0200
160+Subject: file-view: Always unset pending_selection after freeing it
161+
162+When a file view was loaded with a pending selection, and not all the files were
163+seen yet, the private pending_selection list was properly free'd, but the pointer
164+was not cleared, causing a crash when `nautilus_files_view_set_selection` was
165+called again, as it was trying to deeply copy a list pointed by this invalid
166+reference.
167+
168+So, removing the unneeded `pending_selection` temporary pointer from the main
169+function scope, as it only confuses, while use it (with an autolist) when we
170+need to pass the previous `priv->pending_selection` (stealing its ownership)
171+to set_selection again.
172+
173+Eventually use a g_clear_pointer to free the list and nullify its priv reference
174+
175+Fixes #295
176+
177+(cherry picked from commit ae3382a281b018337a8032ef13663ec2d9c7fd6c)
178+
179+Bug-GNOME: https://gitlab.gnome.org/GNOME/nautilus/issues/295
180+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/1713581
181+Applied-Upstream: commit: https://gitlab.gnome.org/GNOME/nautilus/commit/834c4e7f
182+---
183+ src/nautilus-files-view.c | 16 +++++++---------
184+ 1 file changed, 7 insertions(+), 9 deletions(-)
185+
186+diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
187+index f916b05..87a4a42 100644
188+--- a/src/nautilus-files-view.c
189++++ b/src/nautilus-files-view.c
190+@@ -3587,7 +3587,6 @@ done_loading (NautilusFilesView *view,
191+ gboolean all_files_seen)
192+ {
193+ NautilusFilesViewPrivate *priv;
194+- GList *pending_selection;
195+ GList *selection;
196+ gboolean do_reveal = FALSE;
197+
198+@@ -3608,21 +3607,23 @@ done_loading (NautilusFilesView *view,
199+ nautilus_files_view_update_toolbar_menus (view);
200+ reset_update_interval (view);
201+
202+- pending_selection = priv->pending_selection;
203+ selection = nautilus_view_get_selection (NAUTILUS_VIEW (view));
204+
205+ if (nautilus_view_is_searching (NAUTILUS_VIEW (view)) &&
206+- all_files_seen && !selection && !pending_selection)
207++ all_files_seen && selection == NULL && priv->pending_selection == NULL)
208+ {
209+ nautilus_files_view_select_first (view);
210+ do_reveal = TRUE;
211+ }
212+- else if (pending_selection != NULL && all_files_seen)
213++ else if (priv->pending_selection != NULL && all_files_seen)
214+ {
215+- priv->pending_selection = NULL;
216++ GList *pending_selection;
217++ pending_selection = g_steal_pointer (&priv->pending_selection);
218+
219+ nautilus_files_view_call_set_selection (view, pending_selection);
220+ do_reveal = TRUE;
221++
222++ nautilus_file_list_free (pending_selection);
223+ }
224+
225+ if (selection)
226+@@ -3630,10 +3631,7 @@ done_loading (NautilusFilesView *view,
227+ g_list_free_full (selection, g_object_unref);
228+ }
229+
230+- if (pending_selection)
231+- {
232+- g_list_free_full (pending_selection, g_object_unref);
233+- }
234++ g_clear_pointer (&priv->pending_selection, nautilus_file_list_free);
235+
236+ if (do_reveal)
237+ {
238diff --git a/debian/patches/nautilusgtkplacesview-show-error-if-volume-is-not-mo.patch b/debian/patches/nautilusgtkplacesview-show-error-if-volume-is-not-mo.patch
239new file mode 100644
240index 0000000..e43f1d3
241--- /dev/null
242+++ b/debian/patches/nautilusgtkplacesview-show-error-if-volume-is-not-mo.patch
243@@ -0,0 +1,45 @@
244+From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
245+Date: Tue, 17 Jul 2018 04:23:58 +0200
246+Subject: nautilusgtkplacesview: show error if volume is not mounted
247+
248+Fixes crash as location would be NULL afterwards.
249+
250+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/1764779
251+Forwarded: not-needed
252+---
253+ src/gtk/nautilusgtkplacesview.c | 20 +++++++++++++++-----
254+ 1 file changed, 15 insertions(+), 5 deletions(-)
255+
256+diff --git a/src/gtk/nautilusgtkplacesview.c b/src/gtk/nautilusgtkplacesview.c
257+index b72085b..c5e98a5 100644
258+--- a/src/gtk/nautilusgtkplacesview.c
259++++ b/src/gtk/nautilusgtkplacesview.c
260+@@ -1329,13 +1329,23 @@ volume_mount_ready_cb (GObject *source_volume,
261+ GFile *root;
262+
263+ mount = g_volume_get_mount (volume);
264+- root = g_mount_get_default_location (mount);
265+
266+- if (priv->should_open_location)
267+- emit_open_location (NAUTILUS_GTK_PLACES_VIEW (user_data), root, priv->open_flags);
268++ if (G_IS_MOUNT (mount))
269++ {
270++ root = g_mount_get_default_location (mount);
271+
272+- g_object_unref (mount);
273+- g_object_unref (root);
274++ if (priv->should_open_location)
275++ emit_open_location (NAUTILUS_GTK_PLACES_VIEW (user_data), root, priv->open_flags);
276++
277++ g_object_unref (mount);
278++ g_object_unref (root);
279++ }
280++ else
281++ {
282++ emit_show_error_message (NAUTILUS_GTK_PLACES_VIEW(user_data),
283++ _("Unable to access location"),
284++ _("volume not mounted"));
285++ }
286+ }
287+
288+ update_places (view);
289diff --git a/debian/patches/query-add-recursive-flags-and-use-it-in-search-engines.patch b/debian/patches/query-add-recursive-flags-and-use-it-in-search-engines.patch
290index 641fab5..fddae3e 100644
291--- a/debian/patches/query-add-recursive-flags-and-use-it-in-search-engines.patch
292+++ b/debian/patches/query-add-recursive-flags-and-use-it-in-search-engines.patch
293@@ -1,32 +1,36 @@
294 From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
295-Date: Tue, 17 Jul 2018 02:35:20 +0200
296+Date: Thu, 26 Jul 2018 22:01:57 +0200
297 Subject: query: add recursive flags and use it in search-engines
298
299 Forwarded: yes, https://gitlab.gnome.org/GNOME/nautilus/merge_requests/249
300 Bug-Ubuntu: https://bugs.launchpad.net/bugs/1767027
301+Applied-Upstream: 3.29
302 ---
303 src/meson.build | 1 +
304 src/nautilus-application.c | 11 ++----
305 src/nautilus-application.h | 3 +-
306- src/nautilus-directory-async.c | 5 ++-
307+ src/nautilus-directory-async.c | 4 +-
308 src/nautilus-file-private.h | 3 +-
309+ src/nautilus-file-utilities.c | 48 +++++++++++++++++++++++
310+ src/nautilus-file-utilities.h | 6 +++
311 src/nautilus-file.c | 28 ++++++++++++++
312 src/nautilus-file.h | 2 +
313- src/nautilus-query-editor.c | 61 +++++++++++++++++-------------
314+ src/nautilus-query-editor.c | 20 +++++-----
315 src/nautilus-query.c | 28 +++++++-------
316 src/nautilus-query.h | 14 +++++--
317 src/nautilus-search-directory.c | 6 ---
318- src/nautilus-search-engine-private.h | 34 +++++++++++++++++
319- src/nautilus-search-engine-simple.c | 72 ++++++++----------------------------
320+ src/nautilus-search-engine-private.h | 31 +++++++++++++++
321+ src/nautilus-search-engine-simple.c | 74 +++++++++---------------------------
322+ src/nautilus-search-engine-simple.h | 2 +
323 src/nautilus-search-engine-tracker.c | 16 ++++----
324- src/nautilus-search-engine.c | 36 ++++++++++++++----
325+ src/nautilus-search-engine.c | 36 +++++++++++++-----
326 src/nautilus-search-engine.h | 2 -
327- src/nautilus-shell-search-provider.c | 40 +++++++++++---------
328- src/nautilus-window-slot.c | 19 ++++------
329+ src/nautilus-shell-search-provider.c | 50 ++++++++++++++++--------
330+ src/nautilus-window-slot.c | 19 ++++-----
331 src/nautilus-window-slot.h | 2 +-
332 src/nautilus-window.c | 4 +-
333 src/nautilus-window.h | 2 +-
334- 21 files changed, 222 insertions(+), 167 deletions(-)
335+ 24 files changed, 261 insertions(+), 151 deletions(-)
336 create mode 100644 src/nautilus-search-engine-private.h
337
338 diff --git a/src/meson.build b/src/meson.build
339@@ -80,19 +84,18 @@ index 9cb32c8..47adcc4 100644
340
341 void nautilus_application_update_dbus_opened_locations (NautilusApplication *app);
342 diff --git a/src/nautilus-directory-async.c b/src/nautilus-directory-async.c
343-index 05a87e3..b519e20 100644
344+index 05a87e3..a1a27de 100644
345 --- a/src/nautilus-directory-async.c
346 +++ b/src/nautilus-directory-async.c
347-@@ -4383,6 +4383,8 @@ got_filesystem_info (FilesystemInfoState *state,
348+@@ -4383,6 +4383,7 @@ got_filesystem_info (FilesystemInfoState *state,
349 file->details->filesystem_readonly =
350 g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY);
351 filesystem_type = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE);
352-+ file->details->filesystem_remote =
353-+ g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE);
354++ file->details->filesystem_remote = g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE);
355 if (g_strcmp0 (eel_ref_str_peek (file->details->filesystem_type), filesystem_type) != 0)
356 {
357 eel_ref_str_unref (file->details->filesystem_type);
358-@@ -4465,7 +4467,8 @@ filesystem_info_start (NautilusDirectory *directory,
359+@@ -4465,7 +4466,8 @@ filesystem_info_start (NautilusDirectory *directory,
360 g_file_query_filesystem_info_async (location,
361 G_FILE_ATTRIBUTE_FILESYSTEM_READONLY ","
362 G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW ","
363@@ -116,6 +119,84 @@ index cb2bebb..5f6b209 100644
364
365 time_t trash_time; /* 0 is unknown */
366 time_t recency; /* 0 is unknown */
367+diff --git a/src/nautilus-file-utilities.c b/src/nautilus-file-utilities.c
368+index e79f37b..f8d8476 100644
369+--- a/src/nautilus-file-utilities.c
370++++ b/src/nautilus-file-utilities.c
371+@@ -1517,3 +1517,51 @@ nautilus_uri_to_native_uri (const gchar *uri)
372+ return NULL;
373+ }
374+
375++NautilusQueryRecursive
376++location_settings_search_get_recursive (void)
377++{
378++ switch (g_settings_get_enum (nautilus_preferences, "recursive-search"))
379++ {
380++ case NAUTILUS_SPEED_TRADEOFF_ALWAYS:
381++ {
382++ return NAUTILUS_QUERY_RECURSIVE_ALWAYS;
383++ }
384++ break;
385++
386++ case NAUTILUS_SPEED_TRADEOFF_LOCAL_ONLY:
387++ {
388++ return NAUTILUS_QUERY_RECURSIVE_LOCAL_ONLY;
389++ }
390++ break;
391++
392++ case NAUTILUS_SPEED_TRADEOFF_NEVER:
393++ {
394++ return NAUTILUS_QUERY_RECURSIVE_NEVER;
395++ }
396++ break;
397++ }
398++
399++ return NAUTILUS_QUERY_RECURSIVE_ALWAYS;
400++}
401++
402++NautilusQueryRecursive
403++location_settings_search_get_recursive_for_location (GFile *location)
404++{
405++ NautilusQueryRecursive recursive = location_settings_search_get_recursive ();
406++
407++ g_return_val_if_fail (location, recursive);
408++
409++ if (recursive == NAUTILUS_QUERY_RECURSIVE_LOCAL_ONLY)
410++ {
411++ g_autoptr (NautilusFile) file = nautilus_file_get_existing (location);
412++
413++ g_return_val_if_fail (file != NULL, recursive);
414++
415++ if (nautilus_file_is_remote (file))
416++ {
417++ recursive = NAUTILUS_QUERY_RECURSIVE_NEVER;
418++ }
419++ }
420++
421++ return recursive;
422++}
423+diff --git a/src/nautilus-file-utilities.h b/src/nautilus-file-utilities.h
424+index b567611..b165d63 100644
425+--- a/src/nautilus-file-utilities.h
426++++ b/src/nautilus-file-utilities.h
427+@@ -25,6 +25,9 @@
428+
429+ #include <gio/gio.h>
430+ #include <gtk/gtk.h>
431++#include <config.h>
432++
433++#include "nautilus-query.h"
434+
435+ #define NAUTILUS_DESKTOP_ID "org.gnome.Nautilus.desktop"
436+
437+@@ -127,4 +130,7 @@ GList * nautilus_file_list_from_uri_list (GList *uris);
438+
439+ gchar * nautilus_uri_to_native_uri (const gchar *uri);
440+
441++NautilusQueryRecursive location_settings_search_get_recursive (void);
442++NautilusQueryRecursive location_settings_search_get_recursive_for_location (GFile *location);
443++
444+ #endif /* NAUTILUS_FILE_UTILITIES_H */
445 diff --git a/src/nautilus-file.c b/src/nautilus-file.c
446 index 3f6a69f..63413a6 100644
447 --- a/src/nautilus-file.c
448@@ -176,108 +257,47 @@ index 5b319f9..54fdcb3 100644
449
450 /* Permissions. */
451 diff --git a/src/nautilus-query-editor.c b/src/nautilus-query-editor.c
452-index 94b9c4d..f5260c9 100644
453+index 94b9c4d..8398ad4 100644
454 --- a/src/nautilus-query-editor.c
455 +++ b/src/nautilus-query-editor.c
456-@@ -80,33 +80,47 @@ static void nautilus_query_editor_changed (NautilusQueryEditor *editor);
457-
458- G_DEFINE_TYPE_WITH_PRIVATE (NautilusQueryEditor, nautilus_query_editor, GTK_TYPE_SEARCH_BAR);
459-
460--static gboolean
461--settings_search_is_recursive (NautilusQueryEditor *editor)
462-+static NautilusQueryRecursive
463-+settings_search_get_recursive (void)
464-+{
465-+ switch (g_settings_get_enum (nautilus_preferences, "recursive-search"))
466-+ {
467-+ case NAUTILUS_SPEED_TRADEOFF_ALWAYS:
468-+ return NAUTILUS_QUERY_RECURSIVE_ALWAYS;
469-+ case NAUTILUS_SPEED_TRADEOFF_LOCAL_ONLY:
470-+ return NAUTILUS_QUERY_RECURSIVE_LOCAL_ONLY;
471-+ case NAUTILUS_SPEED_TRADEOFF_NEVER:
472-+ return NAUTILUS_QUERY_RECURSIVE_NEVER;
473-+ }
474-+
475-+ return NAUTILUS_QUERY_RECURSIVE_ALWAYS;
476-+}
477-+
478-+static NautilusQueryRecursive
479-+settings_search_get_recursive_for_location (NautilusQueryEditor *editor)
480- {
481- NautilusQueryEditorPrivate *priv;
482-- NautilusFile *file;
483-- gboolean recursive;
484-+ NautilusQueryRecursive recursive;
485-
486- priv = nautilus_query_editor_get_instance_private (editor);
487-+ recursive = settings_search_get_recursive ();
488-
489-- if (!priv->location)
490-+ if (priv->location == NULL)
491- {
492-- return TRUE;
493-+ return recursive;
494- }
495-
496-- file = nautilus_file_get (priv->location);
497--
498-- if (nautilus_file_is_remote (file))
499-+ if (recursive == NAUTILUS_QUERY_RECURSIVE_LOCAL_ONLY)
500- {
501-- recursive = g_settings_get_enum (nautilus_preferences, "recursive-search") == NAUTILUS_SPEED_TRADEOFF_ALWAYS;
502-- }
503-- else
504-- {
505-- recursive = g_settings_get_enum (nautilus_preferences, "recursive-search") == NAUTILUS_SPEED_TRADEOFF_LOCAL_ONLY ||
506-- g_settings_get_enum (nautilus_preferences, "recursive-search") == NAUTILUS_SPEED_TRADEOFF_ALWAYS;
507-- }
508-+ NautilusFile *file = nautilus_file_get (priv->location);
509-
510-- nautilus_file_unref (file);
511-+ if (nautilus_file_is_remote (file))
512-+ {
513-+ recursive = NAUTILUS_QUERY_RECURSIVE_NEVER;
514-+ }
515-+
516-+ nautilus_file_unref (file);
517-+ }
518-
519- return recursive;
520- }
521-@@ -144,12 +158,12 @@ update_information_label (NautilusQueryEditor *editor)
522+@@ -144,12 +144,12 @@ update_information_label (NautilusQueryEditor *editor)
523 fts_sensitive = FALSE;
524 }
525 else if (nautilus_file_is_remote (file) &&
526 - !settings_search_is_recursive (editor))
527-+ settings_search_get_recursive_for_location (editor) == NAUTILUS_QUERY_RECURSIVE_NEVER)
528++ location_settings_search_get_recursive_for_location (priv->location) == NAUTILUS_QUERY_RECURSIVE_NEVER)
529 {
530 label = _("Remote location — only searching the current folder");
531 fts_sensitive = FALSE;
532 }
533 - else if (!settings_search_is_recursive (editor))
534-+ else if (settings_search_get_recursive_for_location (editor) == NAUTILUS_QUERY_RECURSIVE_NEVER)
535++ else if (location_settings_search_get_recursive_for_location (priv->location) == NAUTILUS_QUERY_RECURSIVE_NEVER)
536 {
537 label = _("Only searching the current folder");
538 }
539-@@ -171,7 +185,7 @@ recursive_search_preferences_changed (GSettings *settings,
540+@@ -170,17 +170,18 @@ recursive_search_preferences_changed (GSettings *settings,
541+ gchar *key,
542 NautilusQueryEditor *editor)
543 {
544++
545 NautilusQueryEditorPrivate *priv;
546 - gboolean recursive;
547 + NautilusQueryRecursive recursive;
548
549 priv = nautilus_query_editor_get_instance_private (editor);
550
551-@@ -180,7 +194,7 @@ recursive_search_preferences_changed (GSettings *settings,
552+- if (!priv->location || !priv->query)
553++ if (!priv->query)
554+ {
555 return;
556 }
557
558 - recursive = settings_search_is_recursive (editor);
559-+ recursive = settings_search_get_recursive ();
560++ recursive = location_settings_search_get_recursive ();
561 if (recursive != nautilus_query_get_recursive (priv->query))
562 {
563 nautilus_query_set_recursive (priv->query, recursive);
564-@@ -382,7 +396,6 @@ create_query (NautilusQueryEditor *editor)
565+@@ -382,7 +383,6 @@ create_query (NautilusQueryEditor *editor)
566 NautilusQueryEditorPrivate *priv;
567 NautilusQuery *query;
568 NautilusFile *file;
569@@ -285,7 +305,7 @@ index 94b9c4d..f5260c9 100644
570 gboolean fts_enabled;
571
572 priv = nautilus_query_editor_get_instance_private (editor);
573-@@ -396,11 +409,9 @@ create_query (NautilusQueryEditor *editor)
574+@@ -396,11 +396,13 @@ create_query (NautilusQueryEditor *editor)
575
576 nautilus_query_set_search_content (query, fts_enabled);
577
578@@ -294,7 +314,11 @@ index 94b9c4d..f5260c9 100644
579 nautilus_query_set_text (query, gtk_entry_get_text (GTK_ENTRY (priv->entry)));
580 nautilus_query_set_location (query, priv->location);
581 - nautilus_query_set_recursive (query, recursive);
582-+ nautilus_query_set_recursive (query, settings_search_get_recursive ());
583++
584++ /* We only set the query using the global setting for recursivity here,
585++ * it's up to the search engine to check weather it can proceed with
586++ * deep search in the current directory or not. */
587++ nautilus_query_set_recursive (query, location_settings_search_get_recursive ());
588
589 nautilus_query_editor_set_query (editor, query);
590
591@@ -437,10 +461,10 @@ index ae710f3..d86fda2 100644
592 nautilus_search_provider_start (NAUTILUS_SEARCH_PROVIDER (self->engine));
593 diff --git a/src/nautilus-search-engine-private.h b/src/nautilus-search-engine-private.h
594 new file mode 100644
595-index 0000000..8e28ad7
596+index 0000000..e5f989f
597 --- /dev/null
598 +++ b/src/nautilus-search-engine-private.h
599-@@ -0,0 +1,34 @@
600+@@ -0,0 +1,31 @@
601 +/*
602 + * Copyright (C) 2018 Canonical Ltd.
603 + *
604@@ -462,8 +486,7 @@ index 0000000..8e28ad7
605 + *
606 + */
607 +
608-+#ifndef NAUTILUS_SEARCH_ENGINE_PRIVATE_H
609-+#define NAUTILUS_SEARCH_ENGINE_PRIVATE_H
610++#pragma once
611 +
612 +#include "nautilus-query.h"
613 +
614@@ -473,21 +496,20 @@ index 0000000..8e28ad7
615 +} NautilusSearchEngineType;
616 +
617 +gboolean is_recursive_search (NautilusSearchEngineType engine_type, NautilusQueryRecursive recursive, GFile *location);
618-+
619-+#endif /* NAUTILUS_SEARCH_ENGINE_PRIVATE_H */
620 diff --git a/src/nautilus-search-engine-simple.c b/src/nautilus-search-engine-simple.c
621-index 3ec9eb3..0c9ea81 100644
622+index 3ec9eb3..19a8616 100644
623 --- a/src/nautilus-search-engine-simple.c
624 +++ b/src/nautilus-search-engine-simple.c
625 @@ -20,9 +20,11 @@
626 */
627
628 #include <config.h>
629++#include "nautilus-search-engine-simple.h"
630 +
631++#include "nautilus-search-engine-private.h"
632 #include "nautilus-search-hit.h"
633 #include "nautilus-search-provider.h"
634- #include "nautilus-search-engine-simple.h"
635-+#include "nautilus-search-engine-private.h"
636+-#include "nautilus-search-engine-simple.h"
637 #include "nautilus-ui-utilities.h"
638 #define DEBUG_FLAG NAUTILUS_DEBUG_SEARCH
639 #include "nautilus-debug.h"
640@@ -647,8 +669,21 @@ index 3ec9eb3..0c9ea81 100644
641
642 /**
643 * NautilusSearchEngine::running:
644+diff --git a/src/nautilus-search-engine-simple.h b/src/nautilus-search-engine-simple.h
645+index dd6953f..d50b36d 100644
646+--- a/src/nautilus-search-engine-simple.h
647++++ b/src/nautilus-search-engine-simple.h
648+@@ -22,6 +22,8 @@
649+ #ifndef NAUTILUS_SEARCH_ENGINE_SIMPLE_H
650+ #define NAUTILUS_SEARCH_ENGINE_SIMPLE_H
651+
652++#include <glib-object.h>
653++
654+ G_BEGIN_DECLS
655+
656+ #define NAUTILUS_TYPE_SEARCH_ENGINE_SIMPLE (nautilus_search_engine_simple_get_type ())
657 diff --git a/src/nautilus-search-engine-tracker.c b/src/nautilus-search-engine-tracker.c
658-index 8218ea3..98f3c79 100644
659+index 4c917dd..8885ca4 100644
660 --- a/src/nautilus-search-engine-tracker.c
661 +++ b/src/nautilus-search-engine-tracker.c
662 @@ -22,7 +22,7 @@
663@@ -660,7 +695,7 @@ index 8218ea3..98f3c79 100644
664 #include "nautilus-search-hit.h"
665 #include "nautilus-search-provider.h"
666 #define DEBUG_FLAG NAUTILUS_DEBUG_SEARCH
667-@@ -296,7 +296,6 @@ nautilus_search_engine_tracker_start (NautilusSearchProvider *provider)
668+@@ -295,7 +295,6 @@ nautilus_search_engine_tracker_start (NautilusSearchProvider *provider)
669 GString *sparql;
670 GList *mimetypes, *l;
671 gint mime_count;
672@@ -668,7 +703,7 @@ index 8218ea3..98f3c79 100644
673 GPtrArray *date_range;
674
675 tracker = NAUTILUS_SEARCH_ENGINE_TRACKER (provider);
676-@@ -325,10 +324,6 @@ nautilus_search_engine_tracker_start (NautilusSearchProvider *provider)
677+@@ -317,10 +316,6 @@ nautilus_search_engine_tracker_start (NautilusSearchProvider *provider)
678 return;
679 }
680
681@@ -679,7 +714,7 @@ index 8218ea3..98f3c79 100644
682 tracker->fts_enabled = nautilus_query_get_search_content (tracker->query);
683
684 query_text = nautilus_query_get_text (tracker->query);
685-@@ -476,16 +471,21 @@ static void
686+@@ -468,13 +463,18 @@ static void
687 nautilus_search_engine_tracker_set_query (NautilusSearchProvider *provider,
688 NautilusQuery *query)
689 {
690@@ -689,9 +724,6 @@ index 8218ea3..98f3c79 100644
691 tracker = NAUTILUS_SEARCH_ENGINE_TRACKER (provider);
692 + location = nautilus_query_get_location (query);
693
694- if (!tracker->available)
695- return;
696-
697 - g_object_ref (query);
698 g_clear_object (&tracker->query);
699 - tracker->query = query;
700@@ -704,10 +736,10 @@ index 8218ea3..98f3c79 100644
701
702 static gboolean
703 diff --git a/src/nautilus-search-engine.c b/src/nautilus-search-engine.c
704-index 209bd4f..a545160 100644
705+index 209bd4f..3a0c9d4 100644
706 --- a/src/nautilus-search-engine.c
707 +++ b/src/nautilus-search-engine.c
708-@@ -20,12 +20,14 @@
709+@@ -20,14 +20,16 @@
710 */
711
712 #include <config.h>
713@@ -715,17 +747,20 @@ index 209bd4f..a545160 100644
714 -#include <glib/gi18n.h>
715 -#include "nautilus-search-provider.h"
716 #include "nautilus-search-engine.h"
717- #include "nautilus-search-engine-simple.h"
718+-#include "nautilus-search-engine-simple.h"
719 +#include "nautilus-search-engine-private.h"
720 +
721++#include "nautilus-file.h"
722 #include "nautilus-search-engine-model.h"
723 +#include "nautilus-search-provider.h"
724-+#include "nautilus-file.h"
725 +#include <glib/gi18n.h>
726 #define DEBUG_FLAG NAUTILUS_DEBUG_SEARCH
727 #include "nautilus-debug.h"
728++#include "nautilus-search-engine-simple.h"
729 #include "nautilus-search-engine-tracker.h"
730-@@ -417,12 +419,30 @@ nautilus_search_engine_get_model_provider (NautilusSearchEngine *engine)
731+
732+ typedef struct
733+@@ -417,12 +419,28 @@ nautilus_search_engine_get_model_provider (NautilusSearchEngine *engine)
734 return priv->model;
735 }
736
737@@ -751,10 +786,8 @@ index 209bd4f..a545160 100644
738 +
739 + case NAUTILUS_QUERY_RECURSIVE_LOCAL_ONLY:
740 + {
741-+ NautilusFile *file = nautilus_file_get (location);
742-+ gboolean remote = !nautilus_file_is_remote (file);
743-+ nautilus_file_unref (file);
744-+ return remote;
745++ g_autoptr (NautilusFile) file = nautilus_file_get (location);
746++ return !nautilus_file_is_remote (file);
747 + }
748 + }
749
750@@ -775,10 +808,10 @@ index 0416e83..435908a 100644
751 G_END_DECLS
752
753 diff --git a/src/nautilus-shell-search-provider.c b/src/nautilus-shell-search-provider.c
754-index cdadc08..b95babf 100644
755+index cdadc08..ffc2b7f 100644
756 --- a/src/nautilus-shell-search-provider.c
757 +++ b/src/nautilus-shell-search-provider.c
758-@@ -426,15 +426,32 @@ search_add_volumes_and_bookmarks (PendingSearch *search)
759+@@ -426,15 +426,30 @@ search_add_volumes_and_bookmarks (PendingSearch *search)
760 g_object_unref (volume_monitor);
761 }
762
763@@ -793,8 +826,6 @@ index cdadc08..b95babf 100644
764 + home = g_file_new_for_path (g_get_home_dir ());
765 +
766 + query = nautilus_query_new ();
767-+ nautilus_query_set_show_hidden_files (query, FALSE);
768-+ nautilus_query_set_recursive (query, NAUTILUS_QUERY_RECURSIVE_INDEXED_ONLY);
769 + nautilus_query_set_text (query, terms_joined);
770 + nautilus_query_set_location (query, home);
771 +
772@@ -813,7 +844,7 @@ index cdadc08..b95babf 100644
773
774 cancel_current_search (self);
775
776-@@ -446,13 +463,7 @@ execute_search (NautilusShellSearchProvider *self,
777+@@ -446,13 +461,9 @@ execute_search (NautilusShellSearchProvider *self,
778 return;
779 }
780
781@@ -821,10 +852,11 @@ index cdadc08..b95babf 100644
782 - home = g_file_new_for_path (g_get_home_dir ());
783 -
784 - query = nautilus_query_new ();
785-- nautilus_query_set_show_hidden_files (query, FALSE);
786++ query = shell_query_new (terms);
787++ nautilus_query_set_recursive (query, NAUTILUS_QUERY_RECURSIVE_INDEXED_ONLY);
788+ nautilus_query_set_show_hidden_files (query, FALSE);
789 - nautilus_query_set_text (query, terms_joined);
790 - nautilus_query_set_location (query, home);
791-+ query = shell_query_new (terms);
792
793 pending_search = g_slice_new0 (PendingSearch);
794 pending_search->invocation = g_object_ref (invocation);
795@@ -838,7 +870,7 @@ index cdadc08..b95babf 100644
796 }
797
798 static gboolean
799-@@ -713,13 +721,9 @@ handle_launch_search (NautilusShellSearchProvider2 *skeleton,
800+@@ -713,13 +721,23 @@ handle_launch_search (NautilusShellSearchProvider2 *skeleton,
801 gpointer user_data)
802 {
803 GApplication *app = g_application_get_default ();
804@@ -847,7 +879,20 @@ index cdadc08..b95babf 100644
805 + g_autoptr (NautilusQuery) query = shell_query_new (terms);
806
807 - nautilus_application_search (NAUTILUS_APPLICATION (app), uri, string);
808--
809++ if (location_settings_search_get_recursive () == NAUTILUS_QUERY_RECURSIVE_NEVER)
810++ {
811++ /*
812++ * If no recursive search is enabled, we still want to be able to
813++ * show the same results we presented in the overview when nautilus
814++ * is explicitly launched to access to more results, and thus we perform
815++ * a query showing results coming from index-based search engines.
816++ * Otherwise we just respect the user settings.
817++ * See: https://gitlab.gnome.org/GNOME/nautilus/merge_requests/249
818++ */
819++ nautilus_query_set_recursive (query,
820++ NAUTILUS_QUERY_RECURSIVE_INDEXED_ONLY);
821++ }
822+
823 - g_free (string);
824 - g_free (uri);
825 + nautilus_application_search (NAUTILUS_APPLICATION (app), query);
826diff --git a/debian/patches/series b/debian/patches/series
827index 09e8099..41a35d1 100644
828--- a/debian/patches/series
829+++ b/debian/patches/series
830@@ -16,9 +16,11 @@ ubuntu_backspace_behaviour.patch
831 0001-Respect-gtk-dialogs-use-header-for-all-dialogs.patch
832 #Needs updating
833 #16_unity_new_documents.patch
834-0015-tracker-search-engine-don-t-start-it-if-not-availabl.patch
835 query-add-recursive-flags-and-use-it-in-search-engines.patch
836+0015-tracker-search-engine-don-t-start-it-if-not-availabl.patch
837 0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch
838 0017-recent-add-function-to-update-manager-on-file-rename.patch
839 0018-search-engine-add-locate-based-search-engine.patch
840 appstream-compulsory.patch
841+nautilusgtkplacesview-show-error-if-volume-is-not-mo.patch
842+file-view-Always-unset-pending_selection-after-freeing-it.patch

Subscribers

People subscribed via source and target branches