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

Proposed by Marco Trevisan (Treviño) on 2018-11-08
Status: Needs review
Proposed branch: ~3v1n0/ubuntu/+source/gnome-software:ubuntu/bionic
Merge into: ~ubuntu-desktop/ubuntu/+source/gnome-software:ubuntu/bionic
Diff against target: 207 lines (+185/-0)
3 files modified
debian/changelog (+8/-0)
debian/patches/0026-shell-search-provider-implement-XUbuntuCancel.patch (+176/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Robert Ancell 2018-11-08 Approve on 2019-08-14
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.
review: Approve

Unmerged commits

6ce069c... by Marco Trevisan (Treviño) on 2018-11-08

Finalise changelog

851ed0a... by Robert Ancell on 2018-10-10

Implement XUbuntuCancel to request pending search cancellation from gnome-shell

Fixes LP: #1756826

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 4e4f8a7..9457357 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,11 @@
6+gnome-software (3.28.1-0ubuntu4.18.04.9) 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> Fri, 30 Nov 2018 14:52:14 -0500
13+
14 gnome-software (3.28.1-0ubuntu4.18.04.8) bionic; urgency=medium
15
16 * Re-released to generate correct .changes file
17diff --git a/debian/patches/0026-shell-search-provider-implement-XUbuntuCancel.patch b/debian/patches/0026-shell-search-provider-implement-XUbuntuCancel.patch
18new file mode 100644
19index 0000000..f914b22
20--- /dev/null
21+++ b/debian/patches/0026-shell-search-provider-implement-XUbuntuCancel.patch
22@@ -0,0 +1,176 @@
23+From 2ac5ea28829ecaff2f8a180f2ef7eefbb07602d9 Mon Sep 17 00:00:00 2001
24+From: Andrea Azzarone <andrea.azzarone@canonical.com>
25+Date: Fri, 7 Sep 2018 19:58:00 +0200
26+Subject: [PATCH 24/26] shell-search-provider: implement XUbuntuCancel
27+
28+Implement XUbuntuCancel to request search cancellation. This is used by
29+gnome-shell to cancel the current search e.g. if the search overview is
30+closed.
31+---
32+ src/gs-shell-search-provider.c | 74 +++++++++++++++----
33+ src/shell-search-provider-dbus-interfaces.xml | 1 +
34+ 2 files changed, 60 insertions(+), 15 deletions(-)
35+
36+diff --git a/src/gs-shell-search-provider.c b/src/gs-shell-search-provider.c
37+index c01d72cb..8c1e0fda 100644
38+--- a/src/gs-shell-search-provider.c
39++++ b/src/gs-shell-search-provider.c
40+@@ -45,6 +45,8 @@ struct _GsShellSearchProvider {
41+ GsPluginLoader *plugin_loader;
42+ GCancellable *cancellable;
43+
44++ PendingSearch *current_search;
45++
46+ GHashTable *metas_cache;
47+ GsAppList *search_results;
48+ };
49+@@ -58,6 +60,17 @@ pending_search_free (PendingSearch *search)
50+ g_slice_free (PendingSearch, search);
51+ }
52+
53++static void
54++cancel_current_search (GsShellSearchProvider *self)
55++{
56++ g_debug ("*** Cancel current search");
57++
58++ if (self->cancellable != NULL) {
59++ g_cancellable_cancel (self->cancellable);
60++ g_clear_object (&self->cancellable);
61++ }
62++}
63++
64+ static gint
65+ search_sort_by_kudo_cb (GsApp *app1, GsApp *app2, gpointer user_data)
66+ {
67+@@ -71,6 +84,23 @@ search_sort_by_kudo_cb (GsApp *app1, GsApp *app2, gpointer user_data)
68+ return 0;
69+ }
70+
71++static void
72++pending_search_finish (PendingSearch *search,
73++ GDBusMethodInvocation *invocation,
74++ GVariant *result)
75++{
76++ GsShellSearchProvider *self = search->provider;
77++
78++ g_dbus_method_invocation_return_value (invocation, result);
79++
80++ if (search == self->current_search) {
81++ self->current_search = NULL;
82++ }
83++
84++ pending_search_free (search);
85++ g_application_release (g_application_get_default ());
86++}
87++
88+ static void
89+ search_done_cb (GObject *source,
90+ GAsyncResult *res,
91+@@ -87,10 +117,9 @@ search_done_cb (GObject *source,
92+
93+ list = gs_plugin_loader_job_process_finish (self->plugin_loader, res, NULL);
94+ if (list == NULL) {
95+- g_dbus_method_invocation_return_value (search->invocation, g_variant_new ("(as)", NULL));
96+- pending_search_free (search);
97+- g_application_release (g_application_get_default ());
98+- return;
99++ pending_search_finish (search, search->invocation,
100++ g_variant_new ("(as)", NULL));
101++ return;
102+ }
103+
104+ /* sort by kudos, as there is no ratings data by default */
105+@@ -106,10 +135,8 @@ search_done_cb (GObject *source,
106+ /* cache this in case we need the app in GetResultMetas */
107+ gs_app_list_add (self->search_results, app);
108+ }
109+- g_dbus_method_invocation_return_value (search->invocation, g_variant_new ("(as)", &builder));
110+
111+- pending_search_free (search);
112+- g_application_release (g_application_get_default ());
113++ pending_search_finish (search, search->invocation, g_variant_new ("(as)", &builder));
114+ }
115+
116+ static gchar *
117+@@ -167,10 +194,7 @@ execute_search (GsShellSearchProvider *self,
118+
119+ value = g_strjoinv (" ", terms);
120+
121+- if (self->cancellable != NULL) {
122+- g_cancellable_cancel (self->cancellable);
123+- g_clear_object (&self->cancellable);
124+- }
125++ cancel_current_search (self);
126+
127+ /* don't attempt searches for a single character */
128+ if (g_strv_length (terms) == 1 &&
129+@@ -183,6 +207,7 @@ execute_search (GsShellSearchProvider *self,
130+ pending_search->provider = self;
131+ pending_search->invocation = g_object_ref (invocation);
132+
133++ self->current_search = pending_search;
134+ g_application_hold (g_application_get_default ());
135+ self->cancellable = g_cancellable_new ();
136+
137+@@ -334,6 +359,26 @@ handle_launch_search (GsShellSearchProvider2 *skeleton,
138+ return TRUE;
139+ }
140+
141++static gboolean
142++handle_xubuntu_cancel (GsShellSearchProvider2 *skeleton,
143++ GDBusMethodInvocation *invocation,
144++ gpointer user_data)
145++{
146++ GsShellSearchProvider *self = GS_SHELL_SEARCH_PROVIDER (user_data);
147++
148++ g_debug ("*** XUbuntuCancel called");
149++
150++ if (self->current_search != NULL &&
151++ g_strcmp0 (g_dbus_method_invocation_get_sender (self->current_search->invocation),
152++ g_dbus_method_invocation_get_sender (invocation)) == 0) {
153++ cancel_current_search (self);
154++ }
155++
156++ gs_shell_search_provider2_complete_xubuntu_cancel (skeleton, invocation);
157++
158++ return TRUE;
159++}
160++
161+ gboolean
162+ gs_shell_search_provider_register (GsShellSearchProvider *self,
163+ GDBusConnection *connection,
164+@@ -355,10 +400,7 @@ search_provider_dispose (GObject *obj)
165+ {
166+ GsShellSearchProvider *self = GS_SHELL_SEARCH_PROVIDER (obj);
167+
168+- if (self->cancellable != NULL) {
169+- g_cancellable_cancel (self->cancellable);
170+- g_clear_object (&self->cancellable);
171+- }
172++ cancel_current_search (self);
173+
174+ if (self->metas_cache != NULL) {
175+ g_hash_table_destroy (self->metas_cache);
176+@@ -393,6 +435,8 @@ gs_shell_search_provider_init (GsShellSearchProvider *self)
177+ G_CALLBACK (handle_activate_result), self);
178+ g_signal_connect (self->skeleton, "handle-launch-search",
179+ G_CALLBACK (handle_launch_search), self);
180++ g_signal_connect (self->skeleton, "handle-xubuntu-cancel",
181++ G_CALLBACK (handle_xubuntu_cancel), self);
182+ }
183+
184+ static void
185+diff --git a/src/shell-search-provider-dbus-interfaces.xml b/src/shell-search-provider-dbus-interfaces.xml
186+index f6840e2c..4529c1e8 100644
187+--- a/src/shell-search-provider-dbus-interfaces.xml
188++++ b/src/shell-search-provider-dbus-interfaces.xml
189+@@ -40,5 +40,6 @@
190+ <arg type='as' name='Terms' direction='in' />
191+ <arg type='u' name='Timestamp' direction='in' />
192+ </method>
193++ <method name = 'XUbuntuCancel' />
194+ </interface>
195+ </node>
196+--
197+2.17.1
198+
199diff --git a/debian/patches/series b/debian/patches/series
200index 5005782..1f80e53 100644
201--- a/debian/patches/series
202+++ b/debian/patches/series
203@@ -34,3 +34,4 @@
204 #0023-Revert-Revert-flatpak-Use-list-of-related-apps-for-i.patch
205 #0024-flatpak-Check-if-a-related-app-is-installed-even-whe.patch
206 #0025-flatpak-Include-related-refs-to-the-app-s-runtime-on.patch
207+0026-shell-search-provider-implement-XUbuntuCancel.patch

Subscribers

People subscribed via source and target branches