mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 02:40:11 +00:00
gtk3-demo: Don't use deprecated API
Replace various override calls.
This commit is contained in:
parent
5a0dc74ded
commit
d120346992
@ -821,7 +821,6 @@ create_text (GtkWidget **view,
|
||||
{
|
||||
GtkWidget *scrolled_window;
|
||||
GtkWidget *text_view;
|
||||
PangoFontDescription *font_desc;
|
||||
|
||||
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
@ -840,22 +839,15 @@ create_text (GtkWidget **view,
|
||||
|
||||
if (is_source)
|
||||
{
|
||||
font_desc = pango_font_description_from_string ("monospace");
|
||||
gtk_widget_override_font (text_view, font_desc);
|
||||
pango_font_description_free (font_desc);
|
||||
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view),
|
||||
GTK_WRAP_NONE);
|
||||
gtk_text_view_set_monospace (GTK_TEXT_VIEW (text_view), TRUE);
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), GTK_WRAP_NONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Make it a bit nicer for text. */
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view),
|
||||
GTK_WRAP_WORD);
|
||||
gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (text_view),
|
||||
2);
|
||||
gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (text_view),
|
||||
2);
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), GTK_WRAP_WORD);
|
||||
gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (text_view), 2);
|
||||
gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (text_view), 2);
|
||||
}
|
||||
|
||||
return scrolled_window;
|
||||
|
@ -573,7 +573,6 @@ do_offscreen_window (GtkWidget *do_widget)
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *bin, *vbox, *scale, *button;
|
||||
GdkRGBA black;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
@ -583,8 +582,6 @@ do_offscreen_window (GtkWidget *do_widget)
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
gdk_rgba_parse (&black, "black");
|
||||
gtk_widget_override_background_color (window, 0, &black);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
|
@ -181,8 +181,6 @@ do_rotated_text (GtkWidget *do_widget)
|
||||
PangoLayout *layout;
|
||||
PangoAttrList *attrs;
|
||||
|
||||
const GdkRGBA white = { 1.0, 1.0, 1.0, 1.0 };
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
@ -195,18 +193,15 @@ do_rotated_text (GtkWidget *do_widget)
|
||||
gtk_container_add (GTK_CONTAINER (window), box);
|
||||
|
||||
/* Add a drawing area */
|
||||
|
||||
drawing_area = gtk_drawing_area_new ();
|
||||
gtk_container_add (GTK_CONTAINER (box), drawing_area);
|
||||
|
||||
/* This overrides the background color from the theme */
|
||||
gtk_widget_override_background_color (drawing_area, 0, &white);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (drawing_area),
|
||||
GTK_STYLE_CLASS_VIEW);
|
||||
|
||||
g_signal_connect (drawing_area, "draw",
|
||||
G_CALLBACK (rotated_text_draw), NULL);
|
||||
|
||||
/* And a label */
|
||||
|
||||
label = gtk_label_new (text);
|
||||
gtk_container_add (GTK_CONTAINER (box), label);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user