[Spice-devel] [PATCH spice-gtk 1/2] Use new GObject define macros with private

marcandre.lureau at redhat.com marcandre.lureau at redhat.com
Fri Jun 8 11:36:00 UTC 2018


From: Marc-André Lureau <marcandre.lureau at redhat.com>

G_ADD_PRIVATE was added in 2.38 and older functions are getting deprecated:
https://gitlab.gnome.org/GNOME/glib/merge_requests/7/commits

Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
 src/channel-cursor.c      | 3 +--
 src/channel-display.c     | 4 +---
 src/channel-inputs.c      | 3 +--
 src/channel-main.c        | 3 +--
 src/channel-playback.c    | 3 +--
 src/channel-port.c        | 3 +--
 src/channel-record.c      | 3 +--
 src/channel-smartcard.c   | 3 +--
 src/channel-usbredir.c    | 3 +--
 src/channel-webdav.c      | 4 +---
 src/desktop-integration.c | 4 +---
 src/smartcard-manager.c   | 4 +---
 src/spice-audio.c         | 4 +---
 src/spice-channel.c       | 3 +--
 src/spice-gstaudio.c      | 6 ++----
 src/spice-gtk-session.c   | 4 +---
 src/spice-pulse.c         | 4 +---
 src/spice-session.c       | 4 +---
 src/spice-widget.c        | 4 +---
 src/usb-acl-helper.c      | 4 +---
 src/usb-device-manager.c  | 3 +--
 src/usb-device-widget.c   | 4 +---
 src/win-usb-dev.c         | 6 ++----
 23 files changed, 25 insertions(+), 61 deletions(-)

diff --git a/src/channel-cursor.c b/src/channel-cursor.c
index d7fa3df..c2e0d85 100644
--- a/src/channel-cursor.c
+++ b/src/channel-cursor.c
@@ -80,7 +80,7 @@ static display_cursor * display_cursor_ref(display_cursor *cursor);
 static void display_cursor_unref(display_cursor *cursor);
 static void channel_set_handlers(SpiceChannelClass *klass);
 
-G_DEFINE_TYPE(SpiceCursorChannel, spice_cursor_channel, SPICE_TYPE_CHANNEL)
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceCursorChannel, spice_cursor_channel, SPICE_TYPE_CHANNEL)
 
 static SpiceCursorShape *spice_cursor_shape_copy(const SpiceCursorShape *cursor);
 static void spice_cursor_shape_free(SpiceCursorShape *cursor);
@@ -278,7 +278,6 @@ static void spice_cursor_channel_class_init(SpiceCursorChannelClass *klass)
                      G_TYPE_NONE,
                      0);
 
-    g_type_class_add_private(klass, sizeof(SpiceCursorChannelPrivate));
     channel_set_handlers(SPICE_CHANNEL_CLASS(klass));
 }
 
diff --git a/src/channel-display.c b/src/channel-display.c
index e0520a3..f5c5542 100644
--- a/src/channel-display.c
+++ b/src/channel-display.c
@@ -73,7 +73,7 @@ struct _SpiceDisplayChannelPrivate {
     SpiceGlScanout scanout;
 };
 
-G_DEFINE_TYPE(SpiceDisplayChannel, spice_display_channel, SPICE_TYPE_CHANNEL)
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceDisplayChannel, spice_display_channel, SPICE_TYPE_CHANNEL)
 
 /* Properties */
 enum {
@@ -477,8 +477,6 @@ static void spice_display_channel_class_init(SpiceDisplayChannelClass *klass)
                      1,
                      G_TYPE_BOOLEAN);
 
-    g_type_class_add_private(klass, sizeof(SpiceDisplayChannelPrivate));
-
     channel_set_handlers(SPICE_CHANNEL_CLASS(klass));
 }
 
diff --git a/src/channel-inputs.c b/src/channel-inputs.c
index 07fc765..8151600 100644
--- a/src/channel-inputs.c
+++ b/src/channel-inputs.c
@@ -52,7 +52,7 @@ struct _SpiceInputsChannelPrivate {
     guint32                     locks;
 };
 
-G_DEFINE_TYPE(SpiceInputsChannel, spice_inputs_channel, SPICE_TYPE_CHANNEL)
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceInputsChannel, spice_inputs_channel, SPICE_TYPE_CHANNEL)
 
 /* Properties */
 enum {
@@ -143,7 +143,6 @@ static void spice_inputs_channel_class_init(SpiceInputsChannelClass *klass)
                      G_TYPE_NONE,
                      0);
 
