audio: fix deprecation warning

Use a private function to avoid the spice_audio_new() deprecation
warning.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
This commit is contained in:
Marc-André Lureau 2017-01-27 14:55:55 +04:00
parent f84431375a
commit 8f72ada3fa
3 changed files with 28 additions and 18 deletions

View File

@ -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,

View File

@ -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);
}

View File

@ -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);