After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 677372 - Add ClutterGridLayout
Add ClutterGridLayout
Status: RESOLVED FIXED
Product: clutter
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: clutter-maint
clutter-maint
Depends on:
Blocks:
 
 
Reported: 2012-06-04 08:17 UTC by Bastian Winkler
Modified: 2012-06-05 10:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add ClutterGridLayout (76.52 KB, patch)
2012-06-04 08:18 UTC, Bastian Winkler
reviewed Details | Review
examples: Add a grid-layout example (12.60 KB, patch)
2012-06-04 08:20 UTC, Bastian Winkler
committed Details | Review
Add ClutterGridLayout (78.59 KB, patch)
2012-06-04 14:44 UTC, Bastian Winkler
committed Details | Review

Description Bastian Winkler 2012-06-04 08:17:40 UTC
ClutterGridLayout is port of GtkGrid to a Clutter layout manager. All
the logic is taken from gtkgrid.c, so all the credits should go to
Mathias Clasen for writing this nice piece of code.

ClutterGridLayout supports adding children with it's own methods
GridLayout.attach() and GridLayout.attach_next_to() as well as
Actor.add_child() and friends. The latter adds children in a similar
fashion to ClutterBoxLayout
Comment 1 Bastian Winkler 2012-06-04 08:18:17 UTC
Created attachment 215526 [details] [review]
Add ClutterGridLayout
Comment 2 Bastian Winkler 2012-06-04 08:20:12 UTC
Created attachment 215527 [details] [review]
examples: Add a grid-layout example

A fairly complete example for ClutterGridLayout
Comment 3 Emmanuele Bassi (:ebassi) 2012-06-04 10:12:26 UTC
Review of attachment 215526 [details] [review]:

thanks ever so much for doing this; it looks generally okay, apart from a couple of issues.

the header is missing the copyright and license notice, and the functions are missing the CLUTTER_AVAILABLE_IN_1_12 annotation.

::: clutter/clutter-grid-layout.c
@@ +52,3 @@
+ * rows and columns. It is a very similar to #ClutterTableLayout and
+ * #ClutterBoxLayout, but it consistently uses #ClutterActor's
+ * #ClutterActor:x-align and #ClutterActor:x-expand properties instead of

I'd use "it consistently uses #ClutterActor's alignment and expansion flags".

@@ +58,3 @@
+ * multiple rows or columns. It is also possible to add a child next to an
+ * existing child, using clutter_grid_layout_attach_next_to(). The behaviour of
+ * #ClutterGridLayout when several children occupy the same grid cell is undefined.

unlike gtk+, we can actually provide some guarantee on the order of painting, as well as painting multiple actors.

@@ +1540,3 @@
+  layout_class->get_child_meta_type = clutter_grid_layout_get_child_meta_type;
+
+  obj_props[PROP_ORIENTATION] =

missing annotation for the ClutterGridLayout properties.
Comment 4 Emmanuele Bassi (:ebassi) 2012-06-04 10:13:09 UTC
Review of attachment 215527 [details] [review]:

looks okay
Comment 5 Bastian Winkler 2012-06-04 14:44:08 UTC
(In reply to comment #3)
> Review of attachment 215526 [details] [review]:
> 
> thanks ever so much for doing this; it looks generally okay, apart from a
> couple of issues.

you're welcome

> the header is missing the copyright and license notice, and the functions are
> missing the CLUTTER_AVAILABLE_IN_1_12 annotation.

oops, fixed

> + * #ClutterBoxLayout, but it consistently uses #ClutterActor's
> + * #ClutterActor:x-align and #ClutterActor:x-expand properties instead of
> 
> I'd use "it consistently uses #ClutterActor's alignment and expansion flags".

ok, I changed that

> + * existing child, using clutter_grid_layout_attach_next_to(). The behaviour
> of
> + * #ClutterGridLayout when several children occupy the same grid cell is
> undefined.
> 
> unlike gtk+, we can actually provide some guarantee on the order of painting,
> as well as painting multiple actors.

right, first come, first serve :)

> missing annotation for the ClutterGridLayout properties.

fixed

I'll attach a modified version of the patch for a further review
Comment 6 Bastian Winkler 2012-06-04 14:44:27 UTC
Created attachment 215554 [details] [review]
Add ClutterGridLayout

ClutterGridLayout is port of GtkGrid to a Clutter layout manager. All
the logic is taken from gtkgrid.c, so all the credits should go to
Mathias Clasen for writing this nice piece of code.

ClutterGridLayout supports adding children with it's own methods
GridLayout.attach() and GridLayout.attach_next_to() as well as
Actor.add_child() and friends. The latter adds children in a similar
fashion to ClutterBoxLayout
Comment 7 Emmanuele Bassi (:ebassi) 2012-06-05 10:00:55 UTC
Review of attachment 215554 [details] [review]:

looks okay, two minor issues still remaining that should be fixed before commit.

::: clutter/clutter-grid-layout.h
@@ +76,3 @@
+{
+  /*< private >*/
+  ClutterLayoutManagerClass parent_class;

missing padding in the Class structure. I'd go for 8 slots.

@@ +79,3 @@
+};
+
+GType clutter_grid_layout_get_type (void) G_GNUC_CONST;

missing CLUTTER_AVAILABLE_IN_1_12

@@ +81,3 @@
+GType clutter_grid_layout_get_type (void) G_GNUC_CONST;
+
+ClutterLayoutManager *  clutter_grid_layout_new                 (void);

missing CLUTTER_AVAILABLE_IN_1_12
Comment 8 Bastian Winkler 2012-06-05 10:24:28 UTC
Review of attachment 215554 [details] [review]:

::: clutter/clutter-grid-layout.c
@@ +1267,3 @@
+
+  priv->container = container;
+

like BoxLayout does, the manager should also change the request mode of the container if necessary.
I'll add this too

::: clutter/clutter-grid-layout.h
@@ +79,3 @@
+};
+
+GType clutter_grid_layout_get_type (void) G_GNUC_CONST;

I either need more sleep or more coffee
Comment 9 Bastian Winkler 2012-06-05 10:35:30 UTC
Attachment 215554 [details] pushed as 1eb869e - Add ClutterGridLayout