Skip to content

Commit

Permalink
examples: fixes to comply with Into<Option<_>>
Browse files Browse the repository at this point in the history
  • Loading branch information
fengalin committed Dec 5, 2024
1 parent 8e7fb3c commit 7b3bb29
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/column_view_datagrid/grid_cell/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ impl Default for GridCell {

impl GridCell {
pub fn set_entry(&self, entry: &Entry) {
self.imp().name.set_text(Some(&entry.name));
self.imp().name.set_text(entry.name.as_str());
}
}
2 changes: 1 addition & 1 deletion examples/dialog/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async fn dialog<W: IsA<gtk::Window>>(window: W) {
let info_dialog = gtk::AlertDialog::builder()
.modal(true)
.message("You answered")
.detail(format!("Your answer: {answer:?}"))
.detail(format!("Your answer: {answer:?}").as_str())
.build();

info_dialog.show(Some(&window));
Expand Down
4 changes: 2 additions & 2 deletions examples/list_view_apps_launcher/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ fn build_ui(app: &gtk::Application) {
let parent_window = list_view.root().and_downcast::<gtk::Window>().unwrap();

gtk::AlertDialog::builder()
.message(format!("Failed to start {}", app_info.name()))
.detail(err.to_string())
.message(format!("Failed to start {}", app_info.name()).as_str())
.detail(err.to_string().as_str())
.modal(true)
.build()
.show(Some(&parent_window));
Expand Down
2 changes: 1 addition & 1 deletion examples/tokio_async_request/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ fn build_ui(app: &Application) {
match response {
Ok(response) => {
for pokemon in response {
let label = gtk::Label::new(Some(&pokemon.name));
let label = gtk::Label::new(pokemon.name.as_str());
label.set_halign(gtk::Align::Start);
list_box.append(&label);
}
Expand Down

0 comments on commit 7b3bb29

Please sign in to comment.