Skip to main content

libadwaita/auto/
preferences_window.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#![allow(deprecated)]
6
7#[cfg(feature = "v1_4")]
8#[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
9use crate::NavigationPage;
10use crate::{PreferencesPage, Toast, Window, ffi};
11use glib::{
12    prelude::*,
13    signal::{SignalHandlerId, connect_raw},
14    translate::*,
15};
16use std::boxed::Box as Box_;
17
18#[cfg(feature = "gtk_v4_10")]
19#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_10")))]
20glib::wrapper! {
21    /// Use [`PreferencesDialog`][crate::PreferencesDialog].
22    ///
23    ///
24    /// The [`PreferencesWindow`][crate::PreferencesWindow] widget presents an application's preferences
25    /// gathered into pages and groups. The preferences are searchable by the user.
26    ///
27    /// ## CSS nodes
28    ///
29    /// [`PreferencesWindow`][crate::PreferencesWindow] has a main CSS node with the name `window` and the
30    /// style class `.preferences`.
31    ///
32    /// ## Properties
33    ///
34    ///
35    /// #### `can-navigate-back`
36    ///   shortcut.
37    ///
38    /// For right-to-left locales, gestures and shortcuts are reversed.
39    ///
40    /// Has no effect for subpages added with
41    /// [`PreferencesWindowExt::push_subpage()`][crate::prelude::PreferencesWindowExt::push_subpage()].
42    ///
43    /// Readable | Writable
44    ///
45    ///
46    /// #### `search-enabled`
47    ///  Whether search is enabled.
48    ///
49    /// Readable | Writable
50    ///
51    ///
52    /// #### `visible-page`
53    ///  The currently visible page.
54    ///
55    /// Readable | Writable
56    ///
57    ///
58    /// #### `visible-page-name`
59    ///  The name of the currently visible page.
60    ///
61    /// See [`visible-page`][struct@crate::PreferencesWindow#visible-page].
62    ///
63    /// Readable | Writable
64    /// <details><summary><h4>Window</h4></summary>
65    ///
66    ///
67    /// #### `adaptive-preview`
68    ///  Whether adaptive preview is currently open.
69    ///
70    /// Adaptive preview is a debugging tool used for testing the window
71    /// contents at specific screen sizes, simulating mobile environment.
72    ///
73    /// Adaptive preview can always be accessed from inspector. This function
74    /// allows applications to open it manually.
75    ///
76    /// Most applications should not use this property.
77    ///
78    /// Readable | Writable
79    ///
80    ///
81    /// #### `content`
82    ///  The content widget.
83    ///
84    /// This property should always be used instead of [`child`][struct@crate::gtk::Window#child].
85    ///
86    /// Readable | Writable
87    ///
88    ///
89    /// #### `current-breakpoint`
90    ///  The current breakpoint.
91    ///
92    /// Readable
93    ///
94    ///
95    /// #### `dialogs`
96    ///  The open dialogs.
97    ///
98    /// Readable
99    ///
100    ///
101    /// #### `visible-dialog`
102    ///  The currently visible dialog
103    ///
104    /// Readable
105    /// </details>
106    /// <details><summary><h4>Window</h4></summary>
107    ///
108    ///
109    /// #### `application`
110    ///  The [`gtk::Application`][crate::gtk::Application] associated with the window.
111    ///
112    /// The application will be kept alive for at least as long as it
113    /// has any windows associated with it (see g_application_hold()
114    /// for a way to keep it alive without windows).
115    ///
116    /// Normally, the connection between the application and the window
117    /// will remain until the window is destroyed, but you can explicitly
118    /// remove it by setting the this property to `NULL`.
119    ///
120    /// Readable | Writable
121    ///
122    ///
123    /// #### `child`
124    ///  The child widget.
125    ///
126    /// Readable | Writable
127    ///
128    ///
129    /// #### `decorated`
130    ///  Whether the window should have a frame (also known as *decorations*).
131    ///
132    /// Readable | Writable
133    ///
134    ///
135    /// #### `default-height`
136    ///  The default height of the window.
137    ///
138    /// Readable | Writable
139    ///
140    ///
141    /// #### `default-widget`
142    ///  The default widget.
143    ///
144    /// Readable | Writable
145    ///
146    ///
147    /// #### `default-width`
148    ///  The default width of the window.
149    ///
150    /// Readable | Writable
151    ///
152    ///
153    /// #### `deletable`
154    ///  Whether the window frame should have a close button.
155    ///
156    /// Readable | Writable
157    ///
158    ///
159    /// #### `destroy-with-parent`
160    ///  If this window should be destroyed when the parent is destroyed.
161    ///
162    /// Readable | Writable
163    ///
164    ///
165    /// #### `display`
166    ///  The display that will display this window.
167    ///
168    /// Readable | Writable
169    ///
170    ///
171    /// #### `focus-visible`
172    ///  Whether 'focus rectangles' are currently visible in this window.
173    ///
174    /// This property is maintained by GTK based on user input
175    /// and should not be set by applications.
176    ///
177    /// Readable | Writable
178    ///
179    ///
180    /// #### `focus-widget`
181    ///  The focus widget.
182    ///
183    /// Readable | Writable
184    ///
185    ///
186    /// #### `fullscreened`
187    ///  Whether the window is fullscreen.
188    ///
189    /// Setting this property is the equivalent of calling
190    /// [`GtkWindowExtManual::fullscreen()`][crate::gtk::prelude::GtkWindowExtManual::fullscreen()] or [`GtkWindowExtManual::unfullscreen()`][crate::gtk::prelude::GtkWindowExtManual::unfullscreen()];
191    /// either operation is asynchronous, which means you will need to
192    /// connect to the ::notify signal in order to know whether the
193    /// operation was successful.
194    ///
195    /// Readable | Writable
196    ///
197    ///
198    /// #### `gravity`
199    ///  The gravity to use when resizing the window programmatically.
200    ///
201    /// Gravity describes which point of the window we want to keep
202    /// fixed (meaning that the window will grow in the opposite direction).
203    /// For example, a gravity of `GTK_WINDOW_GRAVITY_TOP_RIGHT` means that we
204    /// want the to fix top right corner of the window.
205    ///
206    /// Readable | Writable
207    ///
208    ///
209    /// #### `handle-menubar-accel`
210    ///   for activating
211    /// menubars.
212    ///
213    /// Readable | Writable
214    ///
215    ///
216    /// #### `hide-on-close`
217    ///  If this window should be hidden instead of destroyed when the user clicks
218    /// the close button.
219    ///
220    /// Readable | Writable
221    ///
222    ///
223    /// #### `icon-name`
224    ///  Specifies the name of the themed icon to use as the window icon.
225    ///
226    /// See `Gtk::IconTheme` for more details.
227    ///
228    /// Readable | Writable
229    ///
230    ///
231    /// #### `is-active`
232    ///  Whether the toplevel is the currently active window.
233    ///
234    /// Readable
235    ///
236    ///
237    /// #### `maximized`
238    ///  Whether the window is maximized.
239    ///
240    /// Setting this property is the equivalent of calling
241    /// [`GtkWindowExtManual::maximize()`][crate::gtk::prelude::GtkWindowExtManual::maximize()] or [`GtkWindowExtManual::unmaximize()`][crate::gtk::prelude::GtkWindowExtManual::unmaximize()];
242    /// either operation is asynchronous, which means you will need to
243    /// connect to the ::notify signal in order to know whether the
244    /// operation was successful.
245    ///
246    /// Readable | Writable
247    ///
248    ///
249    /// #### `mnemonics-visible`
250    ///  Whether mnemonics are currently visible in this window.
251    ///
252    /// This property is maintained by GTK based on user input,
253    /// and should not be set by applications.
254    ///
255    /// Readable | Writable
256    ///
257    ///
258    /// #### `modal`
259    ///  If true, the window is modal.
260    ///
261    /// Readable | Writable
262    ///
263    ///
264    /// #### `resizable`
265    ///  If true, users can resize the window.
266    ///
267    /// Readable | Writable
268    ///
269    ///
270    /// #### `startup-id`
271    ///  A write-only property for setting window's startup notification identifier.
272    ///
273    /// Writable
274    ///
275    ///
276    /// #### `suspended`
277    ///  Whether the window is suspended.
278    ///
279    /// See [`GtkWindowExtManual::is_suspended()`][crate::gtk::prelude::GtkWindowExtManual::is_suspended()] for details about what suspended means.
280    ///
281    /// Readable
282    ///
283    ///
284    /// #### `title`
285    ///  The title of the window.
286    ///
287    /// Readable | Writable
288    ///
289    ///
290    /// #### `titlebar`
291    ///  The titlebar widget.
292    ///
293    /// Readable | Writable
294    ///
295    ///
296    /// #### `transient-for`
297    ///  The transient parent of the window.
298    ///
299    /// Readable | Writable | Construct
300    /// </details>
301    /// <details><summary><h4>Widget</h4></summary>
302    ///
303    ///
304    /// #### `can-focus`
305    ///  Whether the widget or any of its descendents can accept
306    /// the input focus.
307    ///
308    /// This property is meant to be set by widget implementations,
309    /// typically in their instance init function.
310    ///
311    /// Readable | Writable
312    ///
313    ///
314    /// #### `can-target`
315    ///  Whether the widget can receive pointer events.
316    ///
317    /// Readable | Writable
318    ///
319    ///
320    /// #### `css-classes`
321    ///  A list of css classes applied to this widget.
322    ///
323    /// Readable | Writable
324    ///
325    ///
326    /// #### `css-name`
327    ///  The name of this widget in the CSS tree.
328    ///
329    /// This property is meant to be set by widget implementations,
330    /// typically in their instance init function.
331    ///
332    /// Readable | Writable | Construct Only
333    ///
334    ///
335    /// #### `cursor`
336    ///  The cursor used by @widget.
337    ///
338    /// Readable | Writable
339    ///
340    ///
341    /// #### `focus-on-click`
342    ///  Whether the widget should grab focus when it is clicked with the mouse.
343    ///
344    /// This property is only relevant for widgets that can take focus.
345    ///
346    /// Readable | Writable
347    ///
348    ///
349    /// #### `focusable`
350    ///  Whether this widget itself will accept the input focus.
351    ///
352    /// Readable | Writable
353    ///
354    ///
355    /// #### `halign`
356    ///  How to distribute horizontal space if widget gets extra space.
357    ///
358    /// Readable | Writable
359    ///
360    ///
361    /// #### `has-default`
362    ///  Whether the widget is the default widget.
363    ///
364    /// Readable
365    ///
366    ///
367    /// #### `has-focus`
368    ///  Whether the widget has the input focus.
369    ///
370    /// Readable
371    ///
372    ///
373    /// #### `has-tooltip`
374    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
375    /// signal on @widget.
376    ///
377    /// A true value indicates that @widget can have a tooltip, in this case
378    /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
379    /// determine whether it will provide a tooltip or not.
380    ///
381    /// Readable | Writable
382    ///
383    ///
384    /// #### `height-request`
385    ///  Overrides for height request of the widget.
386    ///
387    /// If this is -1, the natural request will be used.
388    ///
389    /// Readable | Writable
390    ///
391    ///
392    /// #### `hexpand`
393    ///  Whether to expand horizontally.
394    ///
395    /// Readable | Writable
396    ///
397    ///
398    /// #### `hexpand-set`
399    ///  Whether to use the `hexpand` property.
400    ///
401    /// Readable | Writable
402    ///
403    ///
404    /// #### `layout-manager`
405    ///  The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
406    /// the preferred size of the widget, and allocate its children.
407    ///
408    /// This property is meant to be set by widget implementations,
409    /// typically in their instance init function.
410    ///
411    /// Readable | Writable
412    ///
413    ///
414    /// #### `limit-events`
415    ///  Makes this widget act like a modal dialog, with respect to
416    /// event delivery.
417    ///
418    /// Global event controllers will not handle events with targets
419    /// inside the widget, unless they are set up to ignore propagation
420    /// limits. See `Gtk::EventController::set_propagation_limit()`.
421    ///
422    /// Readable | Writable
423    ///
424    ///
425    /// #### `margin-bottom`
426    ///  Margin on bottom side of widget.
427    ///
428    /// This property adds margin outside of the widget's normal size
429    /// request, the margin will be added in addition to the size from
430    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
431    ///
432    /// Readable | Writable
433    ///
434    ///
435    /// #### `margin-end`
436    ///  Margin on end of widget, horizontally.
437    ///
438    /// This property supports left-to-right and right-to-left text
439    /// directions.
440    ///
441    /// This property adds margin outside of the widget's normal size
442    /// request, the margin will be added in addition to the size from
443    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
444    ///
445    /// Readable | Writable
446    ///
447    ///
448    /// #### `margin-start`
449    ///  Margin on start of widget, horizontally.
450    ///
451    /// This property supports left-to-right and right-to-left text
452    /// directions.
453    ///
454    /// This property adds margin outside of the widget's normal size
455    /// request, the margin will be added in addition to the size from
456    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
457    ///
458    /// Readable | Writable
459    ///
460    ///
461    /// #### `margin-top`
462    ///  Margin on top side of widget.
463    ///
464    /// This property adds margin outside of the widget's normal size
465    /// request, the margin will be added in addition to the size from
466    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
467    ///
468    /// Readable | Writable
469    ///
470    ///
471    /// #### `name`
472    ///  The name of the widget.
473    ///
474    /// Readable | Writable
475    ///
476    ///
477    /// #### `opacity`
478    ///  The requested opacity of the widget.
479    ///
480    /// Readable | Writable
481    ///
482    ///
483    /// #### `overflow`
484    ///  How content outside the widget's content area is treated.
485    ///
486    /// This property is meant to be set by widget implementations,
487    /// typically in their instance init function.
488    ///
489    /// Readable | Writable
490    ///
491    ///
492    /// #### `parent`
493    ///  The parent widget of this widget.
494    ///
495    /// Readable
496    ///
497    ///
498    /// #### `receives-default`
499    ///  Whether the widget will receive the default action when it is focused.
500    ///
501    /// Readable | Writable
502    ///
503    ///
504    /// #### `root`
505    ///  The [`gtk::Root`][crate::gtk::Root] widget of the widget tree containing this widget.
506    ///
507    /// This will be `NULL` if the widget is not contained in a root widget.
508    ///
509    /// Readable
510    ///
511    ///
512    /// #### `scale-factor`
513    ///  The scale factor of the widget.
514    ///
515    /// Readable
516    ///
517    ///
518    /// #### `sensitive`
519    ///  Whether the widget responds to input.
520    ///
521    /// Readable | Writable
522    ///
523    ///
524    /// #### `tooltip-markup`
525    ///  Sets the text of tooltip to be the given string, which is marked up
526    /// with Pango markup.
527    ///
528    /// Also see `Gtk::Tooltip::set_markup()`.
529    ///
530    /// This is a convenience property which will take care of getting the
531    /// tooltip shown if the given string is not `NULL`:
532    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
533    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
534    /// the default signal handler.
535    ///
536    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
537    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
538    ///
539    /// Readable | Writable
540    ///
541    ///
542    /// #### `tooltip-text`
543    ///  Sets the text of tooltip to be the given string.
544    ///
545    /// Also see `Gtk::Tooltip::set_text()`.
546    ///
547    /// This is a convenience property which will take care of getting the
548    /// tooltip shown if the given string is not `NULL`:
549    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
550    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
551    /// the default signal handler.
552    ///
553    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
554    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
555    ///
556    /// Readable | Writable
557    ///
558    ///
559    /// #### `valign`
560    ///  How to distribute vertical space if widget gets extra space.
561    ///
562    /// Readable | Writable
563    ///
564    ///
565    /// #### `vexpand`
566    ///  Whether to expand vertically.
567    ///
568    /// Readable | Writable
569    ///
570    ///
571    /// #### `vexpand-set`
572    ///  Whether to use the `vexpand` property.
573    ///
574    /// Readable | Writable
575    ///
576    ///
577    /// #### `visible`
578    ///  Whether the widget is visible.
579    ///
580    /// Readable | Writable
581    ///
582    ///
583    /// #### `width-request`
584    ///  Overrides for width request of the widget.
585    ///
586    /// If this is -1, the natural request will be used.
587    ///
588    /// Readable | Writable
589    /// </details>
590    /// <details><summary><h4>Accessible</h4></summary>
591    ///
592    ///
593    /// #### `accessible-role`
594    ///  The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
595    ///
596    /// The accessible role cannot be changed once set.
597    ///
598    /// Readable | Writable
599    /// </details>
600    ///
601    /// # Implements
602    ///
603    /// [`PreferencesWindowExt`][trait@crate::prelude::PreferencesWindowExt], [`AdwWindowExt`][trait@crate::prelude::AdwWindowExt], [`trait@gtk::prelude::GtkWindowExt`], [`trait@gtk::prelude::WidgetExt`], [`trait@glib::ObjectExt`], [`trait@gtk::prelude::AccessibleExt`], [`trait@gtk::prelude::BuildableExt`], [`trait@gtk::prelude::ConstraintTargetExt`], [`trait@gtk::prelude::NativeExt`], [`trait@gtk::prelude::RootExt`], [`trait@gtk::prelude::ShortcutManagerExt`]
604    #[doc(alias = "AdwPreferencesWindow")]
605    pub struct PreferencesWindow(Object<ffi::AdwPreferencesWindow, ffi::AdwPreferencesWindowClass>) @extends Window, gtk::Window, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Native, gtk::Root, gtk::ShortcutManager;
606
607    match fn {
608        type_ => || ffi::adw_preferences_window_get_type(),
609    }
610}
611
612#[cfg(not(feature = "gtk_v4_10"))]
613glib::wrapper! {
614    #[doc(alias = "AdwPreferencesWindow")]
615    pub struct PreferencesWindow(Object<ffi::AdwPreferencesWindow, ffi::AdwPreferencesWindowClass>) @extends Window, gtk::Window, gtk::Widget, @implements gtk::Buildable, gtk::ConstraintTarget, gtk::Native, gtk::Root, gtk::ShortcutManager;
616
617    match fn {
618        type_ => || ffi::adw_preferences_window_get_type(),
619    }
620}
621
622impl PreferencesWindow {
623    pub const NONE: Option<&'static PreferencesWindow> = None;
624
625    /// Creates a new [`PreferencesWindow`][crate::PreferencesWindow].
626    ///
627    /// # Deprecated since 1.6
628    ///
629    /// Use [`PreferencesDialog`][crate::PreferencesDialog].
630    ///
631    /// # Returns
632    ///
633    /// the newly created [`PreferencesWindow`][crate::PreferencesWindow]
634    #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")]
635    #[allow(deprecated)]
636    #[doc(alias = "adw_preferences_window_new")]
637    pub fn new() -> PreferencesWindow {
638        assert_initialized_main_thread!();
639        unsafe { gtk::Widget::from_glib_none(ffi::adw_preferences_window_new()).unsafe_cast() }
640    }
641
642    // rustdoc-stripper-ignore-next
643    /// Creates a new builder-pattern struct instance to construct [`PreferencesWindow`] objects.
644    ///
645    /// This method returns an instance of [`PreferencesWindowBuilder`](crate::builders::PreferencesWindowBuilder) which can be used to create [`PreferencesWindow`] objects.
646    pub fn builder() -> PreferencesWindowBuilder {
647        PreferencesWindowBuilder::new()
648    }
649}
650
651impl Default for PreferencesWindow {
652    fn default() -> Self {
653        Self::new()
654    }
655}
656
657// rustdoc-stripper-ignore-next
658/// A [builder-pattern] type to construct [`PreferencesWindow`] objects.
659///
660/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
661#[must_use = "The builder must be built to be used"]
662pub struct PreferencesWindowBuilder {
663    builder: glib::object::ObjectBuilder<'static, PreferencesWindow>,
664}
665
666impl PreferencesWindowBuilder {
667    fn new() -> Self {
668        Self {
669            builder: glib::object::Object::builder(),
670        }
671    }
672
673    ///  shortcut.
674    ///
675    /// For right-to-left locales, gestures and shortcuts are reversed.
676    ///
677    /// Has no effect for subpages added with
678    /// [`PreferencesWindowExt::push_subpage()`][crate::prelude::PreferencesWindowExt::push_subpage()].
679    /// Use [`can-pop`][struct@crate::NavigationPage#can-pop] instead.
680    #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
681    pub fn can_navigate_back(self, can_navigate_back: bool) -> Self {
682        Self {
683            builder: self
684                .builder
685                .property("can-navigate-back", can_navigate_back),
686        }
687    }
688
689    /// Whether search is enabled.
690    /// Use [`PreferencesDialog`][crate::PreferencesDialog].
691    #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")]
692    pub fn search_enabled(self, search_enabled: bool) -> Self {
693        Self {
694            builder: self.builder.property("search-enabled", search_enabled),
695        }
696    }
697
698    /// The currently visible page.
699    /// Use [`PreferencesDialog`][crate::PreferencesDialog].
700    #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")]
701    pub fn visible_page(self, visible_page: &impl IsA<gtk::Widget>) -> Self {
702        Self {
703            builder: self
704                .builder
705                .property("visible-page", visible_page.clone().upcast()),
706        }
707    }
708
709    /// The name of the currently visible page.
710    ///
711    /// See [`visible-page`][struct@crate::PreferencesWindow#visible-page].
712    /// Use [`PreferencesDialog`][crate::PreferencesDialog].
713    #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")]
714    pub fn visible_page_name(self, visible_page_name: impl Into<glib::GString>) -> Self {
715        Self {
716            builder: self
717                .builder
718                .property("visible-page-name", visible_page_name.into()),
719        }
720    }
721
722    /// Whether adaptive preview is currently open.
723    ///
724    /// Adaptive preview is a debugging tool used for testing the window
725    /// contents at specific screen sizes, simulating mobile environment.
726    ///
727    /// Adaptive preview can always be accessed from inspector. This function
728    /// allows applications to open it manually.
729    ///
730    /// Most applications should not use this property.
731    #[cfg(feature = "v1_7")]
732    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
733    pub fn adaptive_preview(self, adaptive_preview: bool) -> Self {
734        Self {
735            builder: self.builder.property("adaptive-preview", adaptive_preview),
736        }
737    }
738
739    /// The content widget.
740    ///
741    /// This property should always be used instead of [`child`][struct@crate::gtk::Window#child].
742    pub fn content(self, content: &impl IsA<gtk::Widget>) -> Self {
743        Self {
744            builder: self.builder.property("content", content.clone().upcast()),
745        }
746    }
747
748    /// The [`gtk::Application`][crate::gtk::Application] associated with the window.
749    ///
750    /// The application will be kept alive for at least as long as it
751    /// has any windows associated with it (see g_application_hold()
752    /// for a way to keep it alive without windows).
753    ///
754    /// Normally, the connection between the application and the window
755    /// will remain until the window is destroyed, but you can explicitly
756    /// remove it by setting the this property to `NULL`.
757    pub fn application(self, application: &impl IsA<gtk::Application>) -> Self {
758        Self {
759            builder: self
760                .builder
761                .property("application", application.clone().upcast()),
762        }
763    }
764
765    /// Whether the window should have a frame (also known as *decorations*).
766    pub fn decorated(self, decorated: bool) -> Self {
767        Self {
768            builder: self.builder.property("decorated", decorated),
769        }
770    }
771
772    /// The default height of the window.
773    pub fn default_height(self, default_height: i32) -> Self {
774        Self {
775            builder: self.builder.property("default-height", default_height),
776        }
777    }
778
779    /// The default widget.
780    pub fn default_widget(self, default_widget: &impl IsA<gtk::Widget>) -> Self {
781        Self {
782            builder: self
783                .builder
784                .property("default-widget", default_widget.clone().upcast()),
785        }
786    }
787
788    /// The default width of the window.
789    pub fn default_width(self, default_width: i32) -> Self {
790        Self {
791            builder: self.builder.property("default-width", default_width),
792        }
793    }
794
795    /// Whether the window frame should have a close button.
796    pub fn deletable(self, deletable: bool) -> Self {
797        Self {
798            builder: self.builder.property("deletable", deletable),
799        }
800    }
801
802    /// If this window should be destroyed when the parent is destroyed.
803    pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self {
804        Self {
805            builder: self
806                .builder
807                .property("destroy-with-parent", destroy_with_parent),
808        }
809    }
810
811    /// The display that will display this window.
812    pub fn display(self, display: &gdk::Display) -> Self {
813        Self {
814            builder: self.builder.property("display", display.clone()),
815        }
816    }
817
818    /// Whether 'focus rectangles' are currently visible in this window.
819    ///
820    /// This property is maintained by GTK based on user input
821    /// and should not be set by applications.
822    pub fn focus_visible(self, focus_visible: bool) -> Self {
823        Self {
824            builder: self.builder.property("focus-visible", focus_visible),
825        }
826    }
827
828    /// The focus widget.
829    pub fn focus_widget(self, focus_widget: &impl IsA<gtk::Widget>) -> Self {
830        Self {
831            builder: self
832                .builder
833                .property("focus-widget", focus_widget.clone().upcast()),
834        }
835    }
836
837    /// Whether the window is fullscreen.
838    ///
839    /// Setting this property is the equivalent of calling
840    /// [`GtkWindowExtManual::fullscreen()`][crate::gtk::prelude::GtkWindowExtManual::fullscreen()] or [`GtkWindowExtManual::unfullscreen()`][crate::gtk::prelude::GtkWindowExtManual::unfullscreen()];
841    /// either operation is asynchronous, which means you will need to
842    /// connect to the ::notify signal in order to know whether the
843    /// operation was successful.
844    pub fn fullscreened(self, fullscreened: bool) -> Self {
845        Self {
846            builder: self.builder.property("fullscreened", fullscreened),
847        }
848    }
849
850    /// The gravity to use when resizing the window programmatically.
851    ///
852    /// Gravity describes which point of the window we want to keep
853    /// fixed (meaning that the window will grow in the opposite direction).
854    /// For example, a gravity of `GTK_WINDOW_GRAVITY_TOP_RIGHT` means that we
855    /// want the to fix top right corner of the window.
856    #[cfg(feature = "gtk_v4_20")]
857    #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_20")))]
858    pub fn gravity(self, gravity: gtk::WindowGravity) -> Self {
859        Self {
860            builder: self.builder.property("gravity", gravity),
861        }
862    }
863
864    ///  for activating
865    /// menubars.
866    #[cfg(feature = "gtk_v4_2")]
867    #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_2")))]
868    pub fn handle_menubar_accel(self, handle_menubar_accel: bool) -> Self {
869        Self {
870            builder: self
871                .builder
872                .property("handle-menubar-accel", handle_menubar_accel),
873        }
874    }
875
876    /// If this window should be hidden instead of destroyed when the user clicks
877    /// the close button.
878    pub fn hide_on_close(self, hide_on_close: bool) -> Self {
879        Self {
880            builder: self.builder.property("hide-on-close", hide_on_close),
881        }
882    }
883
884    /// Specifies the name of the themed icon to use as the window icon.
885    ///
886    /// See `Gtk::IconTheme` for more details.
887    pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
888        Self {
889            builder: self.builder.property("icon-name", icon_name.into()),
890        }
891    }
892
893    /// Whether the window is maximized.
894    ///
895    /// Setting this property is the equivalent of calling
896    /// [`GtkWindowExtManual::maximize()`][crate::gtk::prelude::GtkWindowExtManual::maximize()] or [`GtkWindowExtManual::unmaximize()`][crate::gtk::prelude::GtkWindowExtManual::unmaximize()];
897    /// either operation is asynchronous, which means you will need to
898    /// connect to the ::notify signal in order to know whether the
899    /// operation was successful.
900    pub fn maximized(self, maximized: bool) -> Self {
901        Self {
902            builder: self.builder.property("maximized", maximized),
903        }
904    }
905
906    /// Whether mnemonics are currently visible in this window.
907    ///
908    /// This property is maintained by GTK based on user input,
909    /// and should not be set by applications.
910    pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self {
911        Self {
912            builder: self
913                .builder
914                .property("mnemonics-visible", mnemonics_visible),
915        }
916    }
917
918    /// If true, the window is modal.
919    pub fn modal(self, modal: bool) -> Self {
920        Self {
921            builder: self.builder.property("modal", modal),
922        }
923    }
924
925    /// If true, users can resize the window.
926    pub fn resizable(self, resizable: bool) -> Self {
927        Self {
928            builder: self.builder.property("resizable", resizable),
929        }
930    }
931
932    /// A write-only property for setting window's startup notification identifier.
933    pub fn startup_id(self, startup_id: impl Into<glib::GString>) -> Self {
934        Self {
935            builder: self.builder.property("startup-id", startup_id.into()),
936        }
937    }
938
939    /// The title of the window.
940    pub fn title(self, title: impl Into<glib::GString>) -> Self {
941        Self {
942            builder: self.builder.property("title", title.into()),
943        }
944    }
945
946    /// The titlebar widget.
947    #[cfg(feature = "gtk_v4_6")]
948    #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_6")))]
949    pub fn titlebar(self, titlebar: &impl IsA<gtk::Widget>) -> Self {
950        Self {
951            builder: self.builder.property("titlebar", titlebar.clone().upcast()),
952        }
953    }
954
955    /// The transient parent of the window.
956    pub fn transient_for(self, transient_for: &impl IsA<gtk::Window>) -> Self {
957        Self {
958            builder: self
959                .builder
960                .property("transient-for", transient_for.clone().upcast()),
961        }
962    }
963
964    /// Whether the widget or any of its descendents can accept
965    /// the input focus.
966    ///
967    /// This property is meant to be set by widget implementations,
968    /// typically in their instance init function.
969    pub fn can_focus(self, can_focus: bool) -> Self {
970        Self {
971            builder: self.builder.property("can-focus", can_focus),
972        }
973    }
974
975    /// Whether the widget can receive pointer events.
976    pub fn can_target(self, can_target: bool) -> Self {
977        Self {
978            builder: self.builder.property("can-target", can_target),
979        }
980    }
981
982    /// A list of css classes applied to this widget.
983    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
984        Self {
985            builder: self.builder.property("css-classes", css_classes.into()),
986        }
987    }
988
989    /// The name of this widget in the CSS tree.
990    ///
991    /// This property is meant to be set by widget implementations,
992    /// typically in their instance init function.
993    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
994        Self {
995            builder: self.builder.property("css-name", css_name.into()),
996        }
997    }
998
999    /// The cursor used by @widget.
1000    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1001        Self {
1002            builder: self.builder.property("cursor", cursor.clone()),
1003        }
1004    }
1005
1006    /// Whether the widget should grab focus when it is clicked with the mouse.
1007    ///
1008    /// This property is only relevant for widgets that can take focus.
1009    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1010        Self {
1011            builder: self.builder.property("focus-on-click", focus_on_click),
1012        }
1013    }
1014
1015    /// Whether this widget itself will accept the input focus.
1016    pub fn focusable(self, focusable: bool) -> Self {
1017        Self {
1018            builder: self.builder.property("focusable", focusable),
1019        }
1020    }
1021
1022    /// How to distribute horizontal space if widget gets extra space.
1023    pub fn halign(self, halign: gtk::Align) -> Self {
1024        Self {
1025            builder: self.builder.property("halign", halign),
1026        }
1027    }
1028
1029    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
1030    /// signal on @widget.
1031    ///
1032    /// A true value indicates that @widget can have a tooltip, in this case
1033    /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
1034    /// determine whether it will provide a tooltip or not.
1035    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1036        Self {
1037            builder: self.builder.property("has-tooltip", has_tooltip),
1038        }
1039    }
1040
1041    /// Overrides for height request of the widget.
1042    ///
1043    /// If this is -1, the natural request will be used.
1044    pub fn height_request(self, height_request: i32) -> Self {
1045        Self {
1046            builder: self.builder.property("height-request", height_request),
1047        }
1048    }
1049
1050    /// Whether to expand horizontally.
1051    pub fn hexpand(self, hexpand: bool) -> Self {
1052        Self {
1053            builder: self.builder.property("hexpand", hexpand),
1054        }
1055    }
1056
1057    /// Whether to use the `hexpand` property.
1058    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1059        Self {
1060            builder: self.builder.property("hexpand-set", hexpand_set),
1061        }
1062    }
1063
1064    /// The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
1065    /// the preferred size of the widget, and allocate its children.
1066    ///
1067    /// This property is meant to be set by widget implementations,
1068    /// typically in their instance init function.
1069    pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
1070        Self {
1071            builder: self
1072                .builder
1073                .property("layout-manager", layout_manager.clone().upcast()),
1074        }
1075    }
1076
1077    /// Makes this widget act like a modal dialog, with respect to
1078    /// event delivery.
1079    ///
1080    /// Global event controllers will not handle events with targets
1081    /// inside the widget, unless they are set up to ignore propagation
1082    /// limits. See `Gtk::EventController::set_propagation_limit()`.
1083    #[cfg(feature = "gtk_v4_18")]
1084    #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
1085    pub fn limit_events(self, limit_events: bool) -> Self {
1086        Self {
1087            builder: self.builder.property("limit-events", limit_events),
1088        }
1089    }
1090
1091    /// Margin on bottom side of widget.
1092    ///
1093    /// This property adds margin outside of the widget's normal size
1094    /// request, the margin will be added in addition to the size from
1095    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1096    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1097        Self {
1098            builder: self.builder.property("margin-bottom", margin_bottom),
1099        }
1100    }
1101
1102    /// Margin on end of widget, horizontally.
1103    ///
1104    /// This property supports left-to-right and right-to-left text
1105    /// directions.
1106    ///
1107    /// This property adds margin outside of the widget's normal size
1108    /// request, the margin will be added in addition to the size from
1109    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1110    pub fn margin_end(self, margin_end: i32) -> Self {
1111        Self {
1112            builder: self.builder.property("margin-end", margin_end),
1113        }
1114    }
1115
1116    /// Margin on start of widget, horizontally.
1117    ///
1118    /// This property supports left-to-right and right-to-left text
1119    /// directions.
1120    ///
1121    /// This property adds margin outside of the widget's normal size
1122    /// request, the margin will be added in addition to the size from
1123    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1124    pub fn margin_start(self, margin_start: i32) -> Self {
1125        Self {
1126            builder: self.builder.property("margin-start", margin_start),
1127        }
1128    }
1129
1130    /// Margin on top side of widget.
1131    ///
1132    /// This property adds margin outside of the widget's normal size
1133    /// request, the margin will be added in addition to the size from
1134    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1135    pub fn margin_top(self, margin_top: i32) -> Self {
1136        Self {
1137            builder: self.builder.property("margin-top", margin_top),
1138        }
1139    }
1140
1141    /// The name of the widget.
1142    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1143        Self {
1144            builder: self.builder.property("name", name.into()),
1145        }
1146    }
1147
1148    /// The requested opacity of the widget.
1149    pub fn opacity(self, opacity: f64) -> Self {
1150        Self {
1151            builder: self.builder.property("opacity", opacity),
1152        }
1153    }
1154
1155    /// How content outside the widget's content area is treated.
1156    ///
1157    /// This property is meant to be set by widget implementations,
1158    /// typically in their instance init function.
1159    pub fn overflow(self, overflow: gtk::Overflow) -> Self {
1160        Self {
1161            builder: self.builder.property("overflow", overflow),
1162        }
1163    }
1164
1165    /// Whether the widget will receive the default action when it is focused.
1166    pub fn receives_default(self, receives_default: bool) -> Self {
1167        Self {
1168            builder: self.builder.property("receives-default", receives_default),
1169        }
1170    }
1171
1172    /// Whether the widget responds to input.
1173    pub fn sensitive(self, sensitive: bool) -> Self {
1174        Self {
1175            builder: self.builder.property("sensitive", sensitive),
1176        }
1177    }
1178
1179    /// Sets the text of tooltip to be the given string, which is marked up
1180    /// with Pango markup.
1181    ///
1182    /// Also see `Gtk::Tooltip::set_markup()`.
1183    ///
1184    /// This is a convenience property which will take care of getting the
1185    /// tooltip shown if the given string is not `NULL`:
1186    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
1187    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
1188    /// the default signal handler.
1189    ///
1190    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
1191    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
1192    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1193        Self {
1194            builder: self
1195                .builder
1196                .property("tooltip-markup", tooltip_markup.into()),
1197        }
1198    }
1199
1200    /// Sets the text of tooltip to be the given string.
1201    ///
1202    /// Also see `Gtk::Tooltip::set_text()`.
1203    ///
1204    /// This is a convenience property which will take care of getting the
1205    /// tooltip shown if the given string is not `NULL`:
1206    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
1207    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
1208    /// the default signal handler.
1209    ///
1210    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
1211    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
1212    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1213        Self {
1214            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1215        }
1216    }
1217
1218    /// How to distribute vertical space if widget gets extra space.
1219    pub fn valign(self, valign: gtk::Align) -> Self {
1220        Self {
1221            builder: self.builder.property("valign", valign),
1222        }
1223    }
1224
1225    /// Whether to expand vertically.
1226    pub fn vexpand(self, vexpand: bool) -> Self {
1227        Self {
1228            builder: self.builder.property("vexpand", vexpand),
1229        }
1230    }
1231
1232    /// Whether to use the `vexpand` property.
1233    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1234        Self {
1235            builder: self.builder.property("vexpand-set", vexpand_set),
1236        }
1237    }
1238
1239    /// Whether the widget is visible.
1240    pub fn visible(self, visible: bool) -> Self {
1241        Self {
1242            builder: self.builder.property("visible", visible),
1243        }
1244    }
1245
1246    /// Overrides for width request of the widget.
1247    ///
1248    /// If this is -1, the natural request will be used.
1249    pub fn width_request(self, width_request: i32) -> Self {
1250        Self {
1251            builder: self.builder.property("width-request", width_request),
1252        }
1253    }
1254
1255    /// The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
1256    ///
1257    /// The accessible role cannot be changed once set.
1258    pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
1259        Self {
1260            builder: self.builder.property("accessible-role", accessible_role),
1261        }
1262    }
1263
1264    // rustdoc-stripper-ignore-next
1265    /// Build the [`PreferencesWindow`].
1266    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1267    pub fn build(self) -> PreferencesWindow {
1268        assert_initialized_main_thread!();
1269        self.builder.build()
1270    }
1271}
1272
1273/// Trait containing all [`struct@PreferencesWindow`] methods.
1274///
1275/// # Implementors
1276///
1277/// [`PreferencesWindow`][struct@crate::PreferencesWindow]
1278pub trait PreferencesWindowExt: IsA<PreferencesWindow> + 'static {
1279    /// Adds a preferences page to @self.
1280    ///
1281    /// # Deprecated since 1.6
1282    ///
1283    /// Use [`PreferencesDialog`][crate::PreferencesDialog].
1284    /// ## `page`
1285    /// the page to add
1286    #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")]
1287    #[allow(deprecated)]
1288    #[doc(alias = "adw_preferences_window_add")]
1289    fn add(&self, page: &impl IsA<PreferencesPage>) {
1290        unsafe {
1291            ffi::adw_preferences_window_add(
1292                self.as_ref().to_glib_none().0,
1293                page.as_ref().to_glib_none().0,
1294            );
1295        }
1296    }
1297
1298    /// Displays @toast.
1299    ///
1300    /// See [`ToastOverlay::add_toast()`][crate::ToastOverlay::add_toast()].
1301    ///
1302    /// # Deprecated since 1.6
1303    ///
1304    /// Use [`PreferencesDialog`][crate::PreferencesDialog].
1305    /// ## `toast`
1306    /// a toast
1307    #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")]
1308    #[allow(deprecated)]
1309    #[doc(alias = "adw_preferences_window_add_toast")]
1310    fn add_toast(&self, toast: Toast) {
1311        unsafe {
1312            ffi::adw_preferences_window_add_toast(
1313                self.as_ref().to_glib_none().0,
1314                toast.into_glib_ptr(),
1315            );
1316        }
1317    }
1318
1319    /// Closes the current subpage.
1320    ///
1321    /// If there is no presented subpage, this does nothing.
1322    ///
1323    /// # Deprecated since 1.4
1324    ///
1325    /// Use [`pop_subpage()`][Self::pop_subpage()] instead.
1326    #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1327    #[allow(deprecated)]
1328    #[doc(alias = "adw_preferences_window_close_subpage")]
1329    fn close_subpage(&self) {
1330        unsafe {
1331            ffi::adw_preferences_window_close_subpage(self.as_ref().to_glib_none().0);
1332        }
1333    }
1334
1335    /// Gets whether gestures and shortcuts for closing subpages are enabled.
1336    ///
1337    /// # Deprecated since 1.4
1338    ///
1339    /// Use [`NavigationPageExt::can_pop()`][crate::prelude::NavigationPageExt::can_pop()] instead.
1340    ///
1341    /// # Returns
1342    ///
1343    /// whether gestures and shortcuts are enabled.
1344    #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1345    #[allow(deprecated)]
1346    #[doc(alias = "adw_preferences_window_get_can_navigate_back")]
1347    #[doc(alias = "get_can_navigate_back")]
1348    #[doc(alias = "can-navigate-back")]
1349    fn can_navigate_back(&self) -> bool {
1350        unsafe {
1351            from_glib(ffi::adw_preferences_window_get_can_navigate_back(
1352                self.as_ref().to_glib_none().0,
1353            ))
1354        }
1355    }
1356
1357    /// Gets whether search is enabled for @self.
1358    ///
1359    /// # Deprecated since 1.6
1360    ///
1361    /// Use [`PreferencesDialog`][crate::PreferencesDialog].
1362    ///
1363    /// # Returns
1364    ///
1365    /// whether search is enabled for @self.
1366    #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")]
1367    #[allow(deprecated)]
1368    #[doc(alias = "adw_preferences_window_get_search_enabled")]
1369    #[doc(alias = "get_search_enabled")]
1370    #[doc(alias = "search-enabled")]
1371    fn is_search_enabled(&self) -> bool {
1372        unsafe {
1373            from_glib(ffi::adw_preferences_window_get_search_enabled(
1374                self.as_ref().to_glib_none().0,
1375            ))
1376        }
1377    }
1378
1379    /// Gets the currently visible page of @self.
1380    ///
1381    /// # Deprecated since 1.6
1382    ///
1383    /// Use [`PreferencesDialog`][crate::PreferencesDialog].
1384    ///
1385    /// # Returns
1386    ///
1387    /// the visible page
1388    #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")]
1389    #[allow(deprecated)]
1390    #[doc(alias = "adw_preferences_window_get_visible_page")]
1391    #[doc(alias = "get_visible_page")]
1392    #[doc(alias = "visible-page")]
1393    fn visible_page(&self) -> Option<PreferencesPage> {
1394        unsafe {
1395            from_glib_none(ffi::adw_preferences_window_get_visible_page(
1396                self.as_ref().to_glib_none().0,
1397            ))
1398        }
1399    }
1400
1401    /// Gets the name of currently visible page of @self.
1402    ///
1403    /// # Deprecated since 1.6
1404    ///
1405    /// Use [`PreferencesDialog`][crate::PreferencesDialog].
1406    ///
1407    /// # Returns
1408    ///
1409    /// the name of the visible page
1410    #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")]
1411    #[allow(deprecated)]
1412    #[doc(alias = "adw_preferences_window_get_visible_page_name")]
1413    #[doc(alias = "get_visible_page_name")]
1414    #[doc(alias = "visible-page-name")]
1415    fn visible_page_name(&self) -> Option<glib::GString> {
1416        unsafe {
1417            from_glib_none(ffi::adw_preferences_window_get_visible_page_name(
1418                self.as_ref().to_glib_none().0,
1419            ))
1420        }
1421    }
1422
1423    /// Pop the visible page from the subpage stack of @self.
1424    ///
1425    /// # Deprecated since 1.6
1426    ///
1427    /// Use [`PreferencesDialog`][crate::PreferencesDialog].
1428    ///
1429    /// # Returns
1430    ///
1431    /// `TRUE` if a page has been popped
1432    #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")]
1433    #[cfg(feature = "v1_4")]
1434    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1435    #[allow(deprecated)]
1436    #[doc(alias = "adw_preferences_window_pop_subpage")]
1437    fn pop_subpage(&self) -> bool {
1438        unsafe {
1439            from_glib(ffi::adw_preferences_window_pop_subpage(
1440                self.as_ref().to_glib_none().0,
1441            ))
1442        }
1443    }
1444
1445    /// Sets @subpage as the window's subpage and opens it.
1446    ///
1447    /// The transition can be cancelled by the user, in which case visible child will
1448    /// change back to the previously visible child.
1449    ///
1450    /// # Deprecated since 1.4
1451    ///
1452    /// Use [`push_subpage()`][Self::push_subpage()] instead.
1453    /// ## `subpage`
1454    /// the subpage
1455    #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1456    #[allow(deprecated)]
1457    #[doc(alias = "adw_preferences_window_present_subpage")]
1458    fn present_subpage(&self, subpage: &impl IsA<gtk::Widget>) {
1459        unsafe {
1460            ffi::adw_preferences_window_present_subpage(
1461                self.as_ref().to_glib_none().0,
1462                subpage.as_ref().to_glib_none().0,
1463            );
1464        }
1465    }
1466
1467    /// Pushes @page onto the subpage stack of @self.
1468    ///
1469    /// The page will be automatically removed when popped.
1470    ///
1471    /// # Deprecated since 1.6
1472    ///
1473    /// Use [`PreferencesDialog`][crate::PreferencesDialog].
1474    /// ## `page`
1475    /// the subpage
1476    #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")]
1477    #[cfg(feature = "v1_4")]
1478    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1479    #[allow(deprecated)]
1480    #[doc(alias = "adw_preferences_window_push_subpage")]
1481    fn push_subpage(&self, page: &impl IsA<NavigationPage>) {
1482        unsafe {
1483            ffi::adw_preferences_window_push_subpage(
1484                self.as_ref().to_glib_none().0,
1485                page.as_ref().to_glib_none().0,
1486            );
1487        }
1488    }
1489
1490    /// Removes a page from @self.
1491    ///
1492    /// # Deprecated since 1.6
1493    ///
1494    /// Use [`PreferencesDialog`][crate::PreferencesDialog].
1495    /// ## `page`
1496    /// the page to remove
1497    #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")]
1498    #[allow(deprecated)]
1499    #[doc(alias = "adw_preferences_window_remove")]
1500    fn remove(&self, page: &impl IsA<PreferencesPage>) {
1501        unsafe {
1502            ffi::adw_preferences_window_remove(
1503                self.as_ref().to_glib_none().0,
1504                page.as_ref().to_glib_none().0,
1505            );
1506        }
1507    }
1508
1509    ///  shortcut.
1510    ///
1511    /// For right-to-left locales, gestures and shortcuts are reversed.
1512    ///
1513    /// Has no effect for subpages added with [`push_subpage()`][Self::push_subpage()].
1514    ///
1515    /// # Deprecated since 1.4
1516    ///
1517    /// Use [`NavigationPageExt::set_can_pop()`][crate::prelude::NavigationPageExt::set_can_pop()] instead.
1518    /// ## `can_navigate_back`
1519    /// the new value
1520    #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1521    #[allow(deprecated)]
1522    #[doc(alias = "adw_preferences_window_set_can_navigate_back")]
1523    #[doc(alias = "can-navigate-back")]
1524    fn set_can_navigate_back(&self, can_navigate_back: bool) {
1525        unsafe {
1526            ffi::adw_preferences_window_set_can_navigate_back(
1527                self.as_ref().to_glib_none().0,
1528                can_navigate_back.into_glib(),
1529            );
1530        }
1531    }
1532
1533    /// Sets whether search is enabled for @self.
1534    ///
1535    /// # Deprecated since 1.6
1536    ///
1537    /// Use [`PreferencesDialog`][crate::PreferencesDialog].
1538    /// ## `search_enabled`
1539    /// whether search is enabled
1540    #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")]
1541    #[allow(deprecated)]
1542    #[doc(alias = "adw_preferences_window_set_search_enabled")]
1543    #[doc(alias = "search-enabled")]
1544    fn set_search_enabled(&self, search_enabled: bool) {
1545        unsafe {
1546            ffi::adw_preferences_window_set_search_enabled(
1547                self.as_ref().to_glib_none().0,
1548                search_enabled.into_glib(),
1549            );
1550        }
1551    }
1552
1553    /// Makes @page the visible page of @self.
1554    ///
1555    /// # Deprecated since 1.6
1556    ///
1557    /// Use [`PreferencesDialog`][crate::PreferencesDialog].
1558    /// ## `page`
1559    /// a page of @self
1560    #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")]
1561    #[allow(deprecated)]
1562    #[doc(alias = "adw_preferences_window_set_visible_page")]
1563    #[doc(alias = "visible-page")]
1564    fn set_visible_page(&self, page: &impl IsA<PreferencesPage>) {
1565        unsafe {
1566            ffi::adw_preferences_window_set_visible_page(
1567                self.as_ref().to_glib_none().0,
1568                page.as_ref().to_glib_none().0,
1569            );
1570        }
1571    }
1572
1573    /// Makes the page with the given name visible.
1574    ///
1575    /// See [`visible-page`][struct@crate::PreferencesWindow#visible-page].
1576    ///
1577    /// # Deprecated since 1.6
1578    ///
1579    /// Use [`PreferencesDialog`][crate::PreferencesDialog].
1580    /// ## `name`
1581    /// the name of the page to make visible
1582    #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")]
1583    #[allow(deprecated)]
1584    #[doc(alias = "adw_preferences_window_set_visible_page_name")]
1585    #[doc(alias = "visible-page-name")]
1586    fn set_visible_page_name(&self, name: &str) {
1587        unsafe {
1588            ffi::adw_preferences_window_set_visible_page_name(
1589                self.as_ref().to_glib_none().0,
1590                name.to_glib_none().0,
1591            );
1592        }
1593    }
1594
1595    #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1596    #[doc(alias = "can-navigate-back")]
1597    fn connect_can_navigate_back_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1598        unsafe extern "C" fn notify_can_navigate_back_trampoline<
1599            P: IsA<PreferencesWindow>,
1600            F: Fn(&P) + 'static,
1601        >(
1602            this: *mut ffi::AdwPreferencesWindow,
1603            _param_spec: glib::ffi::gpointer,
1604            f: glib::ffi::gpointer,
1605        ) {
1606            unsafe {
1607                let f: &F = &*(f as *const F);
1608                f(PreferencesWindow::from_glib_borrow(this).unsafe_cast_ref())
1609            }
1610        }
1611        unsafe {
1612            let f: Box_<F> = Box_::new(f);
1613            connect_raw(
1614                self.as_ptr() as *mut _,
1615                c"notify::can-navigate-back".as_ptr(),
1616                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1617                    notify_can_navigate_back_trampoline::<Self, F> as *const (),
1618                )),
1619                Box_::into_raw(f),
1620            )
1621        }
1622    }
1623
1624    #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")]
1625    #[doc(alias = "search-enabled")]
1626    fn connect_search_enabled_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1627        unsafe extern "C" fn notify_search_enabled_trampoline<
1628            P: IsA<PreferencesWindow>,
1629            F: Fn(&P) + 'static,
1630        >(
1631            this: *mut ffi::AdwPreferencesWindow,
1632            _param_spec: glib::ffi::gpointer,
1633            f: glib::ffi::gpointer,
1634        ) {
1635            unsafe {
1636                let f: &F = &*(f as *const F);
1637                f(PreferencesWindow::from_glib_borrow(this).unsafe_cast_ref())
1638            }
1639        }
1640        unsafe {
1641            let f: Box_<F> = Box_::new(f);
1642            connect_raw(
1643                self.as_ptr() as *mut _,
1644                c"notify::search-enabled".as_ptr(),
1645                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1646                    notify_search_enabled_trampoline::<Self, F> as *const (),
1647                )),
1648                Box_::into_raw(f),
1649            )
1650        }
1651    }
1652
1653    #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")]
1654    #[doc(alias = "visible-page")]
1655    fn connect_visible_page_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1656        unsafe extern "C" fn notify_visible_page_trampoline<
1657            P: IsA<PreferencesWindow>,
1658            F: Fn(&P) + 'static,
1659        >(
1660            this: *mut ffi::AdwPreferencesWindow,
1661            _param_spec: glib::ffi::gpointer,
1662            f: glib::ffi::gpointer,
1663        ) {
1664            unsafe {
1665                let f: &F = &*(f as *const F);
1666                f(PreferencesWindow::from_glib_borrow(this).unsafe_cast_ref())
1667            }
1668        }
1669        unsafe {
1670            let f: Box_<F> = Box_::new(f);
1671            connect_raw(
1672                self.as_ptr() as *mut _,
1673                c"notify::visible-page".as_ptr(),
1674                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1675                    notify_visible_page_trampoline::<Self, F> as *const (),
1676                )),
1677                Box_::into_raw(f),
1678            )
1679        }
1680    }
1681
1682    #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")]
1683    #[doc(alias = "visible-page-name")]
1684    fn connect_visible_page_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1685        unsafe extern "C" fn notify_visible_page_name_trampoline<
1686            P: IsA<PreferencesWindow>,
1687            F: Fn(&P) + 'static,
1688        >(
1689            this: *mut ffi::AdwPreferencesWindow,
1690            _param_spec: glib::ffi::gpointer,
1691            f: glib::ffi::gpointer,
1692        ) {
1693            unsafe {
1694                let f: &F = &*(f as *const F);
1695                f(PreferencesWindow::from_glib_borrow(this).unsafe_cast_ref())
1696            }
1697        }
1698        unsafe {
1699            let f: Box_<F> = Box_::new(f);
1700            connect_raw(
1701                self.as_ptr() as *mut _,
1702                c"notify::visible-page-name".as_ptr(),
1703                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1704                    notify_visible_page_name_trampoline::<Self, F> as *const (),
1705                )),
1706                Box_::into_raw(f),
1707            )
1708        }
1709    }
1710}
1711
1712impl<O: IsA<PreferencesWindow>> PreferencesWindowExt for O {}