core: Rename MetaStartupNotificationSequence to MetaStartupSequence

The name was excruciatingly long and not that much more descriptive.
This commit is contained in:
Carlos Garnacho 2018-08-22 19:06:13 +02:00 committed by Georges Basile Stavracas Neto
parent e8c27603dd
commit 576cd08088

View File

@ -38,8 +38,8 @@
*/ */
#define STARTUP_TIMEOUT 15000000 #define STARTUP_TIMEOUT 15000000
typedef struct _MetaStartupNotificationSequence MetaStartupNotificationSequence; typedef struct _MetaStartupSequence MetaStartupSequence;
typedef struct _MetaStartupNotificationSequenceClass MetaStartupNotificationSequenceClass; typedef struct _MetaStartupSequenceClass MetaStartupSequenceClass;
enum { enum {
PROP_SN_0, PROP_SN_0,
@ -83,30 +83,30 @@ struct _MetaStartupNotification
guint startup_sequence_timeout; guint startup_sequence_timeout;
}; };
#define META_TYPE_STARTUP_NOTIFICATION_SEQUENCE \ #define META_TYPE_STARTUP_SEQUENCE \
(meta_startup_notification_sequence_get_type ()) (meta_startup_sequence_get_type ())
G_DECLARE_DERIVABLE_TYPE (MetaStartupNotificationSequence, G_DECLARE_DERIVABLE_TYPE (MetaStartupSequence,
meta_startup_notification_sequence, meta_startup_sequence,
META, STARTUP_NOTIFICATION_SEQUENCE, META, STARTUP_SEQUENCE,
GObject) GObject)
typedef struct { typedef struct {
gchar *id; gchar *id;
gint64 timestamp; gint64 timestamp;
} MetaStartupNotificationSequencePrivate; } MetaStartupSequencePrivate;
struct _MetaStartupNotificationSequenceClass { struct _MetaStartupSequenceClass {
GObjectClass parent_class; GObjectClass parent_class;
void (* complete) (MetaStartupNotificationSequence *sequence); void (* complete) (MetaStartupSequence *sequence);
}; };
G_DEFINE_TYPE (MetaStartupNotification, G_DEFINE_TYPE (MetaStartupNotification,
meta_startup_notification, meta_startup_notification,
G_TYPE_OBJECT) G_TYPE_OBJECT)
G_DEFINE_TYPE_WITH_PRIVATE (MetaStartupNotificationSequence, G_DEFINE_TYPE_WITH_PRIVATE (MetaStartupSequence,
meta_startup_notification_sequence, meta_startup_sequence,
G_TYPE_OBJECT) G_TYPE_OBJECT)
#ifdef HAVE_STARTUP_NOTIFICATION #ifdef HAVE_STARTUP_NOTIFICATION
@ -117,24 +117,24 @@ enum {
N_SEQ_X11_PROPS N_SEQ_X11_PROPS
}; };
struct _MetaStartupNotificationSequenceX11 { struct _MetaStartupSequenceX11 {
MetaStartupNotificationSequence parent_instance; MetaStartupSequence parent_instance;
SnStartupSequence *seq; SnStartupSequence *seq;
}; };
static GParamSpec *seq_x11_props[N_SEQ_X11_PROPS]; static GParamSpec *seq_x11_props[N_SEQ_X11_PROPS];
#define META_TYPE_STARTUP_NOTIFICATION_SEQUENCE_X11 \ #define META_TYPE_STARTUP_SEQUENCE_X11 \
(meta_startup_notification_sequence_x11_get_type ()) (meta_startup_sequence_x11_get_type ())
G_DECLARE_FINAL_TYPE (MetaStartupNotificationSequenceX11, G_DECLARE_FINAL_TYPE (MetaStartupSequenceX11,
meta_startup_notification_sequence_x11, meta_startup_sequence_x11,
META, STARTUP_NOTIFICATION_SEQUENCE_X11, META, STARTUP_SEQUENCE_X11,
MetaStartupNotificationSequence) MetaStartupSequence)
G_DEFINE_TYPE (MetaStartupNotificationSequenceX11, G_DEFINE_TYPE (MetaStartupSequenceX11,
meta_startup_notification_sequence_x11, meta_startup_sequence_x11,
META_TYPE_STARTUP_NOTIFICATION_SEQUENCE) META_TYPE_STARTUP_SEQUENCE)
static void meta_startup_notification_ensure_timeout (MetaStartupNotification *sn); static void meta_startup_notification_ensure_timeout (MetaStartupNotification *sn);
@ -160,34 +160,34 @@ meta_startup_notification_update_feedback (MetaStartupNotification *sn)
} }
static void static void
meta_startup_notification_sequence_init (MetaStartupNotificationSequence *seq) meta_startup_sequence_init (MetaStartupSequence *seq)
{ {
} }
static void static void
meta_startup_notification_sequence_finalize (GObject *object) meta_startup_sequence_finalize (GObject *object)
{ {
MetaStartupNotificationSequence *seq; MetaStartupSequence *seq;
MetaStartupNotificationSequencePrivate *priv; MetaStartupSequencePrivate *priv;
seq = META_STARTUP_NOTIFICATION_SEQUENCE (object); seq = META_STARTUP_SEQUENCE (object);
priv = meta_startup_notification_sequence_get_instance_private (seq); priv = meta_startup_sequence_get_instance_private (seq);
g_free (priv->id); g_free (priv->id);
G_OBJECT_CLASS (meta_startup_notification_sequence_parent_class)->finalize (object); G_OBJECT_CLASS (meta_startup_sequence_parent_class)->finalize (object);
} }
static void static void
meta_startup_notification_sequence_set_property (GObject *object, meta_startup_sequence_set_property (GObject *object,
guint prop_id, guint prop_id,
const GValue *value, const GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
MetaStartupNotificationSequence *seq; MetaStartupSequence *seq;
MetaStartupNotificationSequencePrivate *priv; MetaStartupSequencePrivate *priv;
seq = META_STARTUP_NOTIFICATION_SEQUENCE (object); seq = META_STARTUP_SEQUENCE (object);
priv = meta_startup_notification_sequence_get_instance_private (seq); priv = meta_startup_sequence_get_instance_private (seq);
switch (prop_id) switch (prop_id)
{ {
@ -204,16 +204,16 @@ meta_startup_notification_sequence_set_property (GObject *object,
} }
static void static void
meta_startup_notification_sequence_get_property (GObject *object, meta_startup_sequence_get_property (GObject *object,
guint prop_id, guint prop_id,
GValue *value, GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
MetaStartupNotificationSequence *seq; MetaStartupSequence *seq;
MetaStartupNotificationSequencePrivate *priv; MetaStartupSequencePrivate *priv;
seq = META_STARTUP_NOTIFICATION_SEQUENCE (object); seq = META_STARTUP_SEQUENCE (object);
priv = meta_startup_notification_sequence_get_instance_private (seq); priv = meta_startup_sequence_get_instance_private (seq);
switch (prop_id) switch (prop_id)
{ {
@ -230,14 +230,14 @@ meta_startup_notification_sequence_get_property (GObject *object,
} }
static void static void
meta_startup_notification_sequence_class_init (MetaStartupNotificationSequenceClass *klass) meta_startup_sequence_class_init (MetaStartupSequenceClass *klass)
{ {
GObjectClass *object_class; GObjectClass *object_class;
object_class = G_OBJECT_CLASS (klass); object_class = G_OBJECT_CLASS (klass);
object_class->finalize = meta_startup_notification_sequence_finalize; object_class->finalize = meta_startup_sequence_finalize;
object_class->set_property = meta_startup_notification_sequence_set_property; object_class->set_property = meta_startup_sequence_set_property;
object_class->get_property = meta_startup_notification_sequence_get_property; object_class->get_property = meta_startup_sequence_get_property;
seq_props[PROP_SEQ_ID] = seq_props[PROP_SEQ_ID] =
g_param_spec_string ("id", g_param_spec_string ("id",
@ -258,30 +258,30 @@ meta_startup_notification_sequence_class_init (MetaStartupNotificationSequenceCl
} }
static const gchar * static const gchar *
meta_startup_notification_sequence_get_id (MetaStartupNotificationSequence *seq) meta_startup_sequence_get_id (MetaStartupSequence *seq)
{ {
MetaStartupNotificationSequencePrivate *priv; MetaStartupSequencePrivate *priv;
priv = meta_startup_notification_sequence_get_instance_private (seq); priv = meta_startup_sequence_get_instance_private (seq);
return priv->id; return priv->id;
} }
#ifdef HAVE_STARTUP_NOTIFICATION #ifdef HAVE_STARTUP_NOTIFICATION
static gint64 static gint64
meta_startup_notification_sequence_get_timestamp (MetaStartupNotificationSequence *seq) meta_startup_sequence_get_timestamp (MetaStartupSequence *seq)
{ {
MetaStartupNotificationSequencePrivate *priv; MetaStartupSequencePrivate *priv;
priv = meta_startup_notification_sequence_get_instance_private (seq); priv = meta_startup_sequence_get_instance_private (seq);
return priv->timestamp; return priv->timestamp;
} }
static void static void
meta_startup_notification_sequence_complete (MetaStartupNotificationSequence *seq) meta_startup_sequence_complete (MetaStartupSequence *seq)
{ {
MetaStartupNotificationSequenceClass *klass; MetaStartupSequenceClass *klass;
klass = META_STARTUP_NOTIFICATION_SEQUENCE_GET_CLASS (seq); klass = META_STARTUP_SEQUENCE_GET_CLASS (seq);
if (klass->complete) if (klass->complete)
klass->complete (seq); klass->complete (seq);
@ -290,34 +290,34 @@ meta_startup_notification_sequence_complete (MetaStartupNotificationSequence *se
#ifdef HAVE_STARTUP_NOTIFICATION #ifdef HAVE_STARTUP_NOTIFICATION
static void static void
meta_startup_notification_sequence_x11_complete (MetaStartupNotificationSequence *seq) meta_startup_sequence_x11_complete (MetaStartupSequence *seq)
{ {
MetaStartupNotificationSequenceX11 *seq_x11; MetaStartupSequenceX11 *seq_x11;
seq_x11 = META_STARTUP_NOTIFICATION_SEQUENCE_X11 (seq); seq_x11 = META_STARTUP_SEQUENCE_X11 (seq);
sn_startup_sequence_complete (seq_x11->seq); sn_startup_sequence_complete (seq_x11->seq);
} }
static void static void
meta_startup_notification_sequence_x11_finalize (GObject *object) meta_startup_sequence_x11_finalize (GObject *object)
{ {
MetaStartupNotificationSequenceX11 *seq; MetaStartupSequenceX11 *seq;
seq = META_STARTUP_NOTIFICATION_SEQUENCE_X11 (object); seq = META_STARTUP_SEQUENCE_X11 (object);
sn_startup_sequence_unref (seq->seq); sn_startup_sequence_unref (seq->seq);
G_OBJECT_CLASS (meta_startup_notification_sequence_x11_parent_class)->finalize (object); G_OBJECT_CLASS (meta_startup_sequence_x11_parent_class)->finalize (object);
} }
static void static void
meta_startup_notification_sequence_x11_set_property (GObject *object, meta_startup_sequence_x11_set_property (GObject *object,
guint prop_id, guint prop_id,
const GValue *value, const GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
MetaStartupNotificationSequenceX11 *seq; MetaStartupSequenceX11 *seq;
seq = META_STARTUP_NOTIFICATION_SEQUENCE_X11 (object); seq = META_STARTUP_SEQUENCE_X11 (object);
switch (prop_id) switch (prop_id)
{ {
@ -332,14 +332,14 @@ meta_startup_notification_sequence_x11_set_property (GObject *object,
} }
static void static void
meta_startup_notification_sequence_x11_get_property (GObject *object, meta_startup_sequence_x11_get_property (GObject *object,
guint prop_id, guint prop_id,
GValue *value, GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
MetaStartupNotificationSequenceX11 *seq; MetaStartupSequenceX11 *seq;
seq = META_STARTUP_NOTIFICATION_SEQUENCE_X11 (object); seq = META_STARTUP_SEQUENCE_X11 (object);
switch (prop_id) switch (prop_id)
{ {
@ -353,23 +353,23 @@ meta_startup_notification_sequence_x11_get_property (GObject *object,
} }
static void static void
meta_startup_notification_sequence_x11_init (MetaStartupNotificationSequenceX11 *seq) meta_startup_sequence_x11_init (MetaStartupSequenceX11 *seq)
{ {
} }
static void static void
meta_startup_notification_sequence_x11_class_init (MetaStartupNotificationSequenceX11Class *klass) meta_startup_sequence_x11_class_init (MetaStartupSequenceX11Class *klass)
{ {
MetaStartupNotificationSequenceClass *seq_class; MetaStartupSequenceClass *seq_class;
GObjectClass *object_class; GObjectClass *object_class;
seq_class = META_STARTUP_NOTIFICATION_SEQUENCE_CLASS (klass); seq_class = META_STARTUP_SEQUENCE_CLASS (klass);
seq_class->complete = meta_startup_notification_sequence_x11_complete; seq_class->complete = meta_startup_sequence_x11_complete;
object_class = G_OBJECT_CLASS (klass); object_class = G_OBJECT_CLASS (klass);
object_class->finalize = meta_startup_notification_sequence_x11_finalize; object_class->finalize = meta_startup_sequence_x11_finalize;
object_class->set_property = meta_startup_notification_sequence_x11_set_property; object_class->set_property = meta_startup_sequence_x11_set_property;
object_class->get_property = meta_startup_notification_sequence_x11_get_property; object_class->get_property = meta_startup_sequence_x11_get_property;
seq_x11_props[PROP_SEQ_X11_SEQ] = seq_x11_props[PROP_SEQ_X11_SEQ] =
g_param_spec_pointer ("seq", g_param_spec_pointer ("seq",
@ -382,13 +382,13 @@ meta_startup_notification_sequence_x11_class_init (MetaStartupNotificationSequen
seq_x11_props); seq_x11_props);
} }
static MetaStartupNotificationSequence * static MetaStartupSequence *
meta_startup_notification_sequence_x11_new (SnStartupSequence *seq) meta_startup_sequence_x11_new (SnStartupSequence *seq)
{ {
gint64 timestamp; gint64 timestamp;
timestamp = sn_startup_sequence_get_timestamp (seq) * 1000; timestamp = sn_startup_sequence_get_timestamp (seq) * 1000;
return g_object_new (META_TYPE_STARTUP_NOTIFICATION_SEQUENCE_X11, return g_object_new (META_TYPE_STARTUP_SEQUENCE_X11,
"id", sn_startup_sequence_get_id (seq), "id", sn_startup_sequence_get_id (seq),
"timestamp", timestamp, "timestamp", timestamp,
"seq", seq, "seq", seq,
@ -397,7 +397,7 @@ meta_startup_notification_sequence_x11_new (SnStartupSequence *seq)
static void static void
meta_startup_notification_add_sequence_internal (MetaStartupNotification *sn, meta_startup_notification_add_sequence_internal (MetaStartupNotification *sn,
MetaStartupNotificationSequence *seq) MetaStartupSequence *seq)
{ {
sn->startup_sequences = g_slist_prepend (sn->startup_sequences, sn->startup_sequences = g_slist_prepend (sn->startup_sequences,
g_object_ref (seq)); g_object_ref (seq));
@ -410,17 +410,17 @@ static void
collect_timed_out_foreach (void *element, collect_timed_out_foreach (void *element,
void *data) void *data)
{ {
MetaStartupNotificationSequence *sequence = element; MetaStartupSequence *sequence = element;
CollectTimedOutData *ctod = data; CollectTimedOutData *ctod = data;
gint64 elapsed, timestamp; gint64 elapsed, timestamp;
timestamp = meta_startup_notification_sequence_get_timestamp (sequence); timestamp = meta_startup_sequence_get_timestamp (sequence);
elapsed = ctod->now - timestamp; elapsed = ctod->now - timestamp;
meta_topic (META_DEBUG_STARTUP, meta_topic (META_DEBUG_STARTUP,
"Sequence used %" G_GINT64_FORMAT " ms vs. %d max: %s\n", "Sequence used %" G_GINT64_FORMAT " ms vs. %d max: %s\n",
elapsed, STARTUP_TIMEOUT, elapsed, STARTUP_TIMEOUT,
meta_startup_notification_sequence_get_id (sequence)); meta_startup_sequence_get_id (sequence));
if (elapsed > STARTUP_TIMEOUT) if (elapsed > STARTUP_TIMEOUT)
ctod->list = g_slist_prepend (ctod->list, sequence); ctod->list = g_slist_prepend (ctod->list, sequence);
@ -441,13 +441,13 @@ startup_sequence_timeout (void *data)
for (l = ctod.list; l != NULL; l = l->next) for (l = ctod.list; l != NULL; l = l->next)
{ {
MetaStartupNotificationSequence *sequence = l->data; MetaStartupSequence *sequence = l->data;
meta_topic (META_DEBUG_STARTUP, meta_topic (META_DEBUG_STARTUP,
"Timed out sequence %s\n", "Timed out sequence %s\n",
meta_startup_notification_sequence_get_id (sequence)); meta_startup_sequence_get_id (sequence));
meta_startup_notification_sequence_complete (sequence); meta_startup_sequence_complete (sequence);
} }
g_slist_free (ctod.list); g_slist_free (ctod.list);
@ -483,7 +483,7 @@ meta_startup_notification_ensure_timeout (MetaStartupNotification *sn)
static void static void
meta_startup_notification_remove_sequence_internal (MetaStartupNotification *sn, meta_startup_notification_remove_sequence_internal (MetaStartupNotification *sn,
MetaStartupNotificationSequence *seq) MetaStartupSequence *seq)
{ {
sn->startup_sequences = g_slist_remove (sn->startup_sequences, seq); sn->startup_sequences = g_slist_remove (sn->startup_sequences, seq);
meta_startup_notification_update_feedback (sn); meta_startup_notification_update_feedback (sn);
@ -498,18 +498,18 @@ meta_startup_notification_remove_sequence_internal (MetaStartupNotification
g_object_unref (seq); g_object_unref (seq);
} }
static MetaStartupNotificationSequence * static MetaStartupSequence *
meta_startup_notification_lookup_sequence (MetaStartupNotification *sn, meta_startup_notification_lookup_sequence (MetaStartupNotification *sn,
const gchar *id) const gchar *id)
{ {
MetaStartupNotificationSequence *seq; MetaStartupSequence *seq;
const gchar *seq_id; const gchar *seq_id;
GSList *l; GSList *l;
for (l = sn->startup_sequences; l; l = l->next) for (l = sn->startup_sequences; l; l = l->next)
{ {
seq = l->data; seq = l->data;
seq_id = meta_startup_notification_sequence_get_id (seq); seq_id = meta_startup_sequence_get_id (seq);
if (g_str_equal (seq_id, id)) if (g_str_equal (seq_id, id))
return l->data; return l->data;
@ -602,7 +602,7 @@ meta_startup_notification_sn_event (SnMonitorEvent *event,
void *user_data) void *user_data)
{ {
MetaStartupNotification *sn = user_data; MetaStartupNotification *sn = user_data;
MetaStartupNotificationSequence *seq; MetaStartupSequence *seq;
SnStartupSequence *sequence; SnStartupSequence *sequence;
sequence = sn_monitor_event_get_startup_sequence (event); sequence = sn_monitor_event_get_startup_sequence (event);
@ -622,7 +622,7 @@ meta_startup_notification_sn_event (SnMonitorEvent *event,
sn_startup_sequence_get_id (sequence), sn_startup_sequence_get_id (sequence),
wmclass ? wmclass : "(unset)"); wmclass ? wmclass : "(unset)");
seq = meta_startup_notification_sequence_x11_new (sequence); seq = meta_startup_sequence_x11_new (sequence);
meta_startup_notification_add_sequence_internal (sn, seq); meta_startup_notification_add_sequence_internal (sn, seq);
g_object_unref (seq); g_object_unref (seq);
} }
@ -757,7 +757,7 @@ void
meta_startup_notification_remove_sequence (MetaStartupNotification *sn, meta_startup_notification_remove_sequence (MetaStartupNotification *sn,
const gchar *id) const gchar *id)
{ {
MetaStartupNotificationSequence *seq; MetaStartupSequence *seq;
seq = meta_startup_notification_lookup_sequence (sn, id); seq = meta_startup_notification_lookup_sequence (sn, id);
if (seq) if (seq)
@ -787,12 +787,12 @@ meta_startup_notification_get_sequences (MetaStartupNotification *sn)
/* We return a list of SnStartupSequences here */ /* We return a list of SnStartupSequences here */
for (l = sn->startup_sequences; l; l = l->next) for (l = sn->startup_sequences; l; l = l->next)
{ {
MetaStartupNotificationSequenceX11 *seq_x11; MetaStartupSequenceX11 *seq_x11;
if (!META_IS_STARTUP_NOTIFICATION_SEQUENCE_X11 (l->data)) if (!META_IS_STARTUP_SEQUENCE_X11 (l->data))
continue; continue;
seq_x11 = META_STARTUP_NOTIFICATION_SEQUENCE_X11 (l->data); seq_x11 = META_STARTUP_SEQUENCE_X11 (l->data);
sequences = g_slist_prepend (sequences, seq_x11->seq); sequences = g_slist_prepend (sequences, seq_x11->seq);
} }
#endif #endif