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