From 5f24d87a5ba97c76c7f421cb34a77ffa584eb2df Mon Sep 17 00:00:00 2001 From: Daniel Boles Date: Tue, 7 Mar 2017 01:32:24 +0000 Subject: [PATCH] =?UTF-8?q?testframe:=20Don=E2=80=99t=20unnecessarily=20qu?= =?UTF-8?q?ery=20the=20padding?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The [hv]padding variables control and hence track this. Also, simplify the CSS using shorthand 2-value notation (again). --- tests/testframe.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/tests/testframe.c b/tests/testframe.c index b0343b3aca..8da56c9855 100644 --- a/tests/testframe.c +++ b/tests/testframe.c @@ -27,7 +27,6 @@ spin_hpadding_cb (GtkSpinButton *spin, gpointer user_data) GtkCssProvider *provider; GtkStyleContext *context; gchar *data; - GtkBorder pad; context = gtk_widget_get_style_context (frame); provider = g_object_get_data (G_OBJECT (frame), "provider"); @@ -40,14 +39,9 @@ spin_hpadding_cb (GtkSpinButton *spin, gpointer user_data) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); } - gtk_style_context_save (context); - gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL); - gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &pad); - gtk_style_context_restore (context); - hpadding = (gint)gtk_spin_button_get_value (spin); - data = g_strdup_printf ("frame > border { padding: %dpx %dpx %dpx %dpx }", - vpadding, hpadding, vpadding, hpadding); + data = g_strdup_printf ("frame > border { padding: %dpx %dpx }", + vpadding, hpadding); gtk_css_provider_load_from_data (provider, data, -1, NULL); g_free (data); @@ -62,7 +56,6 @@ spin_vpadding_cb (GtkSpinButton *spin, gpointer user_data) GtkCssProvider *provider; GtkStyleContext *context; gchar *data; - GtkBorder pad; context = gtk_widget_get_style_context (frame); provider = g_object_get_data (G_OBJECT (frame), "provider"); @@ -75,14 +68,9 @@ spin_vpadding_cb (GtkSpinButton *spin, gpointer user_data) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); } - gtk_style_context_save (context); - gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL); - gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &pad); - gtk_style_context_restore (context); - vpadding = (gint)gtk_spin_button_get_value (spin); - data = g_strdup_printf ("frame > border { padding: %dpx %dpx %dpx %dpx }", - vpadding, hpadding, vpadding, hpadding); + data = g_strdup_printf ("frame > border { padding: %dpx %dpx }", + vpadding, hpadding); gtk_css_provider_load_from_data (provider, data, -1, NULL); g_free (data);