gtk4/
directory_list.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use glib::translate::*;
4
5use crate::{ffi, prelude::*, DirectoryList};
6
7impl DirectoryList {
8    #[doc(alias = "gtk_directory_list_get_io_priority")]
9    #[doc(alias = "get_io_priority")]
10    pub fn io_priority(&self) -> glib::Priority {
11        unsafe {
12            from_glib(ffi::gtk_directory_list_get_io_priority(
13                self.to_glib_none().0,
14            ))
15        }
16    }
17
18    #[doc(alias = "gtk_directory_list_set_io_priority")]
19    pub fn set_io_priority(&self, io_priority: glib::Priority) {
20        unsafe {
21            ffi::gtk_directory_list_set_io_priority(self.to_glib_none().0, io_priority.into_glib());
22        }
23    }
24
25    // rustdoc-stripper-ignore-next
26    /// Creates a new builder-pattern struct instance to construct
27    /// [`DirectoryList`] objects.
28    ///
29    /// This method returns an instance of
30    /// [`DirectoryListBuilder`](crate::builders::DirectoryListBuilder) which
31    /// can be used to create [`DirectoryList`] objects.
32    pub fn builder() -> DirectoryListBuilder {
33        DirectoryListBuilder::new()
34    }
35}
36
37// rustdoc-stripper-ignore-next
38/// A [builder-pattern] type to construct [`DirectoryList`] objects.
39///
40/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
41#[must_use = "The builder must be built to be used"]
42pub struct DirectoryListBuilder {
43    builder: glib::object::ObjectBuilder<'static, DirectoryList>,
44}
45
46impl DirectoryListBuilder {
47    fn new() -> Self {
48        Self {
49            builder: glib::object::Object::builder(),
50        }
51    }
52    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
53    pub fn build(self) -> DirectoryList {
54        self.builder.build()
55    }
56
57    pub fn attributes(self, attributes: &str) -> Self {
58        Self {
59            builder: self.builder.property("attributes", attributes),
60        }
61    }
62
63    pub fn file(self, file: &impl IsA<gio::File>) -> Self {
64        Self {
65            builder: self.builder.property("file", file),
66        }
67    }
68
69    pub fn io_priority(self, io_priority: glib::Priority) -> Self {
70        Self {
71            builder: self
72                .builder
73                .property("io-priority", io_priority.into_glib()),
74        }
75    }
76
77    pub fn monitored(self, monitored: bool) -> Self {
78        Self {
79            builder: self.builder.property("monitored", monitored),
80        }
81    }
82}