[gtk+/gtk-style-context: 80/206] Add region details in gtk_widget_get_path().



commit 29c6065876005ccdd8f415c754067f250e992af7
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Apr 23 02:36:47 2010 +0200

    Add region details in gtk_widget_get_path().

 gtk/gtkwidget.c |   30 ++++++++++++++++++++++++++++--
 1 files changed, 28 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index e53b151..efec461 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -11572,17 +11572,43 @@ gtk_widget_send_focus_change (GtkWidget *widget,
 GtkWidgetPath *
 gtk_widget_get_path (GtkWidget *widget)
 {
+  GtkStyleContext *context;
   GtkWidgetPath *path;
+  GtkWidget *parent;
+  GList *regions, *reg;
 
   g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
   g_return_val_if_fail (GTK_WIDGET_REALIZED (widget), NULL);
 
+  parent = widget->parent;
   path = gtk_widget_path_new ();
+  gtk_widget_path_prepend_type (path, G_OBJECT_TYPE (widget));
+  regions = reg = NULL;
 
-  while (widget)
+  context = g_object_get_qdata (G_OBJECT (widget),
+                                quark_style_context);
+
+  if (context)
+    regions = reg = gtk_style_context_list_child_classes (context);
+
+  while (reg)
+    {
+      GtkChildClassFlags flags;
+      const gchar *region_name;
+
+      region_name = reg->data;
+      reg = reg->next;
+
+      gtk_style_context_has_child_class (context, region_name, &flags);
+      gtk_widget_path_iter_add_region (path, 0, region_name, flags);
+    }
+
+  g_list_free (regions);
+
+  while (parent)
     {
       gtk_widget_path_prepend_type (path, G_OBJECT_TYPE (widget));
-      widget = widget->parent;
+      parent = parent->parent;
     }
 
   return path;



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