From 6c214952d2567143a53ab6273f00fac3a66b3c18 Mon Sep 17 00:00:00 2001 From: Wu Xiaotian Date: Tue, 25 Jun 2019 10:05:08 +0800 Subject: libmatemixer: avoid deprecated g_type_class_add_private --- libmatemixer/matemixer-backend-module.c | 8 ++------ libmatemixer/matemixer-backend.c | 8 ++------ libmatemixer/matemixer-context.c | 8 ++------ libmatemixer/matemixer-device-switch.c | 8 ++------ libmatemixer/matemixer-device.c | 8 ++------ libmatemixer/matemixer-stored-control.c | 8 ++------ libmatemixer/matemixer-stream-control.c | 8 ++------ libmatemixer/matemixer-stream-switch.c | 8 ++------ libmatemixer/matemixer-stream-toggle.c | 8 ++------ libmatemixer/matemixer-stream.c | 8 ++------ libmatemixer/matemixer-switch-option.c | 8 ++------ libmatemixer/matemixer-switch.c | 8 ++------ 12 files changed, 24 insertions(+), 72 deletions(-) diff --git a/libmatemixer/matemixer-backend-module.c b/libmatemixer/matemixer-backend-module.c index f5f7994..b01b33f 100644 --- a/libmatemixer/matemixer-backend-module.c +++ b/libmatemixer/matemixer-backend-module.c @@ -56,7 +56,7 @@ static void mate_mixer_backend_module_init (MateMixerBackendModule static void mate_mixer_backend_module_dispose (GObject *object); static void mate_mixer_backend_module_finalize (GObject *object); -G_DEFINE_TYPE (MateMixerBackendModule, mate_mixer_backend_module, G_TYPE_TYPE_MODULE); +G_DEFINE_TYPE_WITH_PRIVATE (MateMixerBackendModule, mate_mixer_backend_module, G_TYPE_TYPE_MODULE); static gboolean backend_module_load (GTypeModule *gmodule); static void backend_module_unload (GTypeModule *gmodule); @@ -86,8 +86,6 @@ mate_mixer_backend_module_class_init (MateMixerBackendModuleClass *klass) module_class = G_TYPE_MODULE_CLASS (klass); module_class->load = backend_module_load; module_class->unload = backend_module_unload; - - g_type_class_add_private (object_class, sizeof (MateMixerBackendModulePrivate)); } static void @@ -138,9 +136,7 @@ mate_mixer_backend_module_set_property (GObject *object, static void mate_mixer_backend_module_init (MateMixerBackendModule *module) { - module->priv = G_TYPE_INSTANCE_GET_PRIVATE (module, - MATE_MIXER_TYPE_BACKEND_MODULE, - MateMixerBackendModulePrivate); + module->priv = mate_mixer_backend_module_get_instance_private (module); } static void diff --git a/libmatemixer/matemixer-backend.c b/libmatemixer/matemixer-backend.c index 682bf68..7e26fef 100644 --- a/libmatemixer/matemixer-backend.c +++ b/libmatemixer/matemixer-backend.c @@ -74,7 +74,7 @@ static void mate_mixer_backend_set_property (GObject *object, static void mate_mixer_backend_dispose (GObject *object); static void mate_mixer_backend_finalize (GObject *object); -G_DEFINE_ABSTRACT_TYPE (MateMixerBackend, mate_mixer_backend, G_TYPE_OBJECT) +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (MateMixerBackend, mate_mixer_backend, G_TYPE_OBJECT) static void device_added (MateMixerBackend *backend, const gchar *name); @@ -195,8 +195,6 @@ mate_mixer_backend_class_init (MateMixerBackendClass *klass) G_TYPE_NONE, 1, G_TYPE_STRING); - - g_type_class_add_private (object_class, sizeof (MateMixerBackendPrivate)); } static void @@ -253,9 +251,7 @@ mate_mixer_backend_set_property (GObject *object, static void mate_mixer_backend_init (MateMixerBackend *backend) { - backend->priv = G_TYPE_INSTANCE_GET_PRIVATE (backend, - MATE_MIXER_TYPE_BACKEND, - MateMixerBackendPrivate); + backend->priv = mate_mixer_backend_get_instance_private (backend); backend->priv->devices = g_hash_table_new_full (g_str_hash, g_str_equal, diff --git a/libmatemixer/matemixer-context.c b/libmatemixer/matemixer-context.c index dacbc9a..117bda8 100644 --- a/libmatemixer/matemixer-context.c +++ b/libmatemixer/matemixer-context.c @@ -123,7 +123,7 @@ static void mate_mixer_context_init (MateMixerContext *context); static void mate_mixer_context_dispose (GObject *object); static void mate_mixer_context_finalize (GObject *object); -G_DEFINE_TYPE (MateMixerContext, mate_mixer_context, G_TYPE_OBJECT); +G_DEFINE_TYPE_WITH_PRIVATE (MateMixerContext, mate_mixer_context, G_TYPE_OBJECT); static void on_backend_state_notify (MateMixerBackend *backend, GParamSpec *pspec, @@ -430,8 +430,6 @@ mate_mixer_context_class_init (MateMixerContextClass *klass) G_TYPE_NONE, 1, G_TYPE_STRING); - - g_type_class_add_private (object_class, sizeof (MateMixerContextPrivate)); } static void @@ -518,9 +516,7 @@ mate_mixer_context_set_property (GObject *object, static void mate_mixer_context_init (MateMixerContext *context) { - context->priv = G_TYPE_INSTANCE_GET_PRIVATE (context, - MATE_MIXER_TYPE_CONTEXT, - MateMixerContextPrivate); + context->priv = mate_mixer_context_get_instance_private (context); context->priv->app_info = _mate_mixer_app_info_new (); } diff --git a/libmatemixer/matemixer-device-switch.c b/libmatemixer/matemixer-device-switch.c index bc0ea70..773d74c 100644 --- a/libmatemixer/matemixer-device-switch.c +++ b/libmatemixer/matemixer-device-switch.c @@ -57,7 +57,7 @@ static void mate_mixer_device_switch_set_property (GObject *o static void mate_mixer_device_switch_init (MateMixerDeviceSwitch *swtch); -G_DEFINE_ABSTRACT_TYPE (MateMixerDeviceSwitch, mate_mixer_device_switch, MATE_MIXER_TYPE_SWITCH) +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (MateMixerDeviceSwitch, mate_mixer_device_switch, MATE_MIXER_TYPE_SWITCH) static void mate_mixer_device_switch_class_init (MateMixerDeviceSwitchClass *klass) @@ -88,8 +88,6 @@ mate_mixer_device_switch_class_init (MateMixerDeviceSwitchClass *klass) G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, N_PROPERTIES, properties); - - g_type_class_add_private (object_class, sizeof (MateMixerDeviceSwitchPrivate)); } static void @@ -146,9 +144,7 @@ mate_mixer_device_switch_set_property (GObject *object, static void mate_mixer_device_switch_init (MateMixerDeviceSwitch *swtch) { - swtch->priv = G_TYPE_INSTANCE_GET_PRIVATE (swtch, - MATE_MIXER_TYPE_DEVICE_SWITCH, - MateMixerDeviceSwitchPrivate); + swtch->priv = mate_mixer_device_switch_get_instance_private (swtch); } /** diff --git a/libmatemixer/matemixer-device.c b/libmatemixer/matemixer-device.c index 7cf417b..7f5764c 100644 --- a/libmatemixer/matemixer-device.c +++ b/libmatemixer/matemixer-device.c @@ -75,7 +75,7 @@ static void mate_mixer_device_set_property (GObject *object, static void mate_mixer_device_init (MateMixerDevice *device); static void mate_mixer_device_finalize (GObject *object); -G_DEFINE_ABSTRACT_TYPE (MateMixerDevice, mate_mixer_device, G_TYPE_OBJECT) +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (MateMixerDevice, mate_mixer_device, G_TYPE_OBJECT) static MateMixerStream * mate_mixer_device_real_get_stream (MateMixerDevice *device, const gchar *name); @@ -229,8 +229,6 @@ mate_mixer_device_class_init (MateMixerDeviceClass *klass) G_TYPE_NONE, 1, G_TYPE_STRING); - - g_type_class_add_private (object_class, sizeof (MateMixerDevicePrivate)); } static void @@ -293,9 +291,7 @@ mate_mixer_device_set_property (GObject *object, static void mate_mixer_device_init (MateMixerDevice *device) { - device->priv = G_TYPE_INSTANCE_GET_PRIVATE (device, - MATE_MIXER_TYPE_DEVICE, - MateMixerDevicePrivate); + device->priv = mate_mixer_device_get_instance_private (device); } static void diff --git a/libmatemixer/matemixer-stored-control.c b/libmatemixer/matemixer-stored-control.c index d150490..c7d6043 100644 --- a/libmatemixer/matemixer-stored-control.c +++ b/libmatemixer/matemixer-stored-control.c @@ -49,7 +49,7 @@ static void mate_mixer_stored_control_set_property (GObject static void mate_mixer_stored_control_init (MateMixerStoredControl *control); -G_DEFINE_ABSTRACT_TYPE (MateMixerStoredControl, mate_mixer_stored_control, MATE_MIXER_TYPE_STREAM_CONTROL) +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (MateMixerStoredControl, mate_mixer_stored_control, MATE_MIXER_TYPE_STREAM_CONTROL) static void mate_mixer_stored_control_class_init (MateMixerStoredControlClass *klass) @@ -71,8 +71,6 @@ mate_mixer_stored_control_class_init (MateMixerStoredControlClass *klass) G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, N_PROPERTIES, properties); - - g_type_class_add_private (object_class, sizeof (MateMixerStoredControlPrivate)); } static void @@ -118,9 +116,7 @@ mate_mixer_stored_control_set_property (GObject *object, static void mate_mixer_stored_control_init (MateMixerStoredControl *control) { - control->priv = G_TYPE_INSTANCE_GET_PRIVATE (control, - MATE_MIXER_TYPE_STORED_CONTROL, - MateMixerStoredControlPrivate); + control->priv = mate_mixer_stored_control_get_instance_private (control); } /** diff --git a/libmatemixer/matemixer-stream-control.c b/libmatemixer/matemixer-stream-control.c index 98286b1..f0a00a2 100644 --- a/libmatemixer/matemixer-stream-control.c +++ b/libmatemixer/matemixer-stream-control.c @@ -80,7 +80,7 @@ static void mate_mixer_stream_control_set_property (GObject static void mate_mixer_stream_control_init (MateMixerStreamControl *control); static void mate_mixer_stream_control_finalize (GObject *object); -G_DEFINE_ABSTRACT_TYPE (MateMixerStreamControl, mate_mixer_stream_control, G_TYPE_OBJECT) +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (MateMixerStreamControl, mate_mixer_stream_control, G_TYPE_OBJECT) static void mate_mixer_stream_control_class_init (MateMixerStreamControlClass *klass) @@ -200,8 +200,6 @@ mate_mixer_stream_control_class_init (MateMixerStreamControlClass *klass) G_TYPE_NONE, 1, G_TYPE_DOUBLE); - - g_type_class_add_private (object_class, sizeof (MateMixerStreamControlPrivate)); } static void @@ -286,9 +284,7 @@ mate_mixer_stream_control_set_property (GObject *object, static void mate_mixer_stream_control_init (MateMixerStreamControl *control) { - control->priv = G_TYPE_INSTANCE_GET_PRIVATE (control, - MATE_MIXER_TYPE_STREAM_CONTROL, - MateMixerStreamControlPrivate); + control->priv = mate_mixer_stream_control_get_instance_private (control); } static void diff --git a/libmatemixer/matemixer-stream-switch.c b/libmatemixer/matemixer-stream-switch.c index 2a6d3b2..797a3ad 100644 --- a/libmatemixer/matemixer-stream-switch.c +++ b/libmatemixer/matemixer-stream-switch.c @@ -59,7 +59,7 @@ static void mate_mixer_stream_switch_set_property (GObject *o static void mate_mixer_stream_switch_init (MateMixerStreamSwitch *swtch); -G_DEFINE_ABSTRACT_TYPE (MateMixerStreamSwitch, mate_mixer_stream_switch, MATE_MIXER_TYPE_SWITCH) +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (MateMixerStreamSwitch, mate_mixer_stream_switch, MATE_MIXER_TYPE_SWITCH) static void mate_mixer_stream_switch_class_init (MateMixerStreamSwitchClass *klass) @@ -100,8 +100,6 @@ mate_mixer_stream_switch_class_init (MateMixerStreamSwitchClass *klass) G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, N_PROPERTIES, properties); - - g_type_class_add_private (object_class, sizeof (MateMixerStreamSwitchPrivate)); } static void @@ -164,9 +162,7 @@ mate_mixer_stream_switch_set_property (GObject *object, static void mate_mixer_stream_switch_init (MateMixerStreamSwitch *swtch) { - swtch->priv = G_TYPE_INSTANCE_GET_PRIVATE (swtch, - MATE_MIXER_TYPE_STREAM_SWITCH, - MateMixerStreamSwitchPrivate); + swtch->priv = mate_mixer_stream_switch_get_instance_private (swtch); } /** diff --git a/libmatemixer/matemixer-stream-toggle.c b/libmatemixer/matemixer-stream-toggle.c index 70c829e..e15f88f 100644 --- a/libmatemixer/matemixer-stream-toggle.c +++ b/libmatemixer/matemixer-stream-toggle.c @@ -59,7 +59,7 @@ static void mate_mixer_stream_toggle_set_property (GObject *o static void mate_mixer_stream_toggle_init (MateMixerStreamToggle *toggle); static void mate_mixer_stream_toggle_dispose (GObject *object); -G_DEFINE_ABSTRACT_TYPE (MateMixerStreamToggle, mate_mixer_stream_toggle, MATE_MIXER_TYPE_STREAM_SWITCH) +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (MateMixerStreamToggle, mate_mixer_stream_toggle, MATE_MIXER_TYPE_STREAM_SWITCH) static MateMixerSwitchOption *mate_mixer_stream_toggle_get_option (MateMixerSwitch *swtch, const gchar *name); @@ -124,8 +124,6 @@ mate_mixer_stream_toggle_class_init (MateMixerStreamToggleClass *klass) G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, N_PROPERTIES, properties); - - g_type_class_add_private (object_class, sizeof (MateMixerStreamTogglePrivate)); } static void @@ -187,9 +185,7 @@ mate_mixer_stream_toggle_set_property (GObject *object, static void mate_mixer_stream_toggle_init (MateMixerStreamToggle *toggle) { - toggle->priv = G_TYPE_INSTANCE_GET_PRIVATE (toggle, - MATE_MIXER_TYPE_STREAM_TOGGLE, - MateMixerStreamTogglePrivate); + toggle->priv = mate_mixer_stream_toggle_get_instance_private (toggle); } static void diff --git a/libmatemixer/matemixer-stream.c b/libmatemixer/matemixer-stream.c index 9110e22..402ac06 100644 --- a/libmatemixer/matemixer-stream.c +++ b/libmatemixer/matemixer-stream.c @@ -79,7 +79,7 @@ static void mate_mixer_stream_init (MateMixerStream *stream); static void mate_mixer_stream_dispose (GObject *object); static void mate_mixer_stream_finalize (GObject *object); -G_DEFINE_ABSTRACT_TYPE (MateMixerStream, mate_mixer_stream, G_TYPE_OBJECT) +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (MateMixerStream, mate_mixer_stream, G_TYPE_OBJECT) static MateMixerStreamControl *mate_mixer_stream_real_get_control (MateMixerStream *stream, const gchar *name); @@ -195,8 +195,6 @@ mate_mixer_stream_class_init (MateMixerStreamClass *klass) G_TYPE_NONE, 1, G_TYPE_STRING); - - g_type_class_add_private (object_class, sizeof (MateMixerStreamPrivate)); } static void @@ -276,9 +274,7 @@ mate_mixer_stream_set_property (GObject *object, static void mate_mixer_stream_init (MateMixerStream *stream) { - stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream, - MATE_MIXER_TYPE_STREAM, - MateMixerStreamPrivate); + stream->priv = mate_mixer_stream_get_instance_private (stream); } static void diff --git a/libmatemixer/matemixer-switch-option.c b/libmatemixer/matemixer-switch-option.c index 4c0e0fa..8f34bbf 100644 --- a/libmatemixer/matemixer-switch-option.c +++ b/libmatemixer/matemixer-switch-option.c @@ -57,7 +57,7 @@ static void mate_mixer_switch_option_set_property (GObject *o static void mate_mixer_switch_option_init (MateMixerSwitchOption *option); static void mate_mixer_switch_option_finalize (GObject *object); -G_DEFINE_TYPE (MateMixerSwitchOption, mate_mixer_switch_option, G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE (MateMixerSwitchOption, mate_mixer_switch_option, G_TYPE_OBJECT) static void mate_mixer_switch_option_class_init (MateMixerSwitchOptionClass *klass) @@ -114,8 +114,6 @@ mate_mixer_switch_option_class_init (MateMixerSwitchOptionClass *klass) G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, N_PROPERTIES, properties); - - g_type_class_add_private (object_class, sizeof (MateMixerSwitchOptionPrivate)); } static void @@ -178,9 +176,7 @@ mate_mixer_switch_option_set_property (GObject *object, static void mate_mixer_switch_option_init (MateMixerSwitchOption *option) { - option->priv = G_TYPE_INSTANCE_GET_PRIVATE (option, - MATE_MIXER_TYPE_SWITCH_OPTION, - MateMixerSwitchOptionPrivate); + option->priv = mate_mixer_switch_option_get_instance_private (option); } static void diff --git a/libmatemixer/matemixer-switch.c b/libmatemixer/matemixer-switch.c index 8fc0a3f..2fe0cec 100644 --- a/libmatemixer/matemixer-switch.c +++ b/libmatemixer/matemixer-switch.c @@ -62,7 +62,7 @@ static void mate_mixer_switch_init (MateMixerSwitch *swtch); static void mate_mixer_switch_dispose (GObject *object); static void mate_mixer_switch_finalize (GObject *object); -G_DEFINE_ABSTRACT_TYPE (MateMixerSwitch, mate_mixer_switch, G_TYPE_OBJECT) +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (MateMixerSwitch, mate_mixer_switch, G_TYPE_OBJECT) static MateMixerSwitchOption *mate_mixer_switch_real_get_option (MateMixerSwitch *swtch, const gchar *name); @@ -108,8 +108,6 @@ mate_mixer_switch_class_init (MateMixerSwitchClass *klass) G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, N_PROPERTIES, properties); - - g_type_class_add_private (object_class, sizeof (MateMixerSwitchPrivate)); } static void @@ -172,9 +170,7 @@ mate_mixer_switch_set_property (GObject *object, static void mate_mixer_switch_init (MateMixerSwitch *swtch) { - swtch->priv = G_TYPE_INSTANCE_GET_PRIVATE (swtch, - MATE_MIXER_TYPE_SWITCH, - MateMixerSwitchPrivate); + swtch->priv = mate_mixer_switch_get_instance_private (swtch); } static void -- cgit v1.2.1