[virt-tools-list] [PATCH virt-viewer] Use new GObject define macros with private

Eduardo Lima (Etrunko) etrunko at redhat.com
Wed Feb 6 13:52:33 UTC 2019


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: Eduardo Lima (Etrunko) <etrunko at redhat.com>
---
 src/ovirt-foreign-menu.c            |  6 ++----
 src/remote-viewer-iso-list-dialog.c | 12 +++++-------
 src/remote-viewer.c                 |  4 +---
 src/virt-viewer-app.c               |  4 +---
 src/virt-viewer-display-spice.c     |  6 ++----
 src/virt-viewer-display-vnc.c       |  6 ++----
 src/virt-viewer-display-vte.c       |  6 ++----
 src/virt-viewer-display.c           |  4 +---
 src/virt-viewer-file.c              |  3 +--
 src/virt-viewer-notebook.c          | 12 +++++-------
 src/virt-viewer-session-spice.c     |  6 ++----
 src/virt-viewer-session-vnc.c       |  6 ++----
 src/virt-viewer-session.c           |  4 +---
 src/virt-viewer-timed-revealer.c    | 12 +++++-------
 src/virt-viewer-window.c            | 12 +++++-------
 src/virt-viewer.c                   |  4 +---
 16 files changed, 38 insertions(+), 69 deletions(-)

