From 7af55d23e4a24689eba6e3f994e7b96b7495c614 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 19 Nov 2013 00:26:37 +0000 Subject: [PATCH] Deprecate ClutterTableLayout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- clutter/Makefile.am | 4 +-- clutter/clutter-deprecated.h | 1 + clutter/clutter.h | 1 - .../{ => deprecated}/clutter-table-layout.c | 30 +++++++++++++++++++ .../{ => deprecated}/clutter-table-layout.h | 15 ++++++++++ doc/reference/clutter/clutter-docs.xml.in | 4 +-- 6 files changed, 50 insertions(+), 5 deletions(-) rename clutter/{ => deprecated}/clutter-table-layout.c (98%) rename clutter/{ => deprecated}/clutter-table-layout.h (92%) diff --git a/clutter/Makefile.am b/clutter/Makefile.am index b03554823..21ea818a1 100644 --- a/clutter/Makefile.am +++ b/clutter/Makefile.am @@ -115,7 +115,6 @@ source_h = \ $(srcdir)/clutter-snap-constraint.h \ $(srcdir)/clutter-stage.h \ $(srcdir)/clutter-stage-manager.h \ - $(srcdir)/clutter-table-layout.h \ $(srcdir)/clutter-tap-action.h \ $(srcdir)/clutter-texture.h \ $(srcdir)/clutter-text.h \ @@ -199,7 +198,6 @@ source_c = \ $(srcdir)/clutter-stage.c \ $(srcdir)/clutter-stage-manager.c \ $(srcdir)/clutter-stage-window.c \ - $(srcdir)/clutter-table-layout.c \ $(srcdir)/clutter-tap-action.c \ $(srcdir)/clutter-text.c \ $(srcdir)/clutter-text-buffer.c \ @@ -282,6 +280,7 @@ deprecated_h = \ $(srcdir)/deprecated/clutter-stage-manager.h \ $(srcdir)/deprecated/clutter-stage.h \ $(srcdir)/deprecated/clutter-state.h \ + $(srcdir)/deprecated/clutter-table-layout.h \ $(srcdir)/deprecated/clutter-texture.h \ $(srcdir)/deprecated/clutter-timeline.h \ $(srcdir)/deprecated/clutter-timeout-pool.h \ @@ -313,6 +312,7 @@ deprecated_c = \ $(srcdir)/deprecated/clutter-score.c \ $(srcdir)/deprecated/clutter-shader.c \ $(srcdir)/deprecated/clutter-state.c \ + $(srcdir)/deprecated/clutter-table-layout.c \ $(srcdir)/deprecated/clutter-texture.c \ $(srcdir)/deprecated/clutter-timeout-pool.c \ $(NULL) diff --git a/clutter/clutter-deprecated.h b/clutter/clutter-deprecated.h index 1f400299f..fc40557dc 100644 --- a/clutter/clutter-deprecated.h +++ b/clutter/clutter-deprecated.h @@ -33,6 +33,7 @@ #include "deprecated/clutter-stage-manager.h" #include "deprecated/clutter-stage.h" #include "deprecated/clutter-state.h" +#include "deprecated/clutter-table-layout.h" #include "deprecated/clutter-texture.h" #include "deprecated/clutter-timeline.h" #include "deprecated/clutter-timeout-pool.h" diff --git a/clutter/clutter.h b/clutter/clutter.h index 5bdd6bcf5..0300099af 100644 --- a/clutter/clutter.h +++ b/clutter/clutter.h @@ -98,7 +98,6 @@ #include "clutter-snap-constraint.h" #include "clutter-stage.h" #include "clutter-stage-manager.h" -#include "clutter-table-layout.h" #include "clutter-tap-action.h" #include "clutter-texture.h" #include "clutter-text.h" diff --git a/clutter/clutter-table-layout.c b/clutter/deprecated/clutter-table-layout.c similarity index 98% rename from clutter/clutter-table-layout.c rename to clutter/deprecated/clutter-table-layout.c index f95b8c053..f934d634f 100644 --- a/clutter/clutter-table-layout.c +++ b/clutter/deprecated/clutter-table-layout.c @@ -74,6 +74,12 @@ * * * #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 @@ -1624,6 +1630,8 @@ clutter_table_layout_class_init (ClutterTableLayoutClass *klass) * The spacing between columns of the #ClutterTableLayout, in pixels * * Since: 1.4 + * + * Deprecated: 1.18 */ pspec = g_param_spec_uint ("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 * * Since: 1.4 + * + * Deprecated: 1.18 */ pspec = g_param_spec_uint ("row-spacing", P_("Row Spacing"), @@ -1744,6 +1754,8 @@ clutter_table_layout_init (ClutterTableLayout *layout) * Return value: the newly created #ClutterTableLayout * * Since: 1.4 + * + * Deprecated: 1.18: Use #ClutterGridLayout instead */ ClutterLayoutManager * clutter_table_layout_new (void) @@ -1759,6 +1771,8 @@ clutter_table_layout_new (void) * Sets the spacing between columns of @layout * * Since: 1.4 + * + * Deprecated: 1.18: Use #ClutterGridLayout instead */ void 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 * * Since: 1.4 + * + * Deprecated: 1.18: Use #ClutterGridLayout instead */ guint 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 * * Since: 1.4 + * + * Deprecated: 1.18: Use #ClutterGridLayout instead */ void 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 * * Since: 1.4 + * + * Deprecated: 1.18: Use #ClutterGridLayout instead */ guint 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. * * Since: 1.4 + * + * Deprecated: 1.18: Use #ClutterGridLayout instead */ void clutter_table_layout_pack (ClutterTableLayout *layout, @@ -1916,6 +1938,8 @@ clutter_table_layout_pack (ClutterTableLayout *layout, * inside @layout * * Since: 1.4 + * + * Deprecated: 1.18: Use #ClutterGridLayout instead */ void 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() * * Since: 1.4 + * + * Deprecated: 1.18: Use #ClutterGridLayout instead */ void clutter_table_layout_get_span (ClutterTableLayout *layout, @@ -2551,6 +2577,8 @@ clutter_table_layout_get_easing_duration (ClutterTableLayout *layout) * Returns: the number of rows * * Since: 1.4 + * + * Deprecated: 1.18: Use #ClutterGridLayout instead */ gint 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 * * Since: 1.4 + * + * Deprecated: 1.18: Use #ClutterGridLayout instead */ gint clutter_table_layout_get_column_count (ClutterTableLayout *layout) diff --git a/clutter/clutter-table-layout.h b/clutter/deprecated/clutter-table-layout.h similarity index 92% rename from clutter/clutter-table-layout.h rename to clutter/deprecated/clutter-table-layout.h index 06d6e5105..dffbfb777 100644 --- a/clutter/clutter-table-layout.h +++ b/clutter/deprecated/clutter-table-layout.h @@ -54,6 +54,8 @@ typedef struct _ClutterTableLayoutClass ClutterTableLayoutClass; * and should be accessed using the provided API * * Since: 1.4 + * + * Deprecated: 1.18: Use #ClutterGridLayout instead */ struct _ClutterTableLayout { @@ -70,6 +72,8 @@ struct _ClutterTableLayout * data and should be accessed using the provided API * * Since: 1.4 + * + * Deprecated: 1.18: Use #ClutterGridLayout instead */ struct _ClutterTableLayoutClass { @@ -77,26 +81,35 @@ struct _ClutterTableLayoutClass ClutterLayoutManagerClass parent_class; }; +CLUTTER_DEPRECATED_IN_1_18_FOR (clutter_grid_layout_get_type) 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); +CLUTTER_DEPRECATED_IN_1_18_FOR (clutter_grid_layout_attach) void clutter_table_layout_pack (ClutterTableLayout *layout, ClutterActor *actor, gint column, gint row); +CLUTTER_DEPRECATED_IN_1_18_FOR (clutter_grid_layout_set_column_spacing) void clutter_table_layout_set_column_spacing (ClutterTableLayout *layout, guint spacing); +CLUTTER_DEPRECATED_IN_1_18_FOR (clutter_grid_layout_set_row_spacing) void clutter_table_layout_set_row_spacing (ClutterTableLayout *layout, guint spacing); +CLUTTER_DEPRECATED_IN_1_18_FOR (clutter_grid_layout_get_column_spacing) 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); +CLUTTER_DEPRECATED_IN_1_18 void clutter_table_layout_set_span (ClutterTableLayout *layout, ClutterActor *actor, gint column_span, gint row_span); +CLUTTER_DEPRECATED_IN_1_18 void clutter_table_layout_get_span (ClutterTableLayout *layout, ClutterActor *actor, gint *column_span, @@ -133,7 +146,9 @@ void clutter_table_layout_get_expand (ClutterTableLayo gboolean *x_expand, gboolean *y_expand); +CLUTTER_DEPRECATED_IN_1_18 gint clutter_table_layout_get_row_count (ClutterTableLayout *layout); +CLUTTER_DEPRECATED_IN_1_18 gint clutter_table_layout_get_column_count (ClutterTableLayout *layout); CLUTTER_DEPRECATED_IN_1_12 diff --git a/doc/reference/clutter/clutter-docs.xml.in b/doc/reference/clutter/clutter-docs.xml.in index ed2000d0f..c5717270d 100644 --- a/doc/reference/clutter/clutter-docs.xml.in +++ b/doc/reference/clutter/clutter-docs.xml.in @@ -72,7 +72,6 @@ Base actors - @@ -85,7 +84,6 @@ - @@ -263,6 +261,8 @@ + +