Skip to main content

libadwaita/auto/
sidebar_item.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from
3// from gir-files (https://github.com/gtk-rs/gir-files.git)
4// DO NOT EDIT
5
6use 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    /// An item within [`SidebarSection`][crate::SidebarSection].
16    ///
17    /// Sidebar items must have a title, set via [`title`][struct@crate::SidebarItem#title].
18    ///
19    /// Sidebar items should, but are not required to, have an icon. Icons can be set
20    /// from an icon name, via [`icon-name`][struct@crate::SidebarItem#icon-name], or a
21    /// [`gdk::Paintable`][crate::gdk::Paintable], via [`icon-paintable`][struct@crate::SidebarItem#icon-paintable].
22    ///
23    /// Items can also have subtitles, set with the [`subtitle`][struct@crate::SidebarItem#subtitle]
24    /// property. Subtitles should be used sparingly.
25    ///
26    /// To add a tooltip, use [`tooltip`][struct@crate::SidebarItem#tooltip]. Tooltips always use
27    /// Pango markup.
28    ///
29    /// Items can have an arbitrary suffix widget, set with the
30    /// [`suffix`][struct@crate::SidebarItem#suffix] properties. It will be displayed at the end of
31    /// its row, or before the arrow in the [enum@Adw.SidebarMode.page] mode.
32    ///
33    /// To hide or disable the item, use the [`visible`][struct@crate::SidebarItem#visible] and
34    /// [`enabled`][struct@crate::SidebarItem#enabled] properties respectively.
35    ///
36    /// To access the items's section, use [`section`][struct@crate::SidebarItem#section].
37    ///
38    /// It's also possible to access the index of the item in both the section and
39    /// the sidebar, using [`SidebarItemExt::section_index()`][crate::prelude::SidebarItemExt::section_index()] and
40    /// [`SidebarItemExt::index()`][crate::prelude::SidebarItemExt::index()] respectively.
41    ///
42    /// Dragging content over sidebar items activates them by default. To disable
43    /// this behavior, set [`drag-motion-activate`][struct@crate::SidebarItem#drag-motion-activate] to `FALSE`.
44    ///
45    /// [`SidebarItem`][crate::SidebarItem] is derivable, and applications that need to associate each
46    /// page with data can store it in the items themselves  this way.
47    ///
48    /// ## Properties
49    ///
50    ///
51    /// #### `drag-motion-activate`
52    ///  Whether to activate the item on pointer motion during Drag-and-Drop.
53    ///
54    /// This is needed to be able to drag content into the page the item
55    /// represents, when the sidebar is used as a page switcher. However, it may be
56    /// unwanted when dropping content onto the item itself, so it can be disabled.
57    ///
58    /// Readable | Writeable
59    ///
60    ///
61    /// #### `enabled`
62    ///  Whether the item is enabled.
63    ///
64    /// See [`sensitive`][struct@crate::gtk::Widget#sensitive].
65    ///
66    /// Readable | Writeable
67    ///
68    ///
69    /// #### `icon-name`
70    ///  The icon name for this item.
71    ///
72    /// Mutually exclusive with [`icon-paintable`][struct@crate::SidebarItem#icon-paintable].
73    ///
74    /// Readable | Writeable
75    ///
76    ///
77    /// #### `icon-paintable`
78    ///  The paintable to use as the icon for this item.
79    ///
80    /// Mutually exclusive with [`icon-name`][struct@crate::SidebarItem#icon-name].
81    ///
82    /// Readable | Writeable
83    ///
84    ///
85    /// #### `section`
86    ///  The section the item is in.
87    ///
88    /// Readable
89    ///
90    ///
91    /// #### `subtitle`
92    ///  Subtitle of the item.
93    ///
94    /// Readable | Writeable
95    ///
96    ///
97    /// #### `suffix`
98    ///  The suffix widget for this item.
99    ///
100    /// Suffix will be shown at the end of the item's row, or before the arrow in
101    /// the [enum@Adw.SidebarMode.page] mode.
102    ///
103    /// Readable | Writeable
104    ///
105    ///
106    /// #### `title`
107    ///  Title of the item.
108    ///
109    /// Readable | Writeable
110    ///
111    ///
112    /// #### `tooltip`
113    ///  The tooltip of the item.
114    ///
115    /// The tooltip can be marked up with the Pango text markup language.
116    ///
117    /// Readable | Writeable
118    ///
119    ///
120    /// #### `use-underline`
121    ///  Whether an underline in the title indicates a mnemonic.
122    ///
123    /// The mnemonic can be used to activate the item.
124    ///
125    /// Readable | Writeable
126    ///
127    ///
128    /// #### `visible`
129    ///  Whether the item is visible.
130    ///
131    /// Readable | Writeable
132    ///
133    /// # Implements
134    ///
135    /// [`SidebarItemExt`][trait@crate::prelude::SidebarItemExt], [`trait@glib::ObjectExt`]
136    #[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    /// Creates a new [`SidebarItem`][crate::SidebarItem] with @title as its title.
148    /// ## `title`
149    /// the item title
150    ///
151    /// # Returns
152    ///
153    /// the newly created [`SidebarItem`][crate::SidebarItem]
154    #[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    // rustdoc-stripper-ignore-next
161    /// Creates a new builder-pattern struct instance to construct [`SidebarItem`] objects.
162    ///
163    /// This method returns an instance of [`SidebarItemBuilder`](crate::builders::SidebarItemBuilder) which can be used to create [`SidebarItem`] objects.
164    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// rustdoc-stripper-ignore-next
178/// A [builder-pattern] type to construct [`SidebarItem`] objects.
179///
180/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
181#[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    /// Whether to activate the item on pointer motion during Drag-and-Drop.
194    ///
195    /// This is needed to be able to drag content into the page the item
196    /// represents, when the sidebar is used as a page switcher. However, it may be
197    /// unwanted when dropping content onto the item itself, so it can be disabled.
198    #[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    /// Whether the item is enabled.
209    ///
210    /// See [`sensitive`][struct@crate::gtk::Widget#sensitive].
211    #[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    /// The icon name for this item.
220    ///
221    /// Mutually exclusive with [`icon-paintable`][struct@crate::SidebarItem#icon-paintable].
222    #[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    /// The paintable to use as the icon for this item.
231    ///
232    /// Mutually exclusive with [`icon-name`][struct@crate::SidebarItem#icon-name].
233    #[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    /// Subtitle of the item.
244    #[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    /// The suffix widget for this item.
253    ///
254    /// Suffix will be shown at the end of the item's row, or before the arrow in
255    /// the [enum@Adw.SidebarMode.page] mode.
256    #[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    /// Title of the item.
265    #[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    /// The tooltip of the item.
274    ///
275    /// The tooltip can be marked up with the Pango text markup language.
276    #[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    /// Whether an underline in the title indicates a mnemonic.
285    ///
286    /// The mnemonic can be used to activate the item.
287    #[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    /// Whether the item is visible.
296    #[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    // rustdoc-stripper-ignore-next
305    /// Build the [`SidebarItem`].
306    #[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
313/// Trait containing all [`struct@SidebarItem`] methods.
314///
315/// # Implementors
316///
317/// [`SidebarItem`][struct@crate::SidebarItem]
318pub trait SidebarItemExt: IsA<SidebarItem> + 'static {
319    /// Gets whether @self will be activated on pointer motion during Drag-and-Drop.
320    ///
321    /// # Returns
322    ///
323    /// whether to enable the item on drag motion
324    #[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    /// Gets whether @self is enabled.
336    ///
337    /// # Returns
338    ///
339    /// whether the item is enabled
340    #[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    /// Gets the icon name for @item.
352    ///
353    /// # Returns
354    ///
355    /// the icon name
356    #[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    /// Gets the paintable used as the icon for @item.
368    ///
369    /// # Returns
370    ///
371    /// the icon paintable
372    #[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    /// Gets index of @self within its [`Sidebar`][crate::Sidebar].
384    ///
385    /// If @self is within a section, but that section is not in a sidebar, index
386    /// will be within the section only.
387    ///
388    /// If @self is not within a section, the index will be 0.
389    ///
390    /// The item can later be retrieved by passing this index into
391    /// [`Sidebar::item()`][crate::Sidebar::item()].
392    ///
393    /// # Returns
394    ///
395    /// the index of @self
396    #[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    /// Gets the section @self is in.
403    ///
404    /// # Returns
405    ///
406    /// the section of @self
407    #[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    /// Gets index of @self within its [`SidebarSection`][crate::SidebarSection].
418    ///
419    /// If @self is not within a section, the index will be 0.
420    ///
421    /// The item can later be retrieved by passing this index into
422    /// [`SidebarSection::item()`][crate::SidebarSection::item()].
423    ///
424    /// # Returns
425    ///
426    /// the index of @self
427    #[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    /// Gets the subtitle of @self.
434    ///
435    /// # Returns
436    ///
437    /// the subtitle
438    #[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    /// Gets the suffix widget for @self.
449    ///
450    /// # Returns
451    ///
452    /// the suffix widget
453    #[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    /// Gets the title of @self.
464    ///
465    /// # Returns
466    ///
467    /// the title
468    #[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    /// Gets the tooltip of @self.
479    ///
480    /// # Returns
481    ///
482    /// the tooltip
483    #[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    /// Gets whether an underline in the title indicates a mnemonic.
494    ///
495    /// # Returns
496    ///
497    /// whether an underline in the text indicates a mnemonic
498    #[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    /// Gets whether @self is visible.
510    ///
511    /// # Returns
512    ///
513    /// whether the item is visible
514    #[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    /// Sets whether to activate @self on pointer motion during Drag-and-Drop.
526    ///
527    /// This is needed to be able to drag content into the page the item
528    /// represents, when the sidebar is used as a page switcher. However, it may be
529    /// unwanted when dropping content onto the item itself, so it can be disabled.
530    /// ## `drag_motion_activate`
531    /// whether to enable the item on drag motion
532    #[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    /// Sets whether @self is enabled.
544    ///
545    /// See [`sensitive`][struct@crate::gtk::Widget#sensitive].
546    /// ## `enabled`
547    /// whether to enable the item
548    #[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    /// Sets the icon name for @item.
557    ///
558    /// Mutually exclusive with [`icon-paintable`][struct@crate::SidebarItem#icon-paintable].
559    /// ## `icon_name`
560    /// the icon name
561    #[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    /// Sets the paintable to use as the icon for @item.
573    ///
574    /// Mutually exclusive with [`icon-name`][struct@crate::SidebarItem#icon-name].
575    /// ## `paintable`
576    /// the icon paintable
577    #[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    /// Sets the subtitle of @self.
589    /// ## `subtitle`
590    /// the subtitle
591    #[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    /// Sets the suffix widget for @self.
603    ///
604    /// Suffix will be shown at the end of the item's row, or before the arrow in
605    /// the [enum@Adw.SidebarMode.page] mode.
606    /// ## `suffix`
607    /// the suffix widget
608    #[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    /// Sets the title of @self.
620    /// ## `title`
621    /// the title
622    #[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    /// Sets the tooltip of @self.
631    ///
632    /// The tooltip can be marked up with the Pango text markup language.
633    /// ## `tooltip`
634    /// the tooltip
635    #[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    /// Sets whether an underline in the title indicates a mnemonic.
647    ///
648    /// The mnemonic can be used to activate the item.
649    /// ## `use_underline`
650    /// whether an underline in the text indicates a mnemonic
651    #[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    /// Sets whether @self is visible.
663    /// ## `visible`
664    /// whether the item is visible
665    #[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 {}