summaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorWu Xiaotian <[email protected]>2019-06-30 17:49:52 +0800
committerraveit65 <[email protected]>2019-07-02 13:41:11 +0200
commitceedb3408e9f12f1b36ad98218fee69960eb47e8 (patch)
treed9917bc70002c55b0ce310c6c800603bbf8c5b3d /backends
parentead1fde223a89a5157e936d23b3bbc5d77260167 (diff)
downloadlibmatemixer-ceedb3408e9f12f1b36ad98218fee69960eb47e8.tar.bz2
libmatemixer-ceedb3408e9f12f1b36ad98218fee69960eb47e8.tar.xz
oss: avoid deprecated g_type_class_add_private
Diffstat (limited to 'backends')
-rw-r--r--backends/oss/oss-backend.c8
-rw-r--r--backends/oss/oss-device.c8
-rw-r--r--backends/oss/oss-stream-control.c7
-rw-r--r--backends/oss/oss-stream.c8
-rw-r--r--backends/oss/oss-switch-option.c7
-rw-r--r--backends/oss/oss-switch.c8
6 files changed, 12 insertions, 34 deletions
diff --git a/backends/oss/oss-backend.c b/backends/oss/oss-backend.c
index 9726570..792367e 100644
--- a/backends/oss/oss-backend.c
+++ b/backends/oss/oss-backend.c
@@ -61,7 +61,7 @@ static void oss_backend_finalize (GObject *object);
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-function"
-G_DEFINE_DYNAMIC_TYPE (OssBackend, oss_backend, MATE_MIXER_TYPE_BACKEND)
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (OssBackend, oss_backend, MATE_MIXER_TYPE_BACKEND, 0, G_ADD_PRIVATE (OssBackend))
#pragma clang diagnostic pop
static gboolean oss_backend_open (MateMixerBackend *backend);
@@ -142,8 +142,6 @@ oss_backend_class_init (OssBackendClass *klass)
backend_class->close = oss_backend_close;
backend_class->list_devices = oss_backend_list_devices;
backend_class->list_streams = oss_backend_list_streams;
-
- g_type_class_add_private (object_class, sizeof (OssBackendPrivate));
}
/* Called in the code generated by G_DEFINE_DYNAMIC_TYPE() */
@@ -155,9 +153,7 @@ oss_backend_class_finalize (OssBackendClass *klass)
static void
oss_backend_init (OssBackend *oss)
{
- oss->priv = G_TYPE_INSTANCE_GET_PRIVATE (oss,
- OSS_TYPE_BACKEND,
- OssBackendPrivate);
+ oss->priv = oss_backend_get_instance_private (oss);
oss->priv->devices_paths = g_hash_table_new_full (g_str_hash,
g_str_equal,
diff --git a/backends/oss/oss-device.c b/backends/oss/oss-device.c
index 70f46e6..c660de2 100644
--- a/backends/oss/oss-device.c
+++ b/backends/oss/oss-device.c
@@ -184,7 +184,7 @@ static void oss_device_init (OssDevice *device);
static void oss_device_dispose (GObject *object);
static void oss_device_finalize (GObject *object);
-G_DEFINE_TYPE (OssDevice, oss_device, MATE_MIXER_TYPE_DEVICE)
+G_DEFINE_TYPE_WITH_PRIVATE (OssDevice, oss_device, MATE_MIXER_TYPE_DEVICE)
static const GList *oss_device_list_streams (MateMixerDevice *mmd);
@@ -227,16 +227,12 @@ oss_device_class_init (OssDeviceClass *klass)
G_TYPE_NONE,
0,
G_TYPE_NONE);
-
- g_type_class_add_private (object_class, sizeof (OssDevicePrivate));
}
static void
oss_device_init (OssDevice *device)
{
- device->priv = G_TYPE_INSTANCE_GET_PRIVATE (device,
- OSS_TYPE_DEVICE,
- OssDevicePrivate);
+ device->priv = oss_device_get_instance_private (device);
}
static void
diff --git a/backends/oss/oss-stream-control.c b/backends/oss/oss-stream-control.c
index 4ae238e..6a78866 100644
--- a/backends/oss/oss-stream-control.c
+++ b/backends/oss/oss-stream-control.c
@@ -51,7 +51,7 @@ static void oss_stream_control_class_init (OssStreamControlClass *klass);
static void oss_stream_control_init (OssStreamControl *control);
static void oss_stream_control_finalize (GObject *object);
-G_DEFINE_TYPE (OssStreamControl, oss_stream_control, MATE_MIXER_TYPE_STREAM_CONTROL)
+G_DEFINE_TYPE_WITH_PRIVATE (OssStreamControl, oss_stream_control, MATE_MIXER_TYPE_STREAM_CONTROL)
static guint oss_stream_control_get_num_channels (MateMixerStreamControl *mmsc);
@@ -110,15 +110,12 @@ oss_stream_control_class_init (OssStreamControlClass *klass)
control_class->get_normal_volume = oss_stream_control_get_normal_volume;
control_class->get_base_volume = oss_stream_control_get_base_volume;
- g_type_class_add_private (object_class, sizeof (OssStreamControlPrivate));
}
static void
oss_stream_control_init (OssStreamControl *control)
{
- control->priv = G_TYPE_INSTANCE_GET_PRIVATE (control,
- OSS_TYPE_STREAM_CONTROL,
- OssStreamControlPrivate);
+ control->priv = oss_stream_control_get_instance_private (control);
}
static void
diff --git a/backends/oss/oss-stream.c b/backends/oss/oss-stream.c
index f094537..d82032e 100644
--- a/backends/oss/oss-stream.c
+++ b/backends/oss/oss-stream.c
@@ -39,7 +39,7 @@ static void oss_stream_class_init (OssStreamClass *klass);
static void oss_stream_init (OssStream *stream);
static void oss_stream_dispose (GObject *object);
-G_DEFINE_TYPE (OssStream, oss_stream, MATE_MIXER_TYPE_STREAM)
+G_DEFINE_TYPE_WITH_PRIVATE (OssStream, oss_stream, MATE_MIXER_TYPE_STREAM)
static const GList *oss_stream_list_controls (MateMixerStream *mms);
static const GList *oss_stream_list_switches (MateMixerStream *mms);
@@ -56,16 +56,12 @@ oss_stream_class_init (OssStreamClass *klass)
stream_class = MATE_MIXER_STREAM_CLASS (klass);
stream_class->list_controls = oss_stream_list_controls;
stream_class->list_switches = oss_stream_list_switches;
-
- g_type_class_add_private (object_class, sizeof (OssStreamPrivate));
}
static void
oss_stream_init (OssStream *stream)
{
- stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream,
- OSS_TYPE_STREAM,
- OssStreamPrivate);
+ stream->priv = oss_stream_get_instance_private (stream);
}
static void
diff --git a/backends/oss/oss-switch-option.c b/backends/oss/oss-switch-option.c
index 544f321..cc3134c 100644
--- a/backends/oss/oss-switch-option.c
+++ b/backends/oss/oss-switch-option.c
@@ -29,20 +29,17 @@ struct _OssSwitchOptionPrivate
static void oss_switch_option_class_init (OssSwitchOptionClass *klass);
static void oss_switch_option_init (OssSwitchOption *option);
-G_DEFINE_TYPE (OssSwitchOption, oss_switch_option, MATE_MIXER_TYPE_SWITCH_OPTION)
+G_DEFINE_TYPE_WITH_PRIVATE (OssSwitchOption, oss_switch_option, MATE_MIXER_TYPE_SWITCH_OPTION)
static void
oss_switch_option_class_init (OssSwitchOptionClass *klass)
{
- g_type_class_add_private (G_OBJECT_CLASS (klass), sizeof (OssSwitchOptionPrivate));
}
static void
oss_switch_option_init (OssSwitchOption *option)
{
- option->priv = G_TYPE_INSTANCE_GET_PRIVATE (option,
- OSS_TYPE_SWITCH_OPTION,
- OssSwitchOptionPrivate);
+ option->priv = oss_switch_option_get_instance_private (option);
}
OssSwitchOption *
diff --git a/backends/oss/oss-switch.c b/backends/oss/oss-switch.c
index ba07d36..0805d33 100644
--- a/backends/oss/oss-switch.c
+++ b/backends/oss/oss-switch.c
@@ -37,7 +37,7 @@ static void oss_switch_init (OssSwitch *swtch);
static void oss_switch_dispose (GObject *object);
static void oss_switch_finalize (GObject *object);
-G_DEFINE_TYPE (OssSwitch, oss_switch, MATE_MIXER_TYPE_STREAM_SWITCH)
+G_DEFINE_TYPE_WITH_PRIVATE (OssSwitch, oss_switch, MATE_MIXER_TYPE_STREAM_SWITCH)
static gboolean oss_switch_set_active_option (MateMixerSwitch *mms,
MateMixerSwitchOption *mmso);
@@ -59,16 +59,12 @@ oss_switch_class_init (OssSwitchClass *klass)
switch_class = MATE_MIXER_SWITCH_CLASS (klass);
switch_class->set_active_option = oss_switch_set_active_option;
switch_class->list_options = oss_switch_list_options;
-
- g_type_class_add_private (G_OBJECT_CLASS (klass), sizeof (OssSwitchPrivate));
}
static void
oss_switch_init (OssSwitch *swtch)
{
- swtch->priv = G_TYPE_INSTANCE_GET_PRIVATE (swtch,
- OSS_TYPE_SWITCH,
- OssSwitchPrivate);
+ swtch->priv = oss_switch_get_instance_private (swtch);
}
static void