[libchamplain] Have ChamplainPolygon inherit from GInitiallyUnowned



commit 5b7f0d697b178c4c4d67a028d5da7987145c5d47
Author: Pierre-Luc Beaudoin <pierre-luc pierlux com>
Date:   Mon Aug 3 21:55:37 2009 -0400

    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.

 champlain/champlain-polygon.h |    4 ++--
 champlain/champlain-view.c    |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
---
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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]