Skip to content

Commit 1af865b

Browse files
Adapt to renamed glib::Continue
1 parent 4535079 commit 1af865b

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed

examples/clock/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ fn build_ui(application: &Application) {
2828
let tick = move || {
2929
let time = current_time();
3030
label.set_text(&time);
31-
// we could return gtk::Continue(false) to stop our clock after this tick
32-
glib::Continue(true)
31+
// we could return glib::ControlFlow::Break to stop our clock after this tick
32+
glib::ControlFlow::Continue
3333
};
3434

3535
// executes the closure once every second

examples/confetti_snapshot_animation/animated_explosion/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ impl AnimatedExplosion {
2323
imp.lastupdate.replace(time);
2424
imp.duration.replace(duration);
2525
}
26-
// Returns glib::source::Continue(false) if the animation is finished
27-
pub(super) fn update(&self, clock: &gdk::FrameClock) -> Continue {
26+
// Returns glib::ControlFlow::Break if the animation is finished
27+
pub(super) fn update(&self, clock: &gdk::FrameClock) -> glib::ControlFlow {
2828
let imp = self.imp();
2929

3030
// Time tracking to correctly update the physics simulation.
@@ -41,7 +41,7 @@ impl AnimatedExplosion {
4141
if !imp.finished.get() && time - imp.start.get() >= imp.duration.get() {
4242
imp.finished.replace(true);
4343
}
44-
Continue(!imp.finished.get())
44+
glib::ControlFlow::from(!imp.finished.get())
4545
}
4646

4747
pub(super) fn draw(&self, snapshot: &gtk::Snapshot) {

examples/confetti_snapshot_animation/confetti_widget/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
mod imp;
22

33
use crate::{AnimatedExplosion, ExplosionParameters};
4-
use glib::clone;
54
use glib::subclass::prelude::*;
5+
use glib::{clone, ControlFlow};
66
use gtk::glib;
77
use gtk::prelude::*;
88

@@ -30,10 +30,10 @@ impl ConfettiWidget {
3030

3131
frame_clock.connect_update(clone!(@weak self as this, @weak exp => move |clock| {
3232
match exp.update(clock) {
33-
Continue(true) => {
33+
ControlFlow::Continue => {
3434
this.queue_draw();
3535
},
36-
Continue(false) => {
36+
ControlFlow::Break => {
3737
this.imp().explosions.borrow_mut().remove(&exp);
3838
clock.end_updating();
3939
}

examples/custom_layout_manager/simple_widget/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl SimpleWidget {
4141
imp.tick_id.replace(Some(tick_id));
4242
}
4343

44-
pub fn transition(&self) -> glib::Continue {
44+
pub fn transition(&self) -> glib::ControlFlow {
4545
let imp = self.imp();
4646
let now = std::time::Instant::now();
4747
self.queue_allocate();
@@ -73,9 +73,9 @@ impl SimpleWidget {
7373
layout_manager.set_position(0.0);
7474
}
7575
let _ = imp.tick_id.borrow_mut().take();
76-
return glib::Continue(false);
76+
return glib::ControlFlow::Break;
7777
}
7878

79-
glib::Continue(true)
79+
glib::ControlFlow::Continue
8080
}
8181
}

examples/femtovg_area/femtovg_area/imp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl ObjectImpl for FemtoVGArea {
4141
area.set_has_stencil_buffer(true);
4242
area.add_tick_callback(|area, _| {
4343
area.queue_render();
44-
glib::Continue(true)
44+
glib::ControlFlow::Continue
4545
});
4646
let click = gtk::GestureClick::new();
4747
let a = area.clone();

gdk4-x11/src/x11_display.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ impl X11Display {
6868
#[cfg(any(feature = "xlib", docsrs))]
6969
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
7070
#[doc(alias = "xevent")]
71-
pub unsafe fn connect_xevent<F: Fn(&Self, *mut xlib::XEvent) -> glib::Continue + 'static>(
71+
pub unsafe fn connect_xevent<F: Fn(&Self, *mut xlib::XEvent) -> glib::ControlFlow + 'static>(
7272
&self,
7373
f: F,
7474
) -> SignalHandlerId {
7575
unsafe extern "C" fn xevent_trampoline<
76-
F: Fn(&X11Display, *mut xlib::XEvent) -> glib::Continue + 'static,
76+
F: Fn(&X11Display, *mut xlib::XEvent) -> glib::ControlFlow + 'static,
7777
>(
7878
this: *mut ffi::GdkX11Display,
7979
xevent: glib::ffi::gpointer,

gtk4/src/widget.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use crate::{prelude::*, Widget};
44

5-
use glib::{translate::*, Continue, WeakRef};
5+
use glib::{translate::*, ControlFlow, WeakRef};
66

77
mod sealed {
88
pub trait Sealed {}
@@ -13,15 +13,15 @@ mod sealed {
1313
/// Trait containing manually implemented methods of [`Widget`](crate::Widget).
1414
pub trait WidgetExtManual: sealed::Sealed + IsA<Widget> + 'static {
1515
#[doc(alias = "gtk_widget_add_tick_callback")]
16-
fn add_tick_callback<P: Fn(&Self, &gdk::FrameClock) -> Continue + 'static>(
16+
fn add_tick_callback<P: Fn(&Self, &gdk::FrameClock) -> ControlFlow + 'static>(
1717
&self,
1818
callback: P,
1919
) -> TickCallbackId {
2020
let callback_data: Box<P> = Box::new(callback);
2121

2222
unsafe extern "C" fn callback_func<
2323
O: IsA<Widget>,
24-
P: Fn(&O, &gdk::FrameClock) -> Continue + 'static,
24+
P: Fn(&O, &gdk::FrameClock) -> ControlFlow + 'static,
2525
>(
2626
widget: *mut ffi::GtkWidget,
2727
frame_clock: *mut gdk::ffi::GdkFrameClock,
@@ -37,7 +37,7 @@ pub trait WidgetExtManual: sealed::Sealed + IsA<Widget> + 'static {
3737

3838
unsafe extern "C" fn notify_func<
3939
O: IsA<Widget>,
40-
P: Fn(&O, &gdk::FrameClock) -> Continue + 'static,
40+
P: Fn(&O, &gdk::FrameClock) -> ControlFlow + 'static,
4141
>(
4242
data: glib::ffi::gpointer,
4343
) {

0 commit comments

Comments
 (0)