From 737896fe3c0ea1101e89e2d0db4aeb239c4c206f Mon Sep 17 00:00:00 2001 From: Zeke Fast Date: Fri, 17 Mar 2023 19:05:00 +0100 Subject: [PATCH 1/2] Replace usage of deprecated Window::show method with Window::present. Deprecation since GTK 4.10: - https://docs.rs/gtk4/0.6.4/src/gtk4/auto/widget.rs.html#582 - https://docs.gtk.org/gtk4/method.Widget.show.html Window::present: - https://docs.gtk.org/gtk4/method.Window.present.html --- book/listings/css/1/main.rs | 2 +- book/listings/css/2/main.rs | 2 +- book/listings/css/3/main.rs | 2 +- book/listings/css/4/main.rs | 2 +- book/listings/css/5/main.rs | 2 +- book/listings/css/6/main.rs | 2 +- book/listings/css/7/main.rs | 2 +- book/listings/css/8/main.rs | 2 +- book/listings/css/9/main.rs | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/book/listings/css/1/main.rs b/book/listings/css/1/main.rs index 13586a36507b..28c8b46431af 100644 --- a/book/listings/css/1/main.rs +++ b/book/listings/css/1/main.rs @@ -48,6 +48,6 @@ fn build_ui(app: &Application) { .title("My GTK App") .child(&button) .build(); - window.show(); + window.present(); } // ANCHOR_END: main diff --git a/book/listings/css/2/main.rs b/book/listings/css/2/main.rs index 8f8ca7fcd059..9a69540d6133 100644 --- a/book/listings/css/2/main.rs +++ b/book/listings/css/2/main.rs @@ -47,5 +47,5 @@ fn build_ui(app: &Application) { .title("My GTK App") .child(&button) .build(); - window.show(); + window.present(); } diff --git a/book/listings/css/3/main.rs b/book/listings/css/3/main.rs index 07e180a3db24..d34b5e478acf 100644 --- a/book/listings/css/3/main.rs +++ b/book/listings/css/3/main.rs @@ -58,6 +58,6 @@ fn build_ui(app: &Application) { .title("My GTK App") .child(>k_box) .build(); - window.show(); + window.present(); } // ANCHOR_END: build_ui diff --git a/book/listings/css/4/main.rs b/book/listings/css/4/main.rs index 6791c6642cbe..e4465e88bf2b 100644 --- a/book/listings/css/4/main.rs +++ b/book/listings/css/4/main.rs @@ -58,6 +58,6 @@ fn build_ui(app: &Application) { .title("My GTK App") .child(>k_box) .build(); - window.show(); + window.present(); } // ANCHOR_END: build_ui diff --git a/book/listings/css/5/main.rs b/book/listings/css/5/main.rs index 139ff425d2df..00b7caa0109d 100644 --- a/book/listings/css/5/main.rs +++ b/book/listings/css/5/main.rs @@ -42,5 +42,5 @@ fn build_ui(app: &Application) { .title("My GTK App") .child(>k_box) .build(); - window.show(); + window.present(); } diff --git a/book/listings/css/6/main.rs b/book/listings/css/6/main.rs index bd66fb7f1ab5..cbafbd0739b6 100644 --- a/book/listings/css/6/main.rs +++ b/book/listings/css/6/main.rs @@ -21,5 +21,5 @@ fn main() -> glib::ExitCode { fn build_ui(app: &Application) { // Create a new window and show it let window = Window::new(app); - window.show(); + window.present(); } diff --git a/book/listings/css/7/main.rs b/book/listings/css/7/main.rs index 953de8b86494..8b785128eb34 100644 --- a/book/listings/css/7/main.rs +++ b/book/listings/css/7/main.rs @@ -36,5 +36,5 @@ fn load_css() { fn build_ui(app: &Application) { // Create a new window and show it let window = Window::new(app); - window.show(); + window.present(); } diff --git a/book/listings/css/8/main.rs b/book/listings/css/8/main.rs index 31959a74792d..df849b3d333e 100644 --- a/book/listings/css/8/main.rs +++ b/book/listings/css/8/main.rs @@ -36,5 +36,5 @@ fn load_css() { fn build_ui(app: &Application) { // Create a new window and show it let window = Window::new(app); - window.show(); + window.present(); } diff --git a/book/listings/css/9/main.rs b/book/listings/css/9/main.rs index 307e4c7fbf2d..26bd3d4ae559 100644 --- a/book/listings/css/9/main.rs +++ b/book/listings/css/9/main.rs @@ -36,5 +36,5 @@ fn load_css() { fn build_ui(app: &Application) { // Create a new window and show it let window = Window::new(app); - window.show(); + window.present(); } From 7c9270ba8ae9ad62656deb241f54825d7571d05f Mon Sep 17 00:00:00 2001 From: Zeke Fast Date: Fri, 17 Mar 2023 19:15:16 +0100 Subject: [PATCH 2/2] Fix typo in CSS class name of listing 3: button_1 -> button-1. With "button_1" example does not work. --- book/listings/css/3/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/listings/css/3/main.rs b/book/listings/css/3/main.rs index d34b5e478acf..e11369a3fc0f 100644 --- a/book/listings/css/3/main.rs +++ b/book/listings/css/3/main.rs @@ -38,7 +38,7 @@ fn build_ui(app: &Application) { let button_1 = Button::with_label("Press me!"); let button_2 = Button::with_label("Press me!"); - button_1.add_css_class("button_1"); + button_1.add_css_class("button-1"); // ANCHOR_END: buttons // Create `gtk_box` and add buttons