mirror of
https://github.com/danbulant/icon
synced 2026-05-19 04:08:36 +00:00
Theme -> ThemeDescriptor
This commit is contained in:
parent
7cdc832b48
commit
c7ee1e7cad
2 changed files with 8 additions and 7 deletions
|
|
@ -34,7 +34,7 @@
|
|||
//!
|
||||
//! To find icons in a theme, its `index.theme` file must be parsed to understand the directory
|
||||
//! structure within the theme itself.
|
||||
//! This is handled by [Theme].
|
||||
//! This is handled by [ThemeDescriptor].
|
||||
//!
|
||||
//! 3a. *Find just one icon* (oneshot):
|
||||
//!
|
||||
|
|
@ -60,7 +60,8 @@
|
|||
|
||||
mod icon;
|
||||
mod search_dir;
|
||||
mod theme;
|
||||
pub mod theme;
|
||||
mod theme_graph;
|
||||
|
||||
pub use search_dir::*;
|
||||
pub use theme::*;
|
||||
|
|
|
|||
10
src/theme.rs
10
src/theme.rs
|
|
@ -3,11 +3,11 @@ use freedesktop_entry_parser::low_level::{EntryIter, SectionBytes};
|
|||
use std::borrow::Cow;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
pub type OwnedTheme = Theme<'static>;
|
||||
pub type OwnedThemeDescriptor = ThemeDescriptor<'static>;
|
||||
pub type OwnedThemeIndex = ThemeIndex<'static>;
|
||||
pub type OwnedDirectoryIndex = DirectoryIndex<'static>;
|
||||
|
||||
pub struct Theme<'a> {
|
||||
pub struct ThemeDescriptor<'a> {
|
||||
pub internal_name: String,
|
||||
pub base_dirs: Vec<Cow<'a, Path>>,
|
||||
pub index_location: PathBuf,
|
||||
|
|
@ -33,7 +33,7 @@ pub enum ThemeParseError {
|
|||
ParseError(#[from] freedesktop_entry_parser::ParseError),
|
||||
}
|
||||
|
||||
impl Theme<'_> {
|
||||
impl ThemeDescriptor<'_> {
|
||||
pub fn new_from_folders(internal_name: String, folders: Vec<PathBuf>) -> std::io::Result<Self> {
|
||||
let index_location = folders
|
||||
.iter()
|
||||
|
|
@ -52,7 +52,7 @@ impl Theme<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
fn theme_into_owned(theme: Theme) -> OwnedTheme {
|
||||
fn theme_into_owned(theme: ThemeDescriptor) -> OwnedThemeDescriptor {
|
||||
let base_dirs = theme
|
||||
.base_dirs
|
||||
.into_iter()
|
||||
|
|
@ -61,7 +61,7 @@ fn theme_into_owned(theme: Theme) -> OwnedTheme {
|
|||
.collect();
|
||||
let index = theme.index.into_owned();
|
||||
|
||||
OwnedTheme {
|
||||
OwnedThemeDescriptor {
|
||||
base_dirs,
|
||||
index,
|
||||
..theme
|
||||
|
|
|
|||
Loading…
Reference in a new issue