[Spice-devel] [spice-gtk 12/13] channel: add spice_channel_get_error()

Marc-André Lureau marcandre.lureau at gmail.com
Tue Feb 11 09:50:50 PST 2014


On Tue, Feb 11, 2014 at 6:49 PM, Christophe Fergeau <cfergeau at redhat.com> wrote:
> On Mon, Feb 03, 2014 at 07:02:43PM +0100, Marc-André Lureau wrote:
>> From: Marc-André Lureau <marcandre.lureau at redhat.com>
>>
>> Add a function to retrieve the last GError from a channel, this may be
>> useful to provide additional error details to the client.
>> ---
>>  doc/reference/spice-gtk-sections.txt |  1 +
>>  gtk/map-file                         |  1 +
>>  gtk/spice-channel-priv.h             |  1 +
>>  gtk/spice-channel.c                  | 26 ++++++++++++++++++++++++--
>>  gtk/spice-channel.h                  |  2 ++
>>  gtk/spice-glib-sym-file              |  1 +
>>  gtk/spice-session-priv.h             |  2 +-
>>  gtk/spice-session.c                  |  6 +++---
>>  gtk/spicy.c                          |  6 ++++++
>>  9 files changed, 40 insertions(+), 6 deletions(-)
>>
>> diff --git a/doc/reference/spice-gtk-sections.txt b/doc/reference/spice-gtk-sections.txt
>> index 411ca0e..9f0cf67 100644
>> --- a/doc/reference/spice-gtk-sections.txt
>> +++ b/doc/reference/spice-gtk-sections.txt
>> @@ -102,6 +102,7 @@ spice_channel_string_to_type
>>  spice_channel_set_capability
>>  spice_channel_flush_async
>>  spice_channel_flush_finish
>> +spice_channel_get_error
>>  <SUBSECTION Standard>
>>  SPICE_TYPE_CHANNEL_EVENT
>>  spice_channel_event_get_type
>> diff --git a/gtk/map-file b/gtk/map-file
>> index cf65db0..d9e596b 100644
>> --- a/gtk/map-file
>> +++ b/gtk/map-file
>> @@ -7,6 +7,7 @@ spice_channel_connect;
>>  spice_channel_destroy;
>>  spice_channel_disconnect;
>>  spice_channel_event_get_type;
>> +spice_channel_get_error;
>>  spice_channel_get_type;
>>  spice_channel_new;
>>  spice_channel_open_fd;
>> diff --git a/gtk/spice-channel-priv.h b/gtk/spice-channel-priv.h
>> index fd08b2a..591f80e 100644
>> --- a/gtk/spice-channel-priv.h
>> +++ b/gtk/spice-channel-priv.h
>> @@ -136,6 +136,7 @@ struct _SpiceChannelPrivate {
>>      GSList                      *flushing;
>>
>>      gboolean                    disable_channel_msg;
>> +    GError                      *error;
>>  };
>>
>>  SpiceMsgIn *spice_msg_in_new(SpiceChannel *channel);
>> diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
>> index 87bc471..e8391be 100644
>> --- a/gtk/spice-channel.c
>> +++ b/gtk/spice-channel.c
>> @@ -154,6 +154,8 @@ static void spice_channel_dispose(GObject *gobject)
>>           c->session = NULL;
>>      }
>>
>> +    g_clear_error(&c->error);
>> +
>>      /* Chain up to the parent class */
>>      if (G_OBJECT_CLASS(spice_channel_parent_class)->dispose)
>>          G_OBJECT_CLASS(spice_channel_parent_class)->dispose(gobject);
>> @@ -2211,6 +2213,25 @@ static int spice_channel_load_ca(SpiceChannel *channel)
>>      return count;
>>  }
>>
>> +/**
>> + * spice_channel_get_error:
>> + * @channel:
>> + *
>> + * Retrieves the #GError currently set on channel, if the #SpiceChannel
>> + * is in error state.
>> + *
>> + * Returns: the pointer to the error, or NULL
>> + * Since: 0.23
>
> It's 0.24 now.

yeah, thanks reminding me :)


-- 
Marc-André Lureau


More information about the Spice-devel mailing list