summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2019-01-29 18:54:05 +0100
committerZenWalker <[email protected]>2019-01-30 20:17:24 +0100
commite8ddb38f2b72ae383e4eb35ecb7774e09e29e3e9 (patch)
treea7b39935f5801938ffcf478ecd1a89a9a701bc54 /src
parent5ffa9d9f00360485763e0e72655e152acf9ed5d6 (diff)
downloadmate-calc-e8ddb38f2b72ae383e4eb35ecb7774e09e29e3e9.tar.bz2
mate-calc-e8ddb38f2b72ae383e4eb35ecb7774e09e29e3e9.tar.xz
unit: avoid deprecated 'g_type_class_add_private'
Diffstat (limited to 'src')
-rw-r--r--src/unit.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/unit.c b/src/unit.c
index 0a906fe..f1a3db3 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -27,7 +27,7 @@ struct UnitPrivate
MpSerializer *serializer;
};
-G_DEFINE_TYPE (Unit, unit, G_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE (Unit, unit, G_TYPE_OBJECT);
Unit *
@@ -199,14 +199,13 @@ unit_format(Unit *unit, MPNumber *x)
static void
unit_class_init(UnitClass *klass)
{
- g_type_class_add_private(klass, sizeof(UnitPrivate));
}
static void
unit_init(Unit *unit)
{
- unit->priv = G_TYPE_INSTANCE_GET_PRIVATE(unit, unit_get_type(), UnitPrivate);
+ unit->priv = unit_get_instance_private (unit);
unit->priv->serializer = mp_serializer_new(MP_DISPLAY_FORMAT_AUTOMATIC, 10, 2);
mp_serializer_set_leading_digits(unit->priv->serializer, 6);
}