]> err.no Git - libchamplain/commitdiff
Have ChamplainPolygon inherit from GInitiallyUnowned
authorPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Tue, 4 Aug 2009 01:55:37 +0000 (21:55 -0400)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Tue, 4 Aug 2009 02:12:34 +0000 (22:12 -0400)
This makes the API nicer to use as you don't have to unref
newly allocated polygons, even after adding them to a view.

champlain/champlain-polygon.h
champlain/champlain-view.c

index e68fb1c35e9be82d31914587c03d554b3e047cb0..27251c5ae938d9c563b4f76c8ab04fcbda96466e 100644 (file)
@@ -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);
index 64258e54a82fc4b140bbfbe83416e8a976529dab..f01c433df489fd7afaec715c927226abd2261a79 100644 (file)
@@ -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);