[gtk+/wip/baedert/symbolic-icons: 1/5] cssstylechange: Add helper function to print change
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/symbolic-icons: 1/5] cssstylechange: Add helper function to print change
- Date: Sat, 6 Feb 2016 08:34:42 +0000 (UTC)
commit 6506136245bf5b3647b59043ad74bbdb0d41c5b6
Author: Timm Bäder <mail baedert org>
Date: Fri Feb 5 10:28:13 2016 +0100
cssstylechange: Add helper function to print change
So I don't have to print both styles to the console, paste them both
into a file and then run diff on the 2 files anymore.
gtk/gtkcssstylechange.c | 32 ++++++++++++++++++++++++++++++++
gtk/gtkcssstylechangeprivate.h | 1 +
2 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcssstylechange.c b/gtk/gtkcssstylechange.c
index 0ce6120..809eff2 100644
--- a/gtk/gtkcssstylechange.c
+++ b/gtk/gtkcssstylechange.c
@@ -110,3 +110,35 @@ gtk_css_style_change_changes_property (GtkCssStyleChange *change,
return _gtk_bitmask_get (change->changes, id);
}
+void
+gtk_css_style_change_print_change (GtkCssStyleChange *change)
+{
+ int i;
+ GtkCssStyle *old = gtk_css_style_change_get_old_style (change);
+ GtkCssStyle *new = gtk_css_style_change_get_new_style (change);
+ GString *string;
+
+ for (i = 0; i < GTK_CSS_PROPERTY_N_PROPERTIES; i ++)
+ {
+ if (gtk_css_style_change_changes_property (change, i))
+ {
+ GtkCssStyleProperty *prop;
+ GtkCssValue *value;
+ const char *name;
+
+ prop = _gtk_css_style_property_lookup_by_id (i);
+ name = _gtk_style_property_get_name (GTK_STYLE_PROPERTY (prop));
+
+ string = g_string_new ("");
+ printf ("%s Changed:\n", name);
+ value = gtk_css_style_get_value (old, i);
+ _gtk_css_value_print (value, string);
+ printf (" Old: %s\n", g_string_free (string, FALSE));
+
+ string = g_string_new ("");
+ value = gtk_css_style_get_value (new, i);
+ _gtk_css_value_print (value, string);
+ printf (" New: %s\n", g_string_free (string, FALSE));
+ }
+ }
+}
diff --git a/gtk/gtkcssstylechangeprivate.h b/gtk/gtkcssstylechangeprivate.h
index 078dee0..5a34b66 100644
--- a/gtk/gtkcssstylechangeprivate.h
+++ b/gtk/gtkcssstylechangeprivate.h
@@ -47,6 +47,7 @@ gboolean gtk_css_style_change_affects (GtkCssStyleChange
GtkCssAffects affects);
gboolean gtk_css_style_change_changes_property (GtkCssStyleChange *change,
guint id);
+void gtk_css_style_change_print_change (GtkCssStyleChange *change);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]