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