Skip to content

Commit d337714

Browse files
Stop using deprecated APIs
1 parent 35739a1 commit d337714

File tree

16 files changed

+17
-17
lines changed

16 files changed

+17
-17
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_8"] }
8+
gtk = { version = "*", package = "gtk4", features = ["v4_12"] }
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fn main() -> glib::ExitCode {
2222
fn load_css() {
2323
// Load the CSS file and add it to the provider
2424
let provider = CssProvider::new();
25-
provider.load_from_data(include_str!("style.css"));
25+
provider.load_from_string(include_str!("style.css"));
2626

2727
// Add the provider to the default screen
2828
StyleContext::add_provider_for_display(

book/listings/css/2/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn main() -> glib::ExitCode {
2121
fn load_css() {
2222
// Load the CSS file and add it to the provider
2323
let provider = CssProvider::new();
24-
provider.load_from_data(include_str!("style.css"));
24+
provider.load_from_string(include_str!("style.css"));
2525

2626
// Add the provider to the default screen
2727
StyleContext::add_provider_for_display(

book/listings/css/3/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn main() -> glib::ExitCode {
2121
fn load_css() {
2222
// Load the CSS file and add it to the provider
2323
let provider = CssProvider::new();
24-
provider.load_from_data(include_str!("style.css"));
24+
provider.load_from_string(include_str!("style.css"));
2525

2626
// Add the provider to the default screen
2727
StyleContext::add_provider_for_display(

book/listings/css/4/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn main() -> glib::ExitCode {
2121
fn load_css() {
2222
// Load the CSS file and add it to the provider
2323
let provider = CssProvider::new();
24-
provider.load_from_data(include_str!("style.css"));
24+
provider.load_from_string(include_str!("style.css"));
2525

2626
// Add the provider to the default screen
2727
StyleContext::add_provider_for_display(

book/listings/css/7/main.rs

Lines changed: 1 addition & 1 deletion
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_data(include_str!("style.css"));
26+
provider.load_from_string(include_str!("style.css"));
2727

2828
// Add the provider to the default screen
2929
StyleContext::add_provider_for_display(

book/listings/css/8/main.rs

Lines changed: 1 addition & 1 deletion
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_data(include_str!("style.css"));
26+
provider.load_from_string(include_str!("style.css"));
2727

2828
// Add the provider to the default screen
2929
StyleContext::add_provider_for_display(

book/listings/css/9/main.rs

Lines changed: 1 addition & 1 deletion
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_data(include_str!("style.css"));
26+
provider.load_from_string(include_str!("style.css"));
2727

2828
// Add the provider to the default screen
2929
StyleContext::add_provider_for_display(

book/listings/todo/4/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ fn setup_shortcuts(app: &Application) {
3333
fn build_ui(app: &Application) {
3434
// Create a new custom window and show it
3535
let window = Window::new(app);
36-
window.show();
36+
window.present();
3737
}

book/listings/todo/5/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ fn setup_shortcuts(app: &adw::Application) {
3737
fn build_ui(app: &adw::Application) {
3838
// Create a new custom window and show it
3939
let window = Window::new(app);
40-
window.show();
40+
window.present();
4141
}
4242
// ANCHOR_END: main

0 commit comments

Comments
 (0)