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

Proposed by Andrea Azzarone
Status: Merged
Approved by: Marco Trevisan (Treviño)
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) Approve
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.
Revision history for this message
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
=== modified file 'src/bamf-control.c'
--- src/bamf-control.c 2016-03-21 15:17:45 +0000
+++ src/bamf-control.c 2016-06-13 22:30:23 +0000
@@ -54,7 +54,7 @@
54 g_variant_get_child (parameters, 0, "^&ay", &desktop_file);54 g_variant_get_child (parameters, 0, "^&ay", &desktop_file);
55 g_variant_get_child (parameters, 2, "x", &pid);55 g_variant_get_child (parameters, 2, "x", &pid);
5656
57 bamf_matcher_set_starting_desktop_file (matcher, desktop_file, TRUE);57 bamf_matcher_set_starting_desktop_file (matcher, desktop_file, NULL, TRUE);
58 bamf_matcher_register_desktop_file_for_pid (matcher, desktop_file, pid);58 bamf_matcher_register_desktop_file_for_pid (matcher, desktop_file, pid);
59}59}
6060
6161
=== modified file 'src/bamf-legacy-screen.c'
--- src/bamf-legacy-screen.c 2016-03-21 15:21:45 +0000
+++ src/bamf-legacy-screen.c 2016-06-13 22:30:23 +0000
@@ -258,7 +258,7 @@
258 {258 {
259 SnStartupSequence *sequence = sn_monitor_event_get_startup_sequence (event);259 SnStartupSequence *sequence = sn_monitor_event_get_startup_sequence (event);
260 const gchar *app_id = sn_startup_sequence_get_application_id (sequence);260 const gchar *app_id = sn_startup_sequence_get_application_id (sequence);
261 g_signal_emit (self, legacy_screen_signals[WINDOW_OPENING], 0, app_id);261 g_signal_emit (self, legacy_screen_signals[WINDOW_OPENING], 0, app_id, sequence);
262 }262 }
263 break;263 break;
264 case SN_MONITOR_EVENT_COMPLETED:264 case SN_MONITOR_EVENT_COMPLETED:
@@ -477,8 +477,8 @@
477 G_SIGNAL_RUN_FIRST,477 G_SIGNAL_RUN_FIRST,
478 G_STRUCT_OFFSET (BamfLegacyScreenClass, window_opening),478 G_STRUCT_OFFSET (BamfLegacyScreenClass, window_opening),
479 NULL, NULL, NULL,479 NULL, NULL, NULL,
480 G_TYPE_NONE, 1,480 G_TYPE_NONE, 2,
481 G_TYPE_STRING);481 G_TYPE_STRING, G_TYPE_POINTER);
482482
483 legacy_screen_signals [WINDOW_OPENING_COMPLETED] =483 legacy_screen_signals [WINDOW_OPENING_COMPLETED] =
484 g_signal_new (BAMF_LEGACY_SCREEN_SIGNAL_WINDOW_OPENING_COMPLETED,484 g_signal_new (BAMF_LEGACY_SCREEN_SIGNAL_WINDOW_OPENING_COMPLETED,
485485
=== modified file 'src/bamf-matcher.c'
--- src/bamf-matcher.c 2016-06-01 11:57:58 +0000
+++ src/bamf-matcher.c 2016-06-13 22:30:23 +0000
@@ -2250,15 +2250,15 @@
2250}2250}
22512251
2252static void2252static void
2253handle_window_opening (BamfLegacyScreen *screen, const gchar *desktop_id, BamfMatcher *self)2253handle_window_opening (BamfLegacyScreen *screen, const gchar *desktop_id, SnStartupSequence *startup_sequence, BamfMatcher *self)
2254{2254{
2255 bamf_matcher_set_starting_desktop_file (self, desktop_id, TRUE);2255 bamf_matcher_set_starting_desktop_file (self, desktop_id, startup_sequence, TRUE);
2256}2256}
22572257
2258static void2258static void
2259handle_window_opening_finished (BamfLegacyScreen *screen, const gchar *desktop_id, BamfMatcher *self)2259handle_window_opening_finished (BamfLegacyScreen *screen, const gchar *desktop_id, BamfMatcher *self)
2260{2260{
2261 bamf_matcher_set_starting_desktop_file (self, desktop_id, FALSE);2261 bamf_matcher_set_starting_desktop_file (self, desktop_id, NULL, FALSE);
2262}2262}
22632263
2264static void2264static void
@@ -2499,6 +2499,7 @@
2499void2499void
2500bamf_matcher_set_starting_desktop_file (BamfMatcher *self,2500bamf_matcher_set_starting_desktop_file (BamfMatcher *self,
2501 const char *desktop_file,2501 const char *desktop_file,
2502 SnStartupSequence *startup_sequence,
2502 gboolean starting)2503 gboolean starting)
2503{2504{
2504 BamfApplication *app;2505 BamfApplication *app;
@@ -2523,7 +2524,7 @@
25232524
2524 if (BAMF_IS_APPLICATION (app))2525 if (BAMF_IS_APPLICATION (app))
2525 {2526 {
2526 bamf_view_set_starting (BAMF_VIEW (app), starting);2527 bamf_view_set_starting (BAMF_VIEW (app), startup_sequence, starting);
2527 }2528 }
2528}2529}
25292530
25302531
=== modified file 'src/bamf-matcher.h'
--- src/bamf-matcher.h 2016-03-21 15:16:22 +0000
+++ src/bamf-matcher.h 2016-06-13 22:30:23 +0000
@@ -76,6 +76,7 @@
7676
77void bamf_matcher_set_starting_desktop_file (BamfMatcher * self,77void bamf_matcher_set_starting_desktop_file (BamfMatcher * self,
78 const char *desktop_file,78 const char *desktop_file,
79 SnStartupSequence *sequence,
79 gboolean starting);80 gboolean starting);
8081
81const char * bamf_matcher_get_desktop_file_class (BamfMatcher * self,82const char * bamf_matcher_get_desktop_file_class (BamfMatcher * self,
8283
=== modified file 'src/bamf-view.c'
--- src/bamf-view.c 2016-03-29 14:52:33 +0000
+++ src/bamf-view.c 2016-06-13 22:30:23 +0000
@@ -78,6 +78,8 @@
78 gboolean closed;78 gboolean closed;
79 guint starting_timeout;79 guint starting_timeout;
8080
81 SnStartupSequence *startup_sequence;
82
81 /* FIXME: remove this as soon as we move to properties on library as well */83 /* FIXME: remove this as soon as we move to properties on library as well */
82 guint active_changed_idle;84 guint active_changed_idle;
83};85};
@@ -115,6 +117,9 @@
115 guint idle = g_idle_add_full (G_PRIORITY_DEFAULT, on_active_changed_idle, view, NULL);117 guint idle = g_idle_add_full (G_PRIORITY_DEFAULT, on_active_changed_idle, view, NULL);
116 view->priv->active_changed_idle = idle;118 view->priv->active_changed_idle = idle;
117 }119 }
120
121 if (active)
122 bamf_view_set_starting (view, NULL, FALSE);
118}123}
119124
120static void125static void
@@ -152,7 +157,7 @@
152{157{
153 BamfView *view = data;158 BamfView *view = data;
154159
155 bamf_view_set_starting (view, FALSE);160 bamf_view_set_starting (view, NULL, FALSE);
156 view->priv->starting_timeout = 0;161 view->priv->starting_timeout = 0;
157162
158 return FALSE;163 return FALSE;
@@ -197,7 +202,7 @@
197 g_signal_emit_by_name (view, "running-changed", running);202 g_signal_emit_by_name (view, "running-changed", running);
198203
199 if (running)204 if (running)
200 bamf_view_set_starting (view, FALSE);205 bamf_view_set_starting (view, NULL, FALSE);
201}206}
202207
203static void208static void
@@ -213,6 +218,9 @@
213218
214 if (emit)219 if (emit)
215 g_signal_emit_by_name (view, "urgent-changed", urgent);220 g_signal_emit_by_name (view, "urgent-changed", urgent);
221
222 if (urgent)
223 bamf_view_set_starting (view, NULL, FALSE);
216}224}
217225
218void226void
@@ -480,8 +488,33 @@
480488
481void489void
482bamf_view_set_starting (BamfView *view,490bamf_view_set_starting (BamfView *view,
491 SnStartupSequence *startup_sequence,
483 gboolean starting)492 gboolean starting)
484{493{
494 if (!bamf_view_is_starting (view) && starting)
495 {
496 if (view->priv->startup_sequence)
497 {
498 sn_startup_sequence_unref (view->priv->startup_sequence);
499 view->priv->startup_sequence = NULL;
500 }
501
502 if (startup_sequence)
503 {
504 view->priv->startup_sequence = startup_sequence;
505 sn_startup_sequence_ref (view->priv->startup_sequence);
506 }
507 }
508 else if (!starting)
509 {
510 if (view->priv->startup_sequence)
511 {
512 sn_startup_sequence_complete (view->priv->startup_sequence);
513 sn_startup_sequence_unref (view->priv->startup_sequence);
514 view->priv->startup_sequence = NULL;
515 }
516 }
517
485 BAMF_VIEW_SET_BOOL_PROPERTY (view, starting);518 BAMF_VIEW_SET_BOOL_PROPERTY (view, starting);
486}519}
487520
@@ -581,7 +614,7 @@
581 bamf_view_set_name (view, cache->name);614 bamf_view_set_name (view, cache->name);
582 bamf_view_set_icon (view, cache->icon);615 bamf_view_set_icon (view, cache->icon);
583 bamf_view_set_active (view, cache->active);616 bamf_view_set_active (view, cache->active);
584 bamf_view_set_starting (view, cache->starting);617 bamf_view_set_starting (view, NULL, cache->starting);
585 bamf_view_set_running (view, cache->running);618 bamf_view_set_running (view, cache->running);
586 bamf_view_set_user_visible (view, cache->user_visible);619 bamf_view_set_user_visible (view, cache->user_visible);
587 bamf_view_set_urgent (view, cache->urgent);620 bamf_view_set_urgent (view, cache->urgent);
@@ -863,6 +896,12 @@
863 priv->active_changed_idle = 0;896 priv->active_changed_idle = 0;
864 }897 }
865898
899 if (priv->startup_sequence)
900 {
901 sn_startup_sequence_unref (priv->startup_sequence);
902 priv->startup_sequence = NULL;
903 }
904
866 bamf_view_cached_properties_clear (view);905 bamf_view_cached_properties_clear (view);
867 g_dbus_object_skeleton_flush (G_DBUS_OBJECT_SKELETON (view));906 g_dbus_object_skeleton_flush (G_DBUS_OBJECT_SKELETON (view));
868907
@@ -931,6 +970,8 @@
931 self->priv->dbus_iface = _bamf_dbus_item_view_skeleton_new ();970 self->priv->dbus_iface = _bamf_dbus_item_view_skeleton_new ();
932 self->priv->props = g_new0 (BamfViewPropCache, 1);971 self->priv->props = g_new0 (BamfViewPropCache, 1);
933972
973 self->priv->startup_sequence = NULL;
974
934 /* We need to connect to the object own signals to redirect them to the dbus975 /* We need to connect to the object own signals to redirect them to the dbus
935 * interface */976 * interface */
936 g_signal_connect (self, "active-changed", G_CALLBACK (on_view_active_changed), NULL);977 g_signal_connect (self, "active-changed", G_CALLBACK (on_view_active_changed), NULL);
937978
=== modified file 'src/bamf-view.h'
--- src/bamf-view.h 2016-03-29 14:32:40 +0000
+++ src/bamf-view.h 2016-06-13 22:30:23 +0000
@@ -25,6 +25,10 @@
25#include <glib-object.h>25#include <glib-object.h>
26#include <libbamf-private/bamf-private.h>26#include <libbamf-private/bamf-private.h>
2727
28#define SN_API_NOT_YET_FROZEN
29#include <libsn/sn.h>
30#undef SN_API_NOT_YET_FROZEN
31
28#define BAMF_TYPE_VIEW (bamf_view_get_type ())32#define BAMF_TYPE_VIEW (bamf_view_get_type ())
29#define BAMF_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BAMF_TYPE_VIEW, BamfView))33#define BAMF_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BAMF_TYPE_VIEW, BamfView))
30#define BAMF_IS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BAMF_TYPE_VIEW))34#define BAMF_IS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BAMF_TYPE_VIEW))
@@ -89,7 +93,7 @@
89void bamf_view_set_active (BamfView *view, gboolean active);93void bamf_view_set_active (BamfView *view, gboolean active);
9094
91gboolean bamf_view_is_starting (BamfView *view);95gboolean bamf_view_is_starting (BamfView *view);
92void bamf_view_set_starting (BamfView *view, gboolean starting);96void bamf_view_set_starting (BamfView *view, SnStartupSequence *startup_sequence, gboolean starting);
9397
94gboolean bamf_view_is_running (BamfView *view);98gboolean bamf_view_is_running (BamfView *view);
95void bamf_view_set_running (BamfView *view, gboolean running);99void bamf_view_set_running (BamfView *view, gboolean running);

Subscribers

People subscribed via source and target branches

to all changes: