Handle adding children to StTable from Javascript

Remove the StTable specific methods to add actors:

 st_table_add_actor()
 st_table_add_actor_with_properties()

Since they shadow the generic ClutterContainer add_actor() method,
and patch in our add() convenience function as we do for
StBoxLayout.

https://bugzilla.gnome.org/show_bug.cgi?id=596811
This commit is contained in:
Owen W. Taylor 2009-09-30 00:04:42 -04:00
parent 289b19aa31
commit af3ec56ca1
3 changed files with 1 additions and 104 deletions

View File

@ -26,6 +26,7 @@ function _patchContainerClass(containerClass) {
}
_patchContainerClass(St.BoxLayout);
_patchContainerClass(St.Table);
function init() {
Tweener.init();

View File

@ -1349,99 +1349,6 @@ st_table_get_col_spacing (StTable *table)
return priv->col_spacing;
}
/**
* st_table_add_actor:
* @table: a #StTable
* @actor: the child to insert
* @row: the row to place the child into
* @column: the column to place the child into
*
* Add an actor at the specified row and column
*
* Note, column and rows numbers start from zero
*/
void
st_table_add_actor (StTable *table,
ClutterActor *actor,
gint row,
gint column)
{
StTableChild *meta;
ClutterContainer *container;
g_return_if_fail (ST_IS_TABLE (table));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
g_return_if_fail (row >= -1);
g_return_if_fail (column >= -1);
if (row < 0)
row = table->priv->n_rows + 1;
if (column < 0)
column = table->priv->n_cols + 1;
container = CLUTTER_CONTAINER (table);
clutter_container_add_actor (container, actor);
meta = (StTableChild *) clutter_container_get_child_meta (container, actor);
meta->row = row;
meta->col = column;
_st_table_update_row_col (table, row, column);
clutter_actor_queue_relayout (CLUTTER_ACTOR (table));
}
/**
* st_table_add_actor_with_properties
* @table: a #StTable
* @actor: the child #ClutterActor
* @row: the row to place the child into
* @column: the column to place the child into
* @first_property_name: name of the first property to set
* @...: value for the first property, followed optionally by more name/value pairs terminated with NULL.
*
* Add an actor into at the specified row and column, with additional child
* properties to set.
*/
void
st_table_add_actor_with_properties (StTable *table,
ClutterActor *actor,
gint row,
gint column,
const gchar *first_property_name,
...)
{
va_list args;
StTableChild *meta;
ClutterContainer *container;
g_return_if_fail (ST_IS_TABLE (table));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
g_return_if_fail (row >= -1);
g_return_if_fail (column >= -1);
g_return_if_fail (first_property_name != NULL);
if (row < 0)
row = table->priv->n_rows + 1;
if (column < 0)
column = table->priv->n_cols + 1;
container = (ClutterContainer *) table;
clutter_container_add_actor (container, actor);
meta = (StTableChild *) clutter_container_get_child_meta (container, actor);
meta->row = row;
meta->col = column;
_st_table_update_row_col (table, row, column);
va_start (args, first_property_name);
g_object_set_valist ((GObject*) meta, first_property_name, args);
va_end (args);
clutter_actor_queue_relayout (CLUTTER_ACTOR (table));
}
/**
* st_table_get_row_count:
* @table: A #StTable

View File

@ -93,17 +93,6 @@ void st_table_set_row_spacing (StTable *table,
gint spacing);
gint st_table_get_col_spacing (StTable *table);
gint st_table_get_row_spacing (StTable *table);
void st_table_add_actor (StTable *table,
ClutterActor *actor,
gint row,
gint column);
void st_table_add_actor_with_properties (StTable *table,
ClutterActor *actor,
gint row,
gint column,
const gchar *first_property_name,
...);
gint st_table_get_row_count (StTable *table);
gint st_table_get_column_count (StTable *table);