Merge ~3v1n0/ubuntu/+source/nautilus:ubuntu/bionic-xubuntu-cancel-search into ~ubuntu-desktop/ubuntu/+source/nautilus:ubuntu/bionic

Proposed by Marco Trevisan (Treviño)
Status: Superseded
Proposed branch: ~3v1n0/ubuntu/+source/nautilus:ubuntu/bionic-xubuntu-cancel-search
Merge into: ~ubuntu-desktop/ubuntu/+source/nautilus:ubuntu/bionic
Diff against target: 310 lines (+240/-8)
4 files modified
debian/changelog (+16/-0)
debian/patches/0015-tracker-search-engine-don-t-start-it-if-not-availabl.patch (+10/-8)
debian/patches/series (+1/-0)
debian/patches/ubuntu/shell-search-provider-implement-XUbuntuCancel-to-request-.patch (+213/-0)
Reviewer Review Type Date Requested Status
Ubuntu Desktop Pending
Review via email: mp+354346@code.launchpad.net

This proposal has been superseded by a proposal from 2019-10-25.

To post a comment you must log in.
2900d50... by Sebastien Bacher

Import Debian changes 1:3.26.4-0~ubuntu18.04.4

nautilus (1:3.26.4-0~ubuntu18.04.4) bionic; urgency=medium

  * d/p/0015-tracker-search-engine-don-t-start-it-if-not-availabl.patch:
    - update the patch to fix a logic error in the code which made tracker
      never being used even if it's installed (lp: #1767817)

fe34d5e... by Marco Trevisan (Treviño)

Update changelog

b56b8e9... by Marco Trevisan (Treviño)

Finalise changelog

Unmerged commits

b56b8e9... by Marco Trevisan (Treviño)

Finalise changelog

fe34d5e... by Marco Trevisan (Treviño)

Update changelog

c529d31... by Marco Trevisan (Treviño)

d/p/ubuntu/shell-search-provider-implement-XUbuntuCancel-to-request-.patch

shell-search-provider: implement XUbuntuCancel to request search cancellation

Stop search and Metadata fetching on XUbuntuCancel dbus method call.
Only allow this if the caller is the same who triggered the actual event.

Fixes LP: #1756826

2900d50... by Sebastien Bacher

Import Debian changes 1:3.26.4-0~ubuntu18.04.4

