Use glib::timeout_add_local() instead of removed gtk::timeout_add()

This commit is contained in:
Sebastian Dröge 2020-08-27 09:49:03 +03:00
parent 42768a3159
commit fb779b42a8
3 changed files with 3 additions and 3 deletions

View file

@ -84,7 +84,7 @@ fn create_ui(app: &gtk::Application) {
// the underlying pipeline, and display it in our gui.
// Since this closure is called by the mainloop thread, we are allowed
// to modify the gui widgets here.
let timeout_id = gtk::timeout_add(500, move || {
let timeout_id = glib::timeout_add_local(500, move || {
// Here we temporarily retrieve a strong reference on the pipeline from the weak one
// we moved into this callback.
let pipeline = match pipeline_weak.upgrade() {

View file

@ -195,7 +195,7 @@ fn create_ui(app: &gtk::Application) {
// the underlying pipeline, and display it in our gui.
// Since this closure is called by the mainloop thread, we are allowed
// to modify the gui widgets here.
let timeout_id = gtk::timeout_add(500, move || {
let timeout_id = glib::timeout_add_local(500, move || {
// Here we temporarily retrieve a strong reference on the pipeline from the weak one
// we moved into this callback.
let pipeline = match pipeline_weak.upgrade() {

View file

@ -167,7 +167,7 @@ mod tutorial5 {
let pipeline = playbin.clone();
let lslider = slider.clone();
// Update the UI (seekbar) every second
let timeout_id = gtk::timeout_add_seconds(1, move || {
let timeout_id = glib::timeout_add_seconds_local(1, move || {
let pipeline = &pipeline;
let lslider = &lslider;