Gets the first ancestor of widget with type widget_type. For example, gtk_widget_get_ancestor (widget, GTK_TYPE_BOX) gets the first gtk.Box that’s an ancestor of widget. No reference will be added to the returned widget; it should not be unreferenced. See note about checking for a toplevel gtk.Window in the docs for Widget.getToplevel.

Note that unlike Widget.isAncestor, Widget.getAncestor considers widget to be an ancestor of itself.

class Widget


widgetType GType

ancestor type

Return Value

Type: Widget

the ancestor widget, or NULL if not found