[Spice-devel] [PATCH spice-gtk 2/4] audio: fix deprecation warning

Marc-André Lureau mlureau at redhat.com
Tue Jan 31 08:52:06 UTC 2017


Hi

----- Original Message -----
> Hi,
> 
> On Fri, Jan 27, 2017 at 03:17:44PM +0400, marcandre.lureau at redhat.com wrote:
> > From: Marc-André Lureau <marcandre.lureau at redhat.com>
> > 
> > Use a private function to avoid the spice_audio_new() deprecation
> > warning.
> > 
> > Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
> > ---
> >  spice-common           |  2 +-
> 
> No need to change spice-common, I guess.

right, fixed

> 
> >  src/spice-audio-priv.h |  3 +++
> >  src/spice-audio.c      | 39 +++++++++++++++++++++++----------------
> >  src/spice-session.c    |  4 ++--
> >  4 files changed, 29 insertions(+), 19 deletions(-)
> > 
> > diff --git a/spice-common b/spice-common
> > index 86dcd22..22864af 160000
> > --- a/spice-common
> > +++ b/spice-common
> > @@ -1 +1 @@
> > -Subproject commit 86dcd22d334a4992718780417bc574623bd61826
> > +Subproject commit 22864af2403377515b275cf95cb181a4ad05111f
> > diff --git a/src/spice-audio-priv.h b/src/spice-audio-priv.h
> > index f108059..04123f5 100644
> > --- a/src/spice-audio-priv.h
> > +++ b/src/spice-audio-priv.h
> > @@ -29,6 +29,9 @@ struct _SpiceAudioPrivate {
> >      GMainContext            *main_context;
> >  };
> >  
> > +SpiceAudio *spice_audio_new_priv(SpiceSession *session, GMainContext
> > *context,
> > +                                 const char *name);
> > +
> >  void spice_audio_get_playback_volume_info_async(SpiceAudio *audio,
> >  GCancellable *cancellable,
> >          SpiceMainChannel *main_channel, GAsyncReadyCallback callback,
> >          gpointer user_data);
> >  gboolean spice_audio_get_playback_volume_info_finish(SpiceAudio *audio,
> >  GAsyncResult *res,
> > diff --git a/src/spice-audio.c b/src/spice-audio.c
> > index c514d30..7dc6a24 100644
> > --- a/src/spice-audio.c
> > +++ b/src/spice-audio.c
> > @@ -232,22 +232,9 @@ gboolean
> > spice_audio_get_record_volume_info_finish(SpiceAudio *audio,
> >              res, mute, nchannels, volume, error);
> >  }
> >  
> > -/**
> > - * spice_audio_new:
> > - * @session: the #SpiceSession to connect to
> > - * @context: (allow-none): a #GMainContext to attach to (or %NULL for
> > - * default).
> > - * @name: (allow-none): a name for the audio channels (or %NULL for
> > - * application name).
> > - *
> > - * Once instantiated, #SpiceAudio will handle the playback and record
> > - * channels to stream to your local audio system.
> > - *
> > - * Returns: a new #SpiceAudio instance or %NULL if no backend or failed.
> > - * Deprecated: 0.8: Use spice_audio_get() instead
> > - **/
> > -SpiceAudio *spice_audio_new(SpiceSession *session, GMainContext *context,
> > -                            const char *name)
> > +G_GNUC_INTERNAL
> > +SpiceAudio *spice_audio_new_priv(SpiceSession *session, GMainContext
> > *context,
> > +                                 const char *name)
> >  {
> >      SpiceAudio *self = NULL;
> >  
> > @@ -272,3 +259,23 @@ SpiceAudio *spice_audio_new(SpiceSession *session,
> > GMainContext *context,
> >  
> >      return self;
> >  }
> > +
> > +/**
> > + * spice_audio_new:
> > + * @session: the #SpiceSession to connect to
> > + * @context: (allow-none): a #GMainContext to attach to (or %NULL for
> > + * default).
> > + * @name: (allow-none): a name for the audio channels (or %NULL for
> > + * application name).
> > + *
> > + * Once instantiated, #SpiceAudio will handle the playback and record
> > + * channels to stream to your local audio system.
> > + *
> > + * Returns: a new #SpiceAudio instance or %NULL if no backend or failed.
> > + * Deprecated: 0.8: Use spice_audio_get() instead
> > + **/
> > +SpiceAudio *spice_audio_new(SpiceSession *session, GMainContext *context,
> > +                            const char *name)
> > +{
> > +    return spice_audio_new_priv(session, context, name);
> > +}
> > diff --git a/src/spice-session.c b/src/spice-session.c
> > index 3f450d9..66376ff 100644
> > --- a/src/spice-session.c
> > +++ b/src/spice-session.c
> > @@ -33,7 +33,7 @@
> >  #include "wocky-http-proxy.h"
> >  #include "spice-uri-priv.h"
> >  #include "channel-playback-priv.h"
> > -#include "spice-audio.h"
> > +#include "spice-audio-priv.h"
> >  
> >  struct channel {
> >      SpiceChannel      *channel;
> > @@ -2648,7 +2648,7 @@ SpiceAudio *spice_audio_get(SpiceSession *session,
> > GMainContext *context)
> >      g_mutex_lock(&mutex);
> >      self = session->priv->audio_manager;
> >      if (self == NULL) {
> > -        self = spice_audio_new(session, context, NULL);
> > +        self = spice_audio_new_priv(session, context, NULL);
> >          session->priv->audio_manager = self;
> >      }
> >      g_mutex_unlock(&mutex);
> > --
> > 2.11.0.295.gd7dffce1c.dirty
> > 
> > _______________________________________________
> > Spice-devel mailing list
> > Spice-devel at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/spice-devel
> 


More information about the Spice-devel mailing list