[gtk+] GtkWidgetPath: Show states in the path string



commit 2df06d3490c3e0b6acbce25d16ef61e693fc2d8c
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Jul 21 19:49:11 2014 -0400

    GtkWidgetPath: Show states in the path string
    
    This shows clearly that some widgets don't set the state on their
    path currently.

 gtk/gtkwidgetpath.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkwidgetpath.c b/gtk/gtkwidgetpath.c
index 40d2972..ba94a7f 100644
--- a/gtk/gtkwidgetpath.c
+++ b/gtk/gtkwidgetpath.c
@@ -22,6 +22,7 @@
 #include "gtkwidget.h"
 #include "gtkwidgetpath.h"
 #include "gtkstylecontextprivate.h"
+#include "gtktypebuiltins.h"
 
 /**
  * SECTION:gtkwidgetpath
@@ -327,6 +328,28 @@ gtk_widget_path_to_string (const GtkWidgetPath *path)
           g_string_append_c (string, ')');
         }
 
+      if (elem->state)
+        {
+          GFlagsClass *fclass;
+          gint i;
+          gboolean appended;
+
+          appended = FALSE;
+          fclass = g_type_class_ref (GTK_TYPE_STATE_FLAGS);
+          g_string_append_c (string, '[');
+          for (i = 0; i < fclass->n_values; i++)
+            {
+              if (elem->state & fclass->values[i].value)
+                {
+                  if (appended)
+                    g_string_append_c (string, '|');
+                  g_string_append (string, fclass->values[i].value_nick);
+                  appended = TRUE;
+                }
+            }
+          g_string_append_c (string, ']');
+          g_type_class_unref (fclass);
+        }
 
       if (elem->siblings)
         g_string_append_printf (string, "[%d/%d]",


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