libadwaita/auto/
leaflet_page.rs1#![allow(deprecated)]
6
7use crate::ffi;
8use glib::{
9 prelude::*,
10 signal::{SignalHandlerId, connect_raw},
11 translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16 #[doc(alias = "AdwLeafletPage")]
49 pub struct LeafletPage(Object<ffi::AdwLeafletPage, ffi::AdwLeafletPageClass>);
50
51 match fn {
52 type_ => || ffi::adw_leaflet_page_get_type(),
53 }
54}
55
56impl LeafletPage {
57 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
67 #[allow(deprecated)]
68 #[doc(alias = "adw_leaflet_page_get_child")]
69 #[doc(alias = "get_child")]
70 pub fn child(&self) -> gtk::Widget {
71 unsafe { from_glib_none(ffi::adw_leaflet_page_get_child(self.to_glib_none().0)) }
72 }
73
74 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
84 #[allow(deprecated)]
85 #[doc(alias = "adw_leaflet_page_get_name")]
86 #[doc(alias = "get_name")]
87 pub fn name(&self) -> Option<glib::GString> {
88 unsafe { from_glib_none(ffi::adw_leaflet_page_get_name(self.to_glib_none().0)) }
89 }
90
91 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
101 #[allow(deprecated)]
102 #[doc(alias = "adw_leaflet_page_get_navigatable")]
103 #[doc(alias = "get_navigatable")]
104 #[doc(alias = "navigatable")]
105 pub fn is_navigatable(&self) -> bool {
106 unsafe { from_glib(ffi::adw_leaflet_page_get_navigatable(self.to_glib_none().0)) }
107 }
108
109 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
117 #[allow(deprecated)]
118 #[doc(alias = "adw_leaflet_page_set_name")]
119 #[doc(alias = "name")]
120 pub fn set_name(&self, name: Option<&str>) {
121 unsafe {
122 ffi::adw_leaflet_page_set_name(self.to_glib_none().0, name.to_glib_none().0);
123 }
124 }
125
126 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
139 #[allow(deprecated)]
140 #[doc(alias = "adw_leaflet_page_set_navigatable")]
141 #[doc(alias = "navigatable")]
142 pub fn set_navigatable(&self, navigatable: bool) {
143 unsafe {
144 ffi::adw_leaflet_page_set_navigatable(self.to_glib_none().0, navigatable.into_glib());
145 }
146 }
147
148 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
149 #[doc(alias = "name")]
150 pub fn connect_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
151 unsafe extern "C" fn notify_name_trampoline<F: Fn(&LeafletPage) + 'static>(
152 this: *mut ffi::AdwLeafletPage,
153 _param_spec: glib::ffi::gpointer,
154 f: glib::ffi::gpointer,
155 ) {
156 unsafe {
157 let f: &F = &*(f as *const F);
158 f(&from_glib_borrow(this))
159 }
160 }
161 unsafe {
162 let f: Box_<F> = Box_::new(f);
163 connect_raw(
164 self.as_ptr() as *mut _,
165 c"notify::name".as_ptr(),
166 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
167 notify_name_trampoline::<F> as *const (),
168 )),
169 Box_::into_raw(f),
170 )
171 }
172 }
173
174 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
175 #[doc(alias = "navigatable")]
176 pub fn connect_navigatable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
177 unsafe extern "C" fn notify_navigatable_trampoline<F: Fn(&LeafletPage) + 'static>(
178 this: *mut ffi::AdwLeafletPage,
179 _param_spec: glib::ffi::gpointer,
180 f: glib::ffi::gpointer,
181 ) {
182 unsafe {
183 let f: &F = &*(f as *const F);
184 f(&from_glib_borrow(this))
185 }
186 }
187 unsafe {
188 let f: Box_<F> = Box_::new(f);
189 connect_raw(
190 self.as_ptr() as *mut _,
191 c"notify::navigatable".as_ptr(),
192 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
193 notify_navigatable_trampoline::<F> as *const (),
194 )),
195 Box_::into_raw(f),
196 )
197 }
198 }
199}