Skip to content

Commit d3e2ba0

Browse files
authored
Merge pull request #1303 from sdroege/0.6-backports
0.6 backports
2 parents ec139db + 38215f3 commit d3e2ba0

File tree

42 files changed

+77
-96
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+77
-96
lines changed

book/listings/Cargo.toml

Lines changed: 2 additions & 2 deletions
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"
@@ -16,7 +16,7 @@ dirs = "4.0"
1616
walkdir = "2.3"
1717

1818
[build-dependencies]
19-
glib-build-tools = "*"
19+
glib-build-tools = "0.17"
2020

2121
# actions
2222
[[bin]]

book/listings/actions/3/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fn main() {
2222
fn build_ui(app: &Application) {
2323
let original_state = 0;
2424
let label = Label::builder()
25-
.label(&format!("Counter: {original_state}"))
25+
.label(format!("Counter: {original_state}"))
2626
.build();
2727

2828
// Create a button with label
@@ -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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fn main() {
2222
fn build_ui(app: &Application) {
2323
let original_state = 0;
2424
let label = Label::builder()
25-
.label(&format!("Counter: {original_state}"))
25+
.label(format!("Counter: {original_state}"))
2626
.build();
2727
// ANCHOR: button_builder
2828
// Create a button with label and action
@@ -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/imp.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use glib::subclass::InitializingObject;
2-
use gtk::prelude::*;
32
use gtk::subclass::prelude::*;
43
use gtk::{glib, CompositeTemplate, Label};
54

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/imp.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use glib::subclass::InitializingObject;
2-
use gtk::prelude::*;
32
use gtk::subclass::prelude::*;
43
use gtk::{glib, Button, CompositeTemplate, Label};
54

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/imp.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use gio::Settings;
22
use glib::subclass::InitializingObject;
3-
use gtk::prelude::*;
43
use gtk::subclass::prelude::*;
54
use gtk::{gio, glib, Button, CompositeTemplate, Label};
65
use once_cell::sync::OnceCell;

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/build.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,91 @@
11
fn main() {
22
// actions
33
glib_build_tools::compile_resources(
4-
"actions/5/resources",
4+
&["actions/5/resources"],
55
"actions/5/resources/resources.gresource.xml",
66
"actions_5.gresource",
77
);
88
glib_build_tools::compile_resources(
9-
"actions/6/resources",
9+
&["actions/6/resources"],
1010
"actions/6/resources/resources.gresource.xml",
1111
"actions_6.gresource",
1212
);
1313
glib_build_tools::compile_resources(
14-
"actions/7/resources",
14+
&["actions/7/resources"],
1515
"actions/7/resources/resources.gresource.xml",
1616
"actions_7.gresource",
1717
);
1818

1919
// composite_templates
2020
glib_build_tools::compile_resources(
21-
"composite_templates/1/resources",
21+
&["composite_templates/1/resources"],
2222
"composite_templates/1/resources/resources.gresource.xml",
2323
"composite_templates_1.gresource",
2424
);
2525
glib_build_tools::compile_resources(
26-
"composite_templates/2/resources",
26+
&["composite_templates/2/resources"],
2727
"composite_templates/2/resources/resources.gresource.xml",
2828
"composite_templates_2.gresource",
2929
);
3030
glib_build_tools::compile_resources(
31-
"composite_templates/3/resources",
31+
&["composite_templates/3/resources"],
3232
"composite_templates/3/resources/resources.gresource.xml",
3333
"composite_templates_3.gresource",
3434
);
3535
glib_build_tools::compile_resources(
36-
"composite_templates/4/resources",
36+
&["composite_templates/4/resources"],
3737
"composite_templates/4/resources/resources.gresource.xml",
3838
"composite_templates_4.gresource",
3939
);
4040
glib_build_tools::compile_resources(
41-
"composite_templates/5/resources",
41+
&["composite_templates/5/resources"],
4242
"composite_templates/5/resources/resources.gresource.xml",
4343
"composite_templates_5.gresource",
4444
);
4545
glib_build_tools::compile_resources(
46-
"composite_templates/6/resources",
46+
&["composite_templates/6/resources"],
4747
"composite_templates/6/resources/resources.gresource.xml",
4848
"composite_templates_6.gresource",
4949
);
5050

5151
// todo
5252
glib_build_tools::compile_resources(
53-
"todo/1/resources",
53+
&["todo/1/resources"],
5454
"todo/1/resources/resources.gresource.xml",
5555
"todo_1.gresource",
5656
);
5757
glib_build_tools::compile_resources(
58-
"todo/2/resources",
58+
&["todo/2/resources"],
5959
"todo/2/resources/resources.gresource.xml",
6060
"todo_2.gresource",
6161
);
6262
glib_build_tools::compile_resources(
63-
"todo/3/resources",
63+
&["todo/3/resources"],
6464
"todo/3/resources/resources.gresource.xml",
6565
"todo_3.gresource",
6666
);
6767
glib_build_tools::compile_resources(
68-
"todo/4/resources",
68+
&["todo/4/resources"],
6969
"todo/4/resources/resources.gresource.xml",
7070
"todo_4.gresource",
7171
);
7272
glib_build_tools::compile_resources(
73-
"todo/5/resources",
73+
&["todo/5/resources"],
7474
"todo/5/resources/resources.gresource.xml",
7575
"todo_5.gresource",
7676
);
7777
glib_build_tools::compile_resources(
78-
"todo/6/resources",
78+
&["todo/6/resources"],
7979
"todo/6/resources/resources.gresource.xml",
8080
"todo_6.gresource",
8181
);
8282
glib_build_tools::compile_resources(
83-
"todo/7/resources",
83+
&["todo/7/resources"],
8484
"todo/7/resources/resources.gresource.xml",
8585
"todo_7.gresource",
8686
);
8787
glib_build_tools::compile_resources(
88-
"todo/8/resources",
88+
&["todo/8/resources"],
8989
"todo/8/resources/resources.gresource.xml",
9090
"todo_8.gresource",
9191
);

0 commit comments

Comments
 (0)