1use crate::{SidebarSection, ffi};
7use glib::{
8 prelude::*,
9 signal::{SignalHandlerId, connect_raw},
10 translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15 #[doc(alias = "AdwSidebarItem")]
137 pub struct SidebarItem(Object<ffi::AdwSidebarItem, ffi::AdwSidebarItemClass>);
138
139 match fn {
140 type_ => || ffi::adw_sidebar_item_get_type(),
141 }
142}
143
144impl SidebarItem {
145 pub const NONE: Option<&'static SidebarItem> = None;
146
147 #[doc(alias = "adw_sidebar_item_new")]
155 pub fn new(title: &str) -> SidebarItem {
156 assert_initialized_main_thread!();
157 unsafe { from_glib_full(ffi::adw_sidebar_item_new(title.to_glib_none().0)) }
158 }
159
160 pub fn builder() -> SidebarItemBuilder {
165 SidebarItemBuilder::new()
166 }
167}
168
169#[cfg(feature = "v1_9")]
170#[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
171impl Default for SidebarItem {
172 fn default() -> Self {
173 glib::object::Object::new::<Self>()
174 }
175}
176
177#[must_use = "The builder must be built to be used"]
182pub struct SidebarItemBuilder {
183 builder: glib::object::ObjectBuilder<'static, SidebarItem>,
184}
185
186impl SidebarItemBuilder {
187 fn new() -> Self {
188 Self {
189 builder: glib::object::Object::builder(),
190 }
191 }
192
193 #[cfg(feature = "v1_9")]
199 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
200 pub fn drag_motion_activate(self, drag_motion_activate: bool) -> Self {
201 Self {
202 builder: self
203 .builder
204 .property("drag-motion-activate", drag_motion_activate),
205 }
206 }
207
208 #[cfg(feature = "v1_9")]
212 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
213 pub fn enabled(self, enabled: bool) -> Self {
214 Self {
215 builder: self.builder.property("enabled", enabled),
216 }
217 }
218
219 #[cfg(feature = "v1_9")]
223 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
224 pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
225 Self {
226 builder: self.builder.property("icon-name", icon_name.into()),
227 }
228 }
229
230 #[cfg(feature = "v1_9")]
234 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
235 pub fn icon_paintable(self, icon_paintable: &impl IsA<gdk::Paintable>) -> Self {
236 Self {
237 builder: self
238 .builder
239 .property("icon-paintable", icon_paintable.clone().upcast()),
240 }
241 }
242
243 #[cfg(feature = "v1_9")]
245 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
246 pub fn subtitle(self, subtitle: impl Into<glib::GString>) -> Self {
247 Self {
248 builder: self.builder.property("subtitle", subtitle.into()),
249 }
250 }
251
252 #[cfg(feature = "v1_9")]
257 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
258 pub fn suffix(self, suffix: &impl IsA<gtk::Widget>) -> Self {
259 Self {
260 builder: self.builder.property("suffix", suffix.clone().upcast()),
261 }
262 }
263
264 #[cfg(feature = "v1_9")]
266 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
267 pub fn title(self, title: impl Into<glib::GString>) -> Self {
268 Self {
269 builder: self.builder.property("title", title.into()),
270 }
271 }
272
273 #[cfg(feature = "v1_9")]
277 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
278 pub fn tooltip(self, tooltip: impl Into<glib::GString>) -> Self {
279 Self {
280 builder: self.builder.property("tooltip", tooltip.into()),
281 }
282 }
283
284 #[cfg(feature = "v1_9")]
288 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
289 pub fn use_underline(self, use_underline: bool) -> Self {
290 Self {
291 builder: self.builder.property("use-underline", use_underline),
292 }
293 }
294
295 #[cfg(feature = "v1_9")]
297 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
298 pub fn visible(self, visible: bool) -> Self {
299 Self {
300 builder: self.builder.property("visible", visible),
301 }
302 }
303
304 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
307 pub fn build(self) -> SidebarItem {
308 assert_initialized_main_thread!();
309 self.builder.build()
310 }
311}
312
313pub trait SidebarItemExt: IsA<SidebarItem> + 'static {
319 #[doc(alias = "adw_sidebar_item_get_drag_motion_activate")]
325 #[doc(alias = "get_drag_motion_activate")]
326 #[doc(alias = "drag-motion-activate")]
327 fn is_drag_motion_activate(&self) -> bool {
328 unsafe {
329 from_glib(ffi::adw_sidebar_item_get_drag_motion_activate(
330 self.as_ref().to_glib_none().0,
331 ))
332 }
333 }
334
335 #[doc(alias = "adw_sidebar_item_get_enabled")]
341 #[doc(alias = "get_enabled")]
342 #[doc(alias = "enabled")]
343 fn is_enabled(&self) -> bool {
344 unsafe {
345 from_glib(ffi::adw_sidebar_item_get_enabled(
346 self.as_ref().to_glib_none().0,
347 ))
348 }
349 }
350
351 #[doc(alias = "adw_sidebar_item_get_icon_name")]
357 #[doc(alias = "get_icon_name")]
358 #[doc(alias = "icon-name")]
359 fn icon_name(&self) -> Option<glib::GString> {
360 unsafe {
361 from_glib_none(ffi::adw_sidebar_item_get_icon_name(
362 self.as_ref().to_glib_none().0,
363 ))
364 }
365 }
366
367 #[doc(alias = "adw_sidebar_item_get_icon_paintable")]
373 #[doc(alias = "get_icon_paintable")]
374 #[doc(alias = "icon-paintable")]
375 fn icon_paintable(&self) -> Option<gdk::Paintable> {
376 unsafe {
377 from_glib_none(ffi::adw_sidebar_item_get_icon_paintable(
378 self.as_ref().to_glib_none().0,
379 ))
380 }
381 }
382
383 #[doc(alias = "adw_sidebar_item_get_index")]
397 #[doc(alias = "get_index")]
398 fn index(&self) -> u32 {
399 unsafe { ffi::adw_sidebar_item_get_index(self.as_ref().to_glib_none().0) }
400 }
401
402 #[doc(alias = "adw_sidebar_item_get_section")]
408 #[doc(alias = "get_section")]
409 fn section(&self) -> Option<SidebarSection> {
410 unsafe {
411 from_glib_none(ffi::adw_sidebar_item_get_section(
412 self.as_ref().to_glib_none().0,
413 ))
414 }
415 }
416
417 #[doc(alias = "adw_sidebar_item_get_section_index")]
428 #[doc(alias = "get_section_index")]
429 fn section_index(&self) -> u32 {
430 unsafe { ffi::adw_sidebar_item_get_section_index(self.as_ref().to_glib_none().0) }
431 }
432
433 #[doc(alias = "adw_sidebar_item_get_subtitle")]
439 #[doc(alias = "get_subtitle")]
440 fn subtitle(&self) -> Option<glib::GString> {
441 unsafe {
442 from_glib_none(ffi::adw_sidebar_item_get_subtitle(
443 self.as_ref().to_glib_none().0,
444 ))
445 }
446 }
447
448 #[doc(alias = "adw_sidebar_item_get_suffix")]
454 #[doc(alias = "get_suffix")]
455 fn suffix(&self) -> Option<gtk::Widget> {
456 unsafe {
457 from_glib_none(ffi::adw_sidebar_item_get_suffix(
458 self.as_ref().to_glib_none().0,
459 ))
460 }
461 }
462
463 #[doc(alias = "adw_sidebar_item_get_title")]
469 #[doc(alias = "get_title")]
470 fn title(&self) -> Option<glib::GString> {
471 unsafe {
472 from_glib_none(ffi::adw_sidebar_item_get_title(
473 self.as_ref().to_glib_none().0,
474 ))
475 }
476 }
477
478 #[doc(alias = "adw_sidebar_item_get_tooltip")]
484 #[doc(alias = "get_tooltip")]
485 fn tooltip(&self) -> Option<glib::GString> {
486 unsafe {
487 from_glib_none(ffi::adw_sidebar_item_get_tooltip(
488 self.as_ref().to_glib_none().0,
489 ))
490 }
491 }
492
493 #[doc(alias = "adw_sidebar_item_get_use_underline")]
499 #[doc(alias = "get_use_underline")]
500 #[doc(alias = "use-underline")]
501 fn uses_underline(&self) -> bool {
502 unsafe {
503 from_glib(ffi::adw_sidebar_item_get_use_underline(
504 self.as_ref().to_glib_none().0,
505 ))
506 }
507 }
508
509 #[doc(alias = "adw_sidebar_item_get_visible")]
515 #[doc(alias = "get_visible")]
516 #[doc(alias = "visible")]
517 fn is_visible(&self) -> bool {
518 unsafe {
519 from_glib(ffi::adw_sidebar_item_get_visible(
520 self.as_ref().to_glib_none().0,
521 ))
522 }
523 }
524
525 #[doc(alias = "adw_sidebar_item_set_drag_motion_activate")]
533 #[doc(alias = "drag-motion-activate")]
534 fn set_drag_motion_activate(&self, drag_motion_activate: bool) {
535 unsafe {
536 ffi::adw_sidebar_item_set_drag_motion_activate(
537 self.as_ref().to_glib_none().0,
538 drag_motion_activate.into_glib(),
539 );
540 }
541 }
542
543 #[doc(alias = "adw_sidebar_item_set_enabled")]
549 #[doc(alias = "enabled")]
550 fn set_enabled(&self, enabled: bool) {
551 unsafe {
552 ffi::adw_sidebar_item_set_enabled(self.as_ref().to_glib_none().0, enabled.into_glib());
553 }
554 }
555
556 #[doc(alias = "adw_sidebar_item_set_icon_name")]
562 #[doc(alias = "icon-name")]
563 fn set_icon_name(&self, icon_name: Option<&str>) {
564 unsafe {
565 ffi::adw_sidebar_item_set_icon_name(
566 self.as_ref().to_glib_none().0,
567 icon_name.to_glib_none().0,
568 );
569 }
570 }
571
572 #[doc(alias = "adw_sidebar_item_set_icon_paintable")]
578 #[doc(alias = "icon-paintable")]
579 fn set_icon_paintable(&self, paintable: Option<&impl IsA<gdk::Paintable>>) {
580 unsafe {
581 ffi::adw_sidebar_item_set_icon_paintable(
582 self.as_ref().to_glib_none().0,
583 paintable.map(|p| p.as_ref()).to_glib_none().0,
584 );
585 }
586 }
587
588 #[doc(alias = "adw_sidebar_item_set_subtitle")]
592 #[doc(alias = "subtitle")]
593 fn set_subtitle(&self, subtitle: Option<&str>) {
594 unsafe {
595 ffi::adw_sidebar_item_set_subtitle(
596 self.as_ref().to_glib_none().0,
597 subtitle.to_glib_none().0,
598 );
599 }
600 }
601
602 #[doc(alias = "adw_sidebar_item_set_suffix")]
609 #[doc(alias = "suffix")]
610 fn set_suffix(&self, suffix: Option<&impl IsA<gtk::Widget>>) {
611 unsafe {
612 ffi::adw_sidebar_item_set_suffix(
613 self.as_ref().to_glib_none().0,
614 suffix.map(|p| p.as_ref()).to_glib_none().0,
615 );
616 }
617 }
618
619 #[doc(alias = "adw_sidebar_item_set_title")]
623 #[doc(alias = "title")]
624 fn set_title(&self, title: Option<&str>) {
625 unsafe {
626 ffi::adw_sidebar_item_set_title(self.as_ref().to_glib_none().0, title.to_glib_none().0);
627 }
628 }
629
630 #[doc(alias = "adw_sidebar_item_set_tooltip")]
636 #[doc(alias = "tooltip")]
637 fn set_tooltip(&self, tooltip: Option<&str>) {
638 unsafe {
639 ffi::adw_sidebar_item_set_tooltip(
640 self.as_ref().to_glib_none().0,
641 tooltip.to_glib_none().0,
642 );
643 }
644 }
645
646 #[doc(alias = "adw_sidebar_item_set_use_underline")]
652 #[doc(alias = "use-underline")]
653 fn set_use_underline(&self, use_underline: bool) {
654 unsafe {
655 ffi::adw_sidebar_item_set_use_underline(
656 self.as_ref().to_glib_none().0,
657 use_underline.into_glib(),
658 );
659 }
660 }
661
662 #[doc(alias = "adw_sidebar_item_set_visible")]
666 #[doc(alias = "visible")]
667 fn set_visible(&self, visible: bool) {
668 unsafe {
669 ffi::adw_sidebar_item_set_visible(self.as_ref().to_glib_none().0, visible.into_glib());
670 }
671 }
672
673 #[cfg(feature = "v1_9")]
674 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
675 #[doc(alias = "drag-motion-activate")]
676 fn connect_drag_motion_activate_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
677 unsafe extern "C" fn notify_drag_motion_activate_trampoline<
678 P: IsA<SidebarItem>,
679 F: Fn(&P) + 'static,
680 >(
681 this: *mut ffi::AdwSidebarItem,
682 _param_spec: glib::ffi::gpointer,
683 f: glib::ffi::gpointer,
684 ) {
685 unsafe {
686 let f: &F = &*(f as *const F);
687 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
688 }
689 }
690 unsafe {
691 let f: Box_<F> = Box_::new(f);
692 connect_raw(
693 self.as_ptr() as *mut _,
694 c"notify::drag-motion-activate".as_ptr(),
695 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
696 notify_drag_motion_activate_trampoline::<Self, F> as *const (),
697 )),
698 Box_::into_raw(f),
699 )
700 }
701 }
702
703 #[cfg(feature = "v1_9")]
704 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
705 #[doc(alias = "enabled")]
706 fn connect_enabled_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
707 unsafe extern "C" fn notify_enabled_trampoline<P: IsA<SidebarItem>, F: Fn(&P) + 'static>(
708 this: *mut ffi::AdwSidebarItem,
709 _param_spec: glib::ffi::gpointer,
710 f: glib::ffi::gpointer,
711 ) {
712 unsafe {
713 let f: &F = &*(f as *const F);
714 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
715 }
716 }
717 unsafe {
718 let f: Box_<F> = Box_::new(f);
719 connect_raw(
720 self.as_ptr() as *mut _,
721 c"notify::enabled".as_ptr(),
722 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
723 notify_enabled_trampoline::<Self, F> as *const (),
724 )),
725 Box_::into_raw(f),
726 )
727 }
728 }
729
730 #[cfg(feature = "v1_9")]
731 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
732 #[doc(alias = "icon-name")]
733 fn connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
734 unsafe extern "C" fn notify_icon_name_trampoline<
735 P: IsA<SidebarItem>,
736 F: Fn(&P) + 'static,
737 >(
738 this: *mut ffi::AdwSidebarItem,
739 _param_spec: glib::ffi::gpointer,
740 f: glib::ffi::gpointer,
741 ) {
742 unsafe {
743 let f: &F = &*(f as *const F);
744 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
745 }
746 }
747 unsafe {
748 let f: Box_<F> = Box_::new(f);
749 connect_raw(
750 self.as_ptr() as *mut _,
751 c"notify::icon-name".as_ptr(),
752 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
753 notify_icon_name_trampoline::<Self, F> as *const (),
754 )),
755 Box_::into_raw(f),
756 )
757 }
758 }
759
760 #[cfg(feature = "v1_9")]
761 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
762 #[doc(alias = "icon-paintable")]
763 fn connect_icon_paintable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
764 unsafe extern "C" fn notify_icon_paintable_trampoline<
765 P: IsA<SidebarItem>,
766 F: Fn(&P) + 'static,
767 >(
768 this: *mut ffi::AdwSidebarItem,
769 _param_spec: glib::ffi::gpointer,
770 f: glib::ffi::gpointer,
771 ) {
772 unsafe {
773 let f: &F = &*(f as *const F);
774 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
775 }
776 }
777 unsafe {
778 let f: Box_<F> = Box_::new(f);
779 connect_raw(
780 self.as_ptr() as *mut _,
781 c"notify::icon-paintable".as_ptr(),
782 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
783 notify_icon_paintable_trampoline::<Self, F> as *const (),
784 )),
785 Box_::into_raw(f),
786 )
787 }
788 }
789
790 #[cfg(feature = "v1_9")]
791 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
792 #[doc(alias = "section")]
793 fn connect_section_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
794 unsafe extern "C" fn notify_section_trampoline<P: IsA<SidebarItem>, F: Fn(&P) + 'static>(
795 this: *mut ffi::AdwSidebarItem,
796 _param_spec: glib::ffi::gpointer,
797 f: glib::ffi::gpointer,
798 ) {
799 unsafe {
800 let f: &F = &*(f as *const F);
801 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
802 }
803 }
804 unsafe {
805 let f: Box_<F> = Box_::new(f);
806 connect_raw(
807 self.as_ptr() as *mut _,
808 c"notify::section".as_ptr(),
809 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
810 notify_section_trampoline::<Self, F> as *const (),
811 )),
812 Box_::into_raw(f),
813 )
814 }
815 }
816
817 #[cfg(feature = "v1_9")]
818 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
819 #[doc(alias = "subtitle")]
820 fn connect_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
821 unsafe extern "C" fn notify_subtitle_trampoline<
822 P: IsA<SidebarItem>,
823 F: Fn(&P) + 'static,
824 >(
825 this: *mut ffi::AdwSidebarItem,
826 _param_spec: glib::ffi::gpointer,
827 f: glib::ffi::gpointer,
828 ) {
829 unsafe {
830 let f: &F = &*(f as *const F);
831 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
832 }
833 }
834 unsafe {
835 let f: Box_<F> = Box_::new(f);
836 connect_raw(
837 self.as_ptr() as *mut _,
838 c"notify::subtitle".as_ptr(),
839 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
840 notify_subtitle_trampoline::<Self, F> as *const (),
841 )),
842 Box_::into_raw(f),
843 )
844 }
845 }
846
847 #[cfg(feature = "v1_9")]
848 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
849 #[doc(alias = "suffix")]
850 fn connect_suffix_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
851 unsafe extern "C" fn notify_suffix_trampoline<P: IsA<SidebarItem>, F: Fn(&P) + 'static>(
852 this: *mut ffi::AdwSidebarItem,
853 _param_spec: glib::ffi::gpointer,
854 f: glib::ffi::gpointer,
855 ) {
856 unsafe {
857 let f: &F = &*(f as *const F);
858 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
859 }
860 }
861 unsafe {
862 let f: Box_<F> = Box_::new(f);
863 connect_raw(
864 self.as_ptr() as *mut _,
865 c"notify::suffix".as_ptr(),
866 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
867 notify_suffix_trampoline::<Self, F> as *const (),
868 )),
869 Box_::into_raw(f),
870 )
871 }
872 }
873
874 #[cfg(feature = "v1_9")]
875 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
876 #[doc(alias = "title")]
877 fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
878 unsafe extern "C" fn notify_title_trampoline<P: IsA<SidebarItem>, F: Fn(&P) + 'static>(
879 this: *mut ffi::AdwSidebarItem,
880 _param_spec: glib::ffi::gpointer,
881 f: glib::ffi::gpointer,
882 ) {
883 unsafe {
884 let f: &F = &*(f as *const F);
885 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
886 }
887 }
888 unsafe {
889 let f: Box_<F> = Box_::new(f);
890 connect_raw(
891 self.as_ptr() as *mut _,
892 c"notify::title".as_ptr(),
893 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
894 notify_title_trampoline::<Self, F> as *const (),
895 )),
896 Box_::into_raw(f),
897 )
898 }
899 }
900
901 #[cfg(feature = "v1_9")]
902 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
903 #[doc(alias = "tooltip")]
904 fn connect_tooltip_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
905 unsafe extern "C" fn notify_tooltip_trampoline<P: IsA<SidebarItem>, F: Fn(&P) + 'static>(
906 this: *mut ffi::AdwSidebarItem,
907 _param_spec: glib::ffi::gpointer,
908 f: glib::ffi::gpointer,
909 ) {
910 unsafe {
911 let f: &F = &*(f as *const F);
912 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
913 }
914 }
915 unsafe {
916 let f: Box_<F> = Box_::new(f);
917 connect_raw(
918 self.as_ptr() as *mut _,
919 c"notify::tooltip".as_ptr(),
920 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
921 notify_tooltip_trampoline::<Self, F> as *const (),
922 )),
923 Box_::into_raw(f),
924 )
925 }
926 }
927
928 #[cfg(feature = "v1_9")]
929 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
930 #[doc(alias = "use-underline")]
931 fn connect_use_underline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
932 unsafe extern "C" fn notify_use_underline_trampoline<
933 P: IsA<SidebarItem>,
934 F: Fn(&P) + 'static,
935 >(
936 this: *mut ffi::AdwSidebarItem,
937 _param_spec: glib::ffi::gpointer,
938 f: glib::ffi::gpointer,
939 ) {
940 unsafe {
941 let f: &F = &*(f as *const F);
942 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
943 }
944 }
945 unsafe {
946 let f: Box_<F> = Box_::new(f);
947 connect_raw(
948 self.as_ptr() as *mut _,
949 c"notify::use-underline".as_ptr(),
950 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
951 notify_use_underline_trampoline::<Self, F> as *const (),
952 )),
953 Box_::into_raw(f),
954 )
955 }
956 }
957
958 #[cfg(feature = "v1_9")]
959 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
960 #[doc(alias = "visible")]
961 fn connect_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
962 unsafe extern "C" fn notify_visible_trampoline<P: IsA<SidebarItem>, F: Fn(&P) + 'static>(
963 this: *mut ffi::AdwSidebarItem,
964 _param_spec: glib::ffi::gpointer,
965 f: glib::ffi::gpointer,
966 ) {
967 unsafe {
968 let f: &F = &*(f as *const F);
969 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
970 }
971 }
972 unsafe {
973 let f: Box_<F> = Box_::new(f);
974 connect_raw(
975 self.as_ptr() as *mut _,
976 c"notify::visible".as_ptr(),
977 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
978 notify_visible_trampoline::<Self, F> as *const (),
979 )),
980 Box_::into_raw(f),
981 )
982 }
983 }
984}
985
986impl<O: IsA<SidebarItem>> SidebarItemExt for O {}