GtkCssProvider: Allow to enable debug at runtime

Add a private function that lets us decide at runtime whether to
keep css section information around - this will be useful in the
GtkInspector.
This commit is contained in:
Matthias Clasen 2014-07-06 12:16:26 -04:00
parent b25b33f79f
commit 2952739593
2 changed files with 12 additions and 1 deletions

View File

@ -1244,13 +1244,22 @@ gtk_css_provider_parsing_error (GtkCssProvider *provider,
}
}
/* This is exported privately for use in GtkInspector.
* It is the callers responsibility to reparse the current theme.
*/
void
gtk_css_provider_set_keep_css_sections (void)
{
gtk_keep_css_sections = TRUE;
}
static void
gtk_css_provider_class_init (GtkCssProviderClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
if (g_getenv ("GTK_CSS_DEBUG"))
gtk_keep_css_sections = TRUE;
gtk_css_provider_set_keep_css_sections ();
/**
* GtkCssProvider::parsing-error:

View File

@ -28,6 +28,8 @@ void _gtk_css_provider_load_named (GtkCssProvider *provider,
const gchar *name,
const gchar *variant);
void gtk_css_provider_set_keep_css_sections (void);
G_END_DECLS
#endif /* __GTK_CSS_PROVIDER_PRIVATE_H__ */