1// Take a look at the license at the top of the repository in the LICENSE file.
23use glib::translate::*;
45use crate::{ffi, prelude::*, DirectoryList};
67impl DirectoryList {
8/// Gets the IO priority set via gtk_directory_list_set_io_priority().
9 ///
10 /// # Returns
11 ///
12 /// The IO priority.
13#[doc(alias = "gtk_directory_list_get_io_priority")]
14 #[doc(alias = "get_io_priority")]
15pub fn io_priority(&self) -> glib::Priority {
16unsafe {
17from_glib(ffi::gtk_directory_list_get_io_priority(
18self.to_glib_none().0,
19 ))
20 }
21 }
2223/// Sets the IO priority to use while loading directories.
24 ///
25 /// Setting the priority while @self is loading will reprioritize the
26 /// ongoing load as soon as possible.
27 ///
28 /// The default IO priority is `G_PRIORITY_DEFAULT`, which is higher than
29 /// the GTK redraw priority. If you are loading a lot of directories in
30 /// parallel, lowering it to something like `G_PRIORITY_DEFAULT_IDLE`
31 /// may increase responsiveness.
32 /// ## `io_priority`
33 /// IO priority to use
34#[doc(alias = "gtk_directory_list_set_io_priority")]
35pub fn set_io_priority(&self, io_priority: glib::Priority) {
36unsafe {
37ffi::gtk_directory_list_set_io_priority(self.to_glib_none().0, io_priority.into_glib());
38 }
39 }
4041// rustdoc-stripper-ignore-next
42/// Creates a new builder-pattern struct instance to construct
43 /// [`DirectoryList`] objects.
44 ///
45 /// This method returns an instance of
46 /// [`DirectoryListBuilder`](crate::builders::DirectoryListBuilder) which
47 /// can be used to create [`DirectoryList`] objects.
48pub fn builder() -> DirectoryListBuilder {
49DirectoryListBuilder::new()
50 }
51}
5253// rustdoc-stripper-ignore-next
54/// A [builder-pattern] type to construct [`DirectoryList`] objects.
55///
56/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
57#[must_use = "The builder must be built to be used"]
58pub struct DirectoryListBuilder {
59 builder: glib::object::ObjectBuilder<'static, DirectoryList>,
60}
6162impl DirectoryListBuilder {
63fn new() -> Self {
64Self {
65 builder: glib::object::Object::builder(),
66 }
67 }
68#[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
69pub fn build(self) -> DirectoryList {
70self.builder.build()
71 }
7273pub fn attributes(self, attributes: &str) -> Self {
74Self {
75 builder: self.builder.property("attributes", attributes),
76 }
77 }
7879pub fn file(self, file: &impl IsA<gio::File>) -> Self {
80Self {
81 builder: self.builder.property("file", file),
82 }
83 }
8485pub fn io_priority(self, io_priority: glib::Priority) -> Self {
86Self {
87 builder: self88.builder
89 .property("io-priority", io_priority.into_glib()),
90 }
91 }
9293pub fn monitored(self, monitored: bool) -> Self {
94Self {
95 builder: self.builder.property("monitored", monitored),
96 }
97 }
98}