Widget.getAncestor

Gets the first ancestor of @widget with type @widget_type.

For example, gtk_widget_get_ancestor (widget, GTK_TYPE_BOX) gets the first GtkBox that’s an ancestor of @widget. No reference will be added to the returned widget; it should not be unreferenced.

Note that unlike [method@Gtk.Widget.is_ancestor], this function considers @widget to be an ancestor of itself.

class Widget
getAncestor

Parameters

widgetType GType

ancestor type

Return Value

Type: Widget

the ancestor widget, or %NULL if not found

Meta