[Spice-devel] [PATCH spice-gtk 04/15] smartcard: use spice_session_is_migration_copy()
Jonathon Jongsma
jjongsma at redhat.com
Tue Nov 25 11:57:19 PST 2014
On Tue, 2014-11-25 at 14:19 +0100, Marc-André Lureau wrote:
> ---
> 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,
ACK, but can you add a couple words to the commit log about why you're
moving the _is_migration_copy check from the callback to the other
function?
More information about the Spice-devel
mailing list