mirror of
https://github.com/brl/mutter.git
synced 2024-11-29 19:40:43 -05:00
[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.
This commit is contained in:
parent
0340f65634
commit
141a155690
@ -281,7 +281,8 @@ clutter_box_set_property (GObject *gobject,
|
|||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_LAYOUT_MANAGER:
|
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;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -23,7 +23,9 @@
|
|||||||
G_OBJECT_TYPE_NAME (_obj), \
|
G_OBJECT_TYPE_NAME (_obj), \
|
||||||
(method)); } G_STMT_END
|
(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
|
static void
|
||||||
layout_manager_real_get_preferred_width (ClutterLayoutManager *manager,
|
layout_manager_real_get_preferred_width (ClutterLayoutManager *manager,
|
||||||
|
@ -30,7 +30,7 @@ typedef struct _ClutterLayoutManagerClass ClutterLayoutManagerClass;
|
|||||||
*/
|
*/
|
||||||
struct _ClutterLayoutManager
|
struct _ClutterLayoutManager
|
||||||
{
|
{
|
||||||
GObject parent_instance;
|
GInitiallyUnowned parent_instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -43,7 +43,7 @@ struct _ClutterLayoutManager
|
|||||||
*/
|
*/
|
||||||
struct _ClutterLayoutManagerClass
|
struct _ClutterLayoutManagerClass
|
||||||
{
|
{
|
||||||
GObjectClass parent_class;
|
GInitiallyUnownedClass parent_class;
|
||||||
|
|
||||||
void (* get_preferred_width) (ClutterLayoutManager *manager,
|
void (* get_preferred_width) (ClutterLayoutManager *manager,
|
||||||
ClutterContainer *container,
|
ClutterContainer *container,
|
||||||
|
Loading…
Reference in New Issue
Block a user