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")]
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 unsafe {
401 let f: &F = &*(f as *const F);
402 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
403 }
404 }
405 unsafe {
406 let f: Box_<F> = Box_::new(f);
407 connect_raw(
408 self.as_ptr() as *mut _,
409 c"notify::drag-motion-activate".as_ptr(),
410 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
411 notify_drag_motion_activate_trampoline::<Self, F> as *const (),
412 )),
413 Box_::into_raw(f),
414 )
415 }
416 }
417
418 #[cfg(feature = "v1_9")]
419 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
420 #[doc(alias = "enabled")]
421 fn connect_enabled_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
422 unsafe extern "C" fn notify_enabled_trampoline<P: IsA<SidebarItem>, F: Fn(&P) + 'static>(
423 this: *mut ffi::AdwSidebarItem,
424 _param_spec: glib::ffi::gpointer,
425 f: glib::ffi::gpointer,
426 ) {
427 unsafe {
428 let f: &F = &*(f as *const F);
429 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
430 }
431 }
432 unsafe {
433 let f: Box_<F> = Box_::new(f);
434 connect_raw(
435 self.as_ptr() as *mut _,
436 c"notify::enabled".as_ptr(),
437 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
438 notify_enabled_trampoline::<Self, F> as *const (),
439 )),
440 Box_::into_raw(f),
441 )
442 }
443 }
444
445 #[cfg(feature = "v1_9")]
446 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
447 #[doc(alias = "icon-name")]
448 fn connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
449 unsafe extern "C" fn notify_icon_name_trampoline<
450 P: IsA<SidebarItem>,
451 F: Fn(&P) + 'static,
452 >(
453 this: *mut ffi::AdwSidebarItem,
454 _param_spec: glib::ffi::gpointer,
455 f: glib::ffi::gpointer,
456 ) {
457 unsafe {
458 let f: &F = &*(f as *const F);
459 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
460 }
461 }
462 unsafe {
463 let f: Box_<F> = Box_::new(f);
464 connect_raw(
465 self.as_ptr() as *mut _,
466 c"notify::icon-name".as_ptr(),
467 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
468 notify_icon_name_trampoline::<Self, F> as *const (),
469 )),
470 Box_::into_raw(f),
471 )
472 }
473 }
474
475 #[cfg(feature = "v1_9")]
476 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
477 #[doc(alias = "icon-paintable")]
478 fn connect_icon_paintable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
479 unsafe extern "C" fn notify_icon_paintable_trampoline<
480 P: IsA<SidebarItem>,
481 F: Fn(&P) + 'static,
482 >(
483 this: *mut ffi::AdwSidebarItem,
484 _param_spec: glib::ffi::gpointer,
485 f: glib::ffi::gpointer,
486 ) {
487 unsafe {
488 let f: &F = &*(f as *const F);
489 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
490 }
491 }
492 unsafe {
493 let f: Box_<F> = Box_::new(f);
494 connect_raw(
495 self.as_ptr() as *mut _,
496 c"notify::icon-paintable".as_ptr(),
497 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
498 notify_icon_paintable_trampoline::<Self, F> as *const (),
499 )),
500 Box_::into_raw(f),
501 )
502 }
503 }
504
505 #[cfg(feature = "v1_9")]
506 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
507 #[doc(alias = "section")]
508 fn connect_section_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
509 unsafe extern "C" fn notify_section_trampoline<P: IsA<SidebarItem>, F: Fn(&P) + 'static>(
510 this: *mut ffi::AdwSidebarItem,
511 _param_spec: glib::ffi::gpointer,
512 f: glib::ffi::gpointer,
513 ) {
514 unsafe {
515 let f: &F = &*(f as *const F);
516 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
517 }
518 }
519 unsafe {
520 let f: Box_<F> = Box_::new(f);
521 connect_raw(
522 self.as_ptr() as *mut _,
523 c"notify::section".as_ptr(),
524 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
525 notify_section_trampoline::<Self, F> as *const (),
526 )),
527 Box_::into_raw(f),
528 )
529 }
530 }
531
532 #[cfg(feature = "v1_9")]
533 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
534 #[doc(alias = "subtitle")]
535 fn connect_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
536 unsafe extern "C" fn notify_subtitle_trampoline<
537 P: IsA<SidebarItem>,
538 F: Fn(&P) + 'static,
539 >(
540 this: *mut ffi::AdwSidebarItem,
541 _param_spec: glib::ffi::gpointer,
542 f: glib::ffi::gpointer,
543 ) {
544 unsafe {
545 let f: &F = &*(f as *const F);
546 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
547 }
548 }
549 unsafe {
550 let f: Box_<F> = Box_::new(f);
551 connect_raw(
552 self.as_ptr() as *mut _,
553 c"notify::subtitle".as_ptr(),
554 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
555 notify_subtitle_trampoline::<Self, F> as *const (),
556 )),
557 Box_::into_raw(f),
558 )
559 }
560 }
561
562 #[cfg(feature = "v1_9")]
563 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
564 #[doc(alias = "suffix")]
565 fn connect_suffix_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
566 unsafe extern "C" fn notify_suffix_trampoline<P: IsA<SidebarItem>, F: Fn(&P) + 'static>(
567 this: *mut ffi::AdwSidebarItem,
568 _param_spec: glib::ffi::gpointer,
569 f: glib::ffi::gpointer,
570 ) {
571 unsafe {
572 let f: &F = &*(f as *const F);
573 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
574 }
575 }
576 unsafe {
577 let f: Box_<F> = Box_::new(f);
578 connect_raw(
579 self.as_ptr() as *mut _,
580 c"notify::suffix".as_ptr(),
581 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
582 notify_suffix_trampoline::<Self, F> as *const (),
583 )),
584 Box_::into_raw(f),
585 )
586 }
587 }
588
589 #[cfg(feature = "v1_9")]
590 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
591 #[doc(alias = "title")]
592 fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
593 unsafe extern "C" fn notify_title_trampoline<P: IsA<SidebarItem>, F: Fn(&P) + 'static>(
594 this: *mut ffi::AdwSidebarItem,
595 _param_spec: glib::ffi::gpointer,
596 f: glib::ffi::gpointer,
597 ) {
598 unsafe {
599 let f: &F = &*(f as *const F);
600 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
601 }
602 }
603 unsafe {
604 let f: Box_<F> = Box_::new(f);
605 connect_raw(
606 self.as_ptr() as *mut _,
607 c"notify::title".as_ptr(),
608 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
609 notify_title_trampoline::<Self, F> as *const (),
610 )),
611 Box_::into_raw(f),
612 )
613 }
614 }
615
616 #[cfg(feature = "v1_9")]
617 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
618 #[doc(alias = "tooltip")]
619 fn connect_tooltip_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
620 unsafe extern "C" fn notify_tooltip_trampoline<P: IsA<SidebarItem>, F: Fn(&P) + 'static>(
621 this: *mut ffi::AdwSidebarItem,
622 _param_spec: glib::ffi::gpointer,
623 f: glib::ffi::gpointer,
624 ) {
625 unsafe {
626 let f: &F = &*(f as *const F);
627 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
628 }
629 }
630 unsafe {
631 let f: Box_<F> = Box_::new(f);
632 connect_raw(
633 self.as_ptr() as *mut _,
634 c"notify::tooltip".as_ptr(),
635 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
636 notify_tooltip_trampoline::<Self, F> as *const (),
637 )),
638 Box_::into_raw(f),
639 )
640 }
641 }
642
643 #[cfg(feature = "v1_9")]
644 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
645 #[doc(alias = "use-underline")]
646 fn connect_use_underline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
647 unsafe extern "C" fn notify_use_underline_trampoline<
648 P: IsA<SidebarItem>,
649 F: Fn(&P) + 'static,
650 >(
651 this: *mut ffi::AdwSidebarItem,
652 _param_spec: glib::ffi::gpointer,
653 f: glib::ffi::gpointer,
654 ) {
655 unsafe {
656 let f: &F = &*(f as *const F);
657 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
658 }
659 }
660 unsafe {
661 let f: Box_<F> = Box_::new(f);
662 connect_raw(
663 self.as_ptr() as *mut _,
664 c"notify::use-underline".as_ptr(),
665 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
666 notify_use_underline_trampoline::<Self, F> as *const (),
667 )),
668 Box_::into_raw(f),
669 )
670 }
671 }
672
673 #[cfg(feature = "v1_9")]
674 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
675 #[doc(alias = "visible")]
676 fn connect_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
677 unsafe extern "C" fn notify_visible_trampoline<P: IsA<SidebarItem>, F: Fn(&P) + 'static>(
678 this: *mut ffi::AdwSidebarItem,
679 _param_spec: glib::ffi::gpointer,
680 f: glib::ffi::gpointer,
681 ) {
682 unsafe {
683 let f: &F = &*(f as *const F);
684 f(SidebarItem::from_glib_borrow(this).unsafe_cast_ref())
685 }
686 }
687 unsafe {
688 let f: Box_<F> = Box_::new(f);
689 connect_raw(
690 self.as_ptr() as *mut _,
691 c"notify::visible".as_ptr(),
692 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
693 notify_visible_trampoline::<Self, F> as *const (),
694 )),
695 Box_::into_raw(f),
696 )
697 }
698 }
699}
700
701impl<O: IsA<SidebarItem>> SidebarItemExt for O {}