Stop using gtk_css_provider_load_from_data

This commit is contained in:
Matthias Clasen 2023-05-13 19:44:42 -04:00
parent a1d9cb8ad6
commit f2a297f56d
10 changed files with 15 additions and 12 deletions

View File

@ -50,7 +50,7 @@ update_css_for_blend_mode (GtkCssProvider *provider,
blend_mode,
blend_mode);
gtk_css_provider_load_from_data (provider, css, -1);
gtk_css_provider_load_from_string (provider, css);
g_bytes_unref (bytes);
g_free (css);

View File

@ -70,7 +70,7 @@ set_color (CanvasItem *item,
css = g_strdup_printf ("#%s { background: %s; }", name, str);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, css, -1);
gtk_css_provider_load_from_string (provider, css);
gtk_style_context_add_provider_for_display (gtk_widget_get_display (item->label), GTK_STYLE_PROVIDER (provider), 700);
item->provider = GTK_STYLE_PROVIDER (provider);
@ -765,7 +765,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
g_string_append_printf (css, ".canvasitem.%s { background: %s; }\n", colors[i], colors[i]);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, css->str, css->len);
gtk_css_provider_load_from_string (provider, css->str);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
800);

View File

@ -301,7 +301,7 @@ do_fishbowl (GtkWidget *do_widget)
if (provider == NULL)
{
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, css, -1);
gtk_css_provider_load_from_string (provider, css);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);

View File

@ -337,7 +337,7 @@ create_gltransition_window (GtkWidget *do_widget)
1, 1, 1, 1);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, "button.small { padding: 0; }", -1);
gtk_css_provider_load_from_string (provider, "button.small { padding: 0; }");
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);

View File

@ -367,7 +367,7 @@ do_listview_ucd (GtkWidget *do_widget)
gtk_label_set_width_chars (GTK_LABEL (label), 2);
gtk_widget_add_css_class (label, "enormous");
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, "label.enormous { font-size: 80px; }", -1);
gtk_css_provider_load_from_string (provider, "label.enormous { font-size: 80px; }");
gtk_style_context_add_provider_for_display (gdk_display_get_default (), GTK_STYLE_PROVIDER (provider), 800);
gtk_widget_set_hexpand (label, TRUE);
gtk_box_append (GTK_BOX (box), label);

View File

@ -384,7 +384,7 @@ create_board (GtkWidget *window)
"}";
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, css, -1);
gtk_css_provider_load_from_string (provider, css);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
800);

View File

@ -201,7 +201,7 @@ node_editor_application_startup (GApplication *app)
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, css, -1);
gtk_css_provider_load_from_string (provider, css);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);

View File

@ -260,7 +260,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);
gtk_css_provider_load_from_string (ce->priv->provider, text);
g_free (text);
}

View File

@ -25,10 +25,13 @@ gtk_css_provider_load_data_not_null_terminated (void)
{
GtkCssProvider *p;
const char data[3] = {'*', '{', '}'};
GBytes *bytes;
p = gtk_css_provider_new();
p = gtk_css_provider_new ();
gtk_css_provider_load_from_data(p, data, sizeof (data));
bytes = g_bytes_new_static (data, sizeof (data));
gtk_css_provider_load_from_bytes (p, bytes);
g_bytes_unref (bytes);
g_object_unref (p);
}

View File

@ -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);
gtk_css_provider_load_from_string (provider, "random garbage goes here");
g_object_unref (provider);
}