diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2010-10-11 00:23:40 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2010-12-04 15:38:19 +0100 |
commit | 88b78953b68b01d9ac2f46b088322e4188fb9f38 (patch) | |
tree | 11e147b8e6d3ed606e822ad4cce0640ffe6c2b93 /gtk/gtkcontainer.c | |
parent | c575733edab533c7e36062e06a4a8a9e2382685b (diff) | |
download | gtk+-88b78953b68b01d9ac2f46b088322e4188fb9f38.tar.gz |
GtkContainer: Add method to get the GtkWidgetPath for a child.
This is now used throughout in order to have the full path for a given widget,
including intermediate named regions, the default implementation just returns
the GtkContainer's path copy, no intermediate regions between.
Diffstat (limited to 'gtk/gtkcontainer.c')
-rw-r--r-- | gtk/gtkcontainer.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c index a37e361d65..8c09ba2514 100644 --- a/gtk/gtkcontainer.c +++ b/gtk/gtkcontainer.c @@ -334,6 +334,9 @@ static void gtk_container_adjust_size_allocation (GtkWidget *widget, static gchar* gtk_container_child_default_composite_name (GtkContainer *container, GtkWidget *child); +static GtkWidgetPath * gtk_container_real_get_path_for_child (GtkContainer *container, + GtkWidget *child); + /* GtkBuildable */ static void gtk_container_buildable_init (GtkBuildableIface *iface); static void gtk_container_buildable_add_child (GtkBuildable *buildable, @@ -465,6 +468,7 @@ gtk_container_class_init (GtkContainerClass *class) class->set_focus_child = gtk_container_real_set_focus_child; class->child_type = NULL; class->composite_name = gtk_container_child_default_composite_name; + class->get_path_for_child = gtk_container_real_get_path_for_child; g_object_class_install_property (gobject_class, PROP_RESIZE_MODE, @@ -2207,6 +2211,13 @@ gtk_container_get_all_children (GtkContainer *container) return children; } +static GtkWidgetPath * +gtk_container_real_get_path_for_child (GtkContainer *container, + GtkWidget *child) +{ + return gtk_widget_path_copy (gtk_widget_get_path (GTK_WIDGET (container))); +} + static gboolean gtk_container_focus (GtkWidget *widget, GtkDirectionType direction) @@ -3220,3 +3231,14 @@ _gtk_container_get_reallocate_redraws (GtkContainer *container) { return container->priv->reallocate_redraws; } + +GtkWidgetPath * +gtk_container_get_path_for_child (GtkContainer *container, + GtkWidget *child) +{ + g_return_val_if_fail (GTK_IS_CONTAINER (container), NULL); + g_return_val_if_fail (GTK_IS_WIDGET (child), NULL); + g_return_val_if_fail (container == (GtkContainer *) gtk_widget_get_parent (child), NULL); + + return GTK_CONTAINER_GET_CLASS (container)->get_path_for_child (container, child); +} |