From 498b37841f36c86a27b75b97a4fc22053da94ffa Mon Sep 17 00:00:00 2001 From: Wu Xiaotian Date: Sun, 30 Jun 2019 17:33:00 +0800 Subject: pulse: avoid deprecated g_type_class_add_private --- backends/pulse/pulse-backend.c | 8 ++------ backends/pulse/pulse-connection.c | 8 ++------ backends/pulse/pulse-device-profile.c | 7 ++----- backends/pulse/pulse-device-switch.c | 8 ++------ backends/pulse/pulse-device.c | 8 ++------ backends/pulse/pulse-ext-stream.c | 8 ++------ backends/pulse/pulse-monitor.c | 8 ++------ backends/pulse/pulse-port-switch.c | 8 ++------ backends/pulse/pulse-port.c | 7 ++----- backends/pulse/pulse-sink.c | 8 ++------ backends/pulse/pulse-source.c | 8 ++------ backends/pulse/pulse-stream-control.c | 8 ++------ backends/pulse/pulse-stream.c | 8 ++------ 13 files changed, 26 insertions(+), 76 deletions(-) (limited to 'backends/pulse') diff --git a/backends/pulse/pulse-backend.c b/backends/pulse/pulse-backend.c index 9b483b9..854d414 100644 --- a/backends/pulse/pulse-backend.c +++ b/backends/pulse/pulse-backend.c @@ -123,7 +123,7 @@ static void pulse_backend_finalize (GObject *object); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunused-function" -G_DEFINE_DYNAMIC_TYPE (PulseBackend, pulse_backend, MATE_MIXER_TYPE_BACKEND) +G_DEFINE_DYNAMIC_TYPE_EXTENDED (PulseBackend, pulse_backend, MATE_MIXER_TYPE_BACKEND, 0, G_ADD_PRIVATE_DYNAMIC(PulseBackend)) #pragma clang diagnostic pop static gboolean pulse_backend_open (MateMixerBackend *backend); @@ -252,8 +252,6 @@ pulse_backend_class_init (PulseBackendClass *klass) backend_class->list_stored_controls = pulse_backend_list_stored_controls; backend_class->set_default_input_stream = pulse_backend_set_default_input_stream; backend_class->set_default_output_stream = pulse_backend_set_default_output_stream; - - g_type_class_add_private (object_class, sizeof (PulseBackendPrivate)); } /* Called in the code generated by G_DEFINE_DYNAMIC_TYPE() */ @@ -265,9 +263,7 @@ pulse_backend_class_finalize (PulseBackendClass *klass) static void pulse_backend_init (PulseBackend *pulse) { - pulse->priv = G_TYPE_INSTANCE_GET_PRIVATE (pulse, - PULSE_TYPE_BACKEND, - PulseBackendPrivate); + pulse->priv = pulse_backend_get_instance_private (pulse); /* These hash tables store PulseDevice and PulseStream instances */ pulse->priv->devices = diff --git a/backends/pulse/pulse-connection.c b/backends/pulse/pulse-connection.c index 62156c1..c6fc7b0 100644 --- a/backends/pulse/pulse-connection.c +++ b/backends/pulse/pulse-connection.c @@ -84,7 +84,7 @@ static void pulse_connection_set_property (GObject *object, static void pulse_connection_init (PulseConnection *connection); static void pulse_connection_finalize (GObject *object); -G_DEFINE_TYPE (PulseConnection, pulse_connection, G_TYPE_OBJECT); +G_DEFINE_TYPE_WITH_PRIVATE (PulseConnection, pulse_connection, G_TYPE_OBJECT); static gchar *create_app_name (void); @@ -331,8 +331,6 @@ pulse_connection_class_init (PulseConnectionClass *klass) G_TYPE_NONE, 1, G_TYPE_POINTER); - - g_type_class_add_private (object_class, sizeof (PulseConnectionPrivate)); } static void @@ -382,9 +380,7 @@ pulse_connection_set_property (GObject *object, static void pulse_connection_init (PulseConnection *connection) { - connection->priv = G_TYPE_INSTANCE_GET_PRIVATE (connection, - PULSE_TYPE_CONNECTION, - PulseConnectionPrivate); + connection->priv = pulse_connection_get_instance_private (connection); } static void diff --git a/backends/pulse/pulse-device-profile.c b/backends/pulse/pulse-device-profile.c index 5487841..0b00aba 100644 --- a/backends/pulse/pulse-device-profile.c +++ b/backends/pulse/pulse-device-profile.c @@ -36,20 +36,17 @@ struct _PulseDeviceProfilePrivate static void pulse_device_profile_class_init (PulseDeviceProfileClass *klass); static void pulse_device_profile_init (PulseDeviceProfile *profile); -G_DEFINE_TYPE (PulseDeviceProfile, pulse_device_profile, MATE_MIXER_TYPE_SWITCH_OPTION) +G_DEFINE_TYPE_WITH_PRIVATE (PulseDeviceProfile, pulse_device_profile, MATE_MIXER_TYPE_SWITCH_OPTION) static void pulse_device_profile_class_init (PulseDeviceProfileClass *klass) { - g_type_class_add_private (klass, sizeof (PulseDeviceProfilePrivate)); } static void pulse_device_profile_init (PulseDeviceProfile *profile) { - profile->priv = G_TYPE_INSTANCE_GET_PRIVATE (profile, - PULSE_TYPE_DEVICE_PROFILE, - PulseDeviceProfilePrivate); + profile->priv = pulse_device_profile_get_instance_private (profile); } PulseDeviceProfile * diff --git a/backends/pulse/pulse-device-switch.c b/backends/pulse/pulse-device-switch.c index 4bd32ce..ea0f6fd 100644 --- a/backends/pulse/pulse-device-switch.c +++ b/backends/pulse/pulse-device-switch.c @@ -36,7 +36,7 @@ static void pulse_device_switch_class_init (PulseDeviceSwitchClass *klass); static void pulse_device_switch_init (PulseDeviceSwitch *swtch); static void pulse_device_switch_dispose (GObject *object); -G_DEFINE_TYPE (PulseDeviceSwitch, pulse_device_switch, MATE_MIXER_TYPE_DEVICE_SWITCH) +G_DEFINE_TYPE_WITH_PRIVATE (PulseDeviceSwitch, pulse_device_switch, MATE_MIXER_TYPE_DEVICE_SWITCH) static gboolean pulse_device_switch_set_active_option (MateMixerSwitch *mms, MateMixerSwitchOption *mmso); @@ -60,16 +60,12 @@ pulse_device_switch_class_init (PulseDeviceSwitchClass *klass) switch_class = MATE_MIXER_SWITCH_CLASS (klass); switch_class->set_active_option = pulse_device_switch_set_active_option; switch_class->list_options = pulse_device_switch_list_options; - - g_type_class_add_private (G_OBJECT_CLASS (klass), sizeof (PulseDeviceSwitchPrivate)); } static void pulse_device_switch_init (PulseDeviceSwitch *swtch) { - swtch->priv = G_TYPE_INSTANCE_GET_PRIVATE (swtch, - PULSE_TYPE_DEVICE_SWITCH, - PulseDeviceSwitchPrivate); + swtch->priv = pulse_device_switch_get_instance_private (swtch); } static void diff --git a/backends/pulse/pulse-device.c b/backends/pulse/pulse-device.c index 454e80a..940d3e9 100644 --- a/backends/pulse/pulse-device.c +++ b/backends/pulse/pulse-device.c @@ -67,7 +67,7 @@ static void pulse_device_init (PulseDevice *device); static void pulse_device_dispose (GObject *object); static void pulse_device_finalize (GObject *object); -G_DEFINE_TYPE (PulseDevice, pulse_device, MATE_MIXER_TYPE_DEVICE) +G_DEFINE_TYPE_WITH_PRIVATE (PulseDevice, pulse_device, MATE_MIXER_TYPE_DEVICE) static MateMixerStream *pulse_device_get_stream (MateMixerDevice *mmd, const gchar *name); @@ -118,8 +118,6 @@ pulse_device_class_init (PulseDeviceClass *klass) G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, N_PROPERTIES, properties); - - g_type_class_add_private (object_class, sizeof (PulseDevicePrivate)); } static void @@ -171,9 +169,7 @@ pulse_device_set_property (GObject *object, static void pulse_device_init (PulseDevice *device) { - device->priv = G_TYPE_INSTANCE_GET_PRIVATE (device, - PULSE_TYPE_DEVICE, - PulseDevicePrivate); + device->priv = pulse_device_get_instance_private (device); device->priv->ports = g_hash_table_new_full (g_str_hash, g_str_equal, diff --git a/backends/pulse/pulse-ext-stream.c b/backends/pulse/pulse-ext-stream.c index e99fbb1..ab7d982 100644 --- a/backends/pulse/pulse-ext-stream.c +++ b/backends/pulse/pulse-ext-stream.c @@ -64,7 +64,7 @@ static void pulse_ext_stream_init (PulseExtStream *ext); static void pulse_ext_stream_dispose (GObject *object); static void pulse_ext_stream_finalize (GObject *object); -G_DEFINE_TYPE (PulseExtStream, pulse_ext_stream, MATE_MIXER_TYPE_STORED_CONTROL) +G_DEFINE_TYPE_WITH_PRIVATE (PulseExtStream, pulse_ext_stream, MATE_MIXER_TYPE_STORED_CONTROL) static MateMixerAppInfo * pulse_ext_stream_get_app_info (MateMixerStreamControl *mmsc); @@ -159,8 +159,6 @@ pulse_ext_stream_class_init (PulseExtStreamClass *klass) G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, N_PROPERTIES, properties); - - g_type_class_add_private (object_class, sizeof (PulseExtStreamPrivate)); } static void @@ -214,9 +212,7 @@ pulse_ext_stream_set_property (GObject *object, static void pulse_ext_stream_init (PulseExtStream *ext) { - ext->priv = G_TYPE_INSTANCE_GET_PRIVATE (ext, - PULSE_TYPE_EXT_STREAM, - PulseExtStreamPrivate); + ext->priv = pulse_ext_stream_get_instance_private (ext); } static void diff --git a/backends/pulse/pulse-monitor.c b/backends/pulse/pulse-monitor.c index 915b71b..585e5e8 100644 --- a/backends/pulse/pulse-monitor.c +++ b/backends/pulse/pulse-monitor.c @@ -64,7 +64,7 @@ static void pulse_monitor_set_property (GObject *object, static void pulse_monitor_init (PulseMonitor *monitor); static void pulse_monitor_finalize (GObject *object); -G_DEFINE_TYPE (PulseMonitor, pulse_monitor, G_TYPE_OBJECT); +G_DEFINE_TYPE_WITH_PRIVATE (PulseMonitor, pulse_monitor, G_TYPE_OBJECT); static gboolean stream_connect (PulseMonitor *monitor); @@ -125,8 +125,6 @@ pulse_monitor_class_init (PulseMonitorClass *klass) G_TYPE_NONE, 1, G_TYPE_DOUBLE); - - g_type_class_add_private (object_class, sizeof (PulseMonitorPrivate)); } static void @@ -181,9 +179,7 @@ pulse_monitor_set_property (GObject *object, static void pulse_monitor_init (PulseMonitor *monitor) { - monitor->priv = G_TYPE_INSTANCE_GET_PRIVATE (monitor, - PULSE_TYPE_MONITOR, - PulseMonitorPrivate); + monitor->priv = pulse_monitor_get_instance_private (monitor); } static void diff --git a/backends/pulse/pulse-port-switch.c b/backends/pulse/pulse-port-switch.c index 1f4ce67..7d90911 100644 --- a/backends/pulse/pulse-port-switch.c +++ b/backends/pulse/pulse-port-switch.c @@ -36,7 +36,7 @@ static void pulse_port_switch_class_init (PulsePortSwitchClass *klass); static void pulse_port_switch_init (PulsePortSwitch *swtch); static void pulse_port_switch_dispose (GObject *object); -G_DEFINE_ABSTRACT_TYPE (PulsePortSwitch, pulse_port_switch, MATE_MIXER_TYPE_STREAM_SWITCH) +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (PulsePortSwitch, pulse_port_switch, MATE_MIXER_TYPE_STREAM_SWITCH) static gboolean pulse_port_switch_set_active_option (MateMixerSwitch *mms, MateMixerSwitchOption *mmso); @@ -60,16 +60,12 @@ pulse_port_switch_class_init (PulsePortSwitchClass *klass) switch_class = MATE_MIXER_SWITCH_CLASS (klass); switch_class->set_active_option = pulse_port_switch_set_active_option; switch_class->list_options = pulse_port_switch_list_options; - - g_type_class_add_private (G_OBJECT_CLASS (klass), sizeof (PulsePortSwitchPrivate)); } static void pulse_port_switch_init (PulsePortSwitch *swtch) { - swtch->priv = G_TYPE_INSTANCE_GET_PRIVATE (swtch, - PULSE_TYPE_PORT_SWITCH, - PulsePortSwitchPrivate); + swtch->priv = pulse_port_switch_get_instance_private (swtch); } static void diff --git a/backends/pulse/pulse-port.c b/backends/pulse/pulse-port.c index f427448..23faafa 100644 --- a/backends/pulse/pulse-port.c +++ b/backends/pulse/pulse-port.c @@ -35,20 +35,17 @@ struct _PulsePortPrivate static void pulse_port_class_init (PulsePortClass *klass); static void pulse_port_init (PulsePort *port); -G_DEFINE_TYPE (PulsePort, pulse_port, MATE_MIXER_TYPE_SWITCH_OPTION) +G_DEFINE_TYPE_WITH_PRIVATE (PulsePort, pulse_port, MATE_MIXER_TYPE_SWITCH_OPTION) static void pulse_port_class_init (PulsePortClass *klass) { - g_type_class_add_private (klass, sizeof (PulsePortPrivate)); } static void pulse_port_init (PulsePort *port) { - port->priv = G_TYPE_INSTANCE_GET_PRIVATE (port, - PULSE_TYPE_PORT, - PulsePortPrivate); + port->priv = pulse_port_get_instance_private (port); } PulsePort * diff --git a/backends/pulse/pulse-sink.c b/backends/pulse/pulse-sink.c index 3f9573d..bcfb330 100644 --- a/backends/pulse/pulse-sink.c +++ b/backends/pulse/pulse-sink.c @@ -49,7 +49,7 @@ static void pulse_sink_init (PulseSink *sink); static void pulse_sink_dispose (GObject *object); static void pulse_sink_finalize (GObject *object); -G_DEFINE_TYPE (PulseSink, pulse_sink, PULSE_TYPE_STREAM); +G_DEFINE_TYPE_WITH_PRIVATE (PulseSink, pulse_sink, PULSE_TYPE_STREAM); static const GList *pulse_sink_list_controls (MateMixerStream *mms); static const GList *pulse_sink_list_switches (MateMixerStream *mms); @@ -69,16 +69,12 @@ pulse_sink_class_init (PulseSinkClass *klass) stream_class = MATE_MIXER_STREAM_CLASS (klass); stream_class->list_controls = pulse_sink_list_controls; stream_class->list_switches = pulse_sink_list_switches; - - g_type_class_add_private (klass, sizeof (PulseSinkPrivate)); } static void pulse_sink_init (PulseSink *sink) { - sink->priv = G_TYPE_INSTANCE_GET_PRIVATE (sink, - PULSE_TYPE_SINK, - PulseSinkPrivate); + sink->priv = pulse_sink_get_instance_private (sink); sink->priv->inputs = g_hash_table_new_full (g_direct_hash, g_direct_equal, diff --git a/backends/pulse/pulse-source.c b/backends/pulse/pulse-source.c index b70cbe4..b834a2f 100644 --- a/backends/pulse/pulse-source.c +++ b/backends/pulse/pulse-source.c @@ -48,7 +48,7 @@ static void pulse_source_init (PulseSource *source); static void pulse_source_dispose (GObject *object); static void pulse_source_finalize (GObject *object); -G_DEFINE_TYPE (PulseSource, pulse_source, PULSE_TYPE_STREAM); +G_DEFINE_TYPE_WITH_PRIVATE (PulseSource, pulse_source, PULSE_TYPE_STREAM); static const GList *pulse_source_list_controls (MateMixerStream *mms); static const GList *pulse_source_list_switches (MateMixerStream *mms); @@ -68,16 +68,12 @@ pulse_source_class_init (PulseSourceClass *klass) stream_class = MATE_MIXER_STREAM_CLASS (klass); stream_class->list_controls = pulse_source_list_controls; stream_class->list_switches = pulse_source_list_switches; - - g_type_class_add_private (klass, sizeof (PulseSourcePrivate)); } static void pulse_source_init (PulseSource *source) { - source->priv = G_TYPE_INSTANCE_GET_PRIVATE (source, - PULSE_TYPE_SOURCE, - PulseSourcePrivate); + source->priv = pulse_source_get_instance_private (source); source->priv->outputs = g_hash_table_new_full (g_direct_hash, g_direct_equal, diff --git a/backends/pulse/pulse-stream-control.c b/backends/pulse/pulse-stream-control.c index 5ed5bb8..f65505f 100644 --- a/backends/pulse/pulse-stream-control.c +++ b/backends/pulse/pulse-stream-control.c @@ -64,7 +64,7 @@ static void pulse_stream_control_init (PulseStreamControl *control) static void pulse_stream_control_dispose (GObject *object); static void pulse_stream_control_finalize (GObject *object); -G_DEFINE_ABSTRACT_TYPE (PulseStreamControl, pulse_stream_control, MATE_MIXER_TYPE_STREAM_CONTROL) +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (PulseStreamControl, pulse_stream_control, MATE_MIXER_TYPE_STREAM_CONTROL) static MateMixerAppInfo * pulse_stream_control_get_app_info (MateMixerStreamControl *mmsc); @@ -178,8 +178,6 @@ pulse_stream_control_class_init (PulseStreamControlClass *klass) G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, N_PROPERTIES, properties); - - g_type_class_add_private (object_class, sizeof (PulseStreamControlPrivate)); } static void @@ -231,9 +229,7 @@ pulse_stream_control_set_property (GObject *object, static void pulse_stream_control_init (PulseStreamControl *control) { - control->priv = G_TYPE_INSTANCE_GET_PRIVATE (control, - PULSE_TYPE_STREAM_CONTROL, - PulseStreamControlPrivate); + control->priv = pulse_stream_control_get_instance_private (control); /* Initialize empty volume and channel map structures, they will be used * if the stream does not support volume */ diff --git a/backends/pulse/pulse-stream.c b/backends/pulse/pulse-stream.c index 50b821e..fa795ee 100644 --- a/backends/pulse/pulse-stream.c +++ b/backends/pulse/pulse-stream.c @@ -58,7 +58,7 @@ static void pulse_stream_set_property (GObject *object, static void pulse_stream_init (PulseStream *stream); static void pulse_stream_dispose (GObject *object); -G_DEFINE_ABSTRACT_TYPE (PulseStream, pulse_stream, MATE_MIXER_TYPE_STREAM) +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (PulseStream, pulse_stream, MATE_MIXER_TYPE_STREAM) static void pulse_stream_class_init (PulseStreamClass *klass) @@ -91,8 +91,6 @@ pulse_stream_class_init (PulseStreamClass *klass) G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, N_PROPERTIES, properties); - - g_type_class_add_private (object_class, sizeof (PulseStreamPrivate)); } static void @@ -144,9 +142,7 @@ pulse_stream_set_property (GObject *object, static void pulse_stream_init (PulseStream *stream) { - stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream, - PULSE_TYPE_STREAM, - PulseStreamPrivate); + stream->priv = pulse_stream_get_instance_private (stream); } static void -- cgit v1.2.1