mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-29 06:51:10 +00:00
Drop gtk_widget_get_toplevel
Not used anymore.
This commit is contained in:
parent
7447abb52b
commit
693b2aa4d1
@ -4443,7 +4443,6 @@ gtk_widget_set_name
|
||||
gtk_widget_get_name
|
||||
gtk_widget_set_sensitive
|
||||
gtk_widget_set_parent
|
||||
gtk_widget_get_toplevel
|
||||
gtk_widget_get_root
|
||||
gtk_widget_get_native
|
||||
gtk_widget_get_ancestor
|
||||
|
@ -1419,7 +1419,7 @@ gtk_im_context_xim_get_ic (GtkIMContextXIM *context_xim)
|
||||
* The toplevel is computed by walking up the GdkSurface
|
||||
* hierarchy from context->client_surface until we find a
|
||||
* window that is owned by some widget, and then calling
|
||||
* gtk_widget_get_toplevel() on that widget. This should
|
||||
* gtk_widget_get_root() on that widget. This should
|
||||
* handle both cases where we might have GdkSurfaces without widgets,
|
||||
* and cases where GtkWidgets have strange window hierarchies
|
||||
* (like a torn off GtkHandleBox.)
|
||||
|
@ -7498,59 +7498,6 @@ gtk_widget_has_size_request (GtkWidget *widget)
|
||||
return !(priv->width_request == -1 && priv->height_request == -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_widget_get_toplevel:
|
||||
* @widget: a #GtkWidget
|
||||
*
|
||||
* This function returns the topmost widget in the container hierarchy
|
||||
* @widget is a part of. If @widget has no parent widgets, it will be
|
||||
* returned as the topmost widget. No reference will be added to the
|
||||
* returned widget; it should not be unreferenced.
|
||||
*
|
||||
* Note the difference in behavior vs. gtk_widget_get_ancestor();
|
||||
* `gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW)`
|
||||
* would return
|
||||
* %NULL if @widget wasn’t inside a toplevel window, and if the
|
||||
* window was inside a #GtkWindow-derived widget which was in turn
|
||||
* inside the toplevel #GtkWindow.
|
||||
*
|
||||
* To reliably find the toplevel #GtkWindow, use
|
||||
* gtk_widget_get_toplevel() and call GTK_IS_WINDOW()
|
||||
* on the result. For instance, to get the title of a widget's toplevel
|
||||
* window, one might use:
|
||||
* |[<!-- language="C" -->
|
||||
* static const char *
|
||||
* get_widget_toplevel_title (GtkWidget *widget)
|
||||
* {
|
||||
* GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
|
||||
* if (GTK_IS_WINDOW (toplevel))
|
||||
* {
|
||||
* return gtk_window_get_title (GTK_WINDOW (toplevel));
|
||||
* }
|
||||
*
|
||||
* return NULL;
|
||||
* }
|
||||
* ]|
|
||||
*
|
||||
* Returns: (transfer none): the topmost ancestor of @widget, or @widget itself
|
||||
* if there’s no ancestor.
|
||||
**/
|
||||
GtkWidget *
|
||||
gtk_widget_get_toplevel (GtkWidget *widget)
|
||||
{
|
||||
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
|
||||
|
||||
while (priv->parent)
|
||||
{
|
||||
widget = priv->parent;
|
||||
priv = gtk_widget_get_instance_private (widget);
|
||||
}
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_widget_get_ancestor:
|
||||
* @widget: a #GtkWidget
|
||||
@ -7559,9 +7506,7 @@ gtk_widget_get_toplevel (GtkWidget *widget)
|
||||
* 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. See note
|
||||
* about checking for a toplevel #GtkWindow in the docs for
|
||||
* gtk_widget_get_toplevel().
|
||||
* added to the returned widget; it should not be unreferenced.
|
||||
*
|
||||
* Note that unlike gtk_widget_is_ancestor(), gtk_widget_get_ancestor()
|
||||
* considers @widget to be an ancestor of itself.
|
||||
|
@ -607,9 +607,6 @@ void gtk_widget_set_overflow (GtkWidget *widget,
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkOverflow gtk_widget_get_overflow (GtkWidget *widget);
|
||||
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkWidget* gtk_widget_get_toplevel (GtkWidget *widget);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkWidget* gtk_widget_get_ancestor (GtkWidget *widget,
|
||||
GType widget_type);
|
||||
|
@ -423,15 +423,6 @@ _gtk_widget_get_direction (GtkWidget *widget)
|
||||
return widget->priv->direction;
|
||||
}
|
||||
|
||||
static inline GtkWidget *
|
||||
_gtk_widget_get_toplevel (GtkWidget *widget)
|
||||
{
|
||||
while (widget->priv->parent)
|
||||
widget = widget->priv->parent;
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
static inline GtkRoot *
|
||||
_gtk_widget_get_root (GtkWidget *widget)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user