[Spice-devel] [PATCH 10/10] Move RedCharDeviceCallbacks into RedCharDeviceClass

Christophe Fergeau cfergeau at redhat.com
Thu Apr 7 09:54:41 UTC 2016


On Fri, Apr 01, 2016 at 03:51:44PM -0500, Jonathon Jongsma wrote:
> diff --git a/server/smartcard.c b/server/smartcard.c
> index 52d56ea..0238efe 100644
> --- a/server/smartcard.c
> +++ b/server/smartcard.c
> @@ -272,14 +272,6 @@ static SpiceCharDeviceInstance *smartcard_readers_get_unattached(void)
>  static RedCharDeviceSmartcard *smartcard_device_new(RedsState *reds, SpiceCharDeviceInstance *sin)
>  {
>      RedCharDevice *char_dev;
> -    RedCharDeviceCallbacks char_dev_cbs = {
> -        .read_one_msg_from_device = smartcard_read_msg_from_device,
> -        .ref_msg_to_client = smartcard_ref_msg_to_client,
> -        .unref_msg_to_client = smartcard_unref_msg_to_client,
> -        .send_msg_to_client = smartcard_send_msg_to_client,
> -        .send_tokens_to_client = smartcard_send_tokens_to_client,
> -        .remove_client = smartcard_remove_client,
> -    };
>  
>      char_dev = g_object_new(RED_TYPE_CHAR_DEVICE_SMARTCARD,
>                              "sin", sin,
> @@ -288,8 +280,8 @@ static RedCharDeviceSmartcard *smartcard_device_new(RedsState *reds, SpiceCharDe
>                              "self-tokens", ~0ULL,
>                              NULL);
>  
> -    red_char_device_set_callbacks(RED_CHAR_DEVICE(char_dev),
> -                                  &char_dev_cbs, char_dev);
> +    g_object_set(char_dev, "opaque", char_dev, NULL);
> +

I'm not sure why this is done in a separate call here rather than being
added to the g_object_new call just before as for the other
RedCharDevice children.

Looks good otherwise.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20160407/7833d9fe/attachment.sig>


More information about the Spice-devel mailing list