summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2016-01-24 10:58:32 -0500
committerMatthias Clasen <mclasen@redhat.com>2016-01-24 10:59:46 -0500
commit761120a5e2841475150fd1f6c2456e5f1928bf83 (patch)
treefc5d52f2adabc6cb77d0737702a4390bd776b8ce
parent33bb1af277c7311dcf89dc85d45f5319d0edd8f6 (diff)
downloadgtk+-761120a5e2841475150fd1f6c2456e5f1928bf83.tar.gz
inspector: Show CSS pseudoclass names for node state
This is a better fit for showing CSS node state, since one commonly looks at this information to devise CSS selectors, where the CSS names are needed.
-rw-r--r--gtk/inspector/css-node-tree.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/gtk/inspector/css-node-tree.c b/gtk/inspector/css-node-tree.c
index 88a6498e86..e0c6c008d3 100644
--- a/gtk/inspector/css-node-tree.c
+++ b/gtk/inspector/css-node-tree.c
@@ -36,6 +36,7 @@
#include "gtkcsssectionprivate.h"
#include "gtkcssstyleprivate.h"
#include "gtkcssvalueprivate.h"
+#include "gtkcssselectorprivate.h"
#include "gtkliststore.h"
#include "gtksettings.h"
#include "gtktreeview.h"
@@ -374,30 +375,28 @@ strv_sort (char **strv)
static gchar *
format_state_flags (GtkStateFlags state)
{
- GFlagsClass *fclass;
- GString *str;
- gint i;
-
- str = g_string_new ("");
-
if (state)
{
- fclass = g_type_class_ref (GTK_TYPE_STATE_FLAGS);
- for (i = 0; i < fclass->n_values; i++)
+ GString *str;
+ gint i;
+ gboolean first = TRUE;
+
+ str = g_string_new ("");
+
+ for (i = 0; i < 31; i++)
{
- if (state & fclass->values[i].value)
+ if (state & (1 << i))
{
- if (str->len)
+ if (!first)
g_string_append (str, " | ");
- g_string_append (str, fclass->values[i].value_nick);
+ first = FALSE;
+ g_string_append (str, gtk_css_pseudoclass_name (1 << i));
}
}
- g_type_class_unref (fclass);
+ return g_string_free (str, FALSE);
}
- else
- g_string_append (str, "normal");
- return g_string_free (str, FALSE);
+ return "";
}
static void