nautilus (1:3.26.4-0~ubuntu18.04.4) bionic; urgency=medium

  * d/p/0015-tracker-search-engine-don-t-start-it-if-not-availabl.patch:
    - update the patch to fix a logic error in the code which made tracker
      never being used even if it's installed (lp: #1767817)

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 17553e8..abea57d 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,19 @@
6+nautilus (1:3.26.4-0~ubuntu18.04.5) bionic; urgency=medium
7+
8+ * d/p/ubuntu/shell-search-provider-implement-XUbuntuCancel-to-request-.patch:
9+ - shell-search-provider: implement XUbuntuCancel to request pending search
10+ cancellation from gnome-shell (LP: #1756826)
11+
12+ -- Marco Trevisan (Treviño) <marco@ubuntu.com> Fri, 25 Oct 2019 05:38:04 +0200
13+
14+nautilus (1:3.26.4-0~ubuntu18.04.4) bionic; urgency=medium
15+
16+ * d/p/0015-tracker-search-engine-don-t-start-it-if-not-availabl.patch:
17+ - update the patch to fix a logic error in the code which made tracker
18+ never being used even if it's installed (lp: #1767817)
19+
20+ -- Sebastien Bacher <seb128@ubuntu.com> Wed, 06 Mar 2019 17:31:08 +0100
21+
22 nautilus (1:3.26.4-0~ubuntu18.04.3) bionic; urgency=medium
23
24 * debian/patches/git_captions_order.patch
25diff --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
26index 4cc55ed..d24e83c 100644
27--- a/debian/patches/0015-tracker-search-engine-don-t-start-it-if-not-availabl.patch
28+++ b/debian/patches/0015-tracker-search-engine-don-t-start-it-if-not-availabl.patch
29@@ -6,10 +6,10 @@ Subject: tracker-search-engine: don't start it if not available on system
30 src/nautilus-search-engine-tracker.c | 24 ++++++++++++++++++++----
31 1 file changed, 20 insertions(+), 4 deletions(-)
32
33-diff --git a/src/nautilus-search-engine-tracker.c b/src/nautilus-search-engine-tracker.c
34-index 8885ca4..050716d 100644
35---- a/src/nautilus-search-engine-tracker.c
36-+++ b/src/nautilus-search-engine-tracker.c
37+Index: nautilus-3.26.4/src/nautilus-search-engine-tracker.c
38+===================================================================
39+--- nautilus-3.26.4.orig/src/nautilus-search-engine-tracker.c
40++++ nautilus-3.26.4/src/nautilus-search-engine-tracker.c
41 @@ -42,6 +42,7 @@ struct _NautilusSearchEngineTracker
42 gboolean query_pending;
43 GQueue *hits_pending;
44@@ -18,7 +18,7 @@ index 8885ca4..050716d 100644
45 gboolean recursive;
46 gboolean fts_enabled;
47
48-@@ -304,8 +305,15 @@ nautilus_search_engine_tracker_start (NautilusSearchProvider *provider)
49+@@ -304,8 +305,15 @@ nautilus_search_engine_tracker_start (Na
50 return;
51 }
52
53@@ -35,7 +35,7 @@ index 8885ca4..050716d 100644
54 tracker->query_pending = TRUE;
55
56 g_object_notify (G_OBJECT (provider), "running");
57-@@ -471,6 +479,9 @@ nautilus_search_engine_tracker_set_query (NautilusSearchProvider *provider,
58+@@ -471,6 +479,9 @@ nautilus_search_engine_tracker_set_query
59
60 g_clear_object (&tracker->query);
61
62@@ -45,7 +45,7 @@ index 8885ca4..050716d 100644
63 tracker->query = g_object_ref (query);
64 tracker->recursive = is_recursive_search (NAUTILUS_SEARCH_ENGINE_TYPE_INDEXED,
65 nautilus_query_get_recursive (query),
66-@@ -539,16 +550,21 @@ static void
67+@@ -539,16 +550,23 @@ static void
68 nautilus_search_engine_tracker_init (NautilusSearchEngineTracker *engine)
69 {
70 GError *error = NULL;
71@@ -54,8 +54,10 @@ index 8885ca4..050716d 100644
72 - engine->hits_pending = g_queue_new ();
73 -
74 - engine->connection = tracker_sparql_connection_get (NULL, &error);
75-+ if (!tracker_available)
76++ if (tracker_available)
77 + engine->connection = tracker_sparql_connection_get (NULL, &error);
78++ else
79++ return;
80
81 if (error)
82 {
83diff --git a/debian/patches/series b/debian/patches/series
84index 9417da4..3ec0d73 100644
85--- a/debian/patches/series
86+++ b/debian/patches/series
87@@ -26,3 +26,4 @@ appstream-compulsory.patch
88 nautilusgtkplacesview-show-error-if-volume-is-not-mo.patch
89 file-view-Always-unset-pending_selection-after-freeing-it.patch
90 git_captions_order.patch
91+ubuntu/shell-search-provider-implement-XUbuntuCancel-to-request-.patch
92diff --git a/debian/patches/ubuntu/shell-search-provider-implement-XUbuntuCancel-to-request-.patch b/debian/patches/ubuntu/shell-search-provider-implement-XUbuntuCancel-to-request-.patch
93new file mode 100644
94index 0000000..85fa0c2
95--- /dev/null
96+++ b/debian/patches/ubuntu/shell-search-provider-implement-XUbuntuCancel-to-request-.patch
97@@ -0,0 +1,213 @@
98+From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
99+Date: Tue, 28 Aug 2018 01:44:49 +0200
100+Subject: shell-search-provider: implement XUbuntuCancel to request search
101+ cancellation
102+
103+Stop search and Metadata fetching on XUbuntuCancel dbus method call.
104+Only allow this if the caller is the same who triggered the actual event.
105+
106+Bug-GNOME: https://gitlab.gnome.org/GNOME/gnome-shell/issues/183
107+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/bionic/+source/nautilus/+bug/1756826
108+Forwarded: not-needed
109+---
110+ data/shell-search-provider-dbus-interfaces.xml | 1 +
111+ src/nautilus-shell-search-provider.c | 96 +++++++++++++++++++++++---
112+ 2 files changed, 88 insertions(+), 9 deletions(-)
113+
114+diff --git a/data/shell-search-provider-dbus-interfaces.xml b/data/shell-search-provider-dbus-interfaces.xml
115+index f6840e2..4529c1e 100644
116+--- a/data/shell-search-provider-dbus-interfaces.xml
117++++ b/data/shell-search-provider-dbus-interfaces.xml
118+@@ -40,5 +40,6 @@
119+ <arg type='as' name='Terms' direction='in' />
120+ <arg type='u' name='Timestamp' direction='in' />
121+ </method>
122++ <method name = 'XUbuntuCancel' />
123+ </interface>
124+ </node>
125+diff --git a/src/nautilus-shell-search-provider.c b/src/nautilus-shell-search-provider.c
126+index ffc2b7f..58864d6 100644
127+--- a/src/nautilus-shell-search-provider.c
128++++ b/src/nautilus-shell-search-provider.c
129+@@ -60,6 +60,7 @@ struct _NautilusShellSearchProvider
130+
131+ PendingSearch *current_search;
132+
133++ GList *metas_requests;
134+ GHashTable *metas_cache;
135+ };
136+
137+@@ -143,11 +144,25 @@ pending_search_finish (PendingSearch *search,
138+ }
139+
140+ static void
141+-cancel_current_search (NautilusShellSearchProvider *self)
142++cancel_current_search (NautilusShellSearchProvider *self,
143++ gboolean ignore_partial_results)
144+ {
145+- if (self->current_search != NULL)
146++ PendingSearch *search = self->current_search;
147++
148++ if (search != NULL)
149+ {
150+- nautilus_search_provider_stop (NAUTILUS_SEARCH_PROVIDER (self->current_search->engine));
151++ g_debug ("*** Cancel current search");
152++
153++ nautilus_search_provider_stop (NAUTILUS_SEARCH_PROVIDER (search->engine));
154++
155++ if (ignore_partial_results)
156++ {
157++ g_signal_handlers_disconnect_by_data (G_OBJECT (search->engine),
158++ search);
159++
160++ pending_search_finish (search, search->invocation,
161++ g_variant_new ("(as)", NULL));
162++ }
163+ }
164+ }
165+
166+@@ -451,7 +466,7 @@ execute_search (NautilusShellSearchProvider *self,
167+ NautilusQuery *query;
168+ PendingSearch *pending_search;
169+
170+- cancel_current_search (self);
171++ cancel_current_search (self, FALSE);
172+
173+ /* don't attempt searches for a single character */
174+ if (g_strv_length (terms) == 1 &&
175+@@ -524,6 +539,7 @@ typedef struct
176+ NautilusShellSearchProvider *self;
177+
178+ gint64 start_time;
179++ NautilusFileListHandle *handle;
180+ GDBusMethodInvocation *invocation;
181+
182+ gchar **uris;
183+@@ -532,6 +548,8 @@ typedef struct
184+ static void
185+ result_metas_data_free (ResultMetasData *data)
186+ {
187++ g_clear_pointer (&data->handle, nautilus_file_list_cancel_call_when_ready);
188++
189+ g_clear_object (&data->self);
190+ g_clear_object (&data->invocation);
191+ g_strfreev (data->uris);
192+@@ -549,7 +567,7 @@ result_metas_return_from_cache (ResultMetasData *data)
193+
194+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("aa{sv}"));
195+
196+- for (idx = 0; data->uris[idx] != NULL; idx++)
197++ for (idx = 0; data->uris && data->uris[idx] != NULL; idx++)
198+ {
199+ meta = g_hash_table_lookup (data->self->metas_cache,
200+ data->uris[idx]);
201+@@ -564,6 +582,37 @@ result_metas_return_from_cache (ResultMetasData *data)
202+ g_variant_new ("(aa{sv})", &builder));
203+ }
204+
205++static void
206++cancel_result_meta_requests (NautilusShellSearchProvider *self,
207++ GDBusMethodInvocation *invocation)
208++{
209++ GList *l;
210++ GList *to_remove = NULL;
211++
212++ g_debug ("*** Cancel Results Meta requests");
213++
214++ for (l = self->metas_requests; l; l = l->next)
215++ {
216++ ResultMetasData *data = l->data;
217++
218++ if (invocation == NULL ||
219++ g_strcmp0 (g_dbus_method_invocation_get_sender (data->invocation),
220++ g_dbus_method_invocation_get_sender (invocation)) == 0)
221++ {
222++ g_clear_pointer (&data->uris, g_strfreev);
223++ result_metas_return_from_cache (data);
224++ to_remove = g_list_prepend (to_remove, data);
225++ }
226++ }
227++
228++ for (l = to_remove; l; l = l->next)
229++ {
230++ self->metas_requests = g_list_remove (self->metas_requests, l->data);
231++ }
232++
233++ g_list_free (to_remove);
234++}
235++
236+ static void
237+ result_list_attributes_ready_cb (GList *file_list,
238+ gpointer user_data)
239+@@ -639,6 +688,9 @@ result_list_attributes_ready_cb (GList *file_list,
240+ g_free (uri);
241+ }
242+
243++ data->handle = NULL;
244++ data->self->metas_requests = g_list_remove (data->self->metas_requests, data);
245++
246+ result_metas_return_from_cache (data);
247+ result_metas_data_free (data);
248+ }
249+@@ -682,9 +734,10 @@ handle_get_result_metas (NautilusShellSearchProvider2 *skeleton,
250+
251+ nautilus_file_list_call_when_ready (missing_files,
252+ NAUTILUS_FILE_ATTRIBUTES_FOR_ICON,
253+- NULL,
254++ &data->handle,
255+ result_list_attributes_ready_cb,
256+ data);
257++ self->metas_requests = g_list_prepend (self->metas_requests, data);
258+ nautilus_file_list_free (missing_files);
259+ return TRUE;
260+ }
261+@@ -743,14 +796,37 @@ handle_launch_search (NautilusShellSearchProvider2 *skeleton,
262+ return TRUE;
263+ }
264+
265+-static void
266+-search_provider_dispose (GObject *obj)
267++static gboolean
268++handle_xubuntu_cancel (NautilusShellSearchProvider2 *skeleton,
269++ GDBusMethodInvocation *invocation,
270++ gpointer user_data)
271+ {
272++ NautilusShellSearchProvider *self = user_data;
273++ PendingSearch *search = self->current_search;
274++
275++ g_debug ("*** XUbuntuCancel called");
276++
277++ if (search != NULL &&
278++ g_strcmp0 (g_dbus_method_invocation_get_sender (search->invocation),
279++ g_dbus_method_invocation_get_sender (invocation)) == 0)
280++ {
281++ cancel_current_search (self, TRUE);
282++ }
283++
284++ cancel_result_meta_requests (self, invocation);
285++
286++ nautilus_shell_search_provider2_complete_xubuntu_cancel (skeleton, invocation);
287++
288++ return TRUE;
289++}
290++
291++ static void search_provider_dispose(GObject * obj) {
292+ NautilusShellSearchProvider *self = NAUTILUS_SHELL_SEARCH_PROVIDER (obj);
293+
294+ g_clear_object (&self->skeleton);
295+ g_hash_table_destroy (self->metas_cache);
296+- cancel_current_search (self);
297++ cancel_current_search (self, TRUE);
298++ cancel_result_meta_requests (self, NULL);
299+
300+ G_OBJECT_CLASS (nautilus_shell_search_provider_parent_class)->dispose (obj);
301+ }
302+@@ -773,6 +849,8 @@ nautilus_shell_search_provider_init (NautilusShellSearchProvider *self)
303+ G_CALLBACK (handle_activate_result), self);
304+ g_signal_connect (self->skeleton, "handle-launch-search",
305+ G_CALLBACK (handle_launch_search), self);
306++ g_signal_connect (self->skeleton, "handle-xubuntu-cancel",
307++ G_CALLBACK (handle_xubuntu_cancel), self);
308+ }
309+
310+ static void

Subscribers

People subscribed via source and target branches