diff --git a/src/ovirt-foreign-menu.c b/src/ovirt-foreign-menu.c
index d234a27..124282c 100644
--- a/src/ovirt-foreign-menu.c
+++ b/src/ovirt-foreign-menu.c
@@ -59,8 +59,6 @@ static void ovirt_foreign_menu_fetch_vm_cdrom_async(OvirtForeignMenu *menu, GTas
 static void ovirt_foreign_menu_refresh_cdrom_file_async(OvirtForeignMenu *menu, GTask *task);
 static void ovirt_foreign_menu_fetch_iso_list_async(OvirtForeignMenu *menu, GTask *task);
 
-G_DEFINE_TYPE (OvirtForeignMenu, ovirt_foreign_menu, G_TYPE_OBJECT)
-
 
 struct _OvirtForeignMenuPrivate {
     OvirtProxy *proxy;
@@ -87,6 +85,8 @@ struct _OvirtForeignMenuPrivate {
 };
 
 
+G_DEFINE_TYPE_WITH_PRIVATE (OvirtForeignMenu, ovirt_foreign_menu, G_TYPE_OBJECT)
+
 #define OVIRT_FOREIGN_MENU_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), OVIRT_TYPE_FOREIGN_MENU, OvirtForeignMenuPrivate))
 
 
@@ -229,8 +229,6 @@ ovirt_foreign_menu_class_init(OvirtForeignMenuClass *klass)
     oclass->set_property = ovirt_foreign_menu_set_property;
     oclass->dispose = ovirt_foreign_menu_dispose;
 
-    g_type_class_add_private(klass, sizeof(OvirtForeignMenuPrivate));
-
     g_object_class_install_property(oclass,
                                     PROP_PROXY,
                                     g_param_spec_object("proxy",
diff --git a/src/remote-viewer-iso-list-dialog.c b/src/remote-viewer-iso-list-dialog.c
index 3505211..6368dda 100644
--- a/src/remote-viewer-iso-list-dialog.c
+++ b/src/remote-viewer-iso-list-dialog.c
@@ -29,11 +29,6 @@
 static void ovirt_foreign_menu_iso_name_changed(OvirtForeignMenu *foreign_menu, GAsyncResult *result, RemoteViewerISOListDialog *self);
 static void remote_viewer_iso_list_dialog_show_error(RemoteViewerISOListDialog *self, const gchar *message);
 
-G_DEFINE_TYPE(RemoteViewerISOListDialog, remote_viewer_iso_list_dialog, GTK_TYPE_DIALOG)
-
-#define DIALOG_PRIVATE(o) \
-        (G_TYPE_INSTANCE_GET_PRIVATE((o), REMOTE_VIEWER_TYPE_ISO_LIST_DIALOG, RemoteViewerISOListDialogPrivate))
-
 struct _RemoteViewerISOListDialogPrivate
 {
     GtkListStore *list_store;
@@ -45,6 +40,11 @@ struct _RemoteViewerISOListDialogPrivate
     GCancellable *cancellable;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE(RemoteViewerISOListDialog, remote_viewer_iso_list_dialog, GTK_TYPE_DIALOG)
+
+#define DIALOG_PRIVATE(o) \
+        (G_TYPE_INSTANCE_GET_PRIVATE((o), REMOTE_VIEWER_TYPE_ISO_LIST_DIALOG, RemoteViewerISOListDialogPrivate))
+
 enum RemoteViewerISOListDialogModel
 {
     ISO_IS_ACTIVE = 0,
@@ -97,8 +97,6 @@ remote_viewer_iso_list_dialog_class_init(RemoteViewerISOListDialogClass *klass)
 {
     GObjectClass *object_class = G_OBJECT_CLASS(klass);
 
-    g_type_class_add_private(klass, sizeof(RemoteViewerISOListDialogPrivate));
-
     object_class->dispose = remote_viewer_iso_list_dialog_dispose;
     object_class->set_property = remote_viewer_iso_list_dialog_set_property;
 
diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index 989466b..7312dd5 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -54,7 +54,7 @@ struct _RemoteViewerPrivate {
     gboolean open_recent_dialog;
 };
 
-G_DEFINE_TYPE (RemoteViewer, remote_viewer, VIRT_VIEWER_TYPE_APP)
+G_DEFINE_TYPE_WITH_PRIVATE (RemoteViewer, remote_viewer, VIRT_VIEWER_TYPE_APP)
 #define GET_PRIVATE(o)                                                        \
     (G_TYPE_INSTANCE_GET_PRIVATE ((o), REMOTE_VIEWER_TYPE, RemoteViewerPrivate))
 
@@ -196,8 +196,6 @@ remote_viewer_class_init (RemoteViewerClass *klass)
     VirtViewerAppClass *app_class = VIRT_VIEWER_APP_CLASS (klass);
     GApplicationClass *g_app_class = G_APPLICATION_CLASS(klass);
 
-    g_type_class_add_private (klass, sizeof (RemoteViewerPrivate));
-
     object_class->get_property = remote_viewer_get_property;
     object_class->dispose = remote_viewer_dispose;
 
diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index fd48014..855067c 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -160,7 +160,7 @@ struct _VirtViewerAppPrivate {
 };
 
 
-G_DEFINE_ABSTRACT_TYPE(VirtViewerApp, virt_viewer_app, GTK_TYPE_APPLICATION)
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(VirtViewerApp, virt_viewer_app, GTK_TYPE_APPLICATION)
 #define GET_PRIVATE(o)                                                        \
     (G_TYPE_INSTANCE_GET_PRIVATE ((o), VIRT_VIEWER_TYPE_APP, VirtViewerAppPrivate))
 
@@ -1935,8 +1935,6 @@ virt_viewer_app_class_init (VirtViewerAppClass *klass)
     GObjectClass *object_class = G_OBJECT_CLASS (klass);
     GApplicationClass *g_app_class = G_APPLICATION_CLASS(klass);
 
-    g_type_class_add_private (klass, sizeof (VirtViewerAppPrivate));
-
     object_class->get_property = virt_viewer_app_get_property;
     object_class->set_property = virt_viewer_app_set_property;
     object_class->dispose = virt_viewer_app_dispose;
diff --git a/src/virt-viewer-display-spice.c b/src/virt-viewer-display-spice.c
index 68be8ac..8dd3b6c 100644
--- a/src/virt-viewer-display-spice.c
+++ b/src/virt-viewer-display-spice.c
@@ -33,8 +33,6 @@
 #include "virt-viewer-display-spice.h"
 #include "virt-viewer-auth.h"
 
-G_DEFINE_TYPE (VirtViewerDisplaySpice, virt_viewer_display_spice, VIRT_VIEWER_TYPE_DISPLAY)
-
 typedef enum {
     AUTO_RESIZE_ALWAYS,
     AUTO_RESIZE_FULLSCREEN,
@@ -49,6 +47,8 @@ struct _VirtViewerDisplaySpicePrivate {
     guint y;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE (VirtViewerDisplaySpice, virt_viewer_display_spice, VIRT_VIEWER_TYPE_DISPLAY)
+
 #define VIRT_VIEWER_DISPLAY_SPICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), VIRT_VIEWER_TYPE_DISPLAY_SPICE, VirtViewerDisplaySpicePrivate))
 
 static void virt_viewer_display_spice_send_keys(VirtViewerDisplay *display,
@@ -71,8 +71,6 @@ virt_viewer_display_spice_class_init(VirtViewerDisplaySpiceClass *klass)
     dclass->selectable = virt_viewer_display_spice_selectable;
     dclass->enable = virt_viewer_display_spice_enable;
     dclass->disable = virt_viewer_display_spice_disable;
-
-    g_type_class_add_private(klass, sizeof(VirtViewerDisplaySpicePrivate));
 }
 
 static SpiceMainChannel*
diff --git a/src/virt-viewer-display-vnc.c b/src/virt-viewer-display-vnc.c
index c200ac2..790b625 100644
--- a/src/virt-viewer-display-vnc.c
+++ b/src/virt-viewer-display-vnc.c
@@ -30,12 +30,12 @@
 
 #include <glib/gi18n.h>
 
-G_DEFINE_TYPE(VirtViewerDisplayVnc, virt_viewer_display_vnc, VIRT_VIEWER_TYPE_DISPLAY)
-
 struct _VirtViewerDisplayVncPrivate {
     VncDisplay *vnc;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE(VirtViewerDisplayVnc, virt_viewer_display_vnc, VIRT_VIEWER_TYPE_DISPLAY)
+
 #define VIRT_VIEWER_DISPLAY_VNC_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), VIRT_VIEWER_TYPE_DISPLAY_VNC, VirtViewerDisplayVncPrivate))
 
 static void virt_viewer_display_vnc_send_keys(VirtViewerDisplay* display, const guint *keyvals, int nkeyvals);
@@ -73,8 +73,6 @@ virt_viewer_display_vnc_class_init(VirtViewerDisplayVncClass *klass)
     dclass->get_pixbuf = virt_viewer_display_vnc_get_pixbuf;
     dclass->close = virt_viewer_display_vnc_close;
     dclass->release_cursor = virt_viewer_display_vnc_release_cursor;
-
-    g_type_class_add_private(klass, sizeof(VirtViewerDisplayVncPrivate));
 }
 
 static void
diff --git a/src/virt-viewer-display-vte.c b/src/virt-viewer-display-vte.c
index bd7ac7d..f0ddb85 100644
--- a/src/virt-viewer-display-vte.c
+++ b/src/virt-viewer-display-vte.c
@@ -31,8 +31,6 @@
 #include "virt-viewer-display-vte.h"
 #include "virt-viewer-util.h"
 
-G_DEFINE_TYPE(VirtViewerDisplayVte, virt_viewer_display_vte, VIRT_VIEWER_TYPE_DISPLAY)
-
 struct _VirtViewerDisplayVtePrivate {
 #ifdef HAVE_VTE
     VteTerminal *vte;
@@ -41,6 +39,8 @@ struct _VirtViewerDisplayVtePrivate {
     gchar *name;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE(VirtViewerDisplayVte, virt_viewer_display_vte, VIRT_VIEWER_TYPE_DISPLAY)
+
 #define VIRT_VIEWER_DISPLAY_VTE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), VIRT_VIEWER_TYPE_DISPLAY_VTE, VirtViewerDisplayVtePrivate))
 
 enum {
@@ -132,8 +132,6 @@ virt_viewer_display_vte_class_init(VirtViewerDisplayVteClass *klass)
                  G_TYPE_NONE,
                  2,
                  G_TYPE_POINTER, G_TYPE_INT);
-
-    g_type_class_add_private(klass, sizeof(VirtViewerDisplayVtePrivate));
 }
 
 static void
diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c
index 98d4edd..ff5cda3 100644
--- a/src/virt-viewer-display.c
+++ b/src/virt-viewer-display.c
@@ -63,7 +63,7 @@ static void virt_viewer_display_get_property(GObject *object,
                                              GParamSpec *pspec);
 static void virt_viewer_display_grab_focus(GtkWidget *widget);
 
-G_DEFINE_ABSTRACT_TYPE(VirtViewerDisplay, virt_viewer_display, GTK_TYPE_BIN)
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(VirtViewerDisplay, virt_viewer_display, GTK_TYPE_BIN)
 
 enum {
     PROP_0,
@@ -239,8 +239,6 @@ virt_viewer_display_class_init(VirtViewerDisplayClass *class)
                  g_cclosure_marshal_VOID__VOID,
                  G_TYPE_NONE,
                  0);
-
-    g_type_class_add_private(class, sizeof(VirtViewerDisplayPrivate));
 }
 
 static void
diff --git a/src/virt-viewer-file.c b/src/virt-viewer-file.c
index d88f4f8..436a788 100644
--- a/src/virt-viewer-file.c
+++ b/src/virt-viewer-file.c
@@ -95,7 +95,7 @@ struct _VirtViewerFilePrivate {
     GKeyFile* keyfile;
 };
 
-G_DEFINE_TYPE(VirtViewerFile, virt_viewer_file, G_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE(VirtViewerFile, virt_viewer_file, G_TYPE_OBJECT);
 
 #define VIRT_VIEWER_FILE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), VIRT_VIEWER_TYPE_FILE, VirtViewerFilePrivate))
 
@@ -1200,7 +1200,6 @@ static void
 virt_viewer_file_class_init(VirtViewerFileClass* klass)
 {
     virt_viewer_file_parent_class = g_type_class_peek_parent(klass);
-    g_type_class_add_private(klass, sizeof(VirtViewerFilePrivate));
 
     G_OBJECT_CLASS(klass)->get_property = virt_viewer_file_get_property;
     G_OBJECT_CLASS(klass)->set_property = virt_viewer_file_set_property;
diff --git a/src/virt-viewer-notebook.c b/src/virt-viewer-notebook.c
index 3a74e9f..d9cda0e 100644
--- a/src/virt-viewer-notebook.c
+++ b/src/virt-viewer-notebook.c
@@ -27,15 +27,15 @@
 #include "virt-viewer-notebook.h"
 #include "virt-viewer-util.h"
 
-G_DEFINE_TYPE (VirtViewerNotebook, virt_viewer_notebook, GTK_TYPE_NOTEBOOK)
-
-#define GET_PRIVATE(o)                                                        \
-    (G_TYPE_INSTANCE_GET_PRIVATE ((o), VIRT_VIEWER_TYPE_NOTEBOOK, VirtViewerNotebookPrivate))
-
 struct _VirtViewerNotebookPrivate {
     GtkWidget *status;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE (VirtViewerNotebook, virt_viewer_notebook, GTK_TYPE_NOTEBOOK)
+
+#define GET_PRIVATE(o)                                                        \
+    (G_TYPE_INSTANCE_GET_PRIVATE ((o), VIRT_VIEWER_TYPE_NOTEBOOK, VirtViewerNotebookPrivate))
+
 static void
 virt_viewer_notebook_get_property (GObject *object, guint property_id,
                                    GValue *value G_GNUC_UNUSED, GParamSpec *pspec)
@@ -61,8 +61,6 @@ virt_viewer_notebook_class_init (VirtViewerNotebookClass *klass)
 {
     GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-    g_type_class_add_private (klass, sizeof (VirtViewerNotebookPrivate));
-
     object_class->get_property = virt_viewer_notebook_get_property;
     object_class->set_property = virt_viewer_notebook_set_property;
 }
diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
index 0c58133..4251e9e 100644
--- a/src/virt-viewer-session-spice.c
+++ b/src/virt-viewer-session-spice.c
@@ -37,8 +37,6 @@
 #include "virt-viewer-display-vte.h"
 #include "virt-viewer-auth.h"
 
-G_DEFINE_TYPE (VirtViewerSessionSpice, virt_viewer_session_spice, VIRT_VIEWER_TYPE_SESSION)
-
 struct _VirtViewerSessionSpicePrivate {
     GtkWindow *main_window;
     SpiceSession *session;
@@ -55,6 +53,8 @@ struct _VirtViewerSessionSpicePrivate {
     SpiceQmpPort *qmp;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE (VirtViewerSessionSpice, virt_viewer_session_spice, VIRT_VIEWER_TYPE_SESSION)
+
 #define VIRT_VIEWER_SESSION_SPICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), VIRT_VIEWER_TYPE_SESSION_SPICE, VirtViewerSessionSpicePrivate))
 
 enum {
@@ -266,8 +266,6 @@ virt_viewer_session_spice_class_init(VirtViewerSessionSpiceClass *klass)
     dclass->can_retry_auth = virt_viewer_session_spice_can_retry_auth;
     dclass->vm_action = virt_viewer_session_spice_vm_action;
 
-    g_type_class_add_private(klass, sizeof(VirtViewerSessionSpicePrivate));
-
     g_object_class_install_property(oclass,
                                     PROP_SPICE_SESSION,
                                     g_param_spec_object("spice-session",
diff --git a/src/virt-viewer-session-vnc.c b/src/virt-viewer-session-vnc.c
index c79b63c..93e0822 100644
--- a/src/virt-viewer-session-vnc.c
+++ b/src/virt-viewer-session-vnc.c
@@ -34,8 +34,6 @@
 #include <glib/gi18n.h>
 #include <libxml/uri.h>
 
-G_DEFINE_TYPE(VirtViewerSessionVnc, virt_viewer_session_vnc, VIRT_VIEWER_TYPE_SESSION)
-
 struct _VirtViewerSessionVncPrivate {
     GtkWindow *main_window;
     /* XXX we should really just have a VncConnection */
@@ -43,6 +41,8 @@ struct _VirtViewerSessionVncPrivate {
     gboolean auth_dialog_cancelled;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE(VirtViewerSessionVnc, virt_viewer_session_vnc, VIRT_VIEWER_TYPE_SESSION)
+
 #define VIRT_VIEWER_SESSION_VNC_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), VIRT_VIEWER_TYPE_SESSION_VNC, VirtViewerSessionVncPrivate))
 
 static void virt_viewer_session_vnc_close(VirtViewerSession* session);
@@ -88,8 +88,6 @@ virt_viewer_session_vnc_class_init(VirtViewerSessionVncClass *klass)
     dclass->open_uri = virt_viewer_session_vnc_open_uri;
     dclass->channel_open_fd = virt_viewer_session_vnc_channel_open_fd;
     dclass->mime_type = virt_viewer_session_vnc_mime_type;
-
-    g_type_class_add_private(klass, sizeof(VirtViewerSessionVncPrivate));
 }
 
 static void
diff --git a/src/virt-viewer-session.c b/src/virt-viewer-session.c
index 3590c6d..9f05dda 100644
--- a/src/virt-viewer-session.c
+++ b/src/virt-viewer-session.c
@@ -47,7 +47,7 @@ struct _VirtViewerSessionPrivate
     gboolean share_folder_ro;
 };
 
-G_DEFINE_ABSTRACT_TYPE(VirtViewerSession, virt_viewer_session, G_TYPE_OBJECT)
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(VirtViewerSession, virt_viewer_session, G_TYPE_OBJECT)
 
 enum {
     PROP_0,
@@ -389,8 +389,6 @@ virt_viewer_session_class_init(VirtViewerSessionClass *class)
                  g_cclosure_marshal_VOID__VOID,
                  G_TYPE_NONE,
                  0);
-
-    g_type_class_add_private(class, sizeof(VirtViewerSessionPrivate));
 }
 
 static void
diff --git a/src/virt-viewer-timed-revealer.c b/src/virt-viewer-timed-revealer.c
index 3c48ab5..71e974b 100644
--- a/src/virt-viewer-timed-revealer.c
+++ b/src/virt-viewer-timed-revealer.c
@@ -25,11 +25,6 @@
 
 #include "virt-viewer-timed-revealer.h"
 
-G_DEFINE_TYPE (VirtViewerTimedRevealer, virt_viewer_timed_revealer, GTK_TYPE_EVENT_BOX)
-
-#define VIRT_VIEWER_TIMED_REVEALER_GET_PRIVATE(obj) \
-    (G_TYPE_INSTANCE_GET_PRIVATE ((obj), VIRT_VIEWER_TYPE_TIMED_REVEALER, VirtViewerTimedRevealerPrivate))
-
 struct _VirtViewerTimedRevealerPrivate
 {
     gboolean fullscreen;
@@ -38,6 +33,11 @@ struct _VirtViewerTimedRevealerPrivate
     GtkWidget *revealer;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE (VirtViewerTimedRevealer, virt_viewer_timed_revealer, GTK_TYPE_EVENT_BOX)
+
+#define VIRT_VIEWER_TIMED_REVEALER_GET_PRIVATE(obj) \
+    (G_TYPE_INSTANCE_GET_PRIVATE ((obj), VIRT_VIEWER_TYPE_TIMED_REVEALER, VirtViewerTimedRevealerPrivate))
+
 static void
 virt_viewer_timed_revealer_unregister_timeout(VirtViewerTimedRevealer *self)
 {
@@ -149,8 +149,6 @@ virt_viewer_timed_revealer_class_init(VirtViewerTimedRevealerClass *klass)
 {
    GObjectClass *object_class = G_OBJECT_CLASS(klass);
 
-   g_type_class_add_private (klass, sizeof (VirtViewerTimedRevealerPrivate));
-
    object_class->dispose = virt_viewer_timed_revealer_dispose;
 }
 
diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index a7b2deb..d5beddf 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -80,11 +80,6 @@ static GtkMenu* virt_viewer_window_get_keycombo_menu(VirtViewerWindow *self);
 static void virt_viewer_window_get_minimal_dimensions(VirtViewerWindow *self, guint *width, guint *height);
 static gint virt_viewer_window_get_minimal_zoom_level(VirtViewerWindow *self);
 
-G_DEFINE_TYPE (VirtViewerWindow, virt_viewer_window, G_TYPE_OBJECT)
-
-#define GET_PRIVATE(o)                                                  \
-    (G_TYPE_INSTANCE_GET_PRIVATE ((o), VIRT_VIEWER_TYPE_WINDOW, VirtViewerWindowPrivate))
-
 enum {
     PROP_0,
     PROP_WINDOW,
@@ -121,6 +116,11 @@ struct _VirtViewerWindowPrivate {
     gboolean initial_zoom_set;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE (VirtViewerWindow, virt_viewer_window, G_TYPE_OBJECT)
+
+#define GET_PRIVATE(o)                                                  \
+    (G_TYPE_INSTANCE_GET_PRIVATE ((o), VIRT_VIEWER_TYPE_WINDOW, VirtViewerWindowPrivate))
+
 static void
 virt_viewer_window_get_property (GObject *object, guint property_id,
                                  GValue *value, GParamSpec *pspec)
@@ -273,8 +273,6 @@ virt_viewer_window_class_init (VirtViewerWindowClass *klass)
 {
     GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-    g_type_class_add_private (klass, sizeof (VirtViewerWindowPrivate));
-
     object_class->get_property = virt_viewer_window_get_property;
     object_class->set_property = virt_viewer_window_set_property;
     object_class->dispose = virt_viewer_window_dispose;
diff --git a/src/virt-viewer.c b/src/virt-viewer.c
index 33b61f7..b2af5e9 100644
--- a/src/virt-viewer.c
+++ b/src/virt-viewer.c
@@ -68,7 +68,7 @@ struct _VirtViewerPrivate {
     guint reconnect_poll; /* source id */
 };
 
-G_DEFINE_TYPE (VirtViewer, virt_viewer, VIRT_VIEWER_TYPE_APP)
+G_DEFINE_TYPE_WITH_PRIVATE (VirtViewer, virt_viewer, VIRT_VIEWER_TYPE_APP)
 #define GET_PRIVATE(o)                                                        \
     (G_TYPE_INSTANCE_GET_PRIVATE ((o), VIRT_VIEWER_TYPE, VirtViewerPrivate))
 
@@ -213,8 +213,6 @@ virt_viewer_class_init (VirtViewerClass *klass)
     VirtViewerAppClass *app_class = VIRT_VIEWER_APP_CLASS (klass);
     GApplicationClass *g_app_class = G_APPLICATION_CLASS(klass);
 
-    g_type_class_add_private (klass, sizeof (VirtViewerPrivate));
-
     object_class->dispose = virt_viewer_dispose;
 
     app_class->initial_connect = virt_viewer_initial_connect;
-- 
2.20.1




More information about the virt-tools-list mailing list