summaryrefslogtreecommitdiff
path: root/backends/alsa
diff options
context:
space:
mode:
authorWu Xiaotian <[email protected]>2019-06-25 10:39:49 +0800
committerraveit65 <[email protected]>2019-06-29 09:16:12 +0200
commitead1fde223a89a5157e936d23b3bbc5d77260167 (patch)
tree88492f6de032b5256551846e9873769fba999b7b /backends/alsa
parent6c214952d2567143a53ab6273f00fac3a66b3c18 (diff)
downloadlibmatemixer-ead1fde223a89a5157e936d23b3bbc5d77260167.tar.bz2
libmatemixer-ead1fde223a89a5157e936d23b3bbc5d77260167.tar.xz
backend-alsa: avoid deprecated g_type_class_add_private
Diffstat (limited to 'backends/alsa')
-rw-r--r--backends/alsa/alsa-backend.c12
-rw-r--r--backends/alsa/alsa-device.c8
-rw-r--r--backends/alsa/alsa-stream-control.c7
-rw-r--r--backends/alsa/alsa-stream.c8
-rw-r--r--backends/alsa/alsa-switch-option.c7
-rw-r--r--backends/alsa/alsa-switch.c7
-rw-r--r--backends/alsa/alsa-toggle.c7
7 files changed, 18 insertions, 38 deletions
diff --git a/backends/alsa/alsa-backend.c b/backends/alsa/alsa-backend.c
index 45bee15..360d867 100644
--- a/backends/alsa/alsa-backend.c
+++ b/backends/alsa/alsa-backend.c
@@ -55,7 +55,11 @@ static void alsa_backend_finalize (GObject *object);
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-function"
-G_DEFINE_DYNAMIC_TYPE (AlsaBackend, alsa_backend, MATE_MIXER_TYPE_BACKEND)
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (AlsaBackend,
+ alsa_backend,
+ MATE_MIXER_TYPE_BACKEND,
+ 0,
+ G_ADD_PRIVATE_DYNAMIC(AlsaBackend))
#pragma clang diagnostic pop
static gboolean alsa_backend_open (MateMixerBackend *backend);
@@ -125,8 +129,6 @@ alsa_backend_class_init (AlsaBackendClass *klass)
backend_class->close = alsa_backend_close;
backend_class->list_devices = alsa_backend_list_devices;
backend_class->list_streams = alsa_backend_list_streams;
-
- g_type_class_add_private (object_class, sizeof (AlsaBackendPrivate));
}
/* Called in the code generated by G_DEFINE_DYNAMIC_TYPE() */
@@ -138,9 +140,7 @@ alsa_backend_class_finalize (AlsaBackendClass *klass)
static void
alsa_backend_init (AlsaBackend *alsa)
{
- alsa->priv = G_TYPE_INSTANCE_GET_PRIVATE (alsa,
- ALSA_TYPE_BACKEND,
- AlsaBackendPrivate);
+ alsa->priv = alsa_backend_get_instance_private (alsa);
alsa->priv->devices_ids = g_hash_table_new_full (g_str_hash,
g_str_equal,
diff --git a/backends/alsa/alsa-device.c b/backends/alsa/alsa-device.c
index fb12447..7cb140a 100644
--- a/backends/alsa/alsa-device.c
+++ b/backends/alsa/alsa-device.c
@@ -74,7 +74,7 @@ static void alsa_device_init (AlsaDevice *device);
static void alsa_device_dispose (GObject *object);
static void alsa_device_finalize (GObject *object);
-G_DEFINE_TYPE (AlsaDevice, alsa_device, MATE_MIXER_TYPE_DEVICE)
+G_DEFINE_TYPE_WITH_PRIVATE (AlsaDevice, alsa_device, MATE_MIXER_TYPE_DEVICE)
static const GList * alsa_device_list_streams (MateMixerDevice *mmd);
@@ -181,16 +181,12 @@ alsa_device_class_init (AlsaDeviceClass *klass)
G_TYPE_NONE,
0,
G_TYPE_NONE);
-
- g_type_class_add_private (object_class, sizeof (AlsaDevicePrivate));
}
static void
alsa_device_init (AlsaDevice *device)
{
- device->priv = G_TYPE_INSTANCE_GET_PRIVATE (device,
- ALSA_TYPE_DEVICE,
- AlsaDevicePrivate);
+ device->priv = alsa_device_get_instance_private (device);
device->priv->context = g_main_context_ref_thread_default ();
diff --git a/backends/alsa/alsa-stream-control.c b/backends/alsa/alsa-stream-control.c
index 5fd643e..e4dab60 100644
--- a/backends/alsa/alsa-stream-control.c
+++ b/backends/alsa/alsa-stream-control.c
@@ -40,6 +40,7 @@ static void alsa_stream_control_init (AlsaStreamControl *control);
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (AlsaStreamControl, alsa_stream_control,
MATE_MIXER_TYPE_STREAM_CONTROL,
+ G_ADD_PRIVATE(AlsaStreamControl)
G_IMPLEMENT_INTERFACE (ALSA_TYPE_ELEMENT,
alsa_element_interface_init))
@@ -135,16 +136,12 @@ alsa_stream_control_class_init (AlsaStreamControlClass *klass)
control_class->get_max_volume = alsa_stream_control_get_max_volume;
control_class->get_normal_volume = alsa_stream_control_get_normal_volume;
control_class->get_base_volume = alsa_stream_control_get_base_volume;
-
- g_type_class_add_private (G_OBJECT_CLASS (klass), sizeof (AlsaStreamControlPrivate));
}
static void
alsa_stream_control_init (AlsaStreamControl *control)
{
- control->priv = G_TYPE_INSTANCE_GET_PRIVATE (control,
- ALSA_TYPE_STREAM_CONTROL,
- AlsaStreamControlPrivate);
+ control->priv = alsa_stream_control_get_instance_private (control);
}
AlsaControlData *
diff --git a/backends/alsa/alsa-stream.c b/backends/alsa/alsa-stream.c
index fc72f65..2cc61a8 100644
--- a/backends/alsa/alsa-stream.c
+++ b/backends/alsa/alsa-stream.c
@@ -37,7 +37,7 @@ static void alsa_stream_class_init (AlsaStreamClass *klass);
static void alsa_stream_init (AlsaStream *stream);
static void alsa_stream_dispose (GObject *object);
-G_DEFINE_TYPE (AlsaStream, alsa_stream, MATE_MIXER_TYPE_STREAM)
+G_DEFINE_TYPE_WITH_PRIVATE (AlsaStream, alsa_stream, MATE_MIXER_TYPE_STREAM)
static const GList *alsa_stream_list_controls (MateMixerStream *mms);
static const GList *alsa_stream_list_switches (MateMixerStream *mms);
@@ -59,16 +59,12 @@ alsa_stream_class_init (AlsaStreamClass *klass)
stream_class = MATE_MIXER_STREAM_CLASS (klass);
stream_class->list_controls = alsa_stream_list_controls;
stream_class->list_switches = alsa_stream_list_switches;
-
- g_type_class_add_private (object_class, sizeof (AlsaStreamPrivate));
}
static void
alsa_stream_init (AlsaStream *stream)
{
- stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream,
- ALSA_TYPE_STREAM,
- AlsaStreamPrivate);
+ stream->priv = alsa_stream_get_instance_private (stream);
}
static void
diff --git a/backends/alsa/alsa-switch-option.c b/backends/alsa/alsa-switch-option.c
index 81326ce..d73113f 100644
--- a/backends/alsa/alsa-switch-option.c
+++ b/backends/alsa/alsa-switch-option.c
@@ -30,20 +30,17 @@ struct _AlsaSwitchOptionPrivate
static void alsa_switch_option_class_init (AlsaSwitchOptionClass *klass);
static void alsa_switch_option_init (AlsaSwitchOption *option);
-G_DEFINE_TYPE (AlsaSwitchOption, alsa_switch_option, MATE_MIXER_TYPE_SWITCH_OPTION)
+G_DEFINE_TYPE_WITH_PRIVATE (AlsaSwitchOption, alsa_switch_option, MATE_MIXER_TYPE_SWITCH_OPTION)
static void
alsa_switch_option_class_init (AlsaSwitchOptionClass *klass)
{
- g_type_class_add_private (G_OBJECT_CLASS (klass), sizeof (AlsaSwitchOptionPrivate));
}
static void
alsa_switch_option_init (AlsaSwitchOption *option)
{
- option->priv = G_TYPE_INSTANCE_GET_PRIVATE (option,
- ALSA_TYPE_SWITCH_OPTION,
- AlsaSwitchOptionPrivate);
+ option->priv = alsa_switch_option_get_instance_private (option);
}
AlsaSwitchOption *
diff --git a/backends/alsa/alsa-switch.c b/backends/alsa/alsa-switch.c
index c2a95ca..7711e0d 100644
--- a/backends/alsa/alsa-switch.c
+++ b/backends/alsa/alsa-switch.c
@@ -42,6 +42,7 @@ static void alsa_switch_dispose (GObject *object);
G_DEFINE_TYPE_WITH_CODE (AlsaSwitch, alsa_switch,
MATE_MIXER_TYPE_STREAM_SWITCH,
+ G_ADD_PRIVATE(AlsaSwitch)
G_IMPLEMENT_INTERFACE (ALSA_TYPE_ELEMENT,
alsa_element_interface_init))
@@ -75,8 +76,6 @@ alsa_switch_class_init (AlsaSwitchClass *klass)
switch_class = MATE_MIXER_SWITCH_CLASS (klass);
switch_class->set_active_option = alsa_switch_set_active_option;
switch_class->list_options = alsa_switch_list_options;
-
- g_type_class_add_private (G_OBJECT_CLASS (klass), sizeof (AlsaSwitchPrivate));
}
static void
@@ -97,9 +96,7 @@ alsa_switch_dispose (GObject *object)
static void
alsa_switch_init (AlsaSwitch *swtch)
{
- swtch->priv = G_TYPE_INSTANCE_GET_PRIVATE (swtch,
- ALSA_TYPE_SWITCH,
- AlsaSwitchPrivate);
+ swtch->priv = alsa_switch_get_instance_private (swtch);
}
AlsaSwitch *
diff --git a/backends/alsa/alsa-toggle.c b/backends/alsa/alsa-toggle.c
index d143236..ec363dd 100644
--- a/backends/alsa/alsa-toggle.c
+++ b/backends/alsa/alsa-toggle.c
@@ -40,6 +40,7 @@ static void alsa_toggle_class_init (AlsaToggleClass *klass);
static void alsa_toggle_init (AlsaToggle *toggle);
G_DEFINE_TYPE_WITH_CODE (AlsaToggle, alsa_toggle, MATE_MIXER_TYPE_STREAM_TOGGLE,
+ G_ADD_PRIVATE(AlsaToggle)
G_IMPLEMENT_INTERFACE (ALSA_TYPE_ELEMENT,
alsa_element_interface_init))
@@ -66,16 +67,12 @@ alsa_toggle_class_init (AlsaToggleClass *klass)
switch_class = MATE_MIXER_SWITCH_CLASS (klass);
switch_class->set_active_option = alsa_toggle_set_active_option;
-
- g_type_class_add_private (G_OBJECT_CLASS (klass), sizeof (AlsaTogglePrivate));
}
static void
alsa_toggle_init (AlsaToggle *toggle)
{
- toggle->priv = G_TYPE_INSTANCE_GET_PRIVATE (toggle,
- ALSA_TYPE_TOGGLE,
- AlsaTogglePrivate);
+ toggle->priv = alsa_toggle_get_instance_private (toggle);
}
AlsaToggle *