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 Box that’s an ancestor of this. No reference will be added to the returned widget; it should not be unreferenced. See note about checking for a toplevel Window in the docs for get_toplevel.

Note that unlike is_ancestor, get_ancestor considers this to be an ancestor of itself.

Parameters:

this

a Widget

widget_type

ancestor type

Returns:

the ancestor widget, or null if not found