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



commit 547bcc9aa294e5acf3388ec3e35d07fcf9ff4d86
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 | 11 +++++++++++
 1 file changed, 11 insertions(+)
---
diff --git a/src/core/startup-notification.c b/src/core/startup-notification.c
index 5706c2779..fbb80e7d1 100644
--- a/src/core/startup-notification.c
+++ b/src/core/startup-notification.c
@@ -424,12 +424,21 @@ meta_startup_sequence_get_wmclass (MetaStartupSequence *seq)
   return priv->wmclass;
 }
 
+static void
+on_sequence_completed (MetaStartupSequence     *seq,
+                       MetaStartupNotification *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 +528,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]