-    g_type_class_add_private(klass, sizeof(SpiceInputsChannelPrivate));
     channel_set_handlers(SPICE_CHANNEL_CLASS(klass));
 }
 
diff --git a/src/channel-main.c b/src/channel-main.c
index 3d682d6..d2c0581 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -136,7 +136,7 @@ struct spice_migrate {
     uint32_t src_mig_version;
 };
 
-G_DEFINE_TYPE(SpiceMainChannel, spice_main_channel, SPICE_TYPE_CHANNEL)
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceMainChannel, spice_main_channel, SPICE_TYPE_CHANNEL)
 
 /* Properties */
 enum {
@@ -851,7 +851,6 @@ static void spice_main_channel_class_init(SpiceMainChannelClass *klass)
                      1,
                      G_TYPE_OBJECT);
 
-    g_type_class_add_private(klass, sizeof(SpiceMainChannelPrivate));
     channel_set_handlers(SPICE_CHANNEL_CLASS(klass));
 }
 
diff --git a/src/channel-playback.c b/src/channel-playback.c
index afc9059..8946d5a 100644
--- a/src/channel-playback.c
+++ b/src/channel-playback.c
@@ -62,7 +62,7 @@ struct _SpicePlaybackChannelPrivate {
     guint32                     min_latency;
 };
 
-G_DEFINE_TYPE(SpicePlaybackChannel, spice_playback_channel, SPICE_TYPE_CHANNEL)
+G_DEFINE_TYPE_WITH_PRIVATE(SpicePlaybackChannel, spice_playback_channel, SPICE_TYPE_CHANNEL)
 
 /* Properties */
 enum {
@@ -296,7 +296,6 @@ static void spice_playback_channel_class_init(SpicePlaybackChannelClass *klass)
                      G_TYPE_NONE,
                      0);
 
-    g_type_class_add_private(klass, sizeof(SpicePlaybackChannelPrivate));
     channel_set_handlers(SPICE_CHANNEL_CLASS(klass));
 }
 
diff --git a/src/channel-port.c b/src/channel-port.c
index ff28b72..b1a4811 100644
--- a/src/channel-port.c
+++ b/src/channel-port.c
@@ -60,7 +60,7 @@ struct _SpicePortChannelPrivate {
     gboolean opened;
 };
 
-G_DEFINE_TYPE(SpicePortChannel, spice_port_channel, SPICE_TYPE_CHANNEL)
+G_DEFINE_TYPE_WITH_PRIVATE(SpicePortChannel, spice_port_channel, SPICE_TYPE_CHANNEL)
 
 /* Properties */
 enum {
@@ -192,7 +192,6 @@ static void spice_port_channel_class_init(SpicePortChannelClass *klass)
                      1,
                      G_TYPE_INT);
 
-    g_type_class_add_private(klass, sizeof(SpicePortChannelPrivate));
     channel_set_handlers(SPICE_CHANNEL_CLASS(klass));
 }
 
diff --git a/src/channel-record.c b/src/channel-record.c
index 88bdb5c..2b5d2de 100644
--- a/src/channel-record.c
+++ b/src/channel-record.c
@@ -62,7 +62,7 @@ struct _SpiceRecordChannelPrivate {
     guint8                      mute;
 };
 
-G_DEFINE_TYPE(SpiceRecordChannel, spice_record_channel, SPICE_TYPE_CHANNEL)
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceRecordChannel, spice_record_channel, SPICE_TYPE_CHANNEL)
 
 /* Properties */
 enum {
@@ -247,7 +247,6 @@ static void spice_record_channel_class_init(SpiceRecordChannelClass *klass)
                      G_TYPE_NONE,
                      0);
 
-    g_type_class_add_private(klass, sizeof(SpiceRecordChannelPrivate));
     channel_set_handlers(SPICE_CHANNEL_CLASS(klass));
 }
 
diff --git a/src/channel-smartcard.c b/src/channel-smartcard.c
index e086e92..f2feb71 100644
--- a/src/channel-smartcard.c
+++ b/src/channel-smartcard.c
@@ -88,7 +88,7 @@ struct _SpiceSmartcardChannelPrivate {
     SpiceSmartcardChannelMessage *in_flight_message;
 };
 
