Merge lp:~unity-team/bamf/x-sru2 into lp:bamf/xenial

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Andrea Azzarone
Approved revision: no longer in the source branch.
Merged at revision: 637
Proposed branch: lp:~unity-team/bamf/x-sru2
Merge into: lp:bamf/xenial
Diff against target: 370 lines (+134/-19)
9 files modified
debian/bamfdaemon.triggers (+2/-2)
debian/changelog (+15/-0)
src/bamf-control.c (+1/-1)
src/bamf-legacy-screen.c (+3/-3)
src/bamf-legacy-window.c (+1/-1)
src/bamf-matcher.c (+62/-8)
src/bamf-matcher.h (+1/-0)
src/bamf-view.c (+44/-3)
src/bamf-view.h (+5/-1)
To merge this branch: bzr merge lp:~unity-team/bamf/x-sru2
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve
Review via email: mp+298662@code.launchpad.net

Commit message

Releasing SRU2 for Xenial

To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

Looks fine but the SRU team likes to have rational about changes, is there a bug report corresponding to the first changeset? If not it would be good to at last describe in the changelog in which cases it would be useful

lp:~unity-team/bamf/x-sru2 updated
637. By CI Train Bot Account

* BamfMatcher: allow overriding desktop with the environment var
  BAMF_DESKTOP_FILE_HINT
