chore: return Vec instead of Option<Vec> for Direcories
This commit is contained in:
parent
a291a8c2e8
commit
bee9d45dd3
1 changed files with 4 additions and 3 deletions
|
|
@ -5,17 +5,17 @@ use ini::Properties;
|
||||||
impl Theme {
|
impl Theme {
|
||||||
pub(super) fn get_all_directories(&self) -> Vec<Directory> {
|
pub(super) fn get_all_directories(&self) -> Vec<Directory> {
|
||||||
self.directories()
|
self.directories()
|
||||||
.unwrap_or_default()
|
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|name| self.get_directory(name))
|
.filter_map(|name| self.get_directory(name))
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: use me
|
// TODO: use me
|
||||||
fn scaled_directories(&self) -> Option<Vec<&str>> {
|
fn scaled_directories(&self) -> Vec<&str> {
|
||||||
self.get_icon_theme_section()
|
self.get_icon_theme_section()
|
||||||
.and_then(|props| props.get("ScaledDirectories"))
|
.and_then(|props| props.get("ScaledDirectories"))
|
||||||
.map(|dirs| dirs.split(',').collect())
|
.map(|dirs| dirs.split(',').collect())
|
||||||
|
.unwrap_or(vec![])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_icon_theme_section(&self) -> Option<&Properties> {
|
fn get_icon_theme_section(&self) -> Option<&Properties> {
|
||||||
|
|
@ -27,11 +27,12 @@ impl Theme {
|
||||||
.and_then(|props| props.get("Inherits"))
|
.and_then(|props| props.get("Inherits"))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn directories(&self) -> Option<Vec<&str>> {
|
fn directories(&self) -> Vec<&str> {
|
||||||
self.index
|
self.index
|
||||||
.section(Some("Icon Theme"))
|
.section(Some("Icon Theme"))
|
||||||
.and_then(|props| props.get("Directories"))
|
.and_then(|props| props.get("Directories"))
|
||||||
.map(|dirs| dirs.split(',').collect())
|
.map(|dirs| dirs.split(',').collect())
|
||||||
|
.unwrap_or(vec![])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_directory<'a>(&'a self, name: &'a str) -> Option<Directory> {
|
fn get_directory<'a>(&'a self, name: &'a str) -> Option<Directory> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue