core: Add MetaStartupSequence::complete signal

It was a vfunc so far, but we want things subscribing to it.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/541
This commit is contained in:
Carlos Garnacho 2019-04-15 18:24:48 +02:00
parent 40103d6f41
commit 38ff01d6d0

View File

@ -59,6 +59,12 @@ enum
N_SEQ_PROPS N_SEQ_PROPS
}; };
enum
{
SEQ_COMPLETE,
N_SEQ_SIGNALS
};
enum enum
{ {
CHANGED, CHANGED,
@ -67,6 +73,7 @@ enum
static guint sn_signals[N_SIGNALS]; static guint sn_signals[N_SIGNALS];
static GParamSpec *sn_props[N_PROPS]; static GParamSpec *sn_props[N_PROPS];
static guint seq_signals[N_SEQ_SIGNALS];
static GParamSpec *seq_props[N_SEQ_PROPS]; static GParamSpec *seq_props[N_SEQ_PROPS];
typedef struct typedef struct
@ -253,6 +260,14 @@ meta_startup_sequence_class_init (MetaStartupSequenceClass *klass)
object_class->set_property = meta_startup_sequence_set_property; object_class->set_property = meta_startup_sequence_set_property;
object_class->get_property = meta_startup_sequence_get_property; object_class->get_property = meta_startup_sequence_get_property;
seq_signals[SEQ_COMPLETE] =
g_signal_new ("complete",
META_TYPE_STARTUP_SEQUENCE,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (MetaStartupSequenceClass, complete),
NULL, NULL, NULL,
G_TYPE_NONE, 0);
seq_props[PROP_SEQ_ID] = seq_props[PROP_SEQ_ID] =
g_param_spec_string ("id", g_param_spec_string ("id",
"ID", "ID",
@ -331,7 +346,6 @@ meta_startup_sequence_get_timestamp (MetaStartupSequence *seq)
void void
meta_startup_sequence_complete (MetaStartupSequence *seq) meta_startup_sequence_complete (MetaStartupSequence *seq)
{ {
MetaStartupSequenceClass *klass;
MetaStartupSequencePrivate *priv; MetaStartupSequencePrivate *priv;
g_return_if_fail (META_IS_STARTUP_SEQUENCE (seq)); g_return_if_fail (META_IS_STARTUP_SEQUENCE (seq));
@ -341,10 +355,7 @@ meta_startup_sequence_complete (MetaStartupSequence *seq)
return; return;
priv->completed = TRUE; priv->completed = TRUE;
klass = META_STARTUP_SEQUENCE_GET_CLASS (seq); g_signal_emit (seq, seq_signals[SEQ_COMPLETE], 0);
if (klass->complete)
klass->complete (seq);
} }
gboolean gboolean