Skip to content
Permalink
Browse files

unit: avoid deprecated 'g_type_class_add_private'

  • Loading branch information...
sc0w committed Jan 29, 2019
1 parent 5ffa9d9 commit e8ddb38f2b72ae383e4eb35ecb7774e09e29e3e9
Showing with 2 additions and 3 deletions.
  1. +2 −3 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);
}

0 comments on commit e8ddb38

Please sign in to comment.
You can’t perform that action at this time.