Skip to content

Commit

Permalink
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
Browse files Browse the repository at this point in the history
gnc_tree_model_owner_get_type is being replaced by
that provided by G_DEFINE_TYPE_WITH_PRIVATE and G_ADD_PRIVATE.
Replace g_type_add_interface_static by G_IMPLEMENT_INTERFACE.
  • Loading branch information
c-holtermann committed Jan 26, 2019
1 parent 3fc6ff1 commit b0fc078
Showing 1 changed file with 4 additions and 40 deletions.
44 changes: 4 additions & 40 deletions gnucash/gnome-utils/gnc-tree-model-commodity.c
Expand Up @@ -106,44 +106,10 @@ typedef struct GncTreeModelCommodityPrivate
/** A pointer to the parent class of a commodity tree model. */
static GObjectClass *parent_class = NULL;

GType
gnc_tree_model_commodity_get_type (void)
{
static GType gnc_tree_model_commodity_type = 0;

if (gnc_tree_model_commodity_type == 0)
{
static const GTypeInfo our_info =
{
sizeof (GncTreeModelCommodityClass),
NULL,
NULL,
(GClassInitFunc) gnc_tree_model_commodity_class_init,
NULL,
NULL,
sizeof (GncTreeModelCommodity),
0,
(GInstanceInitFunc) gnc_tree_model_commodity_init
};

static const GInterfaceInfo tree_model_info =
{
(GInterfaceInitFunc) gnc_tree_model_commodity_tree_model_init,
NULL,
NULL
};

gnc_tree_model_commodity_type = g_type_register_static (GNC_TYPE_TREE_MODEL,
GNC_TREE_MODEL_COMMODITY_NAME,
&our_info, 0);

g_type_add_interface_static (gnc_tree_model_commodity_type,
GTK_TYPE_TREE_MODEL,
&tree_model_info);
}

return gnc_tree_model_commodity_type;
}
G_DEFINE_TYPE_WITH_CODE(GncTreeModelCommodity, gnc_tree_model_commodity, GNC_TYPE_TREE_MODEL,
G_ADD_PRIVATE(GncTreeModelCommodity)
G_IMPLEMENT_INTERFACE(GTK_TYPE_TREE_MODEL,
gnc_tree_model_commodity_tree_model_init))

static void
gnc_tree_model_commodity_class_init (GncTreeModelCommodityClass *klass)
Expand All @@ -154,8 +120,6 @@ gnc_tree_model_commodity_class_init (GncTreeModelCommodityClass *klass)

o_class->finalize = gnc_tree_model_commodity_finalize;
o_class->dispose = gnc_tree_model_commodity_dispose;

g_type_class_add_private(klass, sizeof(GncTreeModelCommodityPrivate));
}

static void
Expand Down

0 comments on commit b0fc078

Please sign in to comment.