diff --git a/examples/dialog/main.rs b/examples/dialog/main.rs index 746ed62c0caf..bd462e751070 100644 --- a/examples/dialog/main.rs +++ b/examples/dialog/main.rs @@ -1,5 +1,4 @@ -use gtk::glib::signal::Inhibit; -use gtk::glib::{self, clone}; +use gtk::glib::{self, clone, ControlFlow}; use gtk::prelude::*; use std::rc::Rc; @@ -41,7 +40,7 @@ fn build_ui(application: >k::Application) { if let Some(application) = window.application() { application.remove_window(window); } - Inhibit(false) + ControlFlow::Break }); } diff --git a/gtk4/src/event_controller_key.rs b/gtk4/src/event_controller_key.rs index 3777fb9194e8..dcb1f3b35656 100644 --- a/gtk4/src/event_controller_key.rs +++ b/gtk4/src/event_controller_key.rs @@ -7,13 +7,13 @@ use std::{boxed::Box as Box_, mem::transmute}; impl EventControllerKey { pub fn connect_key_pressed< - F: Fn(&EventControllerKey, Key, u32, gdk::ModifierType) -> glib::signal::Inhibit + 'static, + F: Fn(&EventControllerKey, Key, u32, gdk::ModifierType) -> glib::ControlFlow + 'static, >( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn key_pressed_trampoline< - F: Fn(&EventControllerKey, Key, u32, gdk::ModifierType) -> glib::signal::Inhibit + 'static, + F: Fn(&EventControllerKey, Key, u32, gdk::ModifierType) -> glib::ControlFlow + 'static, >( this: *mut ffi::GtkEventControllerKey, keyval: libc::c_uint, diff --git a/gtk4/src/lib.rs b/gtk4/src/lib.rs index 13f623f53809..3101d4a951ed 100644 --- a/gtk4/src/lib.rs +++ b/gtk4/src/lib.rs @@ -206,7 +206,6 @@ pub use css_location::CssLocation; pub use enums::Align; pub use expression_watch::ExpressionWatch; pub use functions::*; -pub use glib::signal::Inhibit; pub use keyval_trigger::KeyvalTrigger; pub use mnemonic_trigger::MnemonicTrigger; pub use pad_action_entry::PadActionEntry; diff --git a/gtk4/src/subclass/text_view.rs b/gtk4/src/subclass/text_view.rs index d9f4609d9519..80c9136ba2ae 100644 --- a/gtk4/src/subclass/text_view.rs +++ b/gtk4/src/subclass/text_view.rs @@ -32,7 +32,7 @@ pub trait TextViewImpl: TextViewImplExt + WidgetImpl { location: &TextIter, start: &mut TextIter, end: &mut TextIter, - ) -> glib::signal::Inhibit { + ) -> glib::ControlFlow { self.parent_extend_selection(granularity, location, start, end) } @@ -121,20 +121,20 @@ pub trait TextViewImplExt: sealed::Sealed + ObjectSubclass { location: &TextIter, start: &mut TextIter, end: &mut TextIter, - ) -> glib::signal::Inhibit { + ) -> glib::ControlFlow { unsafe { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::GtkTextViewClass; if let Some(f) = (*parent_class).extend_selection { - glib::signal::Inhibit(from_glib(f( + glib::ControlFlow::from_glib(f( self.obj().unsafe_cast_ref::().to_glib_none().0, granularity.into_glib(), location.to_glib_none().0, start.to_glib_none_mut().0, end.to_glib_none_mut().0, - ))) + )) } else { - glib::signal::Inhibit(false) + glib::ControlFlow::Break } } } diff --git a/gtk4/src/subclass/window.rs b/gtk4/src/subclass/window.rs index 57ae883c81de..9fa1a27d3025 100644 --- a/gtk4/src/subclass/window.rs +++ b/gtk4/src/subclass/window.rs @@ -23,7 +23,7 @@ pub trait WindowImpl: WindowImplExt + WidgetImpl { self.parent_enable_debugging(toggle) } - fn close_request(&self) -> glib::signal::Inhibit { + fn close_request(&self) -> glib::ControlFlow { self.parent_close_request() } } @@ -81,18 +81,14 @@ pub trait WindowImplExt: sealed::Sealed + ObjectSubclass { } } - fn parent_close_request(&self) -> glib::signal::Inhibit { + fn parent_close_request(&self) -> glib::ControlFlow { unsafe { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::GtkWindowClass; let f = (*parent_class) .close_request .expect("No parent class impl for \"close_request\""); - glib::signal::Inhibit(from_glib(f(self - .obj() - .unsafe_cast_ref::() - .to_glib_none() - .0))) + glib::ControlFlow::from_glib(f(self.obj().unsafe_cast_ref::().to_glib_none().0)) } } }