On 2/20/19 12:13 PM, Christophe Fergeau wrote: > Series looks good to me, > Reviewed-by: Christophe Fergeau <cfergeau@xxxxxxxxxx> Pushed, thanks > > On Wed, Feb 20, 2019 at 11:05:36AM -0300, Eduardo Lima (Etrunko) wrote: >> ping >> >> On 2/13/19 12:46 PM, Eduardo Lima (Etrunko) wrote: >>> New functions and macros have been added in glib 2.38 to better handle >>> this case. >>> >>> https://gitlab.gnome.org/GNOME/glib/blob/c8de2b11bbbf5705ee20bf68d0c11e455b441312/NEWS >>> >>> The old method is being deprecated as of version 2.58. >>> >>> https://gitlab.gnome.org/GNOME/glib/merge_requests/7/commits >>> >>> Signed-off-by: Eduardo Lima (Etrunko) <etrunko@xxxxxxxxxx> >>> --- >>> >>> v2: Removed iso-list dialog patch which is dealt separately. >>> >>> --- >>> >>> src/ovirt-foreign-menu.c | 8 ++------ >>> src/remote-viewer.c | 8 ++------ >>> src/virt-viewer-app.c | 8 ++------ >>> src/virt-viewer-display-spice.c | 8 ++------ >>> src/virt-viewer-display-vnc.c | 8 ++------ >>> src/virt-viewer-display-vte.c | 8 ++------ >>> src/virt-viewer-display.c | 8 ++------ >>> src/virt-viewer-file-transfer-dialog.c | 6 +----- >>> src/virt-viewer-file.c | 7 ++----- >>> src/virt-viewer-notebook.c | 11 +++-------- >>> src/virt-viewer-session-spice.c | 8 ++------ >>> src/virt-viewer-session-vnc.c | 8 ++------ >>> src/virt-viewer-session.c | 9 ++------- >>> src/virt-viewer-timed-revealer.c | 11 +++-------- >>> src/virt-viewer-window.c | 11 +++-------- >>> src/virt-viewer.c | 8 ++------ >>> 16 files changed, 34 insertions(+), 101 deletions(-) >>> >>> diff --git a/src/ovirt-foreign-menu.c b/src/ovirt-foreign-menu.c >>> index d234a27..c6d360b 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,7 +85,7 @@ struct _OvirtForeignMenuPrivate { >>> }; >>> >>> >>> -#define OVIRT_FOREIGN_MENU_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), OVIRT_TYPE_FOREIGN_MENU, OvirtForeignMenuPrivate)) >>> +G_DEFINE_TYPE_WITH_PRIVATE (OvirtForeignMenu, ovirt_foreign_menu, G_TYPE_OBJECT) >>> >>> >>> enum { >>> @@ -229,8 +227,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", >>> @@ -286,7 +282,7 @@ ovirt_foreign_menu_class_init(OvirtForeignMenuClass *klass) >>> static void >>> ovirt_foreign_menu_init(OvirtForeignMenu *self) >>> { >>> - self->priv = OVIRT_FOREIGN_MENU_GET_PRIVATE(self); >>> + self->priv = ovirt_foreign_menu_get_instance_private(self); >>> } >>> >>> >>> diff --git a/src/remote-viewer.c b/src/remote-viewer.c >>> index 989466b..91eb39e 100644 >>> --- a/src/remote-viewer.c >>> +++ b/src/remote-viewer.c >>> @@ -54,9 +54,7 @@ struct _RemoteViewerPrivate { >>> gboolean open_recent_dialog; >>> }; >>> >>> -G_DEFINE_TYPE (RemoteViewer, remote_viewer, VIRT_VIEWER_TYPE_APP) >>> -#define GET_PRIVATE(o) \ >>> - (G_TYPE_INSTANCE_GET_PRIVATE ((o), REMOTE_VIEWER_TYPE, RemoteViewerPrivate)) >>> +G_DEFINE_TYPE_WITH_PRIVATE (RemoteViewer, remote_viewer, VIRT_VIEWER_TYPE_APP) >>> >>> enum RemoteViewerProperties { >>> PROP_0, >>> @@ -196,8 +194,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; >>> >>> @@ -221,7 +217,7 @@ remote_viewer_class_init (RemoteViewerClass *klass) >>> static void >>> remote_viewer_init(RemoteViewer *self) >>> { >>> - self->priv = GET_PRIVATE(self); >>> + self->priv = remote_viewer_get_instance_private(self); >>> } >>> >>> RemoteViewer * >>> diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c >>> index fd48014..861f8f3 100644 >>> --- a/src/virt-viewer-app.c >>> +++ b/src/virt-viewer-app.c >>> @@ -160,9 +160,7 @@ struct _VirtViewerAppPrivate { >>> }; >>> >>> >>> -G_DEFINE_ABSTRACT_TYPE(VirtViewerApp, virt_viewer_app, GTK_TYPE_APPLICATION) >>> -#define GET_PRIVATE(o) \ >>> - (G_TYPE_INSTANCE_GET_PRIVATE ((o), VIRT_VIEWER_TYPE_APP, VirtViewerAppPrivate)) >>> +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(VirtViewerApp, virt_viewer_app, GTK_TYPE_APPLICATION) >>> >>> enum { >>> PROP_0, >>> @@ -1749,7 +1747,7 @@ static void >>> virt_viewer_app_init(VirtViewerApp *self) >>> { >>> GError *error = NULL; >>> - self->priv = GET_PRIVATE(self); >>> + self->priv = virt_viewer_app_get_instance_private(self); >>> >>> gtk_window_set_default_icon_name("virt-viewer"); >>> >>> @@ -1935,8 +1933,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..311178b 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,7 +47,7 @@ struct _VirtViewerDisplaySpicePrivate { >>> guint y; >>> }; >>> >>> -#define VIRT_VIEWER_DISPLAY_SPICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), VIRT_VIEWER_TYPE_DISPLAY_SPICE, VirtViewerDisplaySpicePrivate)) >>> +G_DEFINE_TYPE_WITH_PRIVATE (VirtViewerDisplaySpice, virt_viewer_display_spice, VIRT_VIEWER_TYPE_DISPLAY) >>> >>> static void virt_viewer_display_spice_send_keys(VirtViewerDisplay *display, >>> const guint *keyvals, >>> @@ -71,8 +69,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* >>> @@ -126,7 +122,7 @@ static void virt_viewer_display_spice_disable(VirtViewerDisplay *self) >>> static void >>> virt_viewer_display_spice_init(VirtViewerDisplaySpice *self G_GNUC_UNUSED) >>> { >>> - self->priv = VIRT_VIEWER_DISPLAY_SPICE_GET_PRIVATE(self); >>> + self->priv = virt_viewer_display_spice_get_instance_private(self); >>> self->priv->auto_resize = AUTO_RESIZE_ALWAYS; >>> >>> g_signal_connect(self, "notify::show-hint", G_CALLBACK(show_hint_changed), NULL); >>> diff --git a/src/virt-viewer-display-vnc.c b/src/virt-viewer-display-vnc.c >>> index c200ac2..d38dcac 100644 >>> --- a/src/virt-viewer-display-vnc.c >>> +++ b/src/virt-viewer-display-vnc.c >>> @@ -30,13 +30,11 @@ >>> >>> #include <glib/gi18n.h> >>> >>> -G_DEFINE_TYPE(VirtViewerDisplayVnc, virt_viewer_display_vnc, VIRT_VIEWER_TYPE_DISPLAY) >>> - >>> struct _VirtViewerDisplayVncPrivate { >>> VncDisplay *vnc; >>> }; >>> >>> -#define VIRT_VIEWER_DISPLAY_VNC_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), VIRT_VIEWER_TYPE_DISPLAY_VNC, VirtViewerDisplayVncPrivate)) >>> +G_DEFINE_TYPE_WITH_PRIVATE(VirtViewerDisplayVnc, virt_viewer_display_vnc, VIRT_VIEWER_TYPE_DISPLAY) >>> >>> static void virt_viewer_display_vnc_send_keys(VirtViewerDisplay* display, const guint *keyvals, int nkeyvals); >>> static GdkPixbuf *virt_viewer_display_vnc_get_pixbuf(VirtViewerDisplay* display); >>> @@ -73,14 +71,12 @@ 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 >>> virt_viewer_display_vnc_init(VirtViewerDisplayVnc *self G_GNUC_UNUSED) >>> { >>> - self->priv = VIRT_VIEWER_DISPLAY_VNC_GET_PRIVATE(self); >>> + self->priv = virt_viewer_display_vnc_get_instance_private(self); >>> } >>> >>> >>> diff --git a/src/virt-viewer-display-vte.c b/src/virt-viewer-display-vte.c >>> index bd7ac7d..ef0d5ac 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,7 +39,7 @@ struct _VirtViewerDisplayVtePrivate { >>> gchar *name; >>> }; >>> >>> -#define VIRT_VIEWER_DISPLAY_VTE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), VIRT_VIEWER_TYPE_DISPLAY_VTE, VirtViewerDisplayVtePrivate)) >>> +G_DEFINE_TYPE_WITH_PRIVATE(VirtViewerDisplayVte, virt_viewer_display_vte, VIRT_VIEWER_TYPE_DISPLAY) >>> >>> enum { >>> PROP_0, >>> @@ -132,14 +130,12 @@ 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 >>> virt_viewer_display_vte_init(VirtViewerDisplayVte *self G_GNUC_UNUSED) >>> { >>> - self->priv = VIRT_VIEWER_DISPLAY_VTE_GET_PRIVATE(self); >>> + self->priv = virt_viewer_display_vte_get_instance_private(self); >>> } >>> >>> #ifdef HAVE_VTE >>> diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c >>> index 98d4edd..de72353 100644 >>> --- a/src/virt-viewer-display.c >>> +++ b/src/virt-viewer-display.c >>> @@ -31,8 +31,6 @@ >>> #include "virt-viewer-display.h" >>> #include "virt-viewer-util.h" >>> >>> -#define VIRT_VIEWER_DISPLAY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), VIRT_VIEWER_TYPE_DISPLAY, VirtViewerDisplayPrivate)) >>> - >>> struct _VirtViewerDisplayPrivate >>> { >>> guint desktopWidth; >>> @@ -63,7 +61,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 +237,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 >>> @@ -249,7 +245,7 @@ virt_viewer_display_init(VirtViewerDisplay *display) >>> gtk_widget_set_has_window(GTK_WIDGET(display), FALSE); >>> gtk_widget_set_redraw_on_allocate(GTK_WIDGET(display), FALSE); >>> >>> - display->priv = VIRT_VIEWER_DISPLAY_GET_PRIVATE(display); >>> + display->priv = virt_viewer_display_get_instance_private(display); >>> >>> display->priv->desktopWidth = MIN_DISPLAY_WIDTH; >>> display->priv->desktopHeight = MIN_DISPLAY_HEIGHT; >>> diff --git a/src/virt-viewer-file-transfer-dialog.c b/src/virt-viewer-file-transfer-dialog.c >>> index dcf99a3..24cad57 100644 >>> --- a/src/virt-viewer-file-transfer-dialog.c >>> +++ b/src/virt-viewer-file-transfer-dialog.c >>> @@ -39,10 +39,6 @@ struct _VirtViewerFileTransferDialogPrivate >>> >>> G_DEFINE_TYPE_WITH_PRIVATE(VirtViewerFileTransferDialog, virt_viewer_file_transfer_dialog, GTK_TYPE_DIALOG) >>> >>> -#define FILE_TRANSFER_DIALOG_PRIVATE(o) \ >>> - (G_TYPE_INSTANCE_GET_PRIVATE((o), VIRT_VIEWER_TYPE_FILE_TRANSFER_DIALOG, VirtViewerFileTransferDialogPrivate)) >>> - >>> - >>> static void >>> virt_viewer_file_transfer_dialog_dispose(GObject *object) >>> { >>> @@ -115,7 +111,7 @@ virt_viewer_file_transfer_dialog_init(VirtViewerFileTransferDialog *self) >>> { >>> gtk_widget_init_template(GTK_WIDGET(self)); >>> >>> - self->priv = FILE_TRANSFER_DIALOG_PRIVATE(self); >>> + self->priv = virt_viewer_file_transfer_dialog_get_instance_private(self); >>> >>> g_signal_connect(self, "response", G_CALLBACK(dialog_response), NULL); >>> g_signal_connect(self, "delete-event", G_CALLBACK(delete_event), NULL); >>> diff --git a/src/virt-viewer-file.c b/src/virt-viewer-file.c >>> index d88f4f8..7d2b2cb 100644 >>> --- a/src/virt-viewer-file.c >>> +++ b/src/virt-viewer-file.c >>> @@ -95,9 +95,7 @@ struct _VirtViewerFilePrivate { >>> GKeyFile* keyfile; >>> }; >>> >>> -G_DEFINE_TYPE(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)) >>> +G_DEFINE_TYPE_WITH_PRIVATE(VirtViewerFile, virt_viewer_file, G_TYPE_OBJECT); >>> >>> #define MAIN_GROUP "virt-viewer" >>> #define OVIRT_GROUP "ovirt" >>> @@ -1191,7 +1189,7 @@ virt_viewer_file_finalize(GObject* object) >>> static void >>> virt_viewer_file_init(VirtViewerFile* self) >>> { >>> - self->priv = VIRT_VIEWER_FILE_GET_PRIVATE(self); >>> + self->priv = virt_viewer_file_get_instance_private(self); >>> >>> self->priv->keyfile = g_key_file_new(); >>> } >>> @@ -1200,7 +1198,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..1457aa9 100644 >>> --- a/src/virt-viewer-notebook.c >>> +++ b/src/virt-viewer-notebook.c >>> @@ -27,15 +27,12 @@ >>> #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) >>> + >>> static void >>> virt_viewer_notebook_get_property (GObject *object, guint property_id, >>> GValue *value G_GNUC_UNUSED, GParamSpec *pspec) >>> @@ -61,8 +58,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; >>> } >>> @@ -72,7 +67,7 @@ virt_viewer_notebook_init (VirtViewerNotebook *self) >>> { >>> VirtViewerNotebookPrivate *priv; >>> >>> - self->priv = GET_PRIVATE(self); >>> + self->priv = virt_viewer_notebook_get_instance_private(self); >>> priv = self->priv; >>> >>> priv->status = gtk_label_new(""); >>> diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c >>> index c28afc5..47d3975 100644 >>> --- a/src/virt-viewer-session-spice.c >>> +++ b/src/virt-viewer-session-spice.c >>> @@ -41,8 +41,6 @@ >>> #define WITH_QMP_PORT 1 >>> #endif >>> >>> -G_DEFINE_TYPE (VirtViewerSessionSpice, virt_viewer_session_spice, VIRT_VIEWER_TYPE_SESSION) >>> - >>> struct _VirtViewerSessionSpicePrivate { >>> GtkWindow *main_window; >>> SpiceSession *session; >>> @@ -61,7 +59,7 @@ struct _VirtViewerSessionSpicePrivate { >>> #endif >>> }; >>> >>> -#define VIRT_VIEWER_SESSION_SPICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), VIRT_VIEWER_TYPE_SESSION_SPICE, VirtViewerSessionSpicePrivate)) >>> +G_DEFINE_TYPE_WITH_PRIVATE (VirtViewerSessionSpice, virt_viewer_session_spice, VIRT_VIEWER_TYPE_SESSION) >>> >>> enum { >>> PROP_0, >>> @@ -272,8 +270,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", >>> @@ -298,7 +294,7 @@ virt_viewer_session_spice_class_init(VirtViewerSessionSpiceClass *klass) >>> static void >>> virt_viewer_session_spice_init(VirtViewerSessionSpice *self G_GNUC_UNUSED) >>> { >>> - self->priv = VIRT_VIEWER_SESSION_SPICE_GET_PRIVATE(self); >>> + self->priv = virt_viewer_session_spice_get_instance_private(self); >>> } >>> >>> static void >>> diff --git a/src/virt-viewer-session-vnc.c b/src/virt-viewer-session-vnc.c >>> index c79b63c..481abdf 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,7 +41,7 @@ struct _VirtViewerSessionVncPrivate { >>> gboolean auth_dialog_cancelled; >>> }; >>> >>> -#define VIRT_VIEWER_SESSION_VNC_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), VIRT_VIEWER_TYPE_SESSION_VNC, VirtViewerSessionVncPrivate)) >>> +G_DEFINE_TYPE_WITH_PRIVATE(VirtViewerSessionVnc, virt_viewer_session_vnc, VIRT_VIEWER_TYPE_SESSION) >>> >>> static void virt_viewer_session_vnc_close(VirtViewerSession* session); >>> static gboolean virt_viewer_session_vnc_open_fd(VirtViewerSession* session, int fd); >>> @@ -88,14 +86,12 @@ 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 >>> virt_viewer_session_vnc_init(VirtViewerSessionVnc *self G_GNUC_UNUSED) >>> { >>> - self->priv = VIRT_VIEWER_SESSION_VNC_GET_PRIVATE(self); >>> + self->priv = virt_viewer_session_vnc_get_instance_private(self); >>> } >>> >>> static void >>> diff --git a/src/virt-viewer-session.c b/src/virt-viewer-session.c >>> index 3590c6d..a809814 100644 >>> --- a/src/virt-viewer-session.c >>> +++ b/src/virt-viewer-session.c >>> @@ -31,9 +31,6 @@ >>> #include "virt-viewer-util.h" >>> #include "virt-viewer-display-vte.h" >>> >>> -#define VIRT_VIEWER_SESSION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), VIRT_VIEWER_TYPE_SESSION, VirtViewerSessionPrivate)) >>> - >>> - >>> struct _VirtViewerSessionPrivate >>> { >>> GList *displays; >>> @@ -47,7 +44,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,14 +386,12 @@ 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 >>> virt_viewer_session_init(VirtViewerSession *session) >>> { >>> - session->priv = VIRT_VIEWER_SESSION_GET_PRIVATE(session); >>> + session->priv = virt_viewer_session_get_instance_private(session); >>> } >>> >>> static void >>> diff --git a/src/virt-viewer-timed-revealer.c b/src/virt-viewer-timed-revealer.c >>> index 3c48ab5..acc55fc 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,8 @@ struct _VirtViewerTimedRevealerPrivate >>> GtkWidget *revealer; >>> }; >>> >>> +G_DEFINE_TYPE_WITH_PRIVATE (VirtViewerTimedRevealer, virt_viewer_timed_revealer, GTK_TYPE_EVENT_BOX) >>> + >>> static void >>> virt_viewer_timed_revealer_unregister_timeout(VirtViewerTimedRevealer *self) >>> { >>> @@ -124,7 +121,7 @@ virt_viewer_timed_revealer_enter_leave_notify(VirtViewerTimedRevealer *self, >>> static void >>> virt_viewer_timed_revealer_init(VirtViewerTimedRevealer *self) >>> { >>> - self->priv = VIRT_VIEWER_TIMED_REVEALER_GET_PRIVATE(self); >>> + self->priv = virt_viewer_timed_revealer_get_instance_private(self); >>> } >>> >>> static void >>> @@ -149,8 +146,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 a65c61a..4bbe2ca 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,8 @@ struct _VirtViewerWindowPrivate { >>> gboolean initial_zoom_set; >>> }; >>> >>> +G_DEFINE_TYPE_WITH_PRIVATE (VirtViewerWindow, virt_viewer_window, G_TYPE_OBJECT) >>> + >>> static void >>> virt_viewer_window_get_property (GObject *object, guint property_id, >>> GValue *value, GParamSpec *pspec) >>> @@ -273,8 +270,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; >>> @@ -335,7 +330,7 @@ virt_viewer_window_init (VirtViewerWindow *self) >>> GtkWidget *vbox; >>> GSList *accels; >>> >>> - self->priv = GET_PRIVATE(self); >>> + self->priv = virt_viewer_window_get_instance_private(self); >>> priv = self->priv; >>> >>> priv->fullscreen_monitor = -1; >>> diff --git a/src/virt-viewer.c b/src/virt-viewer.c >>> index 33b61f7..227f5fd 100644 >>> --- a/src/virt-viewer.c >>> +++ b/src/virt-viewer.c >>> @@ -68,9 +68,7 @@ struct _VirtViewerPrivate { >>> guint reconnect_poll; /* source id */ >>> }; >>> >>> -G_DEFINE_TYPE (VirtViewer, virt_viewer, VIRT_VIEWER_TYPE_APP) >>> -#define GET_PRIVATE(o) \ >>> - (G_TYPE_INSTANCE_GET_PRIVATE ((o), VIRT_VIEWER_TYPE, VirtViewerPrivate)) >>> +G_DEFINE_TYPE_WITH_PRIVATE (VirtViewer, virt_viewer, VIRT_VIEWER_TYPE_APP) >>> >>> static gboolean virt_viewer_initial_connect(VirtViewerApp *self, GError **error); >>> static gboolean virt_viewer_open_connection(VirtViewerApp *self, int *fd); >>> @@ -213,8 +211,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; >>> @@ -229,7 +225,7 @@ virt_viewer_class_init (VirtViewerClass *klass) >>> static void >>> virt_viewer_init(VirtViewer *self) >>> { >>> - self->priv = GET_PRIVATE(self); >>> + self->priv = virt_viewer_get_instance_private(self); >>> self->priv->domain_event = -1; >>> } >>> >>> >> >> >> -- >> Eduardo de Barros Lima (Etrunko) >> Software Engineer - RedHat >> etrunko@xxxxxxxxxx >> >> _______________________________________________ >> virt-tools-list mailing list >> virt-tools-list@xxxxxxxxxx >> https://www.redhat.com/mailman/listinfo/virt-tools-list -- Eduardo de Barros Lima (Etrunko) Software Engineer - RedHat etrunko@xxxxxxxxxx _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list