-G_DEFINE_TYPE(SpiceSmartcardChannel, spice_smartcard_channel, SPICE_TYPE_CHANNEL)
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceSmartcardChannel, spice_smartcard_channel, SPICE_TYPE_CHANNEL)
 
 enum {
 
@@ -213,7 +213,6 @@ static void spice_smartcard_channel_class_init(SpiceSmartcardChannelClass *klass
     channel_class->channel_up   = spice_smartcard_channel_up;
     channel_class->channel_reset = spice_smartcard_channel_reset;
 
-    g_type_class_add_private(klass, sizeof(SpiceSmartcardChannelPrivate));
     channel_set_handlers(SPICE_CHANNEL_CLASS(klass));
 }
 
diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
index 0cc5630..c09d98a 100644
--- a/src/channel-usbredir.c
+++ b/src/channel-usbredir.c
@@ -108,7 +108,7 @@ static void usbredir_free_lock(void *user_data);
 
 #endif
 
-G_DEFINE_TYPE(SpiceUsbredirChannel, spice_usbredir_channel, SPICE_TYPE_CHANNEL)
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceUsbredirChannel, spice_usbredir_channel, SPICE_TYPE_CHANNEL)
 
 /* ------------------------------------------------------------------ */
 
@@ -183,7 +183,6 @@ static void spice_usbredir_channel_class_init(SpiceUsbredirChannelClass *klass)
     channel_class->channel_up    = spice_usbredir_channel_up;
     channel_class->channel_reset = spice_usbredir_channel_reset;
 
-    g_type_class_add_private(klass, sizeof(SpiceUsbredirChannelPrivate));
     channel_set_handlers(SPICE_CHANNEL_CLASS(klass));
 #endif
 }
diff --git a/src/channel-webdav.c b/src/channel-webdav.c
index f1b6c2a..8ff4080 100644
--- a/src/channel-webdav.c
+++ b/src/channel-webdav.c
@@ -64,7 +64,7 @@ struct _SpiceWebdavChannelPrivate {
     } demux;
 };
 
-G_DEFINE_TYPE(SpiceWebdavChannel, spice_webdav_channel, SPICE_TYPE_PORT_CHANNEL)
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceWebdavChannel, spice_webdav_channel, SPICE_TYPE_PORT_CHANNEL)
 
 static void spice_webdav_handle_msg(SpiceChannel *channel, SpiceMsgIn *msg);
 
@@ -584,8 +584,6 @@ static void spice_webdav_channel_class_init(SpiceWebdavChannelClass *klass)
     g_signal_override_class_handler("port-event",
                                     SPICE_TYPE_WEBDAV_CHANNEL,
                                     G_CALLBACK(port_event));
-
-    g_type_class_add_private(klass, sizeof(SpiceWebdavChannelPrivate));
 }
 
 /* coroutine context */
diff --git a/src/desktop-integration.c b/src/desktop-integration.c
index 8070a71..e18b4d5 100644
--- a/src/desktop-integration.c
+++ b/src/desktop-integration.c
@@ -45,7 +45,7 @@ struct _SpiceDesktopIntegrationPrivate {
     guint gnome_automount_inhibit_cookie;
 };
 
-G_DEFINE_TYPE(SpiceDesktopIntegration, spice_desktop_integration, G_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceDesktopIntegration, spice_desktop_integration, G_TYPE_OBJECT);
 
 /* ------------------------------------------------------------------ */
 /* Gnome specific code                                                */
@@ -189,8 +189,6 @@ static void spice_desktop_integration_class_init(SpiceDesktopIntegrationClass *k
     GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
     gobject_class->dispose      = spice_desktop_integration_dispose;
-
-    g_type_class_add_private(klass, sizeof(SpiceDesktopIntegrationPrivate));
 }
 
 SpiceDesktopIntegration *spice_desktop_integration_get(SpiceSession *session)
diff --git a/src/smartcard-manager.c b/src/smartcard-manager.c
index 708f976..629bbf9 100644
--- a/src/smartcard-manager.c
+++ b/src/smartcard-manager.c
@@ -69,7 +69,7 @@ struct _SpiceSmartcardManagerPrivate {
 #endif
 };
 
-G_DEFINE_TYPE(SpiceSmartcardManager, spice_smartcard_manager, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceSmartcardManager, spice_smartcard_manager, G_TYPE_OBJECT)
 #ifdef USE_SMARTCARD
 G_DEFINE_BOXED_TYPE(VReader, spice_smartcard_reader, vreader_reference, vreader_free)
 #else
