static gint
calculate_num_cols (AppResizer * resizer, gint avail_width)
{
	if (resizer->table_elements_homogeneous)
	{
		gint num_cols;

		if (resizer->cached_element_width == -1)
		{
			GtkTable *table = GTK_TABLE (resizer->cached_tables_list->data);
			GList *children = gtk_container_get_children (GTK_CONTAINER (table));
			GtkWidget *table_element = GTK_WIDGET (children->data);
			GtkAllocation allocation;
			g_list_free (children);

			gtk_widget_get_allocation (table_element, &allocation);
			resizer->cached_element_width = allocation.width;
			resizer->cached_table_spacing = gtk_table_get_default_col_spacing (table);
		}

		num_cols =
			(avail_width +
			resizer->cached_table_spacing) / (resizer->cached_element_width +
			resizer->cached_table_spacing);
		return num_cols;
	}
	else
		g_assert_not_reached ();	/* Fixme - implement... */
}
Esempio n. 2
0
static VALUE
rg_default_column_spacing(VALUE self)
{
    return UINT2NUM(gtk_table_get_default_col_spacing(_SELF(self)));
}