forked from AuroraMiddleware/gtk
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 *scrolled_window;
|
||||||
GtkWidget *text_view;
|
GtkWidget *text_view;
|
||||||
PangoFontDescription *font_desc;
|
|
||||||
|
|
||||||
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
||||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||||
@ -840,22 +839,15 @@ create_text (GtkWidget **view,
|
|||||||
|
|
||||||
if (is_source)
|
if (is_source)
|
||||||
{
|
{
|
||||||
font_desc = pango_font_description_from_string ("monospace");
|
gtk_text_view_set_monospace (GTK_TEXT_VIEW (text_view), TRUE);
|
||||||
gtk_widget_override_font (text_view, font_desc);
|
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), GTK_WRAP_NONE);
|
||||||
pango_font_description_free (font_desc);
|
|
||||||
|
|
||||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view),
|
|
||||||
GTK_WRAP_NONE);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Make it a bit nicer for text. */
|
/* Make it a bit nicer for text. */
|
||||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view),
|
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), GTK_WRAP_WORD);
|
||||||
GTK_WRAP_WORD);
|
gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (text_view), 2);
|
||||||
gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (text_view),
|
gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (text_view), 2);
|
||||||
2);
|
|
||||||
gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (text_view),
|
|
||||||
2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return scrolled_window;
|
return scrolled_window;
|
||||||
|
@ -573,7 +573,6 @@ do_offscreen_window (GtkWidget *do_widget)
|
|||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
GtkWidget *bin, *vbox, *scale, *button;
|
GtkWidget *bin, *vbox, *scale, *button;
|
||||||
GdkRGBA black;
|
|
||||||
|
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
gtk_window_set_screen (GTK_WINDOW (window),
|
gtk_window_set_screen (GTK_WINDOW (window),
|
||||||
@ -583,8 +582,6 @@ do_offscreen_window (GtkWidget *do_widget)
|
|||||||
g_signal_connect (window, "destroy",
|
g_signal_connect (window, "destroy",
|
||||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
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);
|
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||||
|
|
||||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||||
|
@ -181,8 +181,6 @@ do_rotated_text (GtkWidget *do_widget)
|
|||||||
PangoLayout *layout;
|
PangoLayout *layout;
|
||||||
PangoAttrList *attrs;
|
PangoAttrList *attrs;
|
||||||
|
|
||||||
const GdkRGBA white = { 1.0, 1.0, 1.0, 1.0 };
|
|
||||||
|
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
gtk_window_set_screen (GTK_WINDOW (window),
|
gtk_window_set_screen (GTK_WINDOW (window),
|
||||||
gtk_widget_get_screen (do_widget));
|
gtk_widget_get_screen (do_widget));
|
||||||
@ -195,18 +193,15 @@ do_rotated_text (GtkWidget *do_widget)
|
|||||||
gtk_container_add (GTK_CONTAINER (window), box);
|
gtk_container_add (GTK_CONTAINER (window), box);
|
||||||
|
|
||||||
/* Add a drawing area */
|
/* Add a drawing area */
|
||||||
|
|
||||||
drawing_area = gtk_drawing_area_new ();
|
drawing_area = gtk_drawing_area_new ();
|
||||||
gtk_container_add (GTK_CONTAINER (box), drawing_area);
|
gtk_container_add (GTK_CONTAINER (box), drawing_area);
|
||||||
|
gtk_style_context_add_class (gtk_widget_get_style_context (drawing_area),
|
||||||
/* This overrides the background color from the theme */
|
GTK_STYLE_CLASS_VIEW);
|
||||||
gtk_widget_override_background_color (drawing_area, 0, &white);
|
|
||||||
|
|
||||||
g_signal_connect (drawing_area, "draw",
|
g_signal_connect (drawing_area, "draw",
|
||||||
G_CALLBACK (rotated_text_draw), NULL);
|
G_CALLBACK (rotated_text_draw), NULL);
|
||||||
|
|
||||||
/* And a label */
|
/* And a label */
|
||||||
|
|
||||||
label = gtk_label_new (text);
|
label = gtk_label_new (text);
|
||||||
gtk_container_add (GTK_CONTAINER (box), label);
|
gtk_container_add (GTK_CONTAINER (box), label);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user