Skip to main content

CleanSysGui

Struct CleanSysGui 

Source
pub struct CleanSysGui {
Show 18 fields pub categories: Vec<CleanerCategory>, pub logs: Vec<String>, pub total_bytes_cleaned: u64, pub is_running: bool, pub is_root: bool, pub needs_password: bool, pub password_input: String, pub password_error: Option<String>, pub pending_root_ops: Vec<(usize, usize)>, pub active_tab: usize, pub theme_index: usize, pub confirm_run_pending: bool, pub previewing: bool, pub preview_open: bool, pub preview_results: Vec<(String, CleaningResult)>, pub operations_total: usize, pub operations_completed: usize, pub needs_admin_notice: bool,
}
Expand description

Top-level state for the CleanSys GUI application.

Fields§

§categories: Vec<CleanerCategory>

Cleaner categories and items (shared domain model from cleansys-core).

§logs: Vec<String>

Rolling log of operation messages shown in the activity panel.

§total_bytes_cleaned: u64

Total bytes freed across all completed operations in the current run.

§is_running: bool

Whether cleaners are currently running.

§is_root: bool

Whether the process is running with root/administrator privileges.

§needs_password: bool

Whether the sudo authentication dialog is visible.

§password_input: String

The password currently typed into the authentication dialog.

§password_error: Option<String>

Error message shown in the authentication dialog, if any.

§pending_root_ops: Vec<(usize, usize)>

Operations queued to run once sudo authentication succeeds.

§active_tab: usize

Index of the currently active category tab.

§theme_index: usize

Index of the currently selected UI theme (see cleansys_core::THEME_NAMES).

§confirm_run_pending: bool

Whether the “confirm this run” dialog is visible.

§previewing: bool

Whether a preview (dry-run) is currently being computed.

§preview_open: bool

Whether the preview results dialog is visible.

§preview_results: Vec<(String, CleaningResult)>

Results of the most recent preview run: (cleaner_name, result).

§operations_total: usize

Total number of operations in the current run (for the progress bar).

§operations_completed: usize

Number of operations completed so far in the current run.

§needs_admin_notice: bool

Whether the “needs Administrator” notice is visible (Windows only; Windows has no interactive sudo-password flow, so this replaces the password dialog when elevation is required there).

Implementations§

Source§

impl CleanSysGui

Source

pub fn new() -> Self

Construct a fresh application state with all known cleaners loaded.

Source

pub fn selected_count(&self) -> usize

Number of currently selected items across all categories.

Source

pub fn selected_count_in(&self, cat_idx: usize) -> usize

Number of currently selected items within a specific category.

Source

pub fn selection_needs_root(&self) -> bool

True if any selected item requires root and we don’t already have it.

Source

pub fn selected_indices(&self) -> Vec<(usize, usize)>

(category_index, item_index) pairs of every currently-selected item.

Source

pub fn progress_fraction(&self) -> f32

Fraction of the current run’s operations completed so far, in 0.0..=1.0. 0.0 when no run is in progress.

Source

pub fn supports_sudo_prompt(&self) -> bool

Whether this platform supports the interactive sudo-password elevation flow (Unix). Windows uses UAC/Administrator tokens instead.

Source

pub fn push_log(&mut self, line: impl Into<String>)

Push a line to the activity log, keeping only the most recent entries.

Source

pub fn mark_selected_pending(&mut self)

Mark every selected item as Status::Pending in preparation for a run.

Source

pub fn colors(&self) -> ThemeColors

Derive the full ThemeColors from the currently active core theme.

Call this at the top of view functions: let c = state.colors();

Source

pub fn iced_theme(&self) -> Theme

Return a custom iced::Theme derived from the active core theme, for the top-level iced::application(...).theme(...) callback.

Source

pub fn current_theme_name(&self) -> &'static str

The display name of the currently active theme.

Source

pub fn current_settings(&self) -> Settings

Build the full cleansys_core::Settings snapshot for the current state (theme + selected cleaners), for persistence.

Source

pub fn save_theme(&self)

Persist the current theme and cleaner selections to settings.json (best-effort; failures are logged but never surfaced to the UI).

A no-op under cfg(test) so unit tests never touch the real ~/.config/cleansys/settings.json (see the comment in Self::new).

Source

pub fn save_selections(&self)

Persist the current cleaner selections (and theme) to settings.json. A no-op under cfg(test) — see Self::save_theme.

Trait Implementations§

Source§

impl Default for CleanSysGui

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<State, Message> IntoBoot<State, Message> for State

Source§

fn into_boot(self) -> (State, Task<Message>)

Turns some type into the initial state of some Application.
Source§

impl<T> MaybeClone for T

Source§

impl<T> MaybeDebug for T

Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSync for T
where T: Sync,

Source§

impl<T> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more