From c7ee1e7cadd3f54aa5e0b7e9d4409dab78297026 Mon Sep 17 00:00:00 2001 From: Ridan Vandenbergh Date: Wed, 18 Jun 2025 16:05:17 +0200 Subject: [PATCH] Theme -> ThemeDescriptor --- src/lib.rs | 5 +++-- src/theme.rs | 10 +++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index a965ae8..85c1c23 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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::*; diff --git a/src/theme.rs b/src/theme.rs index 4b92ca5..5201fa6 100644 --- a/src/theme.rs +++ b/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>, 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) -> std::io::Result { 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