[virt-tools-list] [PATCH virt-viewer 09/17] Add spice_get_option_group()

Marc-André Lureau marcandre.lureau at gmail.com
Fri Jan 27 13:51:28 UTC 2012


From: Marc-André Lureau <marcandre.lureau at redhat.com>

---
 configure.ac                    |    2 +-
 src/remote-viewer-main.c        |    3 +++
 src/virt-viewer-main.c          |    8 ++++++--
 src/virt-viewer-session-spice.c |    6 +++++-
 4 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index b2d7e8f..77838fe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,7 +16,7 @@ LIBVIRT_REQUIRED="0.6.0"
 GTK2_REQUIRED="2.12.0"
 GTK3_REQUIRED="3.0"
 GTK_VNC_REQUIRED="0.4.3"
-SPICE_GTK_REQUIRED="0.6"
+SPICE_GTK_REQUIRED="0.6.174"
 
 AC_PROG_CC
 AM_PROG_CC_C_O
diff --git a/src/remote-viewer-main.c b/src/remote-viewer-main.c
index 2256528..89ef25f 100644
--- a/src/remote-viewer-main.c
+++ b/src/remote-viewer-main.c
@@ -91,6 +91,9 @@ main(int argc, char **argv)
 #ifdef HAVE_GTK_VNC
 	g_option_context_add_group (context, vnc_display_get_option_group ());
 #endif
+#ifdef HAVE_SPICE_GTK
+	g_option_context_add_group (context, spice_get_option_group ());
+#endif
 	g_option_context_parse (context, &argc, &argv, &error);
 	if (error) {
 		g_printerr("%s\n%s\n",
diff --git a/src/virt-viewer-main.c b/src/virt-viewer-main.c
index 7e2886b..07534b4 100644
--- a/src/virt-viewer-main.c
+++ b/src/virt-viewer-main.c
@@ -25,11 +25,12 @@
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
 #include <stdlib.h>
-
 #ifdef HAVE_GTK_VNC
 #include <vncdisplay.h>
 #endif
-
+#ifdef HAVE_SPICE_GTK
+#include <spice-option.h>
+#endif
 #include "virt-viewer.h"
 
 static void virt_viewer_version(void)
@@ -94,6 +95,9 @@ int main(int argc, char **argv)
 #ifdef HAVE_GTK_VNC
 	g_option_context_add_group (context, vnc_display_get_option_group ());
 #endif
+#ifdef HAVE_SPICE_GTK
+	g_option_context_add_group (context, spice_get_option_group ());
+#endif
 	g_option_context_parse (context, &argc, &argv, &error);
 	if (error) {
 		g_printerr("%s\n%s\n",
diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
index f89d042..de2da3d 100644
--- a/src/virt-viewer-session-spice.c
+++ b/src/virt-viewer-session-spice.c
@@ -23,9 +23,9 @@
  */
 
 #include <spice-audio.h>
-
 #include <glib/gi18n.h>
 
+#include <spice-option.h>
 #include "virt-viewer-util.h"
 #include "virt-viewer-session-spice.h"
 #include "virt-viewer-display-spice.h"
@@ -154,7 +154,9 @@ virt_viewer_session_spice_close(VirtViewerSession *session)
 		self->priv->audio = NULL;
 	}
 
+	/* FIXME: version 0.7 of spice-gtk allows reuse of session */
 	self->priv->session = spice_session_new();
+	spice_set_session_option(self->priv->session);
 	g_signal_connect(self->priv->session, "channel-new",
 			 G_CALLBACK(virt_viewer_session_spice_channel_new), self);
 	g_signal_connect(self->priv->session, "channel-destroy",
@@ -351,6 +353,8 @@ virt_viewer_session_spice_new(void)
 	self = g_object_new(VIRT_VIEWER_TYPE_SESSION_SPICE, NULL);
 
 	self->priv->session = spice_session_new();
+	spice_set_session_option(self->priv->session);
+
 	g_signal_connect(self->priv->session, "channel-new",
 			 G_CALLBACK(virt_viewer_session_spice_channel_new), self);
 	g_signal_connect(self->priv->session, "channel-destroy",
-- 
1.7.7.6




More information about the virt-tools-list mailing list