mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-12 13:30:19 +00:00
Stop using gtk_css_provider_load_from_data
This commit is contained in:
parent
a1d9cb8ad6
commit
f2a297f56d
@ -50,7 +50,7 @@ update_css_for_blend_mode (GtkCssProvider *provider,
|
|||||||
blend_mode,
|
blend_mode,
|
||||||
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_bytes_unref (bytes);
|
||||||
g_free (css);
|
g_free (css);
|
||||||
|
@ -70,7 +70,7 @@ set_color (CanvasItem *item,
|
|||||||
css = g_strdup_printf ("#%s { background: %s; }", name, str);
|
css = g_strdup_printf ("#%s { background: %s; }", name, str);
|
||||||
|
|
||||||
provider = gtk_css_provider_new ();
|
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);
|
gtk_style_context_add_provider_for_display (gtk_widget_get_display (item->label), GTK_STYLE_PROVIDER (provider), 700);
|
||||||
item->provider = GTK_STYLE_PROVIDER (provider);
|
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]);
|
g_string_append_printf (css, ".canvasitem.%s { background: %s; }\n", colors[i], colors[i]);
|
||||||
|
|
||||||
provider = gtk_css_provider_new ();
|
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_context_add_provider_for_display (gdk_display_get_default (),
|
||||||
GTK_STYLE_PROVIDER (provider),
|
GTK_STYLE_PROVIDER (provider),
|
||||||
800);
|
800);
|
||||||
|
@ -301,7 +301,7 @@ do_fishbowl (GtkWidget *do_widget)
|
|||||||
if (provider == NULL)
|
if (provider == NULL)
|
||||||
{
|
{
|
||||||
provider = gtk_css_provider_new ();
|
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_context_add_provider_for_display (gdk_display_get_default (),
|
||||||
GTK_STYLE_PROVIDER (provider),
|
GTK_STYLE_PROVIDER (provider),
|
||||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||||
|
@ -337,7 +337,7 @@ create_gltransition_window (GtkWidget *do_widget)
|
|||||||
1, 1, 1, 1);
|
1, 1, 1, 1);
|
||||||
|
|
||||||
provider = gtk_css_provider_new ();
|
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_context_add_provider_for_display (gdk_display_get_default (),
|
||||||
GTK_STYLE_PROVIDER (provider),
|
GTK_STYLE_PROVIDER (provider),
|
||||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||||
|
@ -367,7 +367,7 @@ do_listview_ucd (GtkWidget *do_widget)
|
|||||||
gtk_label_set_width_chars (GTK_LABEL (label), 2);
|
gtk_label_set_width_chars (GTK_LABEL (label), 2);
|
||||||
gtk_widget_add_css_class (label, "enormous");
|
gtk_widget_add_css_class (label, "enormous");
|
||||||
provider = gtk_css_provider_new ();
|
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_style_context_add_provider_for_display (gdk_display_get_default (), GTK_STYLE_PROVIDER (provider), 800);
|
||||||
gtk_widget_set_hexpand (label, TRUE);
|
gtk_widget_set_hexpand (label, TRUE);
|
||||||
gtk_box_append (GTK_BOX (box), label);
|
gtk_box_append (GTK_BOX (box), label);
|
||||||
|
@ -384,7 +384,7 @@ create_board (GtkWidget *window)
|
|||||||
"}";
|
"}";
|
||||||
|
|
||||||
provider = gtk_css_provider_new ();
|
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_context_add_provider_for_display (gdk_display_get_default (),
|
||||||
GTK_STYLE_PROVIDER (provider),
|
GTK_STYLE_PROVIDER (provider),
|
||||||
800);
|
800);
|
||||||
|
@ -201,7 +201,7 @@ node_editor_application_startup (GApplication *app)
|
|||||||
|
|
||||||
|
|
||||||
provider = gtk_css_provider_new ();
|
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_context_add_provider_for_display (gdk_display_get_default (),
|
||||||
GTK_STYLE_PROVIDER (provider),
|
GTK_STYLE_PROVIDER (provider),
|
||||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||||
|
@ -260,7 +260,7 @@ update_style (GtkInspectorCssEditor *ce)
|
|||||||
ce->priv->errors = NULL;
|
ce->priv->errors = NULL;
|
||||||
|
|
||||||
text = get_current_text (ce->priv->text);
|
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);
|
g_free (text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,10 +25,13 @@ gtk_css_provider_load_data_not_null_terminated (void)
|
|||||||
{
|
{
|
||||||
GtkCssProvider *p;
|
GtkCssProvider *p;
|
||||||
const char data[3] = {'*', '{', '}'};
|
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);
|
g_object_unref (p);
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ test_section_in_load_from_data (void)
|
|||||||
provider = gtk_css_provider_new ();
|
provider = gtk_css_provider_new ();
|
||||||
g_signal_connect (provider, "parsing-error",
|
g_signal_connect (provider, "parsing-error",
|
||||||
G_CALLBACK (assert_section_is_not_null), NULL);
|
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);
|
g_object_unref (provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user