diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dictzip-input-stream.c | 6 | ||||
-rw-r--r-- | src/stardict.c | 7 |
2 files changed, 5 insertions, 8 deletions
diff --git a/src/dictzip-input-stream.c b/src/dictzip-input-stream.c index 2c97ba6..6c0eb04 100644 --- a/src/dictzip-input-stream.c +++ b/src/dictzip-input-stream.c @@ -294,6 +294,7 @@ struct dictzip_input_stream_private G_DEFINE_TYPE_EXTENDED (DictzipInputStream, dictzip_input_stream, G_TYPE_FILTER_INPUT_STREAM, 0, + G_ADD_PRIVATE (DictzipInputStream) G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE, dictzip_input_stream_seekable_init)) static gboolean seekable_true (G_GNUC_UNUSED GSeekable *x) { return TRUE; } @@ -312,8 +313,6 @@ dictzip_input_stream_seekable_init static void dictzip_input_stream_class_init (DictzipInputStreamClass *klass) { - g_type_class_add_private (klass, sizeof (DictzipInputStreamPrivate)); - GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass); stream_class->read_fn = dictzip_input_stream_read; stream_class->skip = dictzip_input_stream_skip; @@ -325,8 +324,7 @@ dictzip_input_stream_class_init (DictzipInputStreamClass *klass) static void dictzip_input_stream_init (DictzipInputStream *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, - DICTZIP_TYPE_INPUT_STREAM, DictzipInputStreamPrivate); + self->priv = dictzip_input_stream_get_instance_private (self); } static void diff --git a/src/stardict.c b/src/stardict.c index 8299d8b..a4c3b70 100644 --- a/src/stardict.c +++ b/src/stardict.c @@ -392,7 +392,8 @@ struct stardict_dict_private gsize dict_length; //!< Length of the dict data in bytes }; -G_DEFINE_TYPE (StardictDict, stardict_dict, G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_CODE (StardictDict, stardict_dict, G_TYPE_OBJECT, + G_ADD_PRIVATE (StardictDict)) static void stardict_dict_finalize (GObject *self) @@ -426,15 +427,13 @@ stardict_dict_finalize (GObject *self) static void stardict_dict_class_init (StardictDictClass *klass) { - g_type_class_add_private (klass, sizeof (StardictDictPrivate)); G_OBJECT_CLASS (klass)->finalize = stardict_dict_finalize; } static void stardict_dict_init (StardictDict *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, - STARDICT_TYPE_DICT, StardictDictPrivate); + self->priv = stardict_dict_get_instance_private (self); } /// Load a StarDict dictionary. |