Skip to content

Commit 0e0e059

Browse files
committed
book: Go back to 4_8 for now
1 parent 31c174b commit 0e0e059

File tree

11 files changed

+19
-19
lines changed

11 files changed

+19
-19
lines changed

book/listings/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2021"
55

66

77
[dependencies]
8-
gtk = { version = "*", package = "gtk4", features = ["v4_12"] }
8+
gtk = { version = "*", package = "gtk4", features = ["v4_8"] }
99
adw = { version = ">= 0.3.1", package = "libadwaita", features = ["v1_2"] }
1010
once_cell = "1.0"
1111
serde = { version = "1.0", features = ["derive"] }

book/listings/css/1/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn main() -> glib::ExitCode {
2020
fn load_css() {
2121
// Load the CSS file and add it to the provider
2222
let provider = CssProvider::new();
23-
provider.load_from_string(include_str!("style.css"));
23+
provider.load_from_data(include_str!("style.css"));
2424

2525
// Add the provider to the default screen
2626
gtk::style_context_add_provider_for_display(
@@ -40,7 +40,7 @@ fn build_ui(app: &Application) {
4040
.margin_end(12)
4141
.build();
4242

43-
// Create a new window and show it
43+
// Create a new window and present it
4444
let window = ApplicationWindow::builder()
4545
.application(app)
4646
.title("My GTK App")

book/listings/css/2/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fn main() -> glib::ExitCode {
1919
fn load_css() {
2020
// Load the CSS file and add it to the provider
2121
let provider = CssProvider::new();
22-
provider.load_from_string(include_str!("style.css"));
22+
provider.load_from_data(include_str!("style.css"));
2323

2424
// Add the provider to the default screen
2525
gtk::style_context_add_provider_for_display(
@@ -39,7 +39,7 @@ fn build_ui(app: &Application) {
3939
.margin_end(12)
4040
.build();
4141

42-
// Create a new window and show it
42+
// Create a new window and present it
4343
let window = ApplicationWindow::builder()
4444
.application(app)
4545
.title("My GTK App")

book/listings/css/3/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fn main() -> glib::ExitCode {
1919
fn load_css() {
2020
// Load the CSS file and add it to the provider
2121
let provider = CssProvider::new();
22-
provider.load_from_string(include_str!("style.css"));
22+
provider.load_from_data(include_str!("style.css"));
2323

2424
// Add the provider to the default screen
2525
gtk::style_context_add_provider_for_display(
@@ -50,7 +50,7 @@ fn build_ui(app: &Application) {
5050
gtk_box.append(&button_1);
5151
gtk_box.append(&button_2);
5252

53-
// Create a new window and show it
53+
// Create a new window and present it
5454
let window = ApplicationWindow::builder()
5555
.application(app)
5656
.title("My GTK App")

book/listings/css/4/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fn main() -> glib::ExitCode {
1919
fn load_css() {
2020
// Load the CSS file and add it to the provider
2121
let provider = CssProvider::new();
22-
provider.load_from_string(include_str!("style.css"));
22+
provider.load_from_data(include_str!("style.css"));
2323

2424
// Add the provider to the default screen
2525
gtk::style_context_add_provider_for_display(
@@ -50,7 +50,7 @@ fn build_ui(app: &Application) {
5050
gtk_box.append(&button_1);
5151
gtk_box.append(&button_2);
5252

53-
// Create a new window and show it
53+
// Create a new window and present it
5454
let window = ApplicationWindow::builder()
5555
.application(app)
5656
.title("My GTK App")

book/listings/css/5/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn build_ui(app: &Application) {
3636
gtk_box.append(&button_1);
3737
gtk_box.append(&button_2);
3838

39-
// Create a new window and show it
39+
// Create a new window and present it
4040
let window = ApplicationWindow::builder()
4141
.application(app)
4242
.title("My GTK App")

book/listings/css/6/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fn main() -> glib::ExitCode {
1919
}
2020

2121
fn build_ui(app: &Application) {
22-
// Create a new window and show it
22+
// Create a new window and present it
2323
let window = Window::new(app);
2424
window.present();
2525
}

book/listings/css/7/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn main() -> glib::ExitCode {
2323
fn load_css() {
2424
// Load the CSS file and add it to the provider
2525
let provider = CssProvider::new();
26-
provider.load_from_string(include_str!("style.css"));
26+
provider.load_from_data(include_str!("style.css"));
2727

2828
// Add the provider to the default screen
2929
gtk::style_context_add_provider_for_display(
@@ -34,7 +34,7 @@ fn load_css() {
3434
}
3535

3636
fn build_ui(app: &Application) {
37-
// Create a new window and show it
37+
// Create a new window and present it
3838
let window = Window::new(app);
3939
window.present();
4040
}

book/listings/css/8/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn main() -> glib::ExitCode {
2323
fn load_css() {
2424
// Load the CSS file and add it to the provider
2525
let provider = CssProvider::new();
26-
provider.load_from_string(include_str!("style.css"));
26+
provider.load_from_data(include_str!("style.css"));
2727

2828
// Add the provider to the default screen
2929
gtk::style_context_add_provider_for_display(
@@ -34,7 +34,7 @@ fn load_css() {
3434
}
3535

3636
fn build_ui(app: &Application) {
37-
// Create a new window and show it
37+
// Create a new window and present it
3838
let window = Window::new(app);
3939
window.present();
4040
}

book/listings/css/9/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn main() -> glib::ExitCode {
2323
fn load_css() {
2424
// Load the CSS file and add it to the provider
2525
let provider = CssProvider::new();
26-
provider.load_from_string(include_str!("style.css"));
26+
provider.load_from_data(include_str!("style.css"));
2727

2828
// Add the provider to the default screen
2929
gtk::style_context_add_provider_for_display(
@@ -34,7 +34,7 @@ fn load_css() {
3434
}
3535

3636
fn build_ui(app: &Application) {
37-
// Create a new window and show it
37+
// Create a new window and present it
3838
let window = Window::new(app);
3939
window.present();
4040
}

0 commit comments

Comments
 (0)