GtkWidgetPath: Show states in the path string

This shows clearly that some widgets don't set the state on their
path currently.
This commit is contained in:
Matthias Clasen
2014-07-21 19:49:11 -04:00
parent 452f92c644
commit 2df06d3490

View File

@ -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]",