summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@linux.intel.com>2009-09-02 11:55:22 +0100
committerEmmanuele Bassi <ebassi@linux.intel.com>2009-10-14 11:27:18 +0100
commit141a1556908749236c90e69fc2388f4fc40c6d8f (patch)
treee1fb086885f2be4febe68c6320834d817595c0b6
parent0340f656346d80696305218897720e28c88f367a (diff)
downloadclutter-141a1556908749236c90e69fc2388f4fc40c6d8f.tar.gz
[layout] Make LayoutManager a floating object
A layout manager instance makes only sense if it's owned by a container. For this reason, it should have a floating reference instead of a full reference on construction; this allows constructing Boxes like: box = clutter_box_new (clutter_fixed_layout_new ()); without leaking the layout manager instance.
-rw-r--r--clutter/clutter-box.c3
-rw-r--r--clutter/clutter-layout-manager.c4
-rw-r--r--clutter/clutter-layout-manager.h4
3 files changed, 7 insertions, 4 deletions
diff --git a/clutter/clutter-box.c b/clutter/clutter-box.c
index 6b8253eac..f3c0648ab 100644
--- a/clutter/clutter-box.c
+++ b/clutter/clutter-box.c
@@ -281,7 +281,8 @@ clutter_box_set_property (GObject *gobject,
switch (prop_id)
{
case PROP_LAYOUT_MANAGER:
- priv->manager = g_value_dup_object (value);
+ priv->manager = g_value_get_object (value);
+ g_object_ref_sink (priv->manager);
break;
default:
diff --git a/clutter/clutter-layout-manager.c b/clutter/clutter-layout-manager.c
index f9e59087f..912ccd2d3 100644
--- a/clutter/clutter-layout-manager.c
+++ b/clutter/clutter-layout-manager.c
@@ -23,7 +23,9 @@
G_OBJECT_TYPE_NAME (_obj), \
(method)); } G_STMT_END
-G_DEFINE_ABSTRACT_TYPE (ClutterLayoutManager, clutter_layout_manager, G_TYPE_OBJECT);
+G_DEFINE_ABSTRACT_TYPE (ClutterLayoutManager,
+ clutter_layout_manager,
+ G_TYPE_INITIALLY_UNOWNED);
static void
layout_manager_real_get_preferred_width (ClutterLayoutManager *manager,
diff --git a/clutter/clutter-layout-manager.h b/clutter/clutter-layout-manager.h
index f93e68a02..e053c658e 100644
--- a/clutter/clutter-layout-manager.h
+++ b/clutter/clutter-layout-manager.h
@@ -30,7 +30,7 @@ typedef struct _ClutterLayoutManagerClass ClutterLayoutManagerClass;
*/
struct _ClutterLayoutManager
{
- GObject parent_instance;
+ GInitiallyUnowned parent_instance;
};
/**
@@ -43,7 +43,7 @@ struct _ClutterLayoutManager
*/
struct _ClutterLayoutManagerClass
{
- GObjectClass parent_class;
+ GInitiallyUnownedClass parent_class;
void (* get_preferred_width) (ClutterLayoutManager *manager,
ClutterContainer *container,