[gtk+/gtk-style-context: 410/490] GtkContainer: Also copy permanent container's classes on get_path_for_child()



commit e30e6a6de72a63dce6dd82de3d1dd1229c7a64eb
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Nov 19 19:02:27 2010 +0100

    GtkContainer: Also copy permanent container's classes on get_path_for_child()
    
    This makes inheritance work for the simplest cases when style is defined
    for classes.

 gtk/gtkcontainer.c |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 1be4ab2..5433766 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -2215,7 +2215,28 @@ 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)));
+  GtkStyleContext *context;
+  GtkWidgetPath *path;
+  GList *classes;
+
+  context = gtk_widget_get_style_context (GTK_WIDGET (container));
+  path = gtk_widget_path_copy (gtk_widget_get_path (GTK_WIDGET (container)));
+
+  /* Copy any permanent classes to the path */
+  classes = gtk_style_context_list_classes (context);
+
+  while (classes)
+    {
+      GList *cur;
+
+      cur = classes;
+      classes = classes->next;
+
+      gtk_widget_path_iter_add_class (path, -1, cur->data);
+      g_list_free_1 (cur);
+    }
+
+  return path;
 }
 
 static gboolean



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]