From 2f94e82f67629f312489894b5c27bb6e87b7b2fc Mon Sep 17 00:00:00 2001 From: Wu Xiaotian Date: Sun, 23 Jun 2019 18:17:24 +0800 Subject: font-viewer: avoid deprecated 'g_type_class_add_private' --- font-viewer/font-model.c | 5 ++--- font-viewer/gd-main-toolbar.c | 8 +++----- font-viewer/sushi-font-widget.c | 6 ++---- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/font-viewer/font-model.c b/font-viewer/font-model.c index 8cbc7ae0..c5d26ceb 100644 --- a/font-viewer/font-model.c +++ b/font-viewer/font-model.c @@ -61,7 +61,7 @@ enum { static guint signals[NUM_SIGNALS] = { 0, }; -G_DEFINE_TYPE (FontViewModel, font_view_model, GTK_TYPE_LIST_STORE); +G_DEFINE_TYPE_WITH_PRIVATE (FontViewModel, font_view_model, GTK_TYPE_LIST_STORE); #define ATTRIBUTES_FOR_CREATING_THUMBNAIL \ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE"," \ @@ -569,7 +569,7 @@ font_view_model_init (FontViewModel *self) GType types[NUM_COLUMNS] = { G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, GDK_TYPE_PIXBUF, G_TYPE_STRING }; - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, FONT_VIEW_TYPE_MODEL, FontViewModelPrivate); + self->priv = font_view_model_get_instance_private (self); if (FT_Init_FreeType (&self->priv->library) != FT_Err_Ok) g_critical ("Can't initialize FreeType library"); @@ -634,7 +634,6 @@ font_view_model_class_init (FontViewModelClass *klass) 0, NULL, NULL, NULL, G_TYPE_NONE, 0); - g_type_class_add_private (klass, sizeof (FontViewModelPrivate)); } GtkTreeModel * diff --git a/font-viewer/gd-main-toolbar.c b/font-viewer/gd-main-toolbar.c index 6d9e9c42..733052b3 100644 --- a/font-viewer/gd-main-toolbar.c +++ b/font-viewer/gd-main-toolbar.c @@ -24,8 +24,6 @@ #include #include -G_DEFINE_TYPE (GdMainToolbar, gd_main_toolbar, GTK_TYPE_TOOLBAR) - typedef enum { CHILD_NORMAL = 0, CHILD_TOGGLE = 1, @@ -62,6 +60,8 @@ enum { PROP_SHOW_MODES, }; +G_DEFINE_TYPE_WITH_PRIVATE (GdMainToolbar, gd_main_toolbar, GTK_TYPE_TOOLBAR) + static void gd_main_toolbar_dispose (GObject *obj) { @@ -328,7 +328,7 @@ gd_main_toolbar_constructed (GObject *obj) static void gd_main_toolbar_init (GdMainToolbar *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GD_TYPE_MAIN_TOOLBAR, GdMainToolbarPrivate); + self->priv = gd_main_toolbar_get_instance_private (self); } static void @@ -349,8 +349,6 @@ gd_main_toolbar_class_init (GdMainToolbarClass *klass) "Show Modes", FALSE, G_PARAM_READWRITE)); - - g_type_class_add_private (klass, sizeof (GdMainToolbarPrivate)); } void diff --git a/font-viewer/sushi-font-widget.c b/font-viewer/sushi-font-widget.c index bad2ffee..cffd8776 100644 --- a/font-viewer/sushi-font-widget.c +++ b/font-viewer/sushi-font-widget.c @@ -62,7 +62,7 @@ struct _SushiFontWidgetPrivate { static GParamSpec *properties[NUM_PROPERTIES] = { NULL, }; static guint signals[NUM_SIGNALS] = { 0, }; -G_DEFINE_TYPE (SushiFontWidget, sushi_font_widget, GTK_TYPE_DRAWING_AREA); +G_DEFINE_TYPE_WITH_PRIVATE (SushiFontWidget, sushi_font_widget, GTK_TYPE_DRAWING_AREA); #define SURFACE_SIZE 4 #define SECTION_SPACING 16 @@ -586,8 +586,7 @@ sushi_font_widget_init (SushiFontWidget *self) { FT_Error err; - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, SUSHI_TYPE_FONT_WIDGET, - SushiFontWidgetPrivate); + self->priv = sushi_font_widget_get_instance_private (self); self->priv->face = NULL; err = FT_Init_FreeType (&self->priv->library); @@ -716,7 +715,6 @@ sushi_font_widget_class_init (SushiFontWidgetClass *klass) G_TYPE_NONE, 1, G_TYPE_STRING); g_object_class_install_properties (oclass, NUM_PROPERTIES, properties); - g_type_class_add_private (klass, sizeof (SushiFontWidgetPrivate)); } SushiFontWidget * -- cgit v1.2.1