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

Subscribers

People subscribed via source and target branches