core: Add extra properties to MetaStartupSequence

Those that we use from SnStartupSequence over the place...
This commit is contained in:
Carlos Garnacho 2018-08-22 21:14:31 +02:00 committed by Georges Basile Stavracas Neto
parent 26fbd56a95
commit 91ce24d4b4

View File

@ -49,6 +49,11 @@ enum {
PROP_SEQ_0, PROP_SEQ_0,
PROP_SEQ_ID, PROP_SEQ_ID,
PROP_SEQ_TIMESTAMP, PROP_SEQ_TIMESTAMP,
PROP_SEQ_ICON_NAME,
PROP_SEQ_APPLICATION_ID,
PROP_SEQ_WMCLASS,
PROP_SEQ_WORKSPACE,
PROP_SEQ_NAME,
N_SEQ_PROPS N_SEQ_PROPS
}; };
@ -78,8 +83,13 @@ struct _MetaStartupNotification
}; };
typedef struct { typedef struct {
gchar *id; char *wmclass;
gint64 timestamp; char *name;
char *application_id;
char *icon_name;
char *id;
uint64_t timestamp;
int workspace;
} MetaStartupSequencePrivate; } MetaStartupSequencePrivate;
G_DEFINE_TYPE (MetaStartupNotification, G_DEFINE_TYPE (MetaStartupNotification,
@ -125,6 +135,10 @@ meta_startup_sequence_finalize (GObject *object)
seq = META_STARTUP_SEQUENCE (object); seq = META_STARTUP_SEQUENCE (object);
priv = meta_startup_sequence_get_instance_private (seq); priv = meta_startup_sequence_get_instance_private (seq);
g_free (priv->id); g_free (priv->id);
g_free (priv->wmclass);
g_free (priv->name);
g_free (priv->application_id);
g_free (priv->icon_name);
G_OBJECT_CLASS (meta_startup_sequence_parent_class)->finalize (object); G_OBJECT_CLASS (meta_startup_sequence_parent_class)->finalize (object);
} }
@ -147,7 +161,22 @@ meta_startup_sequence_set_property (GObject *object,
priv->id = g_value_dup_string (value); priv->id = g_value_dup_string (value);
break; break;
case PROP_SEQ_TIMESTAMP: case PROP_SEQ_TIMESTAMP:
priv->timestamp = g_value_get_int64 (value); priv->timestamp = g_value_get_uint64 (value);
break;
case PROP_SEQ_ICON_NAME:
priv->icon_name = g_value_dup_string (value);
break;
case PROP_SEQ_APPLICATION_ID:
priv->application_id = g_value_dup_string (value);
break;
case PROP_SEQ_WMCLASS:
priv->wmclass = g_value_dup_string (value);
break;
case PROP_SEQ_WORKSPACE:
priv->workspace = g_value_get_int (value);
break;
case PROP_SEQ_NAME:
priv->name = g_value_dup_string (value);
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -173,7 +202,22 @@ meta_startup_sequence_get_property (GObject *object,
g_value_set_string (value, priv->id); g_value_set_string (value, priv->id);
break; break;
case PROP_SEQ_TIMESTAMP: case PROP_SEQ_TIMESTAMP:
g_value_set_int64 (value, priv->timestamp); g_value_set_uint64 (value, priv->timestamp);
break;
case PROP_SEQ_ICON_NAME:
g_value_set_string (value, priv->icon_name);
break;
case PROP_SEQ_APPLICATION_ID:
g_value_set_string (value, priv->application_id);
break;
case PROP_SEQ_WMCLASS:
g_value_set_string (value, priv->wmclass);
break;
case PROP_SEQ_WORKSPACE:
g_value_set_int (value, priv->workspace);
break;
case PROP_SEQ_NAME:
g_value_set_string (value, priv->name);
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -199,12 +243,47 @@ meta_startup_sequence_class_init (MetaStartupSequenceClass *klass)
G_PARAM_READWRITE | G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY); G_PARAM_CONSTRUCT_ONLY);
seq_props[PROP_SEQ_TIMESTAMP] = seq_props[PROP_SEQ_TIMESTAMP] =
g_param_spec_int64 ("timestamp", g_param_spec_uint64 ("timestamp",
"Timestamp", "Timestamp",
"Timestamp", "Timestamp",
G_MININT64, G_MAXINT64, 0, 0, G_MAXUINT64, 0,
G_PARAM_READWRITE | G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY); G_PARAM_CONSTRUCT_ONLY);
seq_props[PROP_SEQ_ICON_NAME] =
g_param_spec_string ("icon-name",
"Icon name",
"Icon name",
NULL,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY);
seq_props[PROP_SEQ_APPLICATION_ID] =
g_param_spec_string ("application-id",
"Application ID",
"Application ID",
NULL,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY);
seq_props[PROP_SEQ_WMCLASS] =
g_param_spec_string ("wmclass",
"WM class",
"WM class",
NULL,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY);
seq_props[PROP_SEQ_WORKSPACE] =
g_param_spec_int ("workspace",
"Workspace",
"Workspace",
G_MININT, G_MAXINT, -1,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY);
seq_props[PROP_SEQ_NAME] =
g_param_spec_string ("name",
"Name",
"Name",
NULL,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_properties (object_class, N_SEQ_PROPS, seq_props); g_object_class_install_properties (object_class, N_SEQ_PROPS, seq_props);
} }