Code cleanup

This commit is contained in:
Benjamyn Love 2024-03-10 23:08:17 +11:00
parent df7368d458
commit ba5a48dae1
6 changed files with 6 additions and 55 deletions

View File

@ -10,9 +10,10 @@ Whats needed to get feature parity
- Support for [ultrawide, horizontal, vertical] displays [✓]
What still needs to be done
- Code cleanup []
- Code cleanup []
- Handler for feh [✓]
I think this is now in feature parity of the python script
What I want to add
- Wallhaven API support

View File

@ -10,10 +10,6 @@ pub struct Monitors {
}
impl Monitors {
pub fn new() -> Monitors {
Monitors { monitors: vec![] }
}
fn add(&mut self, mon_type: MonitorType) {
self.monitors.push(mon_type);
}
@ -37,15 +33,6 @@ pub struct WallpaperDir {
}
impl WallpaperDir {
pub fn new() -> WallpaperDir {
let expanded_tilde: String = untildify::untildify("~/");
WallpaperDir {
ultrawide: expanded_tilde.clone(),
horizontal: expanded_tilde.clone(),
vertical: expanded_tilde.clone(),
}
}
pub fn get(&self, monitor_type: MonitorType) -> String {
match monitor_type {
MonitorType::Ultrawide => self.ultrawide.to_string(),
@ -77,15 +64,6 @@ pub struct Config {
}
impl Config {
pub fn new() -> Config {
Config {
x_server: String::new(),
wallpaper_engine: WallpaperHandler::Plasma,
wallpaper_dir: WallpaperDir::new(),
monitors: Monitors::new(),
}
}
pub fn from_config(file_path: String) -> Config {
let mut config = Ini::new();
let map = config.load(file_path).unwrap();

View File

@ -49,22 +49,3 @@ impl fmt::Display for MonitorType {
write!(f, "{:?}", self)
}
}
#[derive(Debug)]
pub enum ImageTypes {
PNG,
JPG,
JPEG,
}
impl ImageTypes {
pub fn get_types() -> Vec<String> {
vec!["png".to_string(), "jpg".to_string(), "jpeg".to_string()]
}
}
impl fmt::Display for ImageTypes {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:?}", self)
}
}

View File

@ -11,12 +11,6 @@ pub struct Wallpaper {
path: String,
}
impl Wallpaper {
pub fn new(path: String) -> Wallpaper {
Wallpaper { path }
}
}
impl fmt::Display for Wallpaper {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.path)
@ -56,7 +50,8 @@ impl Wallpapers {
.wallpaper_dir
.get(monitor_type.clone())
.to_owned();
for filetype in ImageTypes::get_types().iter() {
let types = vec!["png".to_string(), "jpg".to_string(), "jpeg".to_string()];
for filetype in types.iter() {
let mut tmp_path = path.clone();
let mut tmp_glob = String::new();
write!(&mut tmp_glob, "/**/*.{}", filetype).unwrap();

View File

@ -1,5 +1,5 @@
use crate::Wallpapers;
pub fn change_wallpapers(wallpapers: &Wallpapers) {
pub fn change_wallpapers(_wallpapers: &Wallpapers) {
println!("Not implemented");
}

View File

@ -1,8 +1,4 @@
pub mod dbus_plasma_interface;
use dbus_plasma_interface::*;
pub mod plasma;
use plasma::*;
pub mod feh;
use feh::*;
pub mod gnome;
use gnome::*;
pub mod plasma;