Ejemplo n.º 1
0
void
gtk_css_node_print (GtkCssNode                *cssnode,
                    GtkStyleContextPrintFlags  flags,
                    GString                   *string,
                    guint                      indent)
{
  gboolean need_newline = FALSE;

  g_string_append_printf (string, "%*s", indent, "");

  if (!cssnode->visible)
    g_string_append_c (string, '[');

  gtk_css_node_declaration_print (cssnode->decl, string);

  if (!cssnode->visible)
    g_string_append_c (string, ']');

  g_string_append_c (string, '\n');

  if (flags & GTK_STYLE_CONTEXT_PRINT_SHOW_STYLE)
    need_newline = gtk_css_style_print (gtk_css_node_get_style (cssnode), string, indent + 2, TRUE);

  if (flags & GTK_STYLE_CONTEXT_PRINT_RECURSE)
    {
      GtkCssNode *node;

      if (need_newline && gtk_css_node_get_first_child (cssnode))
        g_string_append_c (string, '\n');

      for (node = gtk_css_node_get_first_child (cssnode); node; node = gtk_css_node_get_next_sibling (node))
        gtk_css_node_print (node, flags, string, indent + 2);
    }
}
Ejemplo n.º 2
0
char *
gtk_css_style_to_string (GtkCssStyle *style)
{
  GString *string;

  g_return_val_if_fail (GTK_IS_CSS_STYLE (style), NULL);

  string = g_string_new ("");

  gtk_css_style_print (style, string);

  return g_string_free (string, FALSE);
}