[gtk+] gtk3-demo: Don't use deprecated API
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gtk3-demo: Don't use deprecated API
- Date: Tue, 7 Oct 2014 04:49:10 +0000 (UTC)
commit d120346992ca7d7cf1a775935e15a85614671541
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Oct 7 00:45:59 2014 -0400
gtk3-demo: Don't use deprecated API
Replace various override calls.
demos/gtk-demo/main.c | 18 +++++-------------
demos/gtk-demo/offscreen_window.c | 3 ---
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 ff79139..6018126 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 ee542b3..9109e27 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 c83030f..8b4ecb2 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]