@@ -218,8 +218,6 @@ static void spice_smartcard_manager_class_init(SpiceSmartcardManagerClass *klass
                      SPICE_TYPE_SMARTCARD_READER);
     gobject_class->dispose      = spice_smartcard_manager_dispose;
     gobject_class->finalize     = spice_smartcard_manager_finalize;
-
-    g_type_class_add_private(klass, sizeof(SpiceSmartcardManagerPrivate));
 }
 
 /* ------------------------------------------------------------------ */
diff --git a/src/spice-audio.c b/src/spice-audio.c
index 7dc6a24..4f6253a 100644
--- a/src/spice-audio.c
+++ b/src/spice-audio.c
@@ -52,7 +52,7 @@
 #define SPICE_AUDIO_GET_PRIVATE(obj)                                  \
     (G_TYPE_INSTANCE_GET_PRIVATE ((obj), SPICE_TYPE_AUDIO, SpiceAudioPrivate))
 
-G_DEFINE_ABSTRACT_TYPE(SpiceAudio, spice_audio, G_TYPE_OBJECT)
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(SpiceAudio, spice_audio, G_TYPE_OBJECT)
 
 enum {
     PROP_0,
@@ -141,8 +141,6 @@ static void spice_audio_class_init(SpiceAudioClass *klass)
                                G_TYPE_MAIN_CONTEXT,
                                G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
     g_object_class_install_property(gobject_class, PROP_MAIN_CONTEXT, pspec);
-
-    g_type_class_add_private(klass, sizeof(SpiceAudioPrivate));
 }
 
 static void spice_audio_init(SpiceAudio *self)
diff --git a/src/spice-channel.c b/src/spice-channel.c
index a25397b..e7fbf57 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -85,6 +85,7 @@ static RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
     (G_TYPE_INSTANCE_GET_PRIVATE ((obj), SPICE_TYPE_CHANNEL, SpiceChannelPrivate))
 
 G_DEFINE_TYPE_WITH_CODE (SpiceChannel, spice_channel, G_TYPE_OBJECT,
+                         G_ADD_PRIVATE (SpiceChannel)
                          g_type_add_class_private (g_define_type_id, sizeof (SpiceChannelClassPrivate)));
 
 /* Properties */
@@ -390,8 +391,6 @@ static void spice_channel_class_init(SpiceChannelClass *klass)
                      1,
                      G_TYPE_INT);
 
-    g_type_class_add_private(klass, sizeof(SpiceChannelPrivate));
-
     SSL_library_init();
     SSL_load_error_strings();
 }
diff --git a/src/spice-gstaudio.c b/src/spice-gstaudio.c
index 910ba93..4ae7cb5 100644
--- a/src/spice-gstaudio.c
+++ b/src/spice-gstaudio.c
@@ -30,8 +30,6 @@
 #define SPICE_GSTAUDIO_GET_PRIVATE(obj)                                  \
     (G_TYPE_INSTANCE_GET_PRIVATE((obj), SPICE_TYPE_GSTAUDIO, SpiceGstaudioPrivate))
 
-G_DEFINE_TYPE(SpiceGstaudio, spice_gstaudio, SPICE_TYPE_AUDIO)
-
 struct stream {
     GstElement              *pipe;
     GstElement              *src;
@@ -49,6 +47,8 @@ struct _SpiceGstaudioPrivate {
     guint                   mmtime_id;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceGstaudio, spice_gstaudio, SPICE_TYPE_AUDIO)
+
 static gboolean connect_channel(SpiceAudio *audio, SpiceChannel *channel);
 static void channel_weak_notified(gpointer data, GObject *where_the_object_was);
 static void spice_gstaudio_get_playback_volume_info_async(SpiceAudio *audio,
@@ -118,8 +118,6 @@ static void spice_gstaudio_class_init(SpiceGstaudioClass *klass)
 
     gobject_class->finalize = spice_gstaudio_finalize;
     gobject_class->dispose = spice_gstaudio_dispose;
-
-    g_type_class_add_private(klass, sizeof(SpiceGstaudioPrivate));
 }
 
 static GstFlowReturn record_new_buffer(GstAppSink *appsink, gpointer data)
diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index 31f60dc..caa8545 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -110,7 +110,7 @@ static gboolean read_only(SpiceGtkSession *self);
 #define SPICE_GTK_SESSION_GET_PRIVATE(obj) \
     (G_TYPE_INSTANCE_GET_PRIVATE ((obj), SPICE_TYPE_GTK_SESSION, SpiceGtkSessionPrivate))
 
-G_DEFINE_TYPE (SpiceGtkSession, spice_gtk_session, G_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceGtkSession, spice_gtk_session, G_TYPE_OBJECT);
 
 /* Properties */
 enum {
@@ -487,8 +487,6 @@ static void spice_gtk_session_class_init(SpiceGtkSessionClass *klass)
                               G_PARAM_READWRITE |
                               G_PARAM_CONSTRUCT |
                               G_PARAM_STATIC_STRINGS));
