[gnome-shell] st-theme-node: Add a to_string function for debugging purposes



commit 53c609c27801e60673d322f3eba21f998a53d2ff
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Apr 4 21:43:42 2013 -0400

    st-theme-node: Add a to_string function for debugging purposes
    
    https://bugzilla.gnome.org/show_bug.cgi?id=697274

 src/st/st-theme-node.c |   27 +++++++++++++++++++++++++++
 src/st/st-theme-node.h |    2 ++
 2 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/src/st/st-theme-node.c b/src/st/st-theme-node.c
index a9a1fb5..51355a3 100644
--- a/src/st/st-theme-node.c
+++ b/src/st/st-theme-node.c
@@ -3894,3 +3894,30 @@ st_theme_node_paint_equal (StThemeNode *node,
 
   return TRUE;
 }
+
+gchar *
+st_theme_node_to_string (StThemeNode *node)
+{
+  GString *desc;
+  gchar **it;
+
+  if (!node)
+    return g_strdup ("[null]");
+
+  desc = g_string_new (NULL);
+  g_string_append_printf (desc,
+                          "[%p %s#%s",
+                          node,
+                          g_type_name (node->element_type),
+                          node->element_id);
+
+  for (it = node->element_classes; it && *it; it++)
+    g_string_append_printf (desc, ".%s", *it);
+
+  for (it = node->pseudo_classes; it && *it; it++)
+    g_string_append_printf (desc, ":%s", *it);
+
+  g_string_append_c (desc, ']');
+
+  return g_string_free (desc, FALSE);
+}
diff --git a/src/st/st-theme-node.h b/src/st/st-theme-node.h
index fc6caa1..dabd5f5 100644
--- a/src/st/st-theme-node.h
+++ b/src/st/st-theme-node.h
@@ -271,6 +271,8 @@ void st_theme_node_paint (StThemeNode            *node,
 void st_theme_node_invalidate_background_image (StThemeNode *node);
 void st_theme_node_invalidate_border_image (StThemeNode *node);
 
+gchar * st_theme_node_to_string (StThemeNode *node);
+
 void st_theme_node_paint_state_init (StThemeNodePaintState *state);
 void st_theme_node_paint_state_free (StThemeNodePaintState *state);
 void st_theme_node_paint_state_copy (StThemeNodePaintState *state,


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