[gtk+/gtk-3-22] testframe: Don’t unnecessarily query the padding



commit 5f24d87a5ba97c76c7f421cb34a77ffa584eb2df
Author: Daniel Boles <dboles src gnome org>
Date:   Tue Mar 7 01:32:24 2017 +0000

    testframe: Don’t unnecessarily query the padding
    
    The [hv]padding variables control and hence track this.
    Also, simplify the CSS using shorthand 2-value notation (again).

 tests/testframe.c |   20 ++++----------------
 1 files changed, 4 insertions(+), 16 deletions(-)
---
diff --git a/tests/testframe.c b/tests/testframe.c
index b0343b3..8da56c9 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);


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