-
-    g_type_class_add_private(klass, sizeof(SpiceGtkSessionPrivate));
 }
 
 /* ---------------------------------------------------------------- */
diff --git a/src/spice-pulse.c b/src/spice-pulse.c
index dcfa71f..1d22c0e 100644
--- a/src/spice-pulse.c
+++ b/src/spice-pulse.c
@@ -69,7 +69,7 @@ struct _SpicePulsePrivate {
     GList                   *results;
 };
 
-G_DEFINE_TYPE(SpicePulse, spice_pulse, SPICE_TYPE_AUDIO)
+G_DEFINE_TYPE_WITH_PRIVATE(SpicePulse, spice_pulse, SPICE_TYPE_AUDIO)
 
 static const char *stream_state_names[] = {
     [ PA_STREAM_UNCONNECTED ] = "unconnected",
@@ -171,8 +171,6 @@ static void spice_pulse_class_init(SpicePulseClass *klass)
 
     gobject_class->finalize = spice_pulse_finalize;
     gobject_class->dispose = spice_pulse_dispose;
-
-    g_type_class_add_private(klass, sizeof(SpicePulsePrivate));
 }
 
 /* ------------------------------------------------------------------ */
diff --git a/src/spice-session.c b/src/spice-session.c
index 57acc63..6f6dfa7 100644
--- a/src/spice-session.c
+++ b/src/spice-session.c
@@ -162,7 +162,7 @@ struct _SpiceSessionPrivate {
 #define SPICE_SESSION_GET_PRIVATE(obj) \
     (G_TYPE_INSTANCE_GET_PRIVATE ((obj), SPICE_TYPE_SESSION, SpiceSessionPrivate))
 
-G_DEFINE_TYPE (SpiceSession, spice_session, G_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceSession, spice_session, G_TYPE_OBJECT);
 
 /* Properties */
 enum {
@@ -1477,8 +1477,6 @@ static void spice_session_class_init(SpiceSessionClass *klass)
                            SPICE_IMAGE_COMPRESSION_INVALID,
                            G_PARAM_READWRITE |
                            G_PARAM_STATIC_STRINGS));
-
-    g_type_class_add_private(klass, sizeof(SpiceSessionPrivate));
 }
 
 /* ------------------------------------------------------------------ */
diff --git a/src/spice-widget.c b/src/spice-widget.c
index f5b7b40..4b5dbd6 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -69,7 +69,7 @@
  * save to disk).
  */
 
-G_DEFINE_TYPE(SpiceDisplay, spice_display, GTK_TYPE_EVENT_BOX)
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceDisplay, spice_display, GTK_TYPE_EVENT_BOX)
 
 /* Properties */
 enum {
@@ -2439,8 +2439,6 @@ static void spice_display_class_init(SpiceDisplayClass *klass)
                      g_cclosure_marshal_VOID__VOID,
                      G_TYPE_NONE,
                      0);
-
-    g_type_class_add_private(klass, sizeof(SpiceDisplayPrivate));
 }
 
 /* ---------------------------------------------------------------- */
diff --git a/src/usb-acl-helper.c b/src/usb-acl-helper.c
index fa845be..23023cf 100644
--- a/src/usb-acl-helper.c
+++ b/src/usb-acl-helper.c
@@ -41,7 +41,7 @@ struct _SpiceUsbAclHelperPrivate {
     gulong cancellable_id;
 };
 
-G_DEFINE_TYPE(SpiceUsbAclHelper, spice_usb_acl_helper, G_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceUsbAclHelper, spice_usb_acl_helper, G_TYPE_OBJECT);
 
 static void spice_usb_acl_helper_init(SpiceUsbAclHelper *self)
 {
@@ -75,8 +75,6 @@ static void spice_usb_acl_helper_class_init(SpiceUsbAclHelperClass *klass)
     GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
     gobject_class->finalize     = spice_usb_acl_helper_finalize;
-
-    g_type_class_add_private(klass, sizeof(SpiceUsbAclHelperPrivate));
 }
 
 /* ------------------------------------------------------------------ */
diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index 29f2846..9757ba0 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -261,6 +261,7 @@ static void spice_usb_device_manager_initable_iface_init(GInitableIface *iface);
 static guint signals[LAST_SIGNAL] = { 0, };
 
 G_DEFINE_TYPE_WITH_CODE(SpiceUsbDeviceManager, spice_usb_device_manager, G_TYPE_OBJECT,
+     G_ADD_PRIVATE(SpiceUsbDeviceManager)
      G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, spice_usb_device_manager_initable_iface_init));
 
 static void spice_usb_device_manager_init(SpiceUsbDeviceManager *self)
@@ -731,8 +732,6 @@ static void spice_usb_device_manager_class_init(SpiceUsbDeviceManagerClass *klas
                      2,
                      SPICE_TYPE_USB_DEVICE,
                      G_TYPE_ERROR);
-
-    g_type_class_add_private(klass, sizeof(SpiceUsbDeviceManagerPrivate));
 }
 
 #ifdef USE_USBREDIR
diff --git a/src/usb-device-widget.c b/src/usb-device-widget.c
index 6dd3617..17f9f8c 100644
--- a/src/usb-device-widget.c
+++ b/src/usb-device-widget.c
@@ -94,7 +94,7 @@ struct _SpiceUsbDeviceWidgetPrivate {
 
 static guint signals[LAST_SIGNAL] = { 0, };
 
-G_DEFINE_TYPE(SpiceUsbDeviceWidget, spice_usb_device_widget, GTK_TYPE_BOX);
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceUsbDeviceWidget, spice_usb_device_widget, GTK_TYPE_BOX);
 
 static void spice_usb_device_widget_get_property(GObject     *gobject,
                                                  guint        prop_id,
@@ -255,8 +255,6 @@ static void spice_usb_device_widget_class_init(
     GObjectClass *gobject_class = (GObjectClass *)klass;
     GParamSpec *pspec;
 
-    g_type_class_add_private (klass, sizeof (SpiceUsbDeviceWidgetPrivate));
-
     gobject_class->constructed  = spice_usb_device_widget_constructed;
     gobject_class->finalize     = spice_usb_device_widget_finalize;
     gobject_class->get_property = spice_usb_device_widget_get_property;
diff --git a/src/win-usb-dev.c b/src/win-usb-dev.c
index e2d77b3..781214f 100644
--- a/src/win-usb-dev.c
+++ b/src/win-usb-dev.c
@@ -49,6 +49,7 @@ struct _GUdevClientPrivate {
 static void g_udev_client_initable_iface_init(GInitableIface  *iface);
 
 G_DEFINE_TYPE_WITH_CODE(GUdevClient, g_udev_client, G_TYPE_OBJECT,
+                        G_ADD_PRIVATE(GUdevClient)
                         G_IMPLEMENT_INTERFACE(G_TYPE_INITABLE, g_udev_client_initable_iface_init));
 
 
@@ -73,7 +74,7 @@ struct _GUdevDevicePrivate
     GUdevDeviceInfo *udevinfo;
 };
 
-G_DEFINE_TYPE(GUdevDevice, g_udev_device, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE(GUdevDevice, g_udev_device, G_TYPE_OBJECT)
 
 
 enum
@@ -351,8 +352,6 @@ static void g_udev_client_class_init(GUdevClientClass *klass)
                                  G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 
     g_object_class_install_property(gobject_class, PROP_REDIRECTING, pspec);
-
-    g_type_class_add_private(klass, sizeof(GUdevClientPrivate));
 }
 
 static gboolean get_usb_dev_info(libusb_device *dev, GUdevDeviceInfo *udevinfo)
@@ -471,7 +470,6 @@ static void g_udev_device_class_init(GUdevDeviceClass *klass)
     GObjectClass *gobject_class = (GObjectClass *) klass;
 
     gobject_class->finalize = g_udev_device_finalize;
-    g_type_class_add_private (klass, sizeof(GUdevDevicePrivate));
 }
 
 static void g_udev_device_init(GUdevDevice *device)

base-commit: e5ece54aca21ae7c4475a8cfebc74d40b6aea44a
-- 
2.18.0.rc1.1.gae296d1cf5



More information about the Spice-devel mailing list