[Spice-devel] [PATCH spice-gtk 04/15] smartcard: use spice_session_is_migration_copy()

Marc-André Lureau marcandre.lureau at redhat.com
Tue Nov 25 05:19:17 PST 2014


---
 gtk/channel-smartcard.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/gtk/channel-smartcard.c b/gtk/channel-smartcard.c
index d27360c..8c54299 100644
--- a/gtk/channel-smartcard.c
+++ b/gtk/channel-smartcard.c
@@ -136,7 +136,7 @@ static void spice_smartcard_channel_constructed(GObject *object)
     g_return_if_fail(s != NULL);
 
 #ifdef USE_SMARTCARD
-    if (!s->priv->migration_copy) {
+    if (!spice_session_is_migration_copy(s)) {
         SpiceSmartcardChannel *channel = SPICE_SMARTCARD_CHANNEL(object);
         SpiceSmartcardManager *manager = spice_smartcard_manager_get();
 
@@ -452,23 +452,23 @@ static void spice_smartcard_channel_up_cb(GObject *source_object,
                                           gpointer user_data)
 {
     SpiceChannel *channel = SPICE_CHANNEL(user_data);
+    GError *error = NULL;
 
     g_return_if_fail(channel != NULL);
     g_return_if_fail(SPICE_IS_SESSION(source_object));
 
-    if (!spice_channel_get_session(SPICE_CHANNEL(channel))->priv->migration_copy) {
-        GError *error = NULL;
-
-        spice_smartcard_manager_init_finish(SPICE_SESSION(source_object),
-                                            res, &error);
-        if (error)
-            g_warning("%s", error->message);
-        g_clear_error(&error);
-    }
+    spice_smartcard_manager_init_finish(SPICE_SESSION(source_object),
+                                        res, &error);
+    if (error)
+        g_warning("%s", error->message);
+    g_clear_error(&error);
 }
 
 static void spice_smartcard_channel_up(SpiceChannel *channel)
 {
+    if (spice_session_is_migration_copy(spice_channel_get_session(channel)))
+        return;
+
     spice_smartcard_manager_init_async(spice_channel_get_session(channel),
                                        g_cancellable_new(),
                                        spice_smartcard_channel_up_cb,
-- 
2.1.0



More information about the Spice-devel mailing list