From: Pierre-Luc Beaudoin Date: Tue, 4 Aug 2009 01:55:37 +0000 (-0400) Subject: Have ChamplainPolygon inherit from GInitiallyUnowned X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b7f0d697b178c4c4d67a028d5da7987145c5d47;p=libchamplain Have ChamplainPolygon inherit from GInitiallyUnowned This makes the API nicer to use as you don't have to unref newly allocated polygons, even after adding them to a view. --- diff --git a/champlain/champlain-polygon.h b/champlain/champlain-polygon.h index e68fb1c..27251c5 100644 --- a/champlain/champlain-polygon.h +++ b/champlain/champlain-polygon.h @@ -50,12 +50,12 @@ G_BEGIN_DECLS typedef struct _ChamplainPolygonPrivate ChamplainPolygonPrivate; typedef struct { - GObject parent; + GInitiallyUnowned parent; ChamplainPolygonPrivate *priv; } ChamplainPolygon; typedef struct { - GObjectClass parent_class; + GInitiallyUnownedClass parent_class; } ChamplainPolygonClass; GType champlain_polygon_get_type (void); diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c index 64258e5..f01c433 100644 --- a/champlain/champlain-view.c +++ b/champlain/champlain-view.c @@ -2263,7 +2263,7 @@ champlain_view_add_polygon (ChamplainView *view, g_return_if_fail (CHAMPLAIN_IS_VIEW (view)); g_return_if_fail (CHAMPLAIN_IS_POLYGON (polygon)); - view->priv->polygons = g_list_append (view->priv->polygons, g_object_ref (polygon)); + view->priv->polygons = g_list_append (view->priv->polygons, g_object_ref_sink (polygon)); g_signal_connect (polygon, "notify", G_CALLBACK (notify_polygon_cb), view);