Commit dbeeaf7d authored by Benjamin Otte's avatar Benjamin Otte

cssprovider: Remove GError out argument from load functions

People should use the GtkCssProvider::parsing-error signal instead.
parent 55e599c5
......@@ -45,7 +45,7 @@ css_text_changed (GtkTextBuffer *buffer,
gtk_text_buffer_remove_all_tags (buffer, &start, &end);
text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
gtk_css_provider_load_from_data (provider, text, -1, NULL);
gtk_css_provider_load_from_data (provider, text, -1);
g_free (text);
gtk_style_context_reset_widgets (gdk_screen_get_default ());
......
......@@ -50,7 +50,7 @@ update_css_for_blend_mode (GtkCssProvider *provider,
blend_mode,
blend_mode);
gtk_css_provider_load_from_data (provider, css, -1, NULL);
gtk_css_provider_load_from_data (provider, css, -1);
g_bytes_unref (bytes);
g_free (css);
......
......@@ -45,7 +45,7 @@ css_text_changed (GtkTextBuffer *buffer,
gtk_text_buffer_remove_all_tags (buffer, &start, &end);
text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
gtk_css_provider_load_from_data (provider, text, -1, NULL);
gtk_css_provider_load_from_data (provider, text, -1);
g_free (text);
gtk_style_context_reset_widgets (gdk_screen_get_default ());
......
......@@ -44,7 +44,7 @@ css_text_changed (GtkTextBuffer *buffer,
gtk_text_buffer_remove_all_tags (buffer, &start, &end);
text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
gtk_css_provider_load_from_data (provider, text, -1, NULL);
gtk_css_provider_load_from_data (provider, text, -1);
g_free (text);
gtk_style_context_reset_widgets (gdk_screen_get_default ());
......
......@@ -43,7 +43,7 @@ css_text_changed (GtkTextBuffer *buffer,
gtk_text_buffer_remove_all_tags (buffer, &start, &end);
text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
gtk_css_provider_load_from_data (provider, text, -1, NULL);
gtk_css_provider_load_from_data (provider, text, -1);
g_free (text);
gtk_style_context_reset_widgets (gdk_screen_get_default ());
......
......@@ -219,7 +219,7 @@ do_transparent (GtkWidget *do_widget)
provider = gtk_css_provider_new ();
css = g_strdup_printf ("* { border-width: 0px %dpx %dpx 0px; }",
SHADOW_OFFSET_X, SHADOW_OFFSET_Y);
gtk_css_provider_load_from_data (provider, css, -1, NULL);
gtk_css_provider_load_from_data (provider, css, -1);
g_free (css);
gtk_style_context_add_provider (gtk_widget_get_style_context (entry),
GTK_STYLE_PROVIDER (provider),
......
......@@ -225,7 +225,7 @@ plugin_action (GAction *action,
g_message ("Color: %s", g_action_get_name (action));
css_provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (css_provider, css_to_load, -1, NULL);
gtk_css_provider_load_from_data (css_provider, css_to_load, -1);
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
GTK_STYLE_PROVIDER (css_provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
......
......@@ -837,11 +837,7 @@ preview_file (const char *filename,
GtkCssProvider *provider;
provider = gtk_css_provider_new ();
if (!gtk_css_provider_load_from_path (provider, cssfile, &error))
{
g_printerr ("%s\n", error->message);
exit (1);
}
gtk_css_provider_load_from_path (provider, cssfile);
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
GTK_STYLE_PROVIDER (provider),
......
......@@ -154,8 +154,7 @@ static gboolean
gtk_css_provider_load_internal (GtkCssProvider *css_provider,
GtkCssScanner *scanner,
GFile *file,
const char *data,
GError **error);
const char *data);
GQuark
gtk_css_provider_error_quark (void)
......@@ -1052,7 +1051,6 @@ parse_import (GtkCssScanner *scanner)
gtk_css_provider_load_internal (scanner->provider,
scanner,
file,
NULL,
NULL);
}
......@@ -1719,21 +1717,11 @@ static gboolean
gtk_css_provider_load_internal (GtkCssProvider *css_provider,
GtkCssScanner *parent,
GFile *file,
const char *text,
GError **error)
const char *text)
{
GtkCssScanner *scanner;
gulong error_handler;
char *free_data = NULL;
if (error)
error_handler = g_signal_connect (css_provider,
"parsing-error",
G_CALLBACK (gtk_css_provider_propagate_error),
error);
else
error_handler = 0; /* silence gcc */
if (text == NULL)
{
GError *load_error = NULL;
......@@ -1793,18 +1781,6 @@ gtk_css_provider_load_internal (GtkCssProvider *css_provider,
g_free (free_data);
if (error)
{
g_signal_handler_disconnect (css_provider, error_handler);
if (*error)
{
/* We clear all contents from the provider for backwards compat reasons */
gtk_css_provider_reset (css_provider);
return FALSE;
}
}
return TRUE;
}
......@@ -1815,7 +1791,6 @@ gtk_css_provider_load_internal (GtkCssProvider *css_provider,
* @length: the length of @data in bytes, or -1 for NUL terminated strings. If
* @length is not -1, the code will assume it is not NUL terminated and will
* potentially do a copy.
* @error: (out) (allow-none): return location for a #GError, or %NULL
*
* Loads @data into @css_provider, and by doing so clears any previously loaded
* information.
......@@ -1828,8 +1803,7 @@ gtk_css_provider_load_internal (GtkCssProvider *css_provider,
gboolean
gtk_css_provider_load_from_data (GtkCssProvider *css_provider,
const gchar *data,
gssize length,
GError **error)
gssize length)
{
char *free_data;
gboolean ret;
......@@ -1850,7 +1824,7 @@ gtk_css_provider_load_from_data (GtkCssProvider *css_provider,
gtk_css_provider_reset (css_provider);
ret = gtk_css_provider_load_internal (css_provider, NULL, NULL, data, error);
ret = gtk_css_provider_load_internal (css_provider, NULL, NULL, data);
g_free (free_data);
......@@ -1863,7 +1837,6 @@ gtk_css_provider_load_from_data (GtkCssProvider *css_provider,
* gtk_css_provider_load_from_file:
* @css_provider: a #GtkCssProvider
* @file: #GFile pointing to a file to load
* @error: (out) (allow-none): return location for a #GError, or %NULL
*
* Loads the data contained in @file into @css_provider, making it
* clear any previously loaded information.
......@@ -1875,8 +1848,7 @@ gtk_css_provider_load_from_data (GtkCssProvider *css_provider,
**/
gboolean
gtk_css_provider_load_from_file (GtkCssProvider *css_provider,
GFile *file,
GError **error)
GFile *file)
{
gboolean success;
......@@ -1885,7 +1857,7 @@ gtk_css_provider_load_from_file (GtkCssProvider *css_provider,
gtk_css_provider_reset (css_provider);
success = gtk_css_provider_load_internal (css_provider, NULL, file, NULL, error);
success = gtk_css_provider_load_internal (css_provider, NULL, file, NULL);
_gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (css_provider));
......@@ -1908,8 +1880,7 @@ gtk_css_provider_load_from_file (GtkCssProvider *css_provider,
**/
gboolean
gtk_css_provider_load_from_path (GtkCssProvider *css_provider,
const gchar *path,
GError **error)
const gchar *path)
{
GFile *file;
gboolean result;
......@@ -1919,7 +1890,7 @@ gtk_css_provider_load_from_path (GtkCssProvider *css_provider,
file = g_file_new_for_path (path);
result = gtk_css_provider_load_from_file (css_provider, file, error);
result = gtk_css_provider_load_from_file (css_provider, file);
g_object_unref (file);
......@@ -1957,7 +1928,7 @@ gtk_css_provider_load_from_resource (GtkCssProvider *css_provider,
file = g_file_new_for_uri (uri);
g_free (uri);
gtk_css_provider_load_from_file (css_provider, file, NULL);
gtk_css_provider_load_from_file (css_provider, file);
g_object_unref (file);
}
......@@ -2159,7 +2130,7 @@ _gtk_css_provider_load_named (GtkCssProvider *provider,
if (resource != NULL)
g_resources_register (resource);
gtk_css_provider_load_from_path (provider, path, NULL);
gtk_css_provider_load_from_path (provider, path);
/* Only set this after load, as load_from_path will clear it */
provider->priv->resource = resource;
......
......@@ -97,16 +97,13 @@ char * gtk_css_provider_to_string (GtkCssProvider *provider);
GDK_AVAILABLE_IN_ALL
gboolean gtk_css_provider_load_from_data (GtkCssProvider *css_provider,
const gchar *data,
gssize length,
GError **error);
gssize length);
GDK_AVAILABLE_IN_ALL
gboolean gtk_css_provider_load_from_file (GtkCssProvider *css_provider,
GFile *file,
GError **error);
GFile *file);
GDK_AVAILABLE_IN_ALL
gboolean gtk_css_provider_load_from_path (GtkCssProvider *css_provider,
const gchar *path,
GError **error);
const gchar *path);
GDK_AVAILABLE_IN_3_16
void gtk_css_provider_load_from_resource (GtkCssProvider *css_provider,
......
......@@ -1320,7 +1320,7 @@ gtk_font_button_label_use_font (GtkFontButton *font_button)
pango_font_description_unset_fields (desc, PANGO_FONT_MASK_SIZE);
data = pango_font_description_to_css (desc);
gtk_css_provider_load_from_data (priv->provider, data, -1, NULL);
gtk_css_provider_load_from_data (priv->provider, data, -1);
g_free (data);
pango_font_description_free (desc);
......
......@@ -1856,7 +1856,7 @@ settings_init_style (GtkSettings *settings)
if (g_file_test (css_path,
G_FILE_TEST_IS_REGULAR))
gtk_css_provider_load_from_path (css_provider, css_path, NULL);
gtk_css_provider_load_from_path (css_provider, css_path);
g_free (css_path);
}
......
......@@ -225,7 +225,7 @@ update_style (GtkInspectorCssEditor *ce)
ce->priv->errors = NULL;
text = get_current_text (ce->priv->text);
gtk_css_provider_load_from_data (ce->priv->provider, text, -1, NULL);
gtk_css_provider_load_from_data (ce->priv->provider, text, -1);
g_free (text);
}
......
......@@ -54,7 +54,7 @@ main(int argc, char **argv)
gtk_container_add (GTK_CONTAINER (revealer), grid);
cssprovider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (cssprovider, "* { padding: 2px; text-shadow: 5px 5px 2px grey; }", -1, NULL);
gtk_css_provider_load_from_data (cssprovider, "* { padding: 2px; text-shadow: 5px 5px 2px grey; }", -1);
for (x = 0; x < 10; x++)
{
......
......@@ -353,7 +353,7 @@ int main (int argc, char *argv[])
" border-style: solid;\n"
" border-width: 1;\n"
" border-radius: 0;\n"
"}\n", -1, NULL);
"}\n", -1);
gtk_style_context_add_provider (context, provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_signal_connect_after (ebox, "draw", G_CALLBACK (draw_cb), NULL);
......
......@@ -403,7 +403,7 @@ main (int argc, char *argv[])
gtk_css_provider_load_from_data (provider,
".black-bg { background-color: black; }"
".red-bg { background-color: red; }"
".blue-bg { background-color: blue; }", -1, NULL);
".blue-bg { background-color: blue; }", -1);
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
......
......@@ -82,7 +82,7 @@ main (int argc,
gtk_css_provider_load_from_data (provider,
".small-font { font-size: 5px; }"
".medium-font { font-size: 10px; }"
".large-font { font-size: 15px; }", -1, NULL);
".large-font { font-size: 15px; }", -1);
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
......
......@@ -82,7 +82,7 @@ css_text_changed (GtkTextBuffer *buffer,
gtk_text_buffer_remove_all_tags (buffer, &start, &end);
text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
gtk_css_provider_load_from_data (provider, text, -1, NULL);
gtk_css_provider_load_from_data (provider, text, -1);
g_free (text);
gtk_style_context_reset_widgets (gdk_screen_get_default ());
......
......@@ -262,7 +262,7 @@ void calendar_select_font (GtkWidget *button,
}
font = gtk_font_button_get_font_name (GTK_FONT_BUTTON (button));
data = g_strdup_printf ("GtkCalendar { font: %s; }", font);
gtk_css_provider_load_from_data (provider, data, -1, NULL);
gtk_css_provider_load_from_data (provider, data, -1);
g_free (data);
}
}
......
......@@ -1070,7 +1070,7 @@ main (int argc, char **argv)
gtk_css_provider_load_from_data (provider,
"* { -GtkComboBox-appears-as-list: true; }",
-1, NULL);
-1);
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
GTK_STYLE_PROVIDER (provider),
......
......@@ -93,7 +93,7 @@ create_combo (const char *name,
provider = gtk_css_provider_new ();
css_data = g_strdup_printf ("#%s { -GtkComboBox-appears-as-list: %s }",
name, is_list ? "true" : "false");
gtk_css_provider_load_from_data (provider, css_data, -1, NULL);
gtk_css_provider_load_from_data (provider, css_data, -1);
g_free (css_data);
gtk_style_context_add_provider (context,
......
......@@ -48,7 +48,7 @@ spin_ythickness_cb (GtkSpinButton *spin, gpointer user_data)
pad.top,
(gint)gtk_spin_button_get_value (spin));
gtk_css_provider_load_from_data (provider, data, -1, NULL);
gtk_css_provider_load_from_data (provider, data, -1);
g_free (data);
gtk_widget_queue_resize (frame);
......@@ -84,7 +84,7 @@ spin_xthickness_cb (GtkSpinButton *spin, gpointer user_data)
(gint)gtk_spin_button_get_value (spin),
pad.left);
gtk_css_provider_load_from_data (provider, data, -1, NULL);
gtk_css_provider_load_from_data (provider, data, -1);
g_free (data);
gtk_widget_queue_resize (frame);
......
......@@ -13,7 +13,7 @@ oriented_test_widget (const gchar *label, const gchar *color, gdouble angle)
box = gtk_event_box_new ();
provider = gtk_css_provider_new ();
data = g_strdup_printf ("GtkEventBox { background-color: %s; }", color);
gtk_css_provider_load_from_data (provider, data, -1, NULL);
gtk_css_provider_load_from_data (provider, data, -1);
gtk_style_context_add_provider (gtk_widget_get_style_context (box),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
......
......@@ -9258,9 +9258,9 @@ main (int argc, char *argv[])
* directory.
*/
if (file_exists ("testgtk.css"))
gtk_css_provider_load_from_path (provider, "testgtk.css", NULL);
gtk_css_provider_load_from_path (provider, "testgtk.css");
else if (file_exists ("tests/testgtk.css"))
gtk_css_provider_load_from_path (provider, "tests/testgtk.css", NULL);
gtk_css_provider_load_from_path (provider, "tests/testgtk.css");
else
g_warning ("Couldn't find file \"testgtk.css\".");
......@@ -9337,7 +9337,7 @@ main (int argc, char *argv[])
" font-family: Sans;\n"
" font-size: 18px;\n"
"}",
-1, NULL);
-1);
gtk_style_context_add_provider_for_screen (screen, GTK_STYLE_PROVIDER (memory_provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION + 1);
......
......@@ -139,7 +139,7 @@ main (int argc, char *argv[])
gtk_style_context_add_class (gtk_widget_get_style_context (window), "main");
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, css, -1, NULL);
gtk_css_provider_load_from_data (provider, css, -1);
gtk_style_context_add_provider_for_screen (gtk_widget_get_screen (window),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_USER);
......
......@@ -220,7 +220,7 @@ set_styles (void)
provider = gtk_css_provider_new ();
if (!gtk_css_provider_load_from_data (provider, CSS, -1, NULL))
if (!gtk_css_provider_load_from_data (provider, CSS, -1))
{
g_assert_not_reached ();
}
......
......@@ -34,7 +34,7 @@ add_custom_css (void)
"}";
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, data, -1, NULL);
gtk_css_provider_load_from_data (provider, data, -1);
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
......
......@@ -262,7 +262,7 @@ main (int argc, char *argv[])
gtk_container_add (GTK_CONTAINER (window), hbox);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, css, -1, NULL);
gtk_css_provider_load_from_data (provider, css, -1);
gtk_style_context_add_provider_for_screen (gtk_widget_get_screen (window),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_USER);
......
......@@ -555,7 +555,7 @@ main (int argc, char *argv[])
gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL);
css_provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (css_provider, css, -1, NULL);
gtk_css_provider_load_from_data (css_provider, css, -1);
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
GTK_STYLE_PROVIDER (css_provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
......
......@@ -54,7 +54,7 @@ main (int argc, char *argv[])
".bottom { border-bottom-style: none; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; }"
".left { border-left-style: none; border-top-left-radius: 0px; border-bottom-left-radius: 0px; }"
".right { border-right-style: none; border-top-right-radius: 0px; border-bottom-right-radius: 0px; }",
-1, NULL);
-1);
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
......
......@@ -17,7 +17,7 @@ test_section_in_load_from_data (void)
provider = gtk_css_provider_new ();
g_signal_connect (provider, "parsing-error",
G_CALLBACK (assert_section_is_not_null), NULL);
gtk_css_provider_load_from_data (provider, "random garbage goes here", -1, NULL);
gtk_css_provider_load_from_data (provider, "random garbage goes here", -1);
g_object_unref (provider);
}
......@@ -33,7 +33,7 @@ test_section_in_style_property (void)
provider = gtk_css_provider_new ();
g_signal_connect (provider, "parsing-error",
G_CALLBACK (assert_section_is_not_null), NULL);
gtk_css_provider_load_from_data (provider, "* { -GtkWindow-decoration-button-layout: random garbage goes here; }", -1, NULL);
gtk_css_provider_load_from_data (provider, "* { -GtkWindow-decoration-button-layout: random garbage goes here; }", -1);
widget_class = g_type_class_ref (GTK_TYPE_WINDOW);
pspec = gtk_widget_class_find_style_property (widget_class, "decoration-button-layout");
......@@ -58,7 +58,7 @@ test_section_load_nonexisting_file (void)
provider = gtk_css_provider_new ();
g_signal_connect (provider, "parsing-error",
G_CALLBACK (assert_section_is_not_null), NULL);
gtk_css_provider_load_from_path (provider, "this/path/does/absolutely/not/exist.css", NULL);
gtk_css_provider_load_from_path (provider, "this/path/does/absolutely/not/exist.css");
g_object_unref (provider);
}
......
......@@ -34,7 +34,7 @@ test_init_of_theme (void)
css = g_strdup_printf (".background { color: %s; }",
before.alpha < 0.5 ? "black" : "transparent");
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, css, -1, NULL);
gtk_css_provider_load_from_data (provider, css, -1);
gtk_style_context_add_provider (context,
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_FALLBACK + 1);
......
......@@ -11,7 +11,6 @@ static void
test_parse_selectors (void)
{
GtkCssProvider *provider;
GError *error;
gboolean res;
gint i;
const gchar *valid[] = {
......@@ -58,14 +57,10 @@ test_parse_selectors (void)
NULL
};
error = NULL;
for (i = 0; valid[i]; i++)
{
provider = gtk_css_provider_new ();
res = gtk_css_provider_load_from_data (provider, valid[i], -1, &error);
if (error)
g_print ("parsing '%s': got unexpected error: %s\n", valid[i], error->message);
g_assert_no_error (error);
res = gtk_css_provider_load_from_data (provider, valid[i], -1);
g_assert (res);
g_object_unref (provider);
......@@ -131,12 +126,10 @@ test_match (void)
GtkStyleContext *context;
GtkWidgetPath *path;
GtkCssProvider *provider;
GError *error;
const gchar *data;
GdkRGBA color;
GdkRGBA expected;
error = NULL;
provider = gtk_css_provider_new ();
gdk_rgba_parse (&expected, "#fff");
......@@ -160,78 +153,68 @@ test_match (void)
GTK_STYLE_PROVIDER_PRIORITY_USER);
data = "* { color: #fff }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
gtk_css_provider_load_from_data (provider, data, -1);
gtk_style_context_get_color (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_css_provider_load_from_data (provider, data, -1);
gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n"
"button { color: #fff }\n"
"window > button { color: #000 }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
gtk_css_provider_load_from_data (provider, data, -1);
gtk_style_context_get_color (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_css_provider_load_from_data (provider, data, -1);
gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n"
"button { color: #000 }\n"
".button { color: #fff }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
gtk_css_provider_load_from_data (provider, data, -1);
gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n"
"button { color: #000 }\n"
"window button { color: #fff }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
gtk_css_provider_load_from_data (provider, data, -1);
gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n"
".button { color: #000 }\n"
"window .button { color: #fff }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
gtk_css_provider_load_from_data (provider, data, -1);
gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n"
"* .button { color: #000 }\n"
"#mywindow .button { color: #fff }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
gtk_css_provider_load_from_data (provider, data, -1);
gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n"
"window .button { color: #000 }\n"
"window#mywindow .button { color: #fff }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
gtk_css_provider_load_from_data (provider, data, -1);
gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n"
"window .button { color: #000 }\n"
"window button.button { color: #fff }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
gtk_css_provider_load_from_data (provider, data, -1);
gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
......@@ -239,8 +222,7 @@ test_match (void)
"window:backdrop .button { color: #000 }\n"
"window .button { color: #111 }\n"
"window:active .button { color: #fff }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
gtk_css_provider_load_from_data (provider, data, -1);
gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
......@@ -354,19 +336,15 @@ static void
test_style_priorities_setup (PrioritiesFixture *f,
gconstpointer unused)
{
GError *error = NULL;
f->blue_provider = gtk_css_provider_new ();
f->red_provider = gtk_css_provider_new ();
f->green_provider = gtk_css_provider_new ();
f->context = gtk_style_context_new ();
GtkWidgetPath *path = gtk_widget_path_new ();
gtk_css_provider_load_from_data (f->blue_provider, "* { color: blue; }", -1, &error);
g_assert_no_error (error);
gtk_css_provider_load_from_data (f->red_provider, "* { color: red; }", -1, &error);
g_assert_no_error (error);
gtk_css_provider_load_from_data (f->green_provider, "* { color: green; }", -1, &error);
g_assert_no_error (error);
gtk_css_provider_load_from_data (f->blue_provider, "* { color: blue; }", -1);
gtk_css_provider_load_from_data (f->red_provider, "* { color: red; }", -1);
gtk_css_provider_load_from_data (f->green_provider, "* { color: green; }", -1);
gtk_widget_path_append_type (path, GTK_TYPE_WINDOW);
gtk_style_context_set_path (f->context, path);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment