Skip to main content

lightdm/auto/
layout.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from lightdm-gir-files
3// DO NOT EDIT
4
5use crate::ffi;
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9    /// #LightDMLayout is an opaque data structure and can only be accessed
10    /// using the provided functions.
11    ///
12    /// ## Properties
13    ///
14    ///
15    /// #### `description`
16    ///  Readable | Writeable | Construct Only
17    ///
18    ///
19    /// #### `name`
20    ///  Readable | Writeable | Construct Only
21    ///
22    ///
23    /// #### `short-description`
24    ///  Readable | Writeable | Construct Only
25    ///
26    /// # Implements
27    ///
28    /// [`LayoutExt`][trait@crate::prelude::LayoutExt]
29    #[doc(alias = "LightDMLayout")]
30    pub struct Layout(Object<ffi::LightDMLayout, ffi::LightDMLayoutClass>);
31
32    match fn {
33        type_ => || ffi::lightdm_layout_get_type(),
34    }
35}
36
37impl Layout {
38    pub const NONE: Option<&'static Layout> = None;
39
40    // rustdoc-stripper-ignore-next
41    /// Creates a new builder-pattern struct instance to construct [`Layout`] objects.
42    ///
43    /// This method returns an instance of [`LayoutBuilder`](crate::builders::LayoutBuilder) which can be used to create [`Layout`] objects.
44    pub fn builder() -> LayoutBuilder {
45        LayoutBuilder::new()
46    }
47}
48
49// rustdoc-stripper-ignore-next
50/// A [builder-pattern] type to construct [`Layout`] objects.
51///
52/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
53#[must_use = "The builder must be built to be used"]
54pub struct LayoutBuilder {
55    builder: glib::object::ObjectBuilder<'static, Layout>,
56}
57
58impl LayoutBuilder {
59    fn new() -> Self {
60        Self {
61            builder: glib::object::Object::builder(),
62        }
63    }
64
65    pub fn description(self, description: impl Into<glib::GString>) -> Self {
66        Self {
67            builder: self.builder.property("description", description.into()),
68        }
69    }
70
71    pub fn name(self, name: impl Into<glib::GString>) -> Self {
72        Self {
73            builder: self.builder.property("name", name.into()),
74        }
75    }
76
77    pub fn short_description(self, short_description: impl Into<glib::GString>) -> Self {
78        Self {
79            builder: self
80                .builder
81                .property("short-description", short_description.into()),
82        }
83    }
84
85    // rustdoc-stripper-ignore-next
86    /// Build the [`Layout`].
87    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
88    pub fn build(self) -> Layout {
89        assert_initialized_main_thread!();
90        self.builder.build()
91    }
92}
93
94/// Trait containing all [`struct@Layout`] methods.
95///
96/// # Implementors
97///
98/// [`Layout`][struct@crate::Layout]
99pub trait LayoutExt: IsA<Layout> + 'static {
100    /// Get the long description of a layout.
101    ///
102    /// # Returns
103    ///
104    /// A long description of the layout
105    #[doc(alias = "lightdm_layout_get_description")]
106    #[doc(alias = "get_description")]
107    fn description(&self) -> Option<glib::GString> {
108        unsafe {
109            from_glib_none(ffi::lightdm_layout_get_description(
110                self.as_ref().to_glib_none().0,
111            ))
112        }
113    }
114
115    /// Get the name of a layout.
116    ///
117    /// # Returns
118    ///
119    /// The name of the layout
120    #[doc(alias = "lightdm_layout_get_name")]
121    #[doc(alias = "get_name")]
122    fn name(&self) -> Option<glib::GString> {
123        unsafe { from_glib_none(ffi::lightdm_layout_get_name(self.as_ref().to_glib_none().0)) }
124    }
125
126    /// Get the short description of a layout.
127    ///
128    /// # Returns
129    ///
130    /// A short description of the layout
131    #[doc(alias = "lightdm_layout_get_short_description")]
132    #[doc(alias = "get_short_description")]
133    #[doc(alias = "short-description")]
134    fn short_description(&self) -> Option<glib::GString> {
135        unsafe {
136            from_glib_none(ffi::lightdm_layout_get_short_description(
137                self.as_ref().to_glib_none().0,
138            ))
139        }
140    }
141}
142
143impl<O: IsA<Layout>> LayoutExt for O {}