Merge ~3v1n0/ubuntu/+source/gnome-software:ubuntu/bionic into ~ubuntu-desktop/ubuntu/+source/gnome-software:ubuntu/bionic

Proposed by Marco Trevisan (Treviño)
Status: Merged
Merged at revision: 7c1644e3c3a724489681b479e1559cd5481f93ad
Proposed branch: ~3v1n0/ubuntu/+source/gnome-software:ubuntu/bionic
Merge into: ~ubuntu-desktop/ubuntu/+source/gnome-software:ubuntu/bionic
Diff against target: 203 lines (+181/-0)
3 files modified
debian/changelog (+8/-0)
debian/patches/0036-shell-search-provider-implement-XUbuntuCancel.patch (+172/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Robert Ancell Approve
Review via email: mp+358489@code.launchpad.net

This proposal supersedes a proposal from 2018-11-08.

To post a comment you must log in.
Revision history for this message
Robert Ancell (robert-ancell) :
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 e42eb5a..46ee144 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,11 @@
6+gnome-software (3.28.1-0ubuntu4.18.04.14) bionic; urgency=medium
7+
8+ * debian/patches/0026-shell-search-provider-implement-XUbuntuCancel.patch
9+ - implement XUbuntuCancel to request pending search cancellation from
10+ gnome-shell (LP: #1756826)
11+
12+ -- Marco Trevisan (Treviño) <marco@ubuntu.com> Thu, 21 Nov 2019 14:06:35 +0100
13+
14 gnome-software (3.28.1-0ubuntu4.18.04.13) bionic; urgency=medium
15
16 * debian/patches/0033-snap-Use-new-banner-media.patch:
17diff --git a/debian/patches/0036-shell-search-provider-implement-XUbuntuCancel.patch b/debian/patches/0036-shell-search-provider-implement-XUbuntuCancel.patch
18new file mode 100644
19index 0000000..95262a8
20--- /dev/null
21+++ b/debian/patches/0036-shell-search-provider-implement-XUbuntuCancel.patch
22@@ -0,0 +1,172 @@
23+From: Andrea Azzarone <andrea.azzarone@canonical.com>
24+Date: Fri, 7 Sep 2018 19:58:00 +0200
25+Subject: [PATCH 24/26] shell-search-provider: implement XUbuntuCancel
26+
27+Implement XUbuntuCancel to request search cancellation. This is used by
28+gnome-shell to cancel the current search e.g. if the search overview is
29+closed.
30+---
31+ src/gs-shell-search-provider.c | 74 +++++++++++++++++++++------
32+ src/shell-search-provider-dbus-interfaces.xml | 1 +
33+ 2 files changed, 60 insertions(+), 15 deletions(-)
34+
35+diff --git a/src/gs-shell-search-provider.c b/src/gs-shell-search-provider.c
36+index 51aa5ef..42aada2 100644
37+--- a/src/gs-shell-search-provider.c
38++++ b/src/gs-shell-search-provider.c
39+@@ -45,6 +45,8 @@ struct _GsShellSearchProvider {
40+ GsPluginLoader *plugin_loader;
41+ GCancellable *cancellable;
42+
43++ PendingSearch *current_search;
44++
45+ GHashTable *metas_cache;
46+ GsAppList *search_results;
47+ };
48+@@ -58,6 +60,17 @@ pending_search_free (PendingSearch *search)
49+ g_slice_free (PendingSearch, search);
50+ }
51+
52++static void
53++cancel_current_search (GsShellSearchProvider *self)
54++{
55++ g_debug ("*** Cancel current search");
56++
57++ if (self->cancellable != NULL) {
58++ g_cancellable_cancel (self->cancellable);
59++ g_clear_object (&self->cancellable);
60++ }
61++}
62++
63+ static gint
64+ search_sort_by_kudo_cb (GsApp *app1, GsApp *app2, gpointer user_data)
65+ {
66+@@ -71,6 +84,23 @@ search_sort_by_kudo_cb (GsApp *app1, GsApp *app2, gpointer user_data)
67+ return 0;
68+ }
69+
70++static void
71++pending_search_finish (PendingSearch *search,
72++ GDBusMethodInvocation *invocation,
73++ GVariant *result)
74++{
75++ GsShellSearchProvider *self = search->provider;
76++
77++ g_dbus_method_invocation_return_value (invocation, result);
78++
79++ if (search == self->current_search) {
80++ self->current_search = NULL;
81++ }
82++
83++ pending_search_free (search);
84++ g_application_release (g_application_get_default ());
85++}
86++
87+ static void
88+ search_done_cb (GObject *source,
89+ GAsyncResult *res,
90+@@ -87,10 +117,9 @@ search_done_cb (GObject *source,
91+
92+ list = gs_plugin_loader_job_process_finish (self->plugin_loader, res, NULL);
93+ if (list == NULL) {
94+- g_dbus_method_invocation_return_value (search->invocation, g_variant_new ("(as)", NULL));
95+- pending_search_free (search);
96+- g_application_release (g_application_get_default ());
97+- return;
98++ pending_search_finish (search, search->invocation,
99++ g_variant_new ("(as)", NULL));
100++ return;
101+ }
102+
103+ /* sort by kudos, as there is no ratings data by default */
104+@@ -106,10 +135,8 @@ search_done_cb (GObject *source,
105+ /* cache this in case we need the app in GetResultMetas */
106+ gs_app_list_add (self->search_results, app);
107+ }
108+- g_dbus_method_invocation_return_value (search->invocation, g_variant_new ("(as)", &builder));
109+
110+- pending_search_free (search);
111+- g_application_release (g_application_get_default ());
112++ pending_search_finish (search, search->invocation, g_variant_new ("(as)", &builder));
113+ }
114+
115+ static gchar *
116+@@ -167,10 +194,7 @@ execute_search (GsShellSearchProvider *self,
117+
118+ value = g_strjoinv (" ", terms);
119+
120+- if (self->cancellable != NULL) {
121+- g_cancellable_cancel (self->cancellable);
122+- g_clear_object (&self->cancellable);
123+- }
124++ cancel_current_search (self);
125+
126+ /* don't attempt searches for a single character */
127+ if (g_strv_length (terms) == 1 &&
128+@@ -183,6 +207,7 @@ execute_search (GsShellSearchProvider *self,
129+ pending_search->provider = self;
130+ pending_search->invocation = g_object_ref (invocation);
131+
132++ self->current_search = pending_search;
133+ g_application_hold (g_application_get_default ());
134+ self->cancellable = g_cancellable_new ();
135+
136+@@ -335,6 +360,26 @@ handle_launch_search (GsShellSearchProvider2 *skeleton,
137+ return TRUE;
138+ }
139+
140++static gboolean
141++handle_xubuntu_cancel (GsShellSearchProvider2 *skeleton,
142++ GDBusMethodInvocation *invocation,
143++ gpointer user_data)
144++{
145++ GsShellSearchProvider *self = GS_SHELL_SEARCH_PROVIDER (user_data);
146++
147++ g_debug ("*** XUbuntuCancel called");
148++
149++ if (self->current_search != NULL &&
150++ g_strcmp0 (g_dbus_method_invocation_get_sender (self->current_search->invocation),
151++ g_dbus_method_invocation_get_sender (invocation)) == 0) {
152++ cancel_current_search (self);
153++ }
154++
155++ gs_shell_search_provider2_complete_xubuntu_cancel (skeleton, invocation);
156++
157++ return TRUE;
158++}
159++
160+ gboolean
161+ gs_shell_search_provider_register (GsShellSearchProvider *self,
162+ GDBusConnection *connection,
163+@@ -356,10 +401,7 @@ search_provider_dispose (GObject *obj)
164+ {
165+ GsShellSearchProvider *self = GS_SHELL_SEARCH_PROVIDER (obj);
166+
167+- if (self->cancellable != NULL) {
168+- g_cancellable_cancel (self->cancellable);
169+- g_clear_object (&self->cancellable);
170+- }
171++ cancel_current_search (self);
172+
173+ if (self->metas_cache != NULL) {
174+ g_hash_table_destroy (self->metas_cache);
175+@@ -394,6 +436,8 @@ gs_shell_search_provider_init (GsShellSearchProvider *self)
176+ G_CALLBACK (handle_activate_result), self);
177+ g_signal_connect (self->skeleton, "handle-launch-search",
178+ G_CALLBACK (handle_launch_search), self);
179++ g_signal_connect (self->skeleton, "handle-xubuntu-cancel",
180++ G_CALLBACK (handle_xubuntu_cancel), self);
181+ }
182+
183+ static void
184+diff --git a/src/shell-search-provider-dbus-interfaces.xml b/src/shell-search-provider-dbus-interfaces.xml
185+index f6840e2..4529c1e 100644
186+--- a/src/shell-search-provider-dbus-interfaces.xml
187++++ b/src/shell-search-provider-dbus-interfaces.xml
188+@@ -40,5 +40,6 @@
189+ <arg type='as' name='Terms' direction='in' />
190+ <arg type='u' name='Timestamp' direction='in' />
191+ </method>
192++ <method name = 'XUbuntuCancel' />
193+ </interface>
194+ </node>
195diff --git a/debian/patches/series b/debian/patches/series
196index 06b1964..03f710f 100644
197--- a/debian/patches/series
198+++ b/debian/patches/series
199@@ -44,3 +44,4 @@
200 0033-snap-Use-new-banner-media.patch
201 0034-Use-plugin-API-to-launch-apps-from-install-notificat.patch
202 0035-snap-Allow-snaps-to-be-shown-by-AppStream-ID.patch
203+0036-shell-search-provider-implement-XUbuntuCancel.patch

Subscribers

People subscribed via source and target branches