[Spice-devel] [spice-gtk PATCH v2 7/8] migration: copy enable-smartcard/audio/usbredir state to the migrated session
Yonit Halperin
yhalperi at redhat.com
Sat Aug 25 13:20:23 PDT 2012
Otherwise, we will not create smartcard/usb channel on the destination
side, and we will create audio channels, no matter if they existed
of didn't exist for the src side.
---
gtk/spice-channel.c | 12 +++---------
gtk/spice-session.c | 3 +++
gtk/usb-device-manager.c | 4 +---
3 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index a557ce8..7e23bfe 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -1912,9 +1912,7 @@ SpiceChannel *spice_channel_new(SpiceSession *s, int type, int id)
break;
case SPICE_CHANNEL_PLAYBACK:
case SPICE_CHANNEL_RECORD: {
- gboolean enabled;
- g_object_get(G_OBJECT(s), "enable-audio", &enabled, NULL);
- if (!enabled) {
+ if (!s->priv->audio) {
g_debug("audio channel is disabled, not creating it");
return NULL;
}
@@ -1924,9 +1922,7 @@ SpiceChannel *spice_channel_new(SpiceSession *s, int type, int id)
}
#ifdef USE_SMARTCARD
case SPICE_CHANNEL_SMARTCARD: {
- gboolean enabled;
- g_object_get(G_OBJECT(s), "enable-smartcard", &enabled, NULL);
- if (!enabled) {
+ if (!s->priv->smartcard) {
g_debug("smartcard channel is disabled, not creating it");
return NULL;
}
@@ -1936,9 +1932,7 @@ SpiceChannel *spice_channel_new(SpiceSession *s, int type, int id)
#endif
#ifdef USE_USBREDIR
case SPICE_CHANNEL_USBREDIR: {
- gboolean enabled;
- g_object_get(G_OBJECT(s), "enable-usbredir", &enabled, NULL);
- if (!enabled) {
+ if (!s->priv->usbredir) {
g_debug("usbredir channel is disabled, not creating it");
return NULL;
}
diff --git a/gtk/spice-session.c b/gtk/spice-session.c
index f714676..b6c7642 100644
--- a/gtk/spice-session.c
+++ b/gtk/spice-session.c
@@ -1089,6 +1089,9 @@ SpiceSession *spice_session_new_from_session(SpiceSession *session)
"verify", &c->verify,
"smartcard-certificates", &c->smartcard_certificates,
"smartcard-db", &c->smartcard_db,
+ "enable-smartcard", &c->smartcard,
+ "enable-audio", &c->audio,
+ "enable-usbredir", &c->usbredir,
NULL);
c->client_provided_sockets = s->client_provided_sockets;
diff --git a/gtk/usb-device-manager.c b/gtk/usb-device-manager.c
index bdef24e..6358da8 100644
--- a/gtk/usb-device-manager.c
+++ b/gtk/usb-device-manager.c
@@ -1215,14 +1215,12 @@ spice_usb_device_manager_can_redirect_device(SpiceUsbDeviceManager *self,
const struct usbredirfilter_rule *guest_filter_rules = NULL;
SpiceUsbDeviceManagerPrivate *priv = self->priv;
int i, guest_filter_rules_count;
- gboolean enabled;
g_return_val_if_fail(SPICE_IS_USB_DEVICE_MANAGER(self), FALSE);
g_return_val_if_fail(device != NULL, FALSE);
g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
- g_object_get(G_OBJECT(priv->session), "enable-usbredir", &enabled, NULL);
- if (!enabled) {
+ if (!priv->session->priv->usbredir) {
g_set_error_literal(err, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
_("USB redirection is disabled"));
return FALSE;
--
1.7.7.6
More information about the Spice-devel
mailing list