screen: add MksScreen:number property

This correlates to "head" of the D-Bus interface, which makes for a
terribly non-descriptive property name.
This commit is contained in:
Christian Hergert 2023-02-08 23:26:35 -08:00
parent d16440566b
commit 169acba1bc
2 changed files with 30 additions and 0 deletions

View File

@ -38,6 +38,7 @@ struct _MksScreen
MksKeyboard *keyboard;
MksMouse *mouse;
guint number;
guint width;
guint height;
@ -52,6 +53,7 @@ enum {
PROP_KIND,
PROP_KEYBOARD,
PROP_MOUSE,
PROP_NUMBER,
PROP_WIDTH,
N_PROPS
};
@ -128,6 +130,7 @@ mks_screen_set_console (MksScreen *self,
self->width = mks_qemu_console_get_width (console);
self->height = mks_qemu_console_get_height (console);
self->number = mks_qemu_console_get_head (console);
}
}
@ -170,6 +173,10 @@ mks_screen_get_property (GObject *object,
g_value_set_object (value, mks_screen_get_mouse (self));
break;
case PROP_NUMBER:
g_value_set_uint (value, mks_screen_get_number (self));
break;
case PROP_WIDTH:
g_value_set_uint (value, mks_screen_get_width (self));
break;
@ -223,6 +230,11 @@ mks_screen_class_init (MksScreenClass *klass)
MKS_TYPE_MOUSE,
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
properties [PROP_NUMBER] =
g_param_spec_uint ("number", NULL, NULL,
0, G_MAXUINT, 0,
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
properties [PROP_WIDTH] =
g_param_spec_uint ("width", NULL, NULL,
0, G_MAXUINT, 0,
@ -387,3 +399,19 @@ mks_screen_get_height (MksScreen *self)
return self->height;
}
/**
* mks_screen_get_number:
* @self: a #MksScreen
*
* Gets the "number" property.
*
* Returns: the screen number
*/
guint
mks_screen_get_number (MksScreen *self)
{
g_return_val_if_fail (MKS_IS_SCREEN (self), 0);
return self->number;
}

View File

@ -48,5 +48,7 @@ MKS_AVAILABLE_IN_ALL
guint mks_screen_get_width (MksScreen *self);
MKS_AVAILABLE_IN_ALL
guint mks_screen_get_height (MksScreen *self);
MKS_AVAILABLE_IN_ALL
guint mks_screen_get_number (MksScreen *self);
G_END_DECLS