Deprecate ClutterTableLayout

The table layout manager has various issues:

  • no support for RTL flipping
  • most of the layout API is legacy, and has been replaced by the
    alignment and expansion flags on ClutterActor
  • the animation API is legacy, and has been replaced by the
    implicitly animatable allocation
  • the spanning cells handling is a bit awkward, as is its API

On top of that, we imported the grid layout management policy from GTK+
into ClutterGridLayout, which provides all the required features in a
more well-designed API.

Instead of wasting time and resources updating TableLayout, we should
deprecate it and point developers of the GridLayout.
This commit is contained in:
Emmanuele Bassi 2013-11-19 00:26:37 +00:00
parent 56b579248e
commit 7af55d23e4
6 changed files with 50 additions and 5 deletions

View File

@ -115,7 +115,6 @@ source_h = \
$(srcdir)/clutter-snap-constraint.h \ $(srcdir)/clutter-snap-constraint.h \
$(srcdir)/clutter-stage.h \ $(srcdir)/clutter-stage.h \
$(srcdir)/clutter-stage-manager.h \ $(srcdir)/clutter-stage-manager.h \
$(srcdir)/clutter-table-layout.h \
$(srcdir)/clutter-tap-action.h \ $(srcdir)/clutter-tap-action.h \
$(srcdir)/clutter-texture.h \ $(srcdir)/clutter-texture.h \
$(srcdir)/clutter-text.h \ $(srcdir)/clutter-text.h \
@ -199,7 +198,6 @@ source_c = \
$(srcdir)/clutter-stage.c \ $(srcdir)/clutter-stage.c \
$(srcdir)/clutter-stage-manager.c \ $(srcdir)/clutter-stage-manager.c \
$(srcdir)/clutter-stage-window.c \ $(srcdir)/clutter-stage-window.c \
$(srcdir)/clutter-table-layout.c \
$(srcdir)/clutter-tap-action.c \ $(srcdir)/clutter-tap-action.c \
$(srcdir)/clutter-text.c \ $(srcdir)/clutter-text.c \
$(srcdir)/clutter-text-buffer.c \ $(srcdir)/clutter-text-buffer.c \
@ -282,6 +280,7 @@ deprecated_h = \
$(srcdir)/deprecated/clutter-stage-manager.h \ $(srcdir)/deprecated/clutter-stage-manager.h \
$(srcdir)/deprecated/clutter-stage.h \ $(srcdir)/deprecated/clutter-stage.h \
$(srcdir)/deprecated/clutter-state.h \ $(srcdir)/deprecated/clutter-state.h \
$(srcdir)/deprecated/clutter-table-layout.h \
$(srcdir)/deprecated/clutter-texture.h \ $(srcdir)/deprecated/clutter-texture.h \
$(srcdir)/deprecated/clutter-timeline.h \ $(srcdir)/deprecated/clutter-timeline.h \
$(srcdir)/deprecated/clutter-timeout-pool.h \ $(srcdir)/deprecated/clutter-timeout-pool.h \
@ -313,6 +312,7 @@ deprecated_c = \
$(srcdir)/deprecated/clutter-score.c \ $(srcdir)/deprecated/clutter-score.c \
$(srcdir)/deprecated/clutter-shader.c \ $(srcdir)/deprecated/clutter-shader.c \
$(srcdir)/deprecated/clutter-state.c \ $(srcdir)/deprecated/clutter-state.c \
$(srcdir)/deprecated/clutter-table-layout.c \
$(srcdir)/deprecated/clutter-texture.c \ $(srcdir)/deprecated/clutter-texture.c \
$(srcdir)/deprecated/clutter-timeout-pool.c \ $(srcdir)/deprecated/clutter-timeout-pool.c \
$(NULL) $(NULL)

View File

@ -33,6 +33,7 @@
#include "deprecated/clutter-stage-manager.h" #include "deprecated/clutter-stage-manager.h"
#include "deprecated/clutter-stage.h" #include "deprecated/clutter-stage.h"
#include "deprecated/clutter-state.h" #include "deprecated/clutter-state.h"
#include "deprecated/clutter-table-layout.h"
#include "deprecated/clutter-texture.h" #include "deprecated/clutter-texture.h"
#include "deprecated/clutter-timeline.h" #include "deprecated/clutter-timeline.h"
#include "deprecated/clutter-timeout-pool.h" #include "deprecated/clutter-timeout-pool.h"

