1use crate::{ffi, SidebarSection};
7use glib::{
8 prelude::*,
9 signal::{connect_raw, SignalHandlerId},
10 translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15 #[doc(alias = "AdwSidebarItem")]
16 pub struct SidebarItem(Object<ffi::AdwSidebarItem, ffi::AdwSidebarItemClass>);
17
18 match fn {
19 type_ => || ffi::adw_sidebar_item_get_type(),
20 }
21}
22
23impl SidebarItem {
24 pub const NONE: Option<&'static SidebarItem> = None;
25
26 #[doc(alias = "adw_sidebar_item_new")]
27 pub fn new(title: &str) -> SidebarItem {
28 assert_initialized_main_thread!();
29 unsafe { from_glib_full(ffi::adw_sidebar_item_new(title.to_glib_none().0)) }
30 }
31
32 pub fn builder() -> SidebarItemBuilder {
37 SidebarItemBuilder::new()
38 }
39}
40
41#[cfg(feature = "v1_9")]
42#[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
43impl Default for SidebarItem {
44 fn default() -> Self {
45 glib::object::Object::new::<Self>()
46 }
47}
48
49#[must_use = "The builder must be built to be used"]
54pub struct SidebarItemBuilder {
55 builder: glib::object::ObjectBuilder<'static, SidebarItem>,
56}
57
58impl SidebarItemBuilder {
59 fn new() -> Self {
60 Self {
61 builder: glib::object::Object::builder(),
62 }
63 }
64
65 #[cfg(feature = "v1_9")]
66 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
67 pub fn drag_motion_activate(self, drag_motion_activate: bool) -> Self {
68 Self {
69 builder: self
70 .builder
71 .property("drag-motion-activate", drag_motion_activate),
72 }
73 }
74
75 #[cfg(feature = "v1_9")]
76 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
77 pub fn enabled(self, enabled: bool) -> Self {
78 Self {
79 builder: self.builder.property("enabled", enabled),
80 }
81 }
82
83 #[cfg(feature = "v1_9")]
84 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
85 pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
86 Self {
87 builder: self.builder.property("icon-name", icon_name.into()),
88 }
89 }
90
91 #[cfg(feature = "v1_9")]
92 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
93 pub fn icon_paintable(self, icon_paintable: &impl IsA<gdk::Paintable>) -> Self {
94 Self {
95 builder: self
96 .builder
97 .property("icon-paintable", icon_paintable.clone().upcast()),
98 }
99 }
100
101 #[cfg(feature = "v1_9")]
102 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
103 pub fn subtitle(self, subtitle: impl Into<glib::GString>) -> Self {
104 Self {
105 builder: self.builder.property("subtitle", subtitle.into()),
106 }
107 }
108
109 #[cfg(feature = "v1_9")]
110 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
111 pub fn suffix(self, suffix: &impl IsA<gtk::Widget>) -> Self {
112 Self {
113 builder: self.builder.property("suffix", suffix.clone().upcast()),
114 }
115 }
116
117 #[cfg(feature = "v1_9")]
118 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
119 pub fn title(self, title: impl Into<glib::GString>) -> Self {
120 Self {
121 builder: self.builder.property("title", title.into()),
122 }
123 }
124
125 #[cfg(feature = "v1_9")]
126 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
127 pub fn tooltip(self, tooltip: impl Into<glib::GString>) -> Self {
128 Self {
129 builder: self.builder.property("tooltip", tooltip.into()),
130 }
131 }
132
133 #[cfg(feature = "v1_9")]
134 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
135 pub fn use_underline(self, use_underline: bool) -> Self {
136 Self {
137 builder: self.builder.property("use-underline", use_underline),
138 }
139 }
140
141 #[cfg(feature = "v1_9")]
142 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
143 pub fn visible(self, visible: bool) -> Self {
144 Self {
145 builder: self.builder.property("visible", visible),
146 }
147 }
148
149 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
152 pub fn build(self) -> SidebarItem {
153 assert_initialized_main_thread!();
154 self.builder.build()
155 }
156}
157
158pub trait SidebarItemExt: IsA<SidebarItem> + 'static {
159 #[doc(alias = "adw_sidebar_item_get_drag_motion_activate")]
160 #[doc(alias = "get_drag_motion_activate")]
161 #[doc(alias = "drag-motion-activate")]
162 fn is_drag_motion_activate(&self) -> bool {
163 unsafe {
164 from_glib(ffi::adw_sidebar_item_get_drag_motion_activate(
165 self.as_ref().to_glib_none().0,
166 ))
167 }
168 }
169
170 #[doc(alias = "adw_sidebar_item_get_enabled")]
171 #[doc(alias = "get_enabled")]
172 #[doc(alias = "enabled")]
173 fn is_enabled(&self) -> bool {
174 unsafe {
175 from_glib(ffi::adw_sidebar_item_get_enabled(
176 self.as_ref().to_glib_none().0,
177 ))
178 }
179 }
180
181 #[doc(alias = "adw_sidebar_item_get_icon_name")]
182 #[doc(alias = "get_icon_name")]
183 #[doc(alias = "icon-name")]
184 fn icon_name(&self) -> Option<glib::GString> {
185 unsafe {
186 from_glib_none(ffi::adw_sidebar_item_get_icon_name(
187 self.as_ref().to_glib_none().0,
188 ))
189 }
190 }
191
192 #[doc(alias = "adw_sidebar_item_get_icon_paintable")]
193 #[doc(alias = "get_icon_paintable")]
194 #[doc(alias = "icon-paintable")]
195 fn icon_paintable(&self) -> Option<gdk::Paintable> {
196 unsafe {
197 from_glib_none(ffi::adw_sidebar_item_get_icon_paintable(
198 self.as_ref().to_glib_none().0,
199 ))
200 }
201 }
202
203 #[doc(alias = "adw_sidebar_item_get_index")]
204 #[doc(alias = "get_index")]
205 fn index(&self) -> u32 {
206 unsafe { ffi::adw_sidebar_item_get_index(self.as_ref().to_glib_none().0) }
207 }
208
209 #[doc(alias = "adw_sidebar_item_get_section")]
210 #[doc(alias = "get_section")]
211 fn section(&self) -> Option<SidebarSection> {
212 unsafe {
213 from_glib_none(ffi::adw_sidebar_item_get_section(
214 self.as_ref().to_glib_none().0,
215 ))
216 }
217 }
218
219 #[doc(alias = "adw_sidebar_item_get_section_index")]
220 #[doc(alias = "get_section_index")]
221 fn section_index(&self) -> u32 {
222 unsafe { ffi::adw_sidebar_item_get_section_index(self.as_ref().to_glib_none().0) }
223 }
224
225 #[doc(alias = "adw_sidebar_item_get_subtitle")]
226 #[doc(alias = "get_subtitle")]
227 fn subtitle(&self) -> Option<glib::GString> {
228 unsafe {
229 from_glib_none(ffi::adw_sidebar_item_get_subtitle(
230 self.as_ref().to_glib_none().0,
231 ))
232 }
233 }
234
235 #[doc(alias = "adw_sidebar_item_get_suffix")]
236 #[doc(alias = "get_suffix")]
237 fn suffix(&self) -> Option<gtk::Widget> {
238 unsafe {
239 from_glib_none(ffi::adw_sidebar_item_get_suffix(
240 self.as_ref().to_glib_none().0,
241 ))
242 }
243 }
244
245 #[doc(alias = "adw_sidebar_item_get_title")]
246 #[doc(alias = "get_title")]
247 fn title(&self) -> Option<glib::GString> {
248 unsafe {
249 from_glib_none(ffi::adw_sidebar_item_get_title(
250 self.as_ref().to_glib_none().0,
251 ))
252 }
253 }
254
255 #[doc(alias = "adw_sidebar_item_get_tooltip")]
256 #[doc(alias = "get_tooltip")]
257 fn tooltip(&self) -> Option<glib::GString> {
258 unsafe {
259 from_glib_none(ffi::adw_sidebar_item_get_tooltip(
260 self.as_ref().to_glib_none().0,
261 ))
262 }
263 }
264
265 #[doc(alias = "adw_sidebar_item_get_use_underline")]
266 #[doc(alias = "get_use_underline")]
267 #[doc(alias = "use-underline")]
268 fn uses_underline(&self) -> bool {
269 unsafe {
270 from_glib(ffi::adw_sidebar_item_get_use_underline(
271 self.as_ref().to_glib_none().0,
272 ))
273 }
274 }
275
276 #[doc(alias = "adw_sidebar_item_get_visible")]
277 #[doc(alias = "get_visible")]
278 #[doc(alias = "visible")]
279 fn is_visible(&self) -> bool {
280 unsafe {
281 from_glib(ffi::adw_sidebar_item_get_visible(
282 self.as_ref().to_glib_none().0,
283 ))
284 }
285 }
286
287 #[doc(alias = "adw_sidebar_item_set_drag_motion_activate")]
288 #[doc(alias = "drag-motion-activate")]
289 fn set_drag_motion_activate(&self, drag_motion_activate: bool) {
290 unsafe {
291 ffi::adw_sidebar_item_set_drag_motion_activate(
292 self.as_ref().to_glib_none().0,
293 drag_motion_activate.into_glib(),
294 );
295 }
296 }
297
298 #[doc(alias = "adw_sidebar_item_set_enabled")]
299 #[doc(alias = "enabled")]
300 fn set_enabled(&self, enabled: bool) {
301 unsafe {
302 ffi::adw_sidebar_item_set_enabled(self.as_ref().to_glib_none().0, enabled.into_glib());
303 }
304 }
305
306 #[doc(alias = "adw_sidebar_item_set_icon_name")]
307 #[doc(alias = "icon-name")]
308 fn set_icon_name(&self, icon_name: Option<&str>) {
309 unsafe {
310 ffi::adw_sidebar_item_set_icon_name(
311 self.as_ref().to_glib_none().0,
312 icon_name.to_glib_none().0,
313 );
314 }
315 }
316
317 #[doc(alias = "adw_sidebar_item_set_icon_paintable")]
318 #[doc(alias = "icon-paintable")]
319 fn set_icon_paintable(&self, paintable: Option<&impl IsA<gdk::Paintable>>) {
320 unsafe {
321 ffi::adw_sidebar_item_set_icon_paintable(
322 self.as_ref().to_glib_none().0,
323 paintable.map(|p| p.as_ref()).to_glib_none().0,
324 );
325 }
326 }
327
328 #[doc(alias = "adw_sidebar_item_set_subtitle")]
329 #[doc(alias = "subtitle")]
330 fn set_subtitle(&self, subtitle: Option<&str>) {
331 unsafe {
332 ffi::adw_sidebar_item_set_subtitle(
333 self.as_ref().to_glib_none().0,
334 subtitle.to_glib_none().0,
335 );
336 }
337 }
338
339 #[doc(alias = "adw_sidebar_item_set_suffix")]
340 #[doc(alias = "suffix")]
341 fn set_suffix(&self, suffix: Option<&impl IsA<gtk::Widget>>) {
342 unsafe {
343 ffi::adw_sidebar_item_set_suffix(
344 self.as_ref().to_glib_none().0,
345 suffix.map(|p| p.as_ref()).to_glib_none().0,
346 );
347 }
348 }
349
350 #[doc(alias = "adw_sidebar_item_set_title")]
351 #[doc(alias = "title")]
352 fn set_title(&self, title: Option<&str>) {
353 unsafe {
354 ffi::adw_sidebar_item_set_title(self.as_ref().to_glib_none().0, title.to_glib_none().0);
355 }
356 }
357
358 #[doc(alias = "adw_sidebar_item_set_tooltip")]
359 #[doc(alias = "tooltip")]
360 fn set_tooltip(&self, tooltip: Option<&str>) {
361 unsafe {
362 ffi::adw_sidebar_item_set_tooltip(
363 self.as_ref().to_glib_none().0,
364 tooltip.to_glib_none().0,
365 );
366 }
367 }
368
369 #[doc(alias = "adw_sidebar_item_set_use_underline")]
370 #[doc(alias = "use-underline")]
371 fn set_use_underline(&self, use_underline: bool) {
372 unsafe {
373 ffi::adw_sidebar_item_set_use_underline(
374 self.as_ref().to_glib_none().0,
375 use_underline.into_glib(),
376 );
377 }
378 }
379
380 #[doc(alias = "adw_sidebar_item_set_visible")]
381 #[doc(alias = "visible")]
382 fn set_visible(&self, visible: bool) {
383 unsafe {
384 ffi::adw_sidebar_item_set_visible(self.as_ref().to_glib_none().0, visible.into_glib());
385 }
386 }
387
388 #[cfg(feature = "v1_9")]
389 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
390 #[doc(alias = "drag-motion-activate")]
391 fn connect_drag_motion_activate_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
392 unsafe extern "C" fn notify_drag_motion_activate_trampoline<
393 P: IsA<SidebarItem>,
394 F: Fn(&P) + 'static,
395 >(
396 this: *mut ffi::AdwSidebarItem,
397 _param_spec: glib::ffi::gpointer,
398 f: glib::ffi::gpointer,
399 ) {
400 let f: &F = &*(f as *const F);
401 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
402 }
403 unsafe {
404 let f: Box_<F> = Box_::new(f);
405 connect_raw(
406 self.as_ptr() as *mut _,
407 c"notify::drag-motion-activate".as_ptr() as *const _,
408 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
409 notify_drag_motion_activate_trampoline::<Self, F> as *const (),
410 )),
411 Box_::into_raw(f),
412 )
413 }
414 }
415
416 #[cfg(feature = "v1_9")]
417 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
418 #[doc(alias = "enabled")]
419 fn connect_enabled_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
420 unsafe extern "C" fn notify_enabled_trampoline<P: IsA<SidebarItem>, F: Fn(&P) + 'static>(
421 this: *mut ffi::AdwSidebarItem,
422 _param_spec: glib::ffi::gpointer,
423 f: glib::ffi::gpointer,
424 ) {
425 let f: &F = &*(f as *const F);
426 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
427 }
428 unsafe {
429 let f: Box_<F> = Box_::new(f);
430 connect_raw(
431 self.as_ptr() as *mut _,
432 c"notify::enabled".as_ptr() as *const _,
433 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
434 notify_enabled_trampoline::<Self, F> as *const (),
435 )),
436 Box_::into_raw(f),
437 )
438 }
439 }
440
441 #[cfg(feature = "v1_9")]
442 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
443 #[doc(alias = "icon-name")]
444 fn connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
445 unsafe extern "C" fn notify_icon_name_trampoline<
446 P: IsA<SidebarItem>,
447 F: Fn(&P) + 'static,
448 >(
449 this: *mut ffi::AdwSidebarItem,
450 _param_spec: glib::ffi::gpointer,
451 f: glib::ffi::gpointer,
452 ) {
453 let f: &F = &*(f as *const F);
454 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
455 }
456 unsafe {
457 let f: Box_<F> = Box_::new(f);
458 connect_raw(
459 self.as_ptr() as *mut _,
460 c"notify::icon-name".as_ptr() as *const _,
461 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
462 notify_icon_name_trampoline::<Self, F> as *const (),
463 )),
464 Box_::into_raw(f),
465 )
466 }
467 }
468
469 #[cfg(feature = "v1_9")]
470 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
471 #[doc(alias = "icon-paintable")]
472 fn connect_icon_paintable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
473 unsafe extern "C" fn notify_icon_paintable_trampoline<
474 P: IsA<SidebarItem>,
475 F: Fn(&P) + 'static,
476 >(
477 this: *mut ffi::AdwSidebarItem,
478 _param_spec: glib::ffi::gpointer,
479 f: glib::ffi::gpointer,
480 ) {
481 let f: &F = &*(f as *const F);
482 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
483 }
484 unsafe {
485 let f: Box_<F> = Box_::new(f);
486 connect_raw(
487 self.as_ptr() as *mut _,
488 c"notify::icon-paintable".as_ptr() as *const _,
489 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
490 notify_icon_paintable_trampoline::<Self, F> as *const (),
491 )),
492 Box_::into_raw(f),
493 )
494 }
495 }
496
497 #[cfg(feature = "v1_9")]
498 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
499 #[doc(alias = "section")]
500 fn connect_section_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
501 unsafe extern "C" fn notify_section_trampoline<P: IsA<SidebarItem>, F: Fn(&P) + 'static>(
502 this: *mut ffi::AdwSidebarItem,
503 _param_spec: glib::ffi::gpointer,
504 f: glib::ffi::gpointer,
505 ) {
506 let f: &F = &*(f as *const F);
507 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
508 }
509 unsafe {
510 let f: Box_<F> = Box_::new(f);
511 connect_raw(
512 self.as_ptr() as *mut _,
513 c"notify::section".as_ptr() as *const _,
514 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
515 notify_section_trampoline::<Self, F> as *const (),
516 )),
517 Box_::into_raw(f),
518 )
519 }
520 }
521
522 #[cfg(feature = "v1_9")]
523 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
524 #[doc(alias = "subtitle")]
525 fn connect_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
526 unsafe extern "C" fn notify_subtitle_trampoline<
527 P: IsA<SidebarItem>,
528 F: Fn(&P) + 'static,
529 >(
530 this: *mut ffi::AdwSidebarItem,
531 _param_spec: glib::ffi::gpointer,
532 f: glib::ffi::gpointer,
533 ) {
534 let f: &F = &*(f as *const F);
535 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
536 }
537 unsafe {
538 let f: Box_<F> = Box_::new(f);
539 connect_raw(
540 self.as_ptr() as *mut _,
541 c"notify::subtitle".as_ptr() as *const _,
542 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
543 notify_subtitle_trampoline::<Self, F> as *const (),
544 )),
545 Box_::into_raw(f),
546 )
547 }
548 }
549
550 #[cfg(feature = "v1_9")]
551 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
552 #[doc(alias = "suffix")]
553 fn connect_suffix_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
554 unsafe extern "C" fn notify_suffix_trampoline<P: IsA<SidebarItem>, F: Fn(&P) + 'static>(
555 this: *mut ffi::AdwSidebarItem,
556 _param_spec: glib::ffi::gpointer,
557 f: glib::ffi::gpointer,
558 ) {
559 let f: &F = &*(f as *const F);
560 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
561 }
562 unsafe {
563 let f: Box_<F> = Box_::new(f);
564 connect_raw(
565 self.as_ptr() as *mut _,
566 c"notify::suffix".as_ptr() as *const _,
567 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
568 notify_suffix_trampoline::<Self, F> as *const (),
569 )),
570 Box_::into_raw(f),
571 )
572 }
573 }
574
575 #[cfg(feature = "v1_9")]
576 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
577 #[doc(alias = "title")]
578 fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
579 unsafe extern "C" fn notify_title_trampoline<P: IsA<SidebarItem>, F: Fn(&P) + 'static>(
580 this: *mut ffi::AdwSidebarItem,
581 _param_spec: glib::ffi::gpointer,
582 f: glib::ffi::gpointer,
583 ) {
584 let f: &F = &*(f as *const F);
585 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
586 }
587 unsafe {
588 let f: Box_<F> = Box_::new(f);
589 connect_raw(
590 self.as_ptr() as *mut _,
591 c"notify::title".as_ptr() as *const _,
592 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
593 notify_title_trampoline::<Self, F> as *const (),
594 )),
595 Box_::into_raw(f),
596 )
597 }
598 }
599
600 #[cfg(feature = "v1_9")]
601 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
602 #[doc(alias = "tooltip")]
603 fn connect_tooltip_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
604 unsafe extern "C" fn notify_tooltip_trampoline<P: IsA<SidebarItem>, F: Fn(&P) + 'static>(
605 this: *mut ffi::AdwSidebarItem,
606 _param_spec: glib::ffi::gpointer,
607 f: glib::ffi::gpointer,
608 ) {
609 let f: &F = &*(f as *const F);
610 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
611 }
612 unsafe {
613 let f: Box_<F> = Box_::new(f);
614 connect_raw(
615 self.as_ptr() as *mut _,
616 c"notify::tooltip".as_ptr() as *const _,
617 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
618 notify_tooltip_trampoline::<Self, F> as *const (),
619 )),
620 Box_::into_raw(f),
621 )
622 }
623 }
624
625 #[cfg(feature = "v1_9")]
626 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
627 #[doc(alias = "use-underline")]
628 fn connect_use_underline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
629 unsafe extern "C" fn notify_use_underline_trampoline<
630 P: IsA<SidebarItem>,
631 F: Fn(&P) + 'static,
632 >(
633 this: *mut ffi::AdwSidebarItem,
634 _param_spec: glib::ffi::gpointer,
635 f: glib::ffi::gpointer,
636 ) {
637 let f: &F = &*(f as *const F);
638 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
639 }
640 unsafe {
641 let f: Box_<F> = Box_::new(f);
642 connect_raw(
643 self.as_ptr() as *mut _,
644 c"notify::use-underline".as_ptr() as *const _,
645 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
646 notify_use_underline_trampoline::<Self, F> as *const (),
647 )),
648 Box_::into_raw(f),
649 )
650 }
651 }
652
653 #[cfg(feature = "v1_9")]
654 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
655 #[doc(alias = "visible")]
656 fn connect_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
657 unsafe extern "C" fn notify_visible_trampoline<P: IsA<SidebarItem>, F: Fn(&P) + 'static>(
658 this: *mut ffi::AdwSidebarItem,
659 _param_spec: glib::ffi::gpointer,
660 f: glib::ffi::gpointer,
661 ) {
662 let f: &F = &*(f as *const F);
663 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
664 }
665 unsafe {
666 let f: Box_<F> = Box_::new(f);
667 connect_raw(
668 self.as_ptr() as *mut _,
669 c"notify::visible".as_ptr() as *const _,
670 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
671 notify_visible_trampoline::<Self, F> as *const (),
672 )),
673 Box_::into_raw(f),
674 )
675 }
676 }
677}
678
679impl<O: IsA<SidebarItem>> SidebarItemExt for O {}