mirror of
https://gitlab.com/virt-viewer/virt-viewer.git
synced 2025-01-06 13:17:45 +03:00
src: add method to test whether a VM action is supported
SPICE provides a number of VM actions, but they are only supported if the QMP tunnel is available. VNC doesn't currently support any, but in future it will support some. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
a511365d78
commit
27aa853981
@ -731,3 +731,16 @@ void virt_viewer_session_vm_action(VirtViewerSession *self, gint action)
|
|||||||
if (klass->vm_action)
|
if (klass->vm_action)
|
||||||
klass->vm_action(self, action);
|
klass->vm_action(self, action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean virt_viewer_session_has_vm_action(VirtViewerSession *self, gint action)
|
||||||
|
{
|
||||||
|
VirtViewerSessionClass *klass;
|
||||||
|
|
||||||
|
g_return_val_if_fail(VIRT_VIEWER_IS_SESSION(self), FALSE);
|
||||||
|
|
||||||
|
klass = VIRT_VIEWER_SESSION_GET_CLASS(self);
|
||||||
|
|
||||||
|
if (klass->has_vm_action)
|
||||||
|
return klass->has_vm_action(self, action);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
@ -68,6 +68,7 @@ struct _VirtViewerSessionClass {
|
|||||||
gboolean (*can_share_folder)(VirtViewerSession *session);
|
gboolean (*can_share_folder)(VirtViewerSession *session);
|
||||||
gboolean (*can_retry_auth)(VirtViewerSession *session);
|
gboolean (*can_retry_auth)(VirtViewerSession *session);
|
||||||
void (*vm_action)(VirtViewerSession *session, gint action);
|
void (*vm_action)(VirtViewerSession *session, gint action);
|
||||||
|
gboolean (*has_vm_action)(VirtViewerSession *session, gint action);
|
||||||
};
|
};
|
||||||
|
|
||||||
GType virt_viewer_session_get_type(void);
|
GType virt_viewer_session_get_type(void);
|
||||||
@ -107,3 +108,4 @@ gboolean virt_viewer_session_can_share_folder(VirtViewerSession *self);
|
|||||||
gboolean virt_viewer_session_can_retry_auth(VirtViewerSession *self);
|
gboolean virt_viewer_session_can_retry_auth(VirtViewerSession *self);
|
||||||
|
|
||||||
void virt_viewer_session_vm_action(VirtViewerSession *self, gint action);
|
void virt_viewer_session_vm_action(VirtViewerSession *self, gint action);
|
||||||
|
gboolean virt_viewer_session_has_vm_action(VirtViewerSession *self, gint action);
|
||||||
|
Loading…
Reference in New Issue
Block a user