* Daemon: manually set to complete the startup notification on view
  state change (LP: #1582430)
* debian/bamfdaemon.triggers: use interest-noawait (LP: #1589097)

Revision history for this message
Andrea Azzarone (azzar1) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/bamfdaemon.triggers'
2--- debian/bamfdaemon.triggers 2010-05-25 11:06:17 +0000
3+++ debian/bamfdaemon.triggers 2016-06-30 12:10:12 +0000
4@@ -1,2 +1,2 @@
5-interest /usr/share/applications
6-interest gmenucache
7+interest-noawait /usr/share/applications
8+interest-noawait gmenucache
9
10=== modified file 'debian/changelog'
11--- debian/changelog 2016-05-23 18:05:14 +0000
12+++ debian/changelog 2016-06-30 12:10:12 +0000
13@@ -1,3 +1,18 @@
14+bamf (0.5.3~bzr0+16.04.20160523-0ubuntu2) UNRELEASED; urgency=medium
15+
16+ [ Marco Trevisan (Treviño) ]
17+ * BamfMatcher: allow overriding desktop with the environment var
18+ BAMF_DESKTOP_FILE_HINT
19+
20+ [ Andrea Azzarone ]
21+ * Daemon: manually set to complete the startup notification on view
22+ state change (LP: #1582430)
23+
24+ [ Marco Trevisan (Treviño) ]
25+ * debian/bamfdaemon.triggers: use interest-noawait (LP: #1589097)
26+
27+ -- Marco Trevisan (Treviño) <mail@3v1n0.net> Wed, 29 Jun 2016 17:57:07 +0200
28+
29 bamf (0.5.3~bzr0+16.04.20160523-0ubuntu1) xenial; urgency=medium
30
31 * bamfdaemon-dbus-runner: don't try to start again if already running
32
33=== modified file 'src/bamf-control.c'
34--- src/bamf-control.c 2016-03-21 15:17:45 +0000
35+++ src/bamf-control.c 2016-06-30 12:10:12 +0000
36@@ -54,7 +54,7 @@
37 g_variant_get_child (parameters, 0, "^&ay", &desktop_file);
38 g_variant_get_child (parameters, 2, "x", &pid);
39
40- bamf_matcher_set_starting_desktop_file (matcher, desktop_file, TRUE);
41+ bamf_matcher_set_starting_desktop_file (matcher, desktop_file, NULL, TRUE);
42 bamf_matcher_register_desktop_file_for_pid (matcher, desktop_file, pid);
43 }
44
45
46=== modified file 'src/bamf-legacy-screen.c'
47--- src/bamf-legacy-screen.c 2016-03-21 15:21:45 +0000
48+++ src/bamf-legacy-screen.c 2016-06-30 12:10:12 +0000
49@@ -258,7 +258,7 @@
50 {
51 SnStartupSequence *sequence = sn_monitor_event_get_startup_sequence (event);
52 const gchar *app_id = sn_startup_sequence_get_application_id (sequence);
53- g_signal_emit (self, legacy_screen_signals[WINDOW_OPENING], 0, app_id);
54+ g_signal_emit (self, legacy_screen_signals[WINDOW_OPENING], 0, app_id, sequence);
55 }
56 break;
57 case SN_MONITOR_EVENT_COMPLETED:
58@@ -477,8 +477,8 @@
59 G_SIGNAL_RUN_FIRST,
60 G_STRUCT_OFFSET (BamfLegacyScreenClass, window_opening),
61 NULL, NULL, NULL,
62- G_TYPE_NONE, 1,
63- G_TYPE_STRING);
64+ G_TYPE_NONE, 2,
65+ G_TYPE_STRING, G_TYPE_POINTER);
66
67 legacy_screen_signals [WINDOW_OPENING_COMPLETED] =
68 g_signal_new (BAMF_LEGACY_SCREEN_SIGNAL_WINDOW_OPENING_COMPLETED,
69
70=== modified file 'src/bamf-legacy-window.c'
71--- src/bamf-legacy-window.c 2016-04-09 02:06:08 +0000
72+++ src/bamf-legacy-window.c 2016-06-30 12:10:12 +0000
73@@ -194,7 +194,7 @@
74
75 pid = bamf_legacy_window_get_pid (self);
76
77- if (pid <= 0)
78+ if (pid < 2)
79 return NULL;
80
81 stat_path = g_strdup_printf ("/proc/%i/status", pid);
82
83=== modified file 'src/bamf-matcher.c'
84--- src/bamf-matcher.c 2016-03-22 13:36:15 +0000
85+++ src/bamf-matcher.c 2016-06-30 12:10:12 +0000
86@@ -30,6 +30,8 @@
87 #include <strings.h>
88
89 #define BAMF_INDEX_NAME "bamf-2.index"
90+#define EXEC_DESKTOP_FILE_OVERRIDE "--desktop_file_hint"
91+#define ENV_DESKTOP_FILE_OVERRIDE "BAMF_DESKTOP_FILE_HINT"
92
93 G_DEFINE_TYPE (BamfMatcher, bamf_matcher, BAMF_DBUS_TYPE_MATCHER_SKELETON);
94 #define BAMF_MATCHER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE(obj, \
95@@ -79,8 +81,6 @@
96 "com-sun-javaws-Main", "VCLSalFrame"
97 };
98
99-const gchar * EXEC_DESKTOP_FILE_OVERRIDE = "--desktop_file_hint";
100-
101 static void
102 on_view_active_changed (BamfView *view, gboolean active, BamfMatcher *matcher)
103 {
104@@ -556,6 +556,49 @@
105 return result;
106 }
107
108+char *
109+get_env_overridden_desktop_file (guint pid)
110+{
111+ gchar *environ_file;
112+ gchar *environ;
113+ gchar *result;
114+ gsize file_len;
115+ gint i;
116+
117+ if (pid < 2)
118+ return NULL;
119+
120+ environ = NULL;
121+ result = NULL;
122+ environ_file = g_strdup_printf ("/proc/%u/environ", pid);
123+
124+ if (g_file_get_contents (environ_file, &environ, &file_len, NULL))
125+ {
126+ for (i = 0; i < file_len && environ && environ[i] != '\0'; i += strlen (environ + i) + 1)
127+ {
128+ const gchar *var = environ + i;
129+
130+ if (g_str_has_prefix (var, ENV_DESKTOP_FILE_OVERRIDE"="))
131+ {
132+ const gchar *file_path;
133+ file_path = var + sizeof (ENV_DESKTOP_FILE_OVERRIDE);
134+
135+ if (g_str_has_suffix (file_path, ".desktop") &&
136+ g_file_test (file_path, G_FILE_TEST_EXISTS|G_FILE_TEST_IS_REGULAR))
137+ {
138+ result = g_strdup (file_path);
139+ break;
140+ }
141+ }
142+ }
143+ }
144+
145+ g_free (environ);
146+ g_free (environ_file);
147+
148+ return result;
149+}
150+
151 static GList *
152 pid_parent_tree (BamfMatcher *self, guint pid)
153 {
154@@ -1670,8 +1713,17 @@
155 g_free (desktop_file);
156 }
157 }
158- else
159+
160+ if (!desktop_files)
161 {
162+ gint pid = bamf_legacy_window_get_pid (window);
163+ desktop_file = get_env_overridden_desktop_file (pid);
164+
165+ if (desktop_file)
166+ {
167+ desktop_files = g_list_prepend (desktop_files, desktop_file);
168+ }
169+
170 const char *exec_string = bamf_legacy_window_get_exec_string (window);
171 desktop_file = get_exec_overridden_desktop_file (exec_string);
172
173@@ -1679,7 +1731,8 @@
174 {
175 desktop_files = g_list_prepend (desktop_files, desktop_file);
176 }
177- else
178+
179+ if (!desktop_files)
180 {
181 app_id = bamf_legacy_window_get_hint (window, _GTK_APPLICATION_ID);
182
183@@ -2197,15 +2250,15 @@
184 }
185
186 static void
187-handle_window_opening (BamfLegacyScreen *screen, const gchar *desktop_id, BamfMatcher *self)
188+handle_window_opening (BamfLegacyScreen *screen, const gchar *desktop_id, SnStartupSequence *startup_sequence, BamfMatcher *self)
189 {
190- bamf_matcher_set_starting_desktop_file (self, desktop_id, TRUE);
191+ bamf_matcher_set_starting_desktop_file (self, desktop_id, startup_sequence, TRUE);
192 }
193
194 static void
195 handle_window_opening_finished (BamfLegacyScreen *screen, const gchar *desktop_id, BamfMatcher *self)
196 {
197- bamf_matcher_set_starting_desktop_file (self, desktop_id, FALSE);
198+ bamf_matcher_set_starting_desktop_file (self, desktop_id, NULL, FALSE);
199 }
200
201 static void
202@@ -2446,6 +2499,7 @@
203 void
204 bamf_matcher_set_starting_desktop_file (BamfMatcher *self,
205 const char *desktop_file,
206+ SnStartupSequence *startup_sequence,
207 gboolean starting)
208 {
209 BamfApplication *app;
210@@ -2470,7 +2524,7 @@
211
212 if (BAMF_IS_APPLICATION (app))
213 {
214- bamf_view_set_starting (BAMF_VIEW (app), starting);
215+ bamf_view_set_starting (BAMF_VIEW (app), startup_sequence, starting);
216 }
217 }
218
219
220=== modified file 'src/bamf-matcher.h'
221--- src/bamf-matcher.h 2016-03-21 15:16:22 +0000
222+++ src/bamf-matcher.h 2016-06-30 12:10:12 +0000
223@@ -76,6 +76,7 @@
224
225 void bamf_matcher_set_starting_desktop_file (BamfMatcher * self,
226 const char *desktop_file,
227+ SnStartupSequence *sequence,
228 gboolean starting);
229
230 const char * bamf_matcher_get_desktop_file_class (BamfMatcher * self,
231
232=== modified file 'src/bamf-view.c'
233--- src/bamf-view.c 2016-03-29 14:52:33 +0000
234+++ src/bamf-view.c 2016-06-30 12:10:12 +0000
235@@ -78,6 +78,8 @@
236 gboolean closed;
237 guint starting_timeout;
238
239+ SnStartupSequence *startup_sequence;
240+
241 /* FIXME: remove this as soon as we move to properties on library as well */
242 guint active_changed_idle;
243 };
244@@ -115,6 +117,9 @@
245 guint idle = g_idle_add_full (G_PRIORITY_DEFAULT, on_active_changed_idle, view, NULL);
246 view->priv->active_changed_idle = idle;
247 }
248+
249+ if (active)
250+ bamf_view_set_starting (view, NULL, FALSE);
251 }
252
253 static void
254@@ -152,7 +157,7 @@
255 {
256 BamfView *view = data;
257
258- bamf_view_set_starting (view, FALSE);
259+ bamf_view_set_starting (view, NULL, FALSE);
260 view->priv->starting_timeout = 0;
261
262 return FALSE;
263@@ -197,7 +202,7 @@
264 g_signal_emit_by_name (view, "running-changed", running);
265
266 if (running)
267- bamf_view_set_starting (view, FALSE);
268+ bamf_view_set_starting (view, NULL, FALSE);
269 }
270
271 static void
272@@ -213,6 +218,9 @@
273
274 if (emit)
275 g_signal_emit_by_name (view, "urgent-changed", urgent);
276+
277+ if (urgent)
278+ bamf_view_set_starting (view, NULL, FALSE);
279 }
280
281 void
282@@ -480,8 +488,33 @@
283
284 void
285 bamf_view_set_starting (BamfView *view,
286+ SnStartupSequence *startup_sequence,
287 gboolean starting)
288 {
289+ if (!bamf_view_is_starting (view) && starting)
290+ {
291+ if (view->priv->startup_sequence)
292+ {
293+ sn_startup_sequence_unref (view->priv->startup_sequence);
294+ view->priv->startup_sequence = NULL;
295+ }
296+
297+ if (startup_sequence)
298+ {
299+ view->priv->startup_sequence = startup_sequence;
300+ sn_startup_sequence_ref (view->priv->startup_sequence);
301+ }
302+ }
303+ else if (!starting)
304+ {
305+ if (view->priv->startup_sequence)
306+ {
307+ sn_startup_sequence_complete (view->priv->startup_sequence);
308+ sn_startup_sequence_unref (view->priv->startup_sequence);
309+ view->priv->startup_sequence = NULL;
310+ }
311+ }
312+
313 BAMF_VIEW_SET_BOOL_PROPERTY (view, starting);
314 }
315
316@@ -581,7 +614,7 @@
317 bamf_view_set_name (view, cache->name);
318 bamf_view_set_icon (view, cache->icon);
319 bamf_view_set_active (view, cache->active);
320- bamf_view_set_starting (view, cache->starting);
321+ bamf_view_set_starting (view, NULL, cache->starting);
322 bamf_view_set_running (view, cache->running);
323 bamf_view_set_user_visible (view, cache->user_visible);
324 bamf_view_set_urgent (view, cache->urgent);
325@@ -863,6 +896,12 @@
326 priv->active_changed_idle = 0;
327 }
328
329+ if (priv->startup_sequence)
330+ {
331+ sn_startup_sequence_unref (priv->startup_sequence);
332+ priv->startup_sequence = NULL;
333+ }
334+
335 bamf_view_cached_properties_clear (view);
336 g_dbus_object_skeleton_flush (G_DBUS_OBJECT_SKELETON (view));
337
338@@ -931,6 +970,8 @@
339 self->priv->dbus_iface = _bamf_dbus_item_view_skeleton_new ();
340 self->priv->props = g_new0 (BamfViewPropCache, 1);
341
342+ self->priv->startup_sequence = NULL;
343+
344 /* We need to connect to the object own signals to redirect them to the dbus
345 * interface */
346 g_signal_connect (self, "active-changed", G_CALLBACK (on_view_active_changed), NULL);
347
348=== modified file 'src/bamf-view.h'
349--- src/bamf-view.h 2016-03-29 14:32:40 +0000
350+++ src/bamf-view.h 2016-06-30 12:10:12 +0000
351@@ -25,6 +25,10 @@
352 #include <glib-object.h>
353 #include <libbamf-private/bamf-private.h>
354
355+#define SN_API_NOT_YET_FROZEN
356+#include <libsn/sn.h>
357+#undef SN_API_NOT_YET_FROZEN
358+
359 #define BAMF_TYPE_VIEW (bamf_view_get_type ())
360 #define BAMF_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BAMF_TYPE_VIEW, BamfView))
361 #define BAMF_IS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BAMF_TYPE_VIEW))
362@@ -89,7 +93,7 @@
363 void bamf_view_set_active (BamfView *view, gboolean active);
364
365 gboolean bamf_view_is_starting (BamfView *view);
366-void bamf_view_set_starting (BamfView *view, gboolean starting);
367+void bamf_view_set_starting (BamfView *view, SnStartupSequence *startup_sequence, gboolean starting);
368
369 gboolean bamf_view_is_running (BamfView *view);
370 void bamf_view_set_running (BamfView *view, gboolean running);

Subscribers

People subscribed via source and target branches

to all changes: