Skip to content

Commit

Permalink
Use glib::spawn_future_local utility
Browse files Browse the repository at this point in the history
  • Loading branch information
andy128k committed Oct 20, 2024
1 parent 7665109 commit 0c5dd7a
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ mod imp {

let files = files.to_owned();
let hint = hint.to_owned();
glib::MainContext::default().spawn_local(glib::clone!(
glib::spawn_future_local(glib::clone!(
#[weak(rename_to = imp)]
self,
async move {
Expand Down
8 changes: 4 additions & 4 deletions src/main_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ mod imp {

let delete_handler = win.connect_close_request(move |win| {
let win = win.clone();
glib::MainContext::default().spawn_local(async move {
glib::spawn_future_local(async move {
win.on_close().await;
});
glib::Propagation::Stop
Expand All @@ -163,7 +163,7 @@ mod imp {
#[weak]
win,
move |event| {
glib::MainContext::default().spawn_local(async move {
glib::spawn_future_local(async move {
win.search(&event).await;
});
}
Expand All @@ -190,7 +190,7 @@ mod imp {
#[weak]
win,
move |_, position, record_node| {
glib::MainContext::default().spawn_local(async move {
glib::spawn_future_local(async move {
win.action_edit(position, record_node).await;
});
}
Expand All @@ -214,7 +214,7 @@ mod imp {
#[weak]
win,
move |_, position, record_node| {
glib::MainContext::default().spawn_local(async move {
glib::spawn_future_local(async move {
win.action_edit(position, record_node).await;
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/edit_record/dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ impl RecordWidget {
#[weak]
widget,
move |_| {
glib::MainContext::default().spawn_local(async move {
glib::spawn_future_local(async move {
widget.open().await;
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/edit_record/record_widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ mod imp {
#[weak(rename_to = imp)]
self,
move |_| {
glib::MainContext::default().spawn_local(async move { imp.open().await });
glib::spawn_future_local(async move { imp.open().await });
}
));
}
Expand Down
13 changes: 6 additions & 7 deletions src/ui/file_pane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ mod imp {
#[weak(rename_to = imp)]
self,
move |position| {
glib::MainContext::default().spawn_local(async move {
glib::spawn_future_local(async move {
imp.row_activated(position).await;
});
}
Expand All @@ -146,36 +146,35 @@ mod imp {
#[weak(rename_to = imp)]
self,
move || {
glib::MainContext::default().spawn_local(async move { imp.go_home().await });
glib::spawn_future_local(async move { imp.go_home().await });
}
));
self.nav_bar.connect_go_path(glib::clone!(
#[weak(rename_to = imp)]
self,
move |position| {
glib::MainContext::default()
.spawn_local(async move { imp.go_path(position).await });
glib::spawn_future_local(async move { imp.go_path(position).await });
}
));
self.nav_bar.connect_go_up(glib::clone!(
#[weak(rename_to = imp)]
self,
move || {
glib::MainContext::default().spawn_local(async move { imp.go_up().await });
glib::spawn_future_local(async move { imp.go_up().await });
}
));
self.view.connect_go_home(glib::clone!(
#[weak(rename_to = imp)]
self,
move || {
glib::MainContext::default().spawn_local(async move { imp.go_home().await });
glib::spawn_future_local(async move { imp.go_home().await });
}
));
self.view.connect_go_up(glib::clone!(
#[weak(rename_to = imp)]
self,
move || {
glib::MainContext::default().spawn_local(async move { imp.go_up().await });
glib::spawn_future_local(async move { imp.go_up().await });
}
));
self.view.connect_move_record(glib::clone!(
Expand Down
2 changes: 1 addition & 1 deletion src/ui/password_editor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl PasswordEditor {
#[weak]
entry,
move |_| {
glib::MainContext::default().spawn_local(generate_password_clicked(entry));
glib::spawn_future_local(generate_password_clicked(entry));
}
));

Expand Down
3 changes: 1 addition & 2 deletions src/ui/record_view/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ mod imp {
#[weak(rename_to = imp)]
self,
move |_gesture, _n, _x, _y| {
glib::MainContext::default()
.spawn_local(async move { imp.on_open_clicked().await });
glib::spawn_future_local(async move { imp.on_open_clicked().await });
}
));
self.open.add_controller(open_click);
Expand Down
2 changes: 1 addition & 1 deletion src/ui/search_pane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ mod imp {
#[weak(rename_to = imp)]
self,
move |position| {
glib::MainContext::default().spawn_local(async move {
glib::spawn_future_local(async move {
imp.row_activated(position).await;
});
}
Expand Down

0 comments on commit 0c5dd7a

Please sign in to comment.