[virt-tools-list] [PATCH 02/12] Add virt_viewer_session_open_uri
Marc-André Lureau
marcandre.lureau at gmail.com
Tue Dec 13 19:35:00 UTC 2011
---
src/virt-viewer-session-spice.c | 16 ++++++++++++++++
src/virt-viewer-session.c | 12 ++++++++++++
src/virt-viewer-session.h | 2 ++
3 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
index d0d6e29..066f922 100644
--- a/src/virt-viewer-session-spice.c
+++ b/src/virt-viewer-session-spice.c
@@ -44,6 +44,7 @@ struct _VirtViewerSessionSpicePrivate {
static void virt_viewer_session_spice_close(VirtViewerSession *session);
static gboolean virt_viewer_session_spice_open_fd(VirtViewerSession *session, int fd);
static gboolean virt_viewer_session_spice_open_host(VirtViewerSession *session, char *host, char *port);
+static gboolean virt_viewer_session_spice_open_uri(VirtViewerSession *session, char *uri);
static gboolean virt_viewer_session_spice_channel_open_fd(VirtViewerSession *session, VirtViewerSessionChannel *channel, int fd);
static void virt_viewer_session_spice_channel_new(SpiceSession *s,
SpiceChannel *channel,
@@ -80,6 +81,7 @@ virt_viewer_session_spice_class_init(VirtViewerSessionSpiceClass *klass)
dclass->close = virt_viewer_session_spice_close;
dclass->open_fd = virt_viewer_session_spice_open_fd;
dclass->open_host = virt_viewer_session_spice_open_host;
+ dclass->open_uri = virt_viewer_session_spice_open_uri;
dclass->channel_open_fd = virt_viewer_session_spice_channel_open_fd;
g_type_class_add_private(oclass, sizeof(VirtViewerSessionSpicePrivate));
@@ -136,6 +138,20 @@ virt_viewer_session_spice_open_host(VirtViewerSession *session,
}
static gboolean
+virt_viewer_session_spice_open_uri(VirtViewerSession *session,
+ char *uri)
+{
+ VirtViewerSessionSpice *self = VIRT_VIEWER_SESSION_SPICE(session);
+
+ g_return_val_if_fail(self != NULL, FALSE);
+ g_return_val_if_fail(self->priv->session != NULL, FALSE);
+
+ g_object_set(self->priv->session, "uri", uri, NULL);
+
+ return spice_session_connect(self->priv->session);
+}
+
+static gboolean
virt_viewer_session_spice_open_fd(VirtViewerSession *session,
int fd)
{
diff --git a/src/virt-viewer-session.c b/src/virt-viewer-session.c
index d151238..b10839f 100644
--- a/src/virt-viewer-session.c
+++ b/src/virt-viewer-session.c
@@ -239,6 +239,18 @@ gboolean virt_viewer_session_open_host(VirtViewerSession *session, char *host, c
return klass->open_host(session, host, port);
}
+gboolean virt_viewer_session_open_uri(VirtViewerSession *session, gchar *uri)
+{
+ VirtViewerSessionClass *klass;
+
+ g_return_val_if_fail(VIRT_VIEWER_IS_SESSION(session), FALSE);
+
+ klass = VIRT_VIEWER_SESSION_GET_CLASS(session);
+ g_return_val_if_fail(klass->open_uri != NULL, FALSE);
+
+ return klass->open_uri(session, uri);
+}
+
gboolean virt_viewer_session_channel_open_fd(VirtViewerSession *session,
VirtViewerSessionChannel *channel, int fd)
{
diff --git a/src/virt-viewer-session.h b/src/virt-viewer-session.h
index 48c8de3..28c2c26 100644
--- a/src/virt-viewer-session.h
+++ b/src/virt-viewer-session.h
@@ -68,6 +68,7 @@ struct _VirtViewerSessionClass {
void (* close) (VirtViewerSession* session);
gboolean (* open_fd) (VirtViewerSession* session, int fd);
gboolean (* open_host) (VirtViewerSession* session, char *host, char *port);
+ gboolean (* open_uri) (VirtViewerSession* session, char *uri);
gboolean (* channel_open_fd) (VirtViewerSession* session, VirtViewerSessionChannel *channel, int fd);
/* signals */
@@ -104,6 +105,7 @@ gboolean virt_viewer_session_open_host(VirtViewerSession* session, char *host, c
GObject* virt_viewer_session_get(VirtViewerSession* session);
gboolean virt_viewer_session_channel_open_fd(VirtViewerSession* session,
VirtViewerSessionChannel* channel, int fd);
+gboolean virt_viewer_session_open_uri(VirtViewerSession *session, gchar *uri);
G_END_DECLS
--
1.7.7.3
More information about the virt-tools-list
mailing list