diff --git a/docs/reference/gtk/gtk-sections.txt b/docs/reference/gtk/gtk-sections.txt index 879cfd0200..a8d2a7ae50 100644 --- a/docs/reference/gtk/gtk-sections.txt +++ b/docs/reference/gtk/gtk-sections.txt @@ -3729,6 +3729,7 @@ gtk_table_get_homogeneous gtk_table_get_row_spacing gtk_table_get_col_spacing gtk_table_get_default_col_spacing +gtk_table_get_size GTK_TABLE GTK_IS_TABLE diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols index c38272b507..bd4f3aff5e 100644 --- a/gtk/gtk.symbols +++ b/gtk/gtk.symbols @@ -3915,6 +3915,7 @@ gtk_table_get_default_col_spacing gtk_table_get_default_row_spacing gtk_table_get_homogeneous gtk_table_get_row_spacing +gtk_table_get_size gtk_table_get_type G_GNUC_CONST gtk_table_new gtk_table_resize diff --git a/gtk/gtktable.c b/gtk/gtktable.c index dd14bedecc..79efc26dee 100644 --- a/gtk/gtktable.c +++ b/gtk/gtktable.c @@ -796,6 +796,32 @@ gtk_table_get_homogeneous (GtkTable *table) return table->homogeneous; } +/** + * gtk_table_get_size: + * @table: a #GtkTable + * @rows: (allow-none): (out): return location for the number of + * rows, or %NULL + * @columns: (allow-none): (out): return location for the number + * of columns, or %NULL + * + * Returns the number of rows and columns in the table. + * + * Since: 2.22 + **/ +void +gtk_table_get_size (GtkTable *table, + guint *rows, + guint *columns) +{ + g_return_if_fail (GTK_IS_TABLE (table)); + + if (rows) + *rows = table->nrows; + + if (columns) + *columns = table->ncols; +} + static void gtk_table_finalize (GObject *object) { diff --git a/gtk/gtktable.h b/gtk/gtktable.h index 9b3ebf9dd3..d73828637a 100644 --- a/gtk/gtktable.h +++ b/gtk/gtktable.h @@ -141,6 +141,9 @@ guint gtk_table_get_default_col_spacing (GtkTable *table); void gtk_table_set_homogeneous (GtkTable *table, gboolean homogeneous); gboolean gtk_table_get_homogeneous (GtkTable *table); +void gtk_table_get_size (GtkTable *table, + guint *rows, + guint *columns); G_END_DECLS