View File

@ -98,7 +98,6 @@
#include "clutter-snap-constraint.h" #include "clutter-snap-constraint.h"
#include "clutter-stage.h" #include "clutter-stage.h"
#include "clutter-stage-manager.h" #include "clutter-stage-manager.h"
#include "clutter-table-layout.h"
#include "clutter-tap-action.h" #include "clutter-tap-action.h"
#include "clutter-texture.h" #include "clutter-texture.h"
#include "clutter-text.h" #include "clutter-text.h"

View File

@ -74,6 +74,12 @@
* </figure> * </figure>
* *
* #ClutterTableLayout is available since Clutter 1.4 * #ClutterTableLayout is available since Clutter 1.4
*
* Since Clutter 1.18 it's recommended to use #ClutterGridLayout instead
* of #ClutterTableLayout; the former supports right-to-left text direction,
* as well as using the alignment and expansion flags on #ClutterActor.
*
* Deprecated: 1.18
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
@ -1624,6 +1630,8 @@ clutter_table_layout_class_init (ClutterTableLayoutClass *klass)
* The spacing between columns of the #ClutterTableLayout, in pixels * The spacing between columns of the #ClutterTableLayout, in pixels
* *
* Since: 1.4 * Since: 1.4
*
* Deprecated: 1.18
*/ */
pspec = g_param_spec_uint ("column-spacing", pspec = g_param_spec_uint ("column-spacing",
P_("Column Spacing"), P_("Column Spacing"),
@ -1638,6 +1646,8 @@ clutter_table_layout_class_init (ClutterTableLayoutClass *klass)
* The spacing between rows of the #ClutterTableLayout, in pixels * The spacing between rows of the #ClutterTableLayout, in pixels
* *
* Since: 1.4 * Since: 1.4
*
* Deprecated: 1.18
*/ */
pspec = g_param_spec_uint ("row-spacing", pspec = g_param_spec_uint ("row-spacing",
P_("Row Spacing"), P_("Row Spacing"),
@ -1744,6 +1754,8 @@ clutter_table_layout_init (ClutterTableLayout *layout)
* Return value: the newly created #ClutterTableLayout * Return value: the newly created #ClutterTableLayout
* *
* Since: 1.4 * Since: 1.4
*
* Deprecated: 1.18: Use #ClutterGridLayout instead
*/ */
ClutterLayoutManager * ClutterLayoutManager *
clutter_table_layout_new (void) clutter_table_layout_new (void)
@ -1759,6 +1771,8 @@ clutter_table_layout_new (void)
* Sets the spacing between columns of @layout * Sets the spacing between columns of @layout
* *
* Since: 1.4 * Since: 1.4
*
* Deprecated: 1.18: Use #ClutterGridLayout instead
*/ */
void void
clutter_table_layout_set_column_spacing (ClutterTableLayout *layout, clutter_table_layout_set_column_spacing (ClutterTableLayout *layout,
@ -1792,6 +1806,8 @@ clutter_table_layout_set_column_spacing (ClutterTableLayout *layout,
* Return value: the spacing between columns of the #ClutterTableLayout * Return value: the spacing between columns of the #ClutterTableLayout
* *
* Since: 1.4 * Since: 1.4
*
* Deprecated: 1.18: Use #ClutterGridLayout instead
*/ */
guint guint
clutter_table_layout_get_column_spacing (ClutterTableLayout *layout) clutter_table_layout_get_column_spacing (ClutterTableLayout *layout)
@ -1809,6 +1825,8 @@ clutter_table_layout_get_column_spacing (ClutterTableLayout *layout)
* Sets the spacing between rows of @layout * Sets the spacing between rows of @layout
* *
* Since: 1.4 * Since: 1.4
*
* Deprecated: 1.18: Use #ClutterGridLayout instead
*/ */
void void
clutter_table_layout_set_row_spacing (ClutterTableLayout *layout, clutter_table_layout_set_row_spacing (ClutterTableLayout *layout,
@ -1842,6 +1860,8 @@ clutter_table_layout_set_row_spacing (ClutterTableLayout *layout,
* Return value: the spacing between rows of the #ClutterTableLayout * Return value: the spacing between rows of the #ClutterTableLayout
* *
* Since: 1.4 * Since: 1.4
*
* Deprecated: 1.18: Use #ClutterGridLayout instead
*/ */
guint guint
clutter_table_layout_get_row_spacing (ClutterTableLayout *layout) clutter_table_layout_get_row_spacing (ClutterTableLayout *layout)
@ -1862,6 +1882,8 @@ clutter_table_layout_get_row_spacing (ClutterTableLayout *layout)
* at the given row and column. * at the given row and column.
* *
* Since: 1.4 * Since: 1.4
*
* Deprecated: 1.18: Use #ClutterGridLayout instead
*/ */
void void
clutter_table_layout_pack (ClutterTableLayout *layout, clutter_table_layout_pack (ClutterTableLayout *layout,
@ -1916,6 +1938,8 @@ clutter_table_layout_pack (ClutterTableLayout *layout,
* inside @layout * inside @layout
* *
* Since: 1.4 * Since: 1.4
*
* Deprecated: 1.18: Use #ClutterGridLayout instead
*/ */
void void
clutter_table_layout_set_span (ClutterTableLayout *layout, clutter_table_layout_set_span (ClutterTableLayout *layout,
@ -1970,6 +1994,8 @@ clutter_table_layout_set_span (ClutterTableLayout *layout,
* clutter_table_layout_pack() or clutter_table_layout_set_span() * clutter_table_layout_pack() or clutter_table_layout_set_span()
* *
* Since: 1.4 * Since: 1.4
*
* Deprecated: 1.18: Use #ClutterGridLayout instead
*/ */
void void
clutter_table_layout_get_span (ClutterTableLayout *layout, clutter_table_layout_get_span (ClutterTableLayout *layout,
@ -2551,6 +2577,8 @@ clutter_table_layout_get_easing_duration (ClutterTableLayout *layout)
* Returns: the number of rows * Returns: the number of rows
* *
* Since: 1.4 * Since: 1.4
*
* Deprecated: 1.18: Use #ClutterGridLayout instead
*/ */
gint gint
clutter_table_layout_get_row_count (ClutterTableLayout *layout) clutter_table_layout_get_row_count (ClutterTableLayout *layout)
@ -2570,6 +2598,8 @@ clutter_table_layout_get_row_count (ClutterTableLayout *layout)
* Returns: the number of columns * Returns: the number of columns
* *
* Since: 1.4 * Since: 1.4
*
* Deprecated: 1.18: Use #ClutterGridLayout instead
*/ */
gint gint
clutter_table_layout_get_column_count (ClutterTableLayout *layout) clutter_table_layout_get_column_count (ClutterTableLayout *layout)

View File

@ -54,6 +54,8 @@ typedef struct _ClutterTableLayoutClass ClutterTableLayoutClass;
* and should be accessed using the provided API * and should be accessed using the provided API
* *
* Since: 1.4 * Since: 1.4
*
* Deprecated: 1.18: Use #ClutterGridLayout instead
*/ */
struct _ClutterTableLayout struct _ClutterTableLayout
{ {
@ -70,6 +72,8 @@ struct _ClutterTableLayout
* data and should be accessed using the provided API * data and should be accessed using the provided API
* *
* Since: 1.4 * Since: 1.4
*
* Deprecated: 1.18: Use #ClutterGridLayout instead
*/ */
struct _ClutterTableLayoutClass struct _ClutterTableLayoutClass
{ {
@ -77,26 +81,35 @@ struct _ClutterTableLayoutClass
ClutterLayoutManagerClass parent_class; ClutterLayoutManagerClass parent_class;
}; };
CLUTTER_DEPRECATED_IN_1_18_FOR (clutter_grid_layout_get_type)
GType clutter_table_layout_get_type (void) G_GNUC_CONST; GType clutter_table_layout_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_IN_1_18_FOR (clutter_grid_layout_new)
ClutterLayoutManager *clutter_table_layout_new (void); ClutterLayoutManager *clutter_table_layout_new (void);
CLUTTER_DEPRECATED_IN_1_18_FOR (clutter_grid_layout_attach)
void clutter_table_layout_pack (ClutterTableLayout *layout, void clutter_table_layout_pack (ClutterTableLayout *layout,
ClutterActor *actor, ClutterActor *actor,
gint column, gint column,
gint row); gint row);
CLUTTER_DEPRECATED_IN_1_18_FOR (clutter_grid_layout_set_column_spacing)
void clutter_table_layout_set_column_spacing (ClutterTableLayout *layout, void clutter_table_layout_set_column_spacing (ClutterTableLayout *layout,
guint spacing); guint spacing);
CLUTTER_DEPRECATED_IN_1_18_FOR (clutter_grid_layout_set_row_spacing)
void clutter_table_layout_set_row_spacing (ClutterTableLayout *layout, void clutter_table_layout_set_row_spacing (ClutterTableLayout *layout,
guint spacing); guint spacing);
CLUTTER_DEPRECATED_IN_1_18_FOR (clutter_grid_layout_get_column_spacing)
guint clutter_table_layout_get_column_spacing (ClutterTableLayout *layout); guint clutter_table_layout_get_column_spacing (ClutterTableLayout *layout);
CLUTTER_DEPRECATED_IN_1_18_FOR (clutter_grid_layout_get_row_spacing)
guint clutter_table_layout_get_row_spacing (ClutterTableLayout *layout); guint clutter_table_layout_get_row_spacing (ClutterTableLayout *layout);
CLUTTER_DEPRECATED_IN_1_18
void clutter_table_layout_set_span (ClutterTableLayout *layout, void clutter_table_layout_set_span (ClutterTableLayout *layout,
ClutterActor *actor, ClutterActor *actor,
gint column_span, gint column_span,
gint row_span); gint row_span);
CLUTTER_DEPRECATED_IN_1_18
void clutter_table_layout_get_span (ClutterTableLayout *layout, void clutter_table_layout_get_span (ClutterTableLayout *layout,
ClutterActor *actor, ClutterActor *actor,
gint *column_span, gint *column_span,
@ -133,7 +146,9 @@ void clutter_table_layout_get_expand (ClutterTableLayo
gboolean *x_expand, gboolean *x_expand,
gboolean *y_expand); gboolean *y_expand);
CLUTTER_DEPRECATED_IN_1_18
gint clutter_table_layout_get_row_count (ClutterTableLayout *layout); gint clutter_table_layout_get_row_count (ClutterTableLayout *layout);
CLUTTER_DEPRECATED_IN_1_18
gint clutter_table_layout_get_column_count (ClutterTableLayout *layout); gint clutter_table_layout_get_column_count (ClutterTableLayout *layout);
CLUTTER_DEPRECATED_IN_1_12 CLUTTER_DEPRECATED_IN_1_12

View File

@ -72,7 +72,6 @@
<chapter> <chapter>
<title>Base actors</title> <title>Base actors</title>
<xi:include href="xml/clutter-stage.xml"/> <xi:include href="xml/clutter-stage.xml"/>
<xi:include href="xml/clutter-texture.xml"/>
<xi:include href="xml/clutter-clone.xml"/> <xi:include href="xml/clutter-clone.xml"/>
<xi:include href="xml/clutter-text.xml"/> <xi:include href="xml/clutter-text.xml"/>
<xi:include href="xml/clutter-scroll-actor.xml"/> <xi:include href="xml/clutter-scroll-actor.xml"/>
@ -85,7 +84,6 @@
<xi:include href="xml/clutter-bin-layout.xml"/> <xi:include href="xml/clutter-bin-layout.xml"/>
<xi:include href="xml/clutter-flow-layout.xml"/> <xi:include href="xml/clutter-flow-layout.xml"/>
<xi:include href="xml/clutter-box-layout.xml"/> <xi:include href="xml/clutter-box-layout.xml"/>
<xi:include href="xml/clutter-table-layout.xml"/>
<xi:include href="xml/clutter-grid-layout.xml"/> <xi:include href="xml/clutter-grid-layout.xml"/>
</chapter> </chapter>
@ -263,6 +261,8 @@
<xi:include href="xml/clutter-score.xml"/> <xi:include href="xml/clutter-score.xml"/>
<xi:include href="xml/clutter-shader.xml"/> <xi:include href="xml/clutter-shader.xml"/>
<xi:include href="xml/clutter-state.xml"/> <xi:include href="xml/clutter-state.xml"/>
<xi:include href="xml/clutter-table-layout.xml"/>
<xi:include href="xml/clutter-texture.xml"/>
</part> </part>
<part id="clutterobjects"> <part id="clutterobjects">