diff options
author | Matthias Clasen <mclasen@redhat.com> | 2014-10-07 00:45:59 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2014-10-07 00:48:30 -0400 |
commit | d120346992ca7d7cf1a775935e15a85614671541 (patch) | |
tree | 16c2465d104796a7a893e35290a6937c4cf20b1a /demos | |
parent | 5a0dc74dedc0dcb495492eee12f9588a7b152f8d (diff) | |
download | gtk+-d120346992ca7d7cf1a775935e15a85614671541.tar.gz |
gtk3-demo: Don't use deprecated API
Replace various override calls.
Diffstat (limited to 'demos')
-rw-r--r-- | demos/gtk-demo/main.c | 18 | ||||
-rw-r--r-- | demos/gtk-demo/offscreen_window.c | 3 | ||||
-rw-r--r-- | demos/gtk-demo/rotated_text.c | 9 |
3 files changed, 7 insertions, 23 deletions
diff --git a/demos/gtk-demo/main.c b/demos/gtk-demo/main.c index ff7913951e..601812640c 100644 --- a/demos/gtk-demo/main.c +++ b/demos/gtk-demo/main.c @@ -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; diff --git a/demos/gtk-demo/offscreen_window.c b/demos/gtk-demo/offscreen_window.c index ee542b3041..9109e271c2 100644 --- a/demos/gtk-demo/offscreen_window.c +++ b/demos/gtk-demo/offscreen_window.c @@ -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); diff --git a/demos/gtk-demo/rotated_text.c b/demos/gtk-demo/rotated_text.c index c83030f6c2..8b4ecb23b2 100644 --- a/demos/gtk-demo/rotated_text.c +++ b/demos/gtk-demo/rotated_text.c @@ -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); |