1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files.git)
// DO NOT EDIT

#[cfg(feature = "v3_26")]
#[cfg_attr(docsrs, doc(cfg(feature = "v3_26")))]
use glib::translate::*;
use std::fmt;

glib::wrapper! {
    ///
    ///
    /// ## Properties
    ///
    ///
    /// #### `icon-name`
    ///  The icon-name of the icon to display next to the path element
    /// in the path bar. Set to [`None`] for no icon.
    ///
    /// Readable | Writeable | Construct Only
    ///
    ///
    /// #### `id`
    ///  The id property is an application specific identifier for the
    /// element within the path.
    ///
    /// Readable | Writeable | Construct Only
    ///
    ///
    /// #### `title`
    ///  The title property should contain the display text that should
    /// be shown to represent the element in the [`PathBar`][crate::PathBar].
    ///
    /// Readable | Writeable | Construct Only
    ///
    /// # Implements
    ///
    /// [`trait@glib::ObjectExt`]
    #[doc(alias = "DzlPathElement")]
    pub struct PathElement(Object<ffi::DzlPathElement, ffi::DzlPathElementClass>);

    match fn {
        type_ => || ffi::dzl_path_element_get_type(),
    }
}

impl PathElement {
    /// Creates a new path element for an [`Path`][crate::Path].
    /// ## `id`
    /// An id for the path element.
    /// ## `icon_name`
    /// An optional icon name for the element
    /// ## `title`
    /// The title of the element.
    ///
    /// # Returns
    ///
    /// A [`PathElement`][crate::PathElement]
    #[cfg(feature = "v3_26")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v3_26")))]
    #[doc(alias = "dzl_path_element_new")]
    pub fn new(id: Option<&str>, icon_name: Option<&str>, title: &str) -> PathElement {
        assert_initialized_main_thread!();
        unsafe {
            from_glib_full(ffi::dzl_path_element_new(
                id.to_glib_none().0,
                icon_name.to_glib_none().0,
                title.to_glib_none().0,
            ))
        }
    }

    /// Gets the [`icon-name`][struct@crate::PathElement#icon-name] property. This is used by the
    /// path bar to display an icon next to the element of the path.
    ///
    /// # Returns
    ///
    /// The icon-name for the [`PathElement`][crate::PathElement].
    #[cfg(feature = "v3_26")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v3_26")))]
    #[doc(alias = "dzl_path_element_get_icon_name")]
    #[doc(alias = "get_icon_name")]
    pub fn icon_name(&self) -> Option<glib::GString> {
        unsafe { from_glib_none(ffi::dzl_path_element_get_icon_name(self.to_glib_none().0)) }
    }

    /// Gets the id for the element. Generally, a path is built of
    /// multiple elements and each element should have an id that
    /// is useful to the application that it using it. You might store
    /// the name of a directory, or some other key as the id.
    ///
    /// # Returns
    ///
    /// The id for the [`PathElement`][crate::PathElement].
    #[cfg(feature = "v3_26")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v3_26")))]
    #[doc(alias = "dzl_path_element_get_id")]
    #[doc(alias = "get_id")]
    pub fn id(&self) -> Option<glib::GString> {
        unsafe { from_glib_none(ffi::dzl_path_element_get_id(self.to_glib_none().0)) }
    }

    /// Gets the [`title`][struct@crate::PathElement#title] property. This is used by the
    /// path bar to display text representing the element of the path.
    ///
    /// # Returns
    ///
    /// The title for the [`PathElement`][crate::PathElement].
    #[cfg(feature = "v3_26")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v3_26")))]
    #[doc(alias = "dzl_path_element_get_title")]
    #[doc(alias = "get_title")]
    pub fn title(&self) -> Option<glib::GString> {
        unsafe { from_glib_none(ffi::dzl_path_element_get_title(self.to_glib_none().0)) }
    }
}

impl fmt::Display for PathElement {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        f.write_str("PathElement")
    }
}