Skip to content

Commit af9f9ad

Browse files
Adapt to removal of glib::Inhibit
1 parent 4b8ff9f commit af9f9ad

File tree

5 files changed

+12
-18
lines changed

5 files changed

+12
-18
lines changed

examples/dialog/main.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use gtk::glib::signal::Inhibit;
2-
use gtk::glib::{self, clone};
1+
use gtk::glib::{self, clone, ControlFlow};
32
use gtk::prelude::*;
43

54
use std::rc::Rc;
@@ -41,7 +40,7 @@ fn build_ui(application: &gtk::Application) {
4140
if let Some(application) = window.application() {
4241
application.remove_window(window);
4342
}
44-
Inhibit(false)
43+
ControlFlow::Break
4544
});
4645
}
4746

gtk4/src/event_controller_key.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ use std::{boxed::Box as Box_, mem::transmute};
77

88
impl EventControllerKey {
99
pub fn connect_key_pressed<
10-
F: Fn(&EventControllerKey, Key, u32, gdk::ModifierType) -> glib::signal::Inhibit + 'static,
10+
F: Fn(&EventControllerKey, Key, u32, gdk::ModifierType) -> glib::ControlFlow + 'static,
1111
>(
1212
&self,
1313
f: F,
1414
) -> SignalHandlerId {
1515
unsafe extern "C" fn key_pressed_trampoline<
16-
F: Fn(&EventControllerKey, Key, u32, gdk::ModifierType) -> glib::signal::Inhibit + 'static,
16+
F: Fn(&EventControllerKey, Key, u32, gdk::ModifierType) -> glib::ControlFlow + 'static,
1717
>(
1818
this: *mut ffi::GtkEventControllerKey,
1919
keyval: libc::c_uint,

gtk4/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ pub use css_location::CssLocation;
206206
pub use enums::Align;
207207
pub use expression_watch::ExpressionWatch;
208208
pub use functions::*;
209-
pub use glib::signal::Inhibit;
210209
pub use keyval_trigger::KeyvalTrigger;
211210
pub use mnemonic_trigger::MnemonicTrigger;
212211
pub use pad_action_entry::PadActionEntry;

gtk4/src/subclass/text_view.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub trait TextViewImpl: TextViewImplExt + WidgetImpl {
3232
location: &TextIter,
3333
start: &mut TextIter,
3434
end: &mut TextIter,
35-
) -> glib::signal::Inhibit {
35+
) -> glib::ControlFlow {
3636
self.parent_extend_selection(granularity, location, start, end)
3737
}
3838

@@ -121,20 +121,20 @@ pub trait TextViewImplExt: sealed::Sealed + ObjectSubclass {
121121
location: &TextIter,
122122
start: &mut TextIter,
123123
end: &mut TextIter,
124-
) -> glib::signal::Inhibit {
124+
) -> glib::ControlFlow {
125125
unsafe {
126126
let data = Self::type_data();
127127
let parent_class = data.as_ref().parent_class() as *mut ffi::GtkTextViewClass;
128128
if let Some(f) = (*parent_class).extend_selection {
129-
glib::signal::Inhibit(from_glib(f(
129+
glib::ControlFlow::from_glib(f(
130130
self.obj().unsafe_cast_ref::<TextView>().to_glib_none().0,
131131
granularity.into_glib(),
132132
location.to_glib_none().0,
133133
start.to_glib_none_mut().0,
134134
end.to_glib_none_mut().0,
135-
)))
135+
))
136136
} else {
137-
glib::signal::Inhibit(false)
137+
glib::ControlFlow::Break
138138
}
139139
}
140140
}

gtk4/src/subclass/window.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub trait WindowImpl: WindowImplExt + WidgetImpl {
2323
self.parent_enable_debugging(toggle)
2424
}
2525

26-
fn close_request(&self) -> glib::signal::Inhibit {
26+
fn close_request(&self) -> glib::ControlFlow {
2727
self.parent_close_request()
2828
}
2929
}
@@ -81,18 +81,14 @@ pub trait WindowImplExt: sealed::Sealed + ObjectSubclass {
8181
}
8282
}
8383

84-
fn parent_close_request(&self) -> glib::signal::Inhibit {
84+
fn parent_close_request(&self) -> glib::ControlFlow {
8585
unsafe {
8686
let data = Self::type_data();
8787
let parent_class = data.as_ref().parent_class() as *mut ffi::GtkWindowClass;
8888
let f = (*parent_class)
8989
.close_request
9090
.expect("No parent class impl for \"close_request\"");
91-
glib::signal::Inhibit(from_glib(f(self
92-
.obj()
93-
.unsafe_cast_ref::<Window>()
94-
.to_glib_none()
95-
.0)))
91+
glib::ControlFlow::from_glib(f(self.obj().unsafe_cast_ref::<Window>().to_glib_none().0))
9692
}
9793
}
9894
}

0 commit comments

Comments
 (0)