[mutter/wip/carlosg/startup-notification-fixes: 4/4] core: Emit MetaStartupNotification::changed on sequence completion



commit 47b842aa553536caf0448851a0b8b2daed0bb17f
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Apr 15 18:29:23 2019 +0200

    core: Emit MetaStartupNotification::changed on sequence completion
    
    This way handlers that want to know the get_complete() status will be able
    to do so without further delays.
    
    https://gitlab.gnome.org/GNOME/mutter/issues/541

 src/core/startup-notification.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/src/core/startup-notification.c b/src/core/startup-notification.c
index 78edb47cf..4cd51aca6 100644
--- a/src/core/startup-notification.c
+++ b/src/core/startup-notification.c
@@ -424,12 +424,22 @@ meta_startup_sequence_get_wmclass (MetaStartupSequence *seq)
   return priv->wmclass;
 }
 
+static void
+on_sequence_completed (MetaStartupSequence     *seq,
+                       MetaStartupNotification *sn)
+{
+  meta_startup_notification_update_feedback (sn);
+  g_signal_emit (sn, sn_signals[CHANGED], 0, seq);
+}
+
 void
 meta_startup_notification_add_sequence (MetaStartupNotification *sn,
                                         MetaStartupSequence     *seq)
 {
   sn->startup_sequences = g_slist_prepend (sn->startup_sequences,
                                            g_object_ref (seq));
+  g_signal_connect (seq, "complete",
+                    G_CALLBACK (on_sequence_completed), sn);
 
   meta_startup_notification_ensure_timeout (sn);
   meta_startup_notification_update_feedback (sn);
@@ -519,6 +529,8 @@ meta_startup_notification_remove_sequence (MetaStartupNotification *sn,
   sn->startup_sequences = g_slist_remove (sn->startup_sequences, seq);
   meta_startup_notification_update_feedback (sn);
 
+  g_signal_handlers_disconnect_by_func (seq, on_sequence_completed, sn);
+
   if (sn->startup_sequences == NULL &&
       sn->startup_sequence_timeout != 0)
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]