Skip to content

Commit 95b18e5

Browse files
Hofer-Juliansdroege
authored andcommitted
Update book to 0.6
1 parent cc623cc commit 95b18e5

File tree

26 files changed

+55
-61
lines changed

26 files changed

+55
-61
lines changed

book/listings/Cargo.toml

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

77
[dependencies]
88
gtk = { version = "*", package = "gtk4", features = ["v4_8"] }
9-
adw = { version = "0.2.0-alpha.2", package = "libadwaita" }
9+
adw = { version = "*", package = "libadwaita" }
1010
once_cell = "1.0"
1111
serde = { version = "1.0", features = ["derive"] }
1212
serde_json = "1.0"

book/listings/actions/3/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ fn build_ui(app: &Application) {
6262
let action_count = SimpleAction::new_stateful(
6363
"count",
6464
Some(&i32::static_variant_type()),
65-
&original_state.to_variant(),
65+
original_state.to_variant(),
6666
);
6767
action_count.connect_activate(clone!(@weak label => move |action, parameter| {
6868
// Get state
@@ -80,7 +80,7 @@ fn build_ui(app: &Application) {
8080

8181
// Increase state by parameter and store state
8282
state += parameter;
83-
action.set_state(&state.to_variant());
83+
action.set_state(state.to_variant());
8484

8585
// Update label with new state
8686
label.set_label(&format!("Counter: {state}"));

book/listings/actions/4/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fn build_ui(app: &Application) {
5858
let action_count = SimpleAction::new_stateful(
5959
"count",
6060
Some(&i32::static_variant_type()),
61-
&original_state.to_variant(),
61+
original_state.to_variant(),
6262
);
6363
action_count.connect_activate(clone!(@weak label => move |action, parameter| {
6464
// Get state
@@ -76,7 +76,7 @@ fn build_ui(app: &Application) {
7676

7777
// Increase state by parameter and save state
7878
state += parameter;
79-
action.set_state(&state.to_variant());
79+
action.set_state(state.to_variant());
8080

8181
// Update label with new state
8282
label.set_label(&format!("Counter: {state}"));

book/listings/actions/5/window/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ impl Window {
2828
let action_count = SimpleAction::new_stateful(
2929
"count",
3030
Some(&i32::static_variant_type()),
31-
&original_state.to_variant(),
31+
original_state.to_variant(),
3232
);
3333

3434
action_count.connect_activate(clone!(@weak label => move |action, parameter| {
@@ -47,7 +47,7 @@ impl Window {
4747

4848
// Increase state by parameter and save state
4949
state += parameter;
50-
action.set_state(&state.to_variant());
50+
action.set_state(state.to_variant());
5151

5252
// Update label with new state
5353
label.set_label(&format!("Counter: {state}"));

book/listings/actions/6/window/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl Window {
2929
let action_count = SimpleAction::new_stateful(
3030
"count",
3131
Some(&i32::static_variant_type()),
32-
&original_state.to_variant(),
32+
original_state.to_variant(),
3333
);
3434

3535
action_count.connect_activate(clone!(@weak label => move |action, parameter| {
@@ -48,7 +48,7 @@ impl Window {
4848

4949
// Increase state by parameter and save state
5050
state += parameter;
51-
action.set_state(&state.to_variant());
51+
action.set_state(state.to_variant());
5252

5353
// Update label with new state
5454
label.set_label(&format!("Counter: {state}"));
@@ -70,7 +70,7 @@ impl Window {
7070
let action_orientation = SimpleAction::new_stateful(
7171
"orientation",
7272
Some(&String::static_variant_type()),
73-
&"Vertical".to_variant(),
73+
"Vertical".to_variant(),
7474
);
7575

7676
action_orientation.connect_activate(clone!(@weak gtk_box =>
@@ -89,7 +89,7 @@ impl Window {
8989

9090
// Set orientation and save state
9191
gtk_box.set_orientation(orientation);
92-
action.set_state(&parameter.to_variant());
92+
action.set_state(parameter.to_variant());
9393
}));
9494
self.add_action(&action_orientation);
9595
//ANCHOR_END: action_orientation

book/listings/actions/7/window/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl Window {
4747
let action_count = SimpleAction::new_stateful(
4848
"count",
4949
Some(&i32::static_variant_type()),
50-
&original_state.to_variant(),
50+
original_state.to_variant(),
5151
);
5252

5353
action_count.connect_activate(clone!(@weak label => move |action, parameter| {
@@ -66,7 +66,7 @@ impl Window {
6666

6767
// Increase state by parameter and save state
6868
state += parameter;
69-
action.set_state(&state.to_variant());
69+
action.set_state(state.to_variant());
7070

7171
// Update label with new state
7272
label.set_label(&format!("Counter: {state}"));

book/listings/css/1/main.rs

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

2525
// Add the provider to the default screen
2626
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
@@ -19,7 +19,7 @@ fn main() {
1919
fn load_css() {
2020
// Load the CSS file and add it to the provider
2121
let provider = CssProvider::new();
22-
provider.load_from_data(include_bytes!("style.css"));
22+
provider.load_from_data(include_str!("style.css"));
2323

2424
// Add the provider to the default screen
2525
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
@@ -19,7 +19,7 @@ fn main() {
1919
fn load_css() {
2020
// Load the CSS file and add it to the provider
2121
let provider = CssProvider::new();
22-
provider.load_from_data(include_bytes!("style.css"));
22+
provider.load_from_data(include_str!("style.css"));
2323

2424
// Add the provider to the default screen
2525
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
@@ -19,7 +19,7 @@ fn main() {
1919
fn load_css() {
2020
// Load the CSS file and add it to the provider
2121
let provider = CssProvider::new();
22-
provider.load_from_data(include_bytes!("style.css"));
22+
provider.load_from_data(include_str!("style.css"));
2323

2424
// Add the provider to the default screen
2525
StyleContext::add_provider_for_display(

0 commit comments

Comments
 (0)