get_ancestor


Description:

public unowned Widget? get_ancestor (Type widget_type)

Gets the first ancestor of this with type widget_type.

For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)` gets the first `GtkBox` that’s an ancestor of this . 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 this to be an ancestor of itself.

Parameters:

this

a `GtkWidget`

widget_type

ancestor type

Returns:

the ancestor widget