layout-manager: Create LayoutMeta on demand
authorEmmanuele Bassi <ebassi@linux.intel.com>
Mon, 30 Nov 2009 19:03:11 +0000 (19:03 +0000)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Mon, 30 Nov 2009 19:11:00 +0000 (19:11 +0000)
commit15a04a1dd39fd19f28132cbd3c22b49c05c0773b
tree273cb41906e50fa46db009ad190cc14345a2667c
parent7d842079ca7521332b98e7cc06480a3f7e23110f
layout-manager: Create LayoutMeta on demand

The ClutterLayoutMeta instances should be created on demand, whenever
the layout manager needs them - if the layout manager supports layout
properties.

This removes the requirement to call add_child_meta() and
remove_child_meta() on add and remove respectively; it also simplifies
the implementation of LayoutManager sub-classes since we can add
fallback code in the base abstract class.

Eventually, this will also lead to an easier to implement ClutterScript
parser for layout properties.

With the new scheme, the ClutterLayoutMeta instance is created whenever
the layout manager tries to access it; if there isn't an instance
already attached to the container's child, one is created -- assuming
that the LayoutManager sub-class has overridden the
get_child_meta_type() virtual function and it's returning a valid GType.

We can also provide a default implementation for create_child_meta(),
by getting the GType and instantiating a ClutterLayoutMeta with all the
fields already set. If the layout manager requires more work then it can
obviously override the default implementation (and even chain up to it).

The ClutterBox actor has been updated, as well as the ClutterBoxLayout
layout manager, to take advantage of the changes of LayoutManager.
clutter/clutter-box-layout.c
clutter/clutter-box.c
clutter/clutter-layout-manager.c
clutter/clutter-layout-manager.h
doc/reference/clutter/clutter-sections.txt