[gtk+] Always pass the right state in style context getters



commit 2d054fa6aed349c15eb98e94e80120c2cf1d46ae
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Nov 14 19:03:57 2015 -0500

    Always pass the right state in style context getters
    
    Otherwise, we are causing warnings that break make check.

 testsuite/gtk/firefox-stylecontext.c |    4 ++--
 testsuite/gtk/stylecontext.c         |   24 ++++++++++++------------
 2 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/testsuite/gtk/firefox-stylecontext.c b/testsuite/gtk/firefox-stylecontext.c
index 0e5ce78..3f0bd69 100644
--- a/testsuite/gtk/firefox-stylecontext.c
+++ b/testsuite/gtk/firefox-stylecontext.c
@@ -26,7 +26,7 @@ test_init_of_theme (void)
 
   /* Get the color. This should be initialized by the theme and not be
    * the default. */
-  gtk_style_context_get_color (context, 0, &before);
+  gtk_style_context_get_color (context, gtk_style_context_get_state (context), &before);
 
   /* Add a style that sets a different color for this widget.
    * This style has a higher priority than fallback, but a lower 
@@ -41,7 +41,7 @@ test_init_of_theme (void)
   g_object_unref (provider);
 
   /* Get the color again. */
-  gtk_style_context_get_color (context, 0, &after);
+  gtk_style_context_get_color (context, gtk_style_context_get_state (context), &after);
 
   /* Because the style we added does not influence the color,
    * the before and after colors should be identical. */
diff --git a/testsuite/gtk/stylecontext.c b/testsuite/gtk/stylecontext.c
index f0381bb..25c3881 100644
--- a/testsuite/gtk/stylecontext.c
+++ b/testsuite/gtk/stylecontext.c
@@ -173,14 +173,14 @@ test_match (void)
   data = "* { color: #fff }";
   gtk_css_provider_load_from_data (provider, data, -1, &error);
   g_assert_no_error (error);
-  gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
+  gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
   g_assert (gdk_rgba_equal (&color, &expected));
 
   data = "* { color: #f00 }\n"
          "GtkButton { color: #fff }";
   gtk_css_provider_load_from_data (provider, data, -1, &error);
   g_assert_no_error (error);
-  gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
+  gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
   g_assert (gdk_rgba_equal (&color, &expected));
 
   data = "* { color: #f00 }\n"
@@ -188,14 +188,14 @@ test_match (void)
          "GtkWindow > GtkButton { color: #000 }";
   gtk_css_provider_load_from_data (provider, data, -1, &error);
   g_assert_no_error (error);
-  gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
+  gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
   g_assert (gdk_rgba_equal (&color, &expected));
 
   data = "* { color: #f00 }\n"
          ".button { color: #fff }";
   gtk_css_provider_load_from_data (provider, data, -1, &error);
   g_assert_no_error (error);
-  gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
+  gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
   g_assert (gdk_rgba_equal (&color, &expected));
 
   data = "* { color: #f00 }\n"
@@ -203,7 +203,7 @@ test_match (void)
          ".button { color: #fff }";
   gtk_css_provider_load_from_data (provider, data, -1, &error);
   g_assert_no_error (error);
-  gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
+  gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
   g_assert (gdk_rgba_equal (&color, &expected));
 
   data = "* { color: #f00 }\n"
@@ -211,7 +211,7 @@ test_match (void)
          "GtkWindow GtkButton { color: #fff }";
   gtk_css_provider_load_from_data (provider, data, -1, &error);
   g_assert_no_error (error);
-  gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
+  gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
   g_assert (gdk_rgba_equal (&color, &expected));
 
   data = "* { color: #f00 }\n"
@@ -219,7 +219,7 @@ test_match (void)
          "GtkWindow .button { color: #fff }";
   gtk_css_provider_load_from_data (provider, data, -1, &error);
   g_assert_no_error (error);
-  gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
+  gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
   g_assert (gdk_rgba_equal (&color, &expected));
 
   data = "* { color: #f00 }\n"
@@ -227,7 +227,7 @@ test_match (void)
          "#mywindow .button { color: #fff }";
   gtk_css_provider_load_from_data (provider, data, -1, &error);
   g_assert_no_error (error);
-  gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
+  gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
   g_assert (gdk_rgba_equal (&color, &expected));
 
   data = "* { color: #f00 }\n"
@@ -235,7 +235,7 @@ test_match (void)
          "GtkWindow#mywindow .button { color: #fff }";
   gtk_css_provider_load_from_data (provider, data, -1, &error);
   g_assert_no_error (error);
-  gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
+  gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
   g_assert (gdk_rgba_equal (&color, &expected));
 
   data = "* { color: #f00 }\n"
@@ -243,7 +243,7 @@ test_match (void)
          "GObject .button { color: #fff }";
   gtk_css_provider_load_from_data (provider, data, -1, &error);
   g_assert_no_error (error);
-  gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
+  gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
   g_assert (gdk_rgba_equal (&color, &expected));
 
   data = "* { color: #f00 }\n"
@@ -252,7 +252,7 @@ test_match (void)
          "GtkWindow:active .button { color: #fff }";
   gtk_css_provider_load_from_data (provider, data, -1, &error);
   g_assert_no_error (error);
-  gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
+  gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
   g_assert (gdk_rgba_equal (&color, &expected));
 
   g_object_unref (provider);
@@ -273,7 +273,7 @@ test_basic_properties (void)
   gtk_style_context_set_path (context, path);
   gtk_widget_path_free (path);
 
-  gtk_style_context_get (context, 0,
+  gtk_style_context_get (context, gtk_style_context_get_state (context),
                          "color", &color,
                          "background-color", &bg_color,
                          "font", &font,


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