@@ -146,3 +146,81 @@ pub fn signal_has_handler_pending<T: ObjectType>(
146
146
) )
147
147
}
148
148
}
149
+
150
+ // rustdoc-stripper-ignore-next
151
+ /// Whether to invoke the other event handlers.
152
+ #[ derive( Copy , Clone , Debug , PartialEq , Eq ) ]
153
+ pub enum Propagation {
154
+ // Stop other handlers from being invoked for the event.
155
+ Stop ,
156
+ // Propagate the event further.
157
+ Proceed ,
158
+ }
159
+
160
+ impl Propagation {
161
+ // rustdoc-stripper-ignore-next
162
+ /// Returns `true` if this is a `Stop` variant.
163
+ pub fn is_stop ( & self ) -> bool {
164
+ matches ! ( self , Self :: Stop )
165
+ }
166
+
167
+ // rustdoc-stripper-ignore-next
168
+ /// Returns `true` if this is a `Proceed` variant.
169
+ pub fn is_proceed ( & self ) -> bool {
170
+ matches ! ( self , Self :: Proceed )
171
+ }
172
+ }
173
+
174
+ impl From < bool > for Propagation {
175
+ fn from ( value : bool ) -> Self {
176
+ if value {
177
+ Self :: Stop
178
+ } else {
179
+ Self :: Proceed
180
+ }
181
+ }
182
+ }
183
+
184
+ impl From < Propagation > for bool {
185
+ fn from ( c : Propagation ) -> Self {
186
+ match c {
187
+ Propagation :: Stop => true ,
188
+ Propagation :: Proceed => false ,
189
+ }
190
+ }
191
+ }
192
+
193
+ #[ doc( hidden) ]
194
+ impl IntoGlib for Propagation {
195
+ type GlibType = ffi:: gboolean ;
196
+
197
+ #[ inline]
198
+ fn into_glib ( self ) -> ffi:: gboolean {
199
+ bool:: from ( self ) . into_glib ( )
200
+ }
201
+ }
202
+
203
+ #[ doc( hidden) ]
204
+ impl FromGlib < ffi:: gboolean > for Propagation {
205
+ #[ inline]
206
+ unsafe fn from_glib ( value : ffi:: gboolean ) -> Self {
207
+ bool:: from_glib ( value) . into ( )
208
+ }
209
+ }
210
+
211
+ impl crate :: ToValue for Propagation {
212
+ fn to_value ( & self ) -> crate :: Value {
213
+ bool:: from ( * self ) . to_value ( )
214
+ }
215
+
216
+ fn value_type ( & self ) -> crate :: Type {
217
+ <bool as crate :: StaticType >:: static_type ( )
218
+ }
219
+ }
220
+
221
+ impl From < Propagation > for crate :: Value {
222
+ #[ inline]
223
+ fn from ( v : Propagation ) -> Self {
224
+ bool:: from ( v) . into ( )
225
+ }
226
+ }
0 commit comments