Merge lp:~azzar1/bamf/manually-complete-sn into lp:bamf

Proposed by Andrea Azzarone on 2016-06-13
Status: Merged
Approved by: Marco Trevisan (Treviño) on 2016-06-28
Approved revision: 639
Merged at revision: 639
Proposed branch: lp:~azzar1/bamf/manually-complete-sn
Merge into: lp:bamf
Diff against target: 228 lines (+59/-12)
6 files modified
src/bamf-control.c (+1/-1)
src/bamf-legacy-screen.c (+3/-3)
src/bamf-matcher.c (+5/-4)
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:~azzar1/bamf/manually-complete-sn
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) 2016-06-13 Approve on 2016-06-28
PS Jenkins bot continuous-integration Pending
Review via email: mp+297249@code.launchpad.net

Commit message

Daemon: manually set to complete the startup notification on view state change

Specifically when the view is running, activated or marked as urgent.

To post a comment you must log in.
Marco Trevisan (Treviño) (3v1n0) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/bamf-control.c'
2--- src/bamf-control.c 2016-03-21 15:17:45 +0000
3+++ src/bamf-control.c 2016-06-13 22:30:23 +0000
4@@ -54,7 +54,7 @@
5 g_variant_get_child (parameters, 0, "^&ay", &desktop_file);
6 g_variant_get_child (parameters, 2, "x", &pid);
7
8- bamf_matcher_set_starting_desktop_file (matcher, desktop_file, TRUE);
9+ bamf_matcher_set_starting_desktop_file (matcher, desktop_file, NULL, TRUE);
10 bamf_matcher_register_desktop_file_for_pid (matcher, desktop_file, pid);
11 }
12
13
14=== modified file 'src/bamf-legacy-screen.c'
15--- src/bamf-legacy-screen.c 2016-03-21 15:21:45 +0000
16+++ src/bamf-legacy-screen.c 2016-06-13 22:30:23 +0000
17@@ -258,7 +258,7 @@
18 {
19 SnStartupSequence *sequence = sn_monitor_event_get_startup_sequence (event);
20 const gchar *app_id = sn_startup_sequence_get_application_id (sequence);
21- g_signal_emit (self, legacy_screen_signals[WINDOW_OPENING], 0, app_id);
22+ g_signal_emit (self, legacy_screen_signals[WINDOW_OPENING], 0, app_id, sequence);
23 }
24 break;
25 case SN_MONITOR_EVENT_COMPLETED:
26@@ -477,8 +477,8 @@
27 G_SIGNAL_RUN_FIRST,
28 G_STRUCT_OFFSET (BamfLegacyScreenClass, window_opening),
29 NULL, NULL, NULL,
30- G_TYPE_NONE, 1,
31- G_TYPE_STRING);
32+ G_TYPE_NONE, 2,
33+ G_TYPE_STRING, G_TYPE_POINTER);
34
35 legacy_screen_signals [WINDOW_OPENING_COMPLETED] =
36 g_signal_new (BAMF_LEGACY_SCREEN_SIGNAL_WINDOW_OPENING_COMPLETED,
37
38=== modified file 'src/bamf-matcher.c'
39--- src/bamf-matcher.c 2016-06-01 11:57:58 +0000
40+++ src/bamf-matcher.c 2016-06-13 22:30:23 +0000
41@@ -2250,15 +2250,15 @@
42 }
43
44 static void
45-handle_window_opening (BamfLegacyScreen *screen, const gchar *desktop_id, BamfMatcher *self)
46+handle_window_opening (BamfLegacyScreen *screen, const gchar *desktop_id, SnStartupSequence *startup_sequence, BamfMatcher *self)
47 {
48- bamf_matcher_set_starting_desktop_file (self, desktop_id, TRUE);
49+ bamf_matcher_set_starting_desktop_file (self, desktop_id, startup_sequence, TRUE);
50 }
51
52 static void
53 handle_window_opening_finished (BamfLegacyScreen *screen, const gchar *desktop_id, BamfMatcher *self)
54 {
55- bamf_matcher_set_starting_desktop_file (self, desktop_id, FALSE);
56+ bamf_matcher_set_starting_desktop_file (self, desktop_id, NULL, FALSE);
57 }
58
59 static void
60@@ -2499,6 +2499,7 @@
61 void
62 bamf_matcher_set_starting_desktop_file (BamfMatcher *self,
63 const char *desktop_file,
64+ SnStartupSequence *startup_sequence,
65 gboolean starting)
66 {
67 BamfApplication *app;
68@@ -2523,7 +2524,7 @@
69
70 if (BAMF_IS_APPLICATION (app))
71 {
72- bamf_view_set_starting (BAMF_VIEW (app), starting);
73+ bamf_view_set_starting (BAMF_VIEW (app), startup_sequence, starting);
74 }
75 }
76
77
78=== modified file 'src/bamf-matcher.h'
79--- src/bamf-matcher.h 2016-03-21 15:16:22 +0000
80+++ src/bamf-matcher.h 2016-06-13 22:30:23 +0000
81@@ -76,6 +76,7 @@
82
83 void bamf_matcher_set_starting_desktop_file (BamfMatcher * self,
84 const char *desktop_file,
85+ SnStartupSequence *sequence,
86 gboolean starting);
87
88 const char * bamf_matcher_get_desktop_file_class (BamfMatcher * self,
89
90=== modified file 'src/bamf-view.c'
91--- src/bamf-view.c 2016-03-29 14:52:33 +0000
92+++ src/bamf-view.c 2016-06-13 22:30:23 +0000
93@@ -78,6 +78,8 @@
94 gboolean closed;
95 guint starting_timeout;
96
97+ SnStartupSequence *startup_sequence;
98+
99 /* FIXME: remove this as soon as we move to properties on library as well */
100 guint active_changed_idle;
101 };
102@@ -115,6 +117,9 @@
103 guint idle = g_idle_add_full (G_PRIORITY_DEFAULT, on_active_changed_idle, view, NULL);
104 view->priv->active_changed_idle = idle;
105 }
106+
107+ if (active)
108+ bamf_view_set_starting (view, NULL, FALSE);
109 }
110
111 static void
112@@ -152,7 +157,7 @@
113 {
114 BamfView *view = data;
115
116- bamf_view_set_starting (view, FALSE);
117+ bamf_view_set_starting (view, NULL, FALSE);
118 view->priv->starting_timeout = 0;
119
120 return FALSE;
121@@ -197,7 +202,7 @@
122 g_signal_emit_by_name (view, "running-changed", running);
123
124 if (running)
125- bamf_view_set_starting (view, FALSE);
126+ bamf_view_set_starting (view, NULL, FALSE);
127 }
128
129 static void
130@@ -213,6 +218,9 @@
131
132 if (emit)
133 g_signal_emit_by_name (view, "urgent-changed", urgent);
134+
135+ if (urgent)
136+ bamf_view_set_starting (view, NULL, FALSE);
137 }
138
139 void
140@@ -480,8 +488,33 @@
141
142 void
143 bamf_view_set_starting (BamfView *view,
144+ SnStartupSequence *startup_sequence,
145 gboolean starting)
146 {
147+ if (!bamf_view_is_starting (view) && starting)
148+ {
149+ if (view->priv->startup_sequence)
150+ {
151+ sn_startup_sequence_unref (view->priv->startup_sequence);
152+ view->priv->startup_sequence = NULL;
153+ }
154+
155+ if (startup_sequence)
156+ {
157+ view->priv->startup_sequence = startup_sequence;
158+ sn_startup_sequence_ref (view->priv->startup_sequence);
159+ }
160+ }
161+ else if (!starting)
162+ {
163+ if (view->priv->startup_sequence)
164+ {
165+ sn_startup_sequence_complete (view->priv->startup_sequence);
166+ sn_startup_sequence_unref (view->priv->startup_sequence);
167+ view->priv->startup_sequence = NULL;
168+ }
169+ }
170+
171 BAMF_VIEW_SET_BOOL_PROPERTY (view, starting);
172 }
173
174@@ -581,7 +614,7 @@
175 bamf_view_set_name (view, cache->name);
176 bamf_view_set_icon (view, cache->icon);
177 bamf_view_set_active (view, cache->active);
178- bamf_view_set_starting (view, cache->starting);
179+ bamf_view_set_starting (view, NULL, cache->starting);
180 bamf_view_set_running (view, cache->running);
181 bamf_view_set_user_visible (view, cache->user_visible);
182 bamf_view_set_urgent (view, cache->urgent);
183@@ -863,6 +896,12 @@
184 priv->active_changed_idle = 0;
185 }
186
187+ if (priv->startup_sequence)
188+ {
189+ sn_startup_sequence_unref (priv->startup_sequence);
190+ priv->startup_sequence = NULL;
191+ }
192+
193 bamf_view_cached_properties_clear (view);
194 g_dbus_object_skeleton_flush (G_DBUS_OBJECT_SKELETON (view));
195
196@@ -931,6 +970,8 @@
197 self->priv->dbus_iface = _bamf_dbus_item_view_skeleton_new ();
198 self->priv->props = g_new0 (BamfViewPropCache, 1);
199
200+ self->priv->startup_sequence = NULL;
201+
202 /* We need to connect to the object own signals to redirect them to the dbus
203 * interface */
204 g_signal_connect (self, "active-changed", G_CALLBACK (on_view_active_changed), NULL);
205
206=== modified file 'src/bamf-view.h'
207--- src/bamf-view.h 2016-03-29 14:32:40 +0000
208+++ src/bamf-view.h 2016-06-13 22:30:23 +0000
209@@ -25,6 +25,10 @@
210 #include <glib-object.h>
211 #include <libbamf-private/bamf-private.h>
212
213+#define SN_API_NOT_YET_FROZEN
214+#include <libsn/sn.h>
215+#undef SN_API_NOT_YET_FROZEN
216+
217 #define BAMF_TYPE_VIEW (bamf_view_get_type ())
218 #define BAMF_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BAMF_TYPE_VIEW, BamfView))
219 #define BAMF_IS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BAMF_TYPE_VIEW))
220@@ -89,7 +93,7 @@
221 void bamf_view_set_active (BamfView *view, gboolean active);
222
223 gboolean bamf_view_is_starting (BamfView *view);
224-void bamf_view_set_starting (BamfView *view, gboolean starting);
225+void bamf_view_set_starting (BamfView *view, SnStartupSequence *startup_sequence, gboolean starting);
226
227 gboolean bamf_view_is_running (BamfView *view);
228 void bamf_view_set_running (BamfView *view, gboolean running);

Subscribers

People subscribed via source and target branches

to all changes: