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

Subscribers

People subscribed via source and target branches