summaryrefslogtreecommitdiff
path: root/schist_desktop_gui/src/main.rs
blob: a5749d35152f557ca3509f8c0a6838741838cf7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
mod cache;
mod config;
mod database_connection;
mod dialog;
mod gui;
mod paths;
mod settings;
mod shortcut;
mod style;
mod theme;
mod traits;
mod window_settings;

pub use cache::Cache;
pub use database_connection::DatabaseConnection;

use anyhow::Context;

use crate::{
    cache::get_cache, config::Config, gui::Gui, settings::make_settings, theme::make_theme,
    window_settings::make_window_settings,
};

fn main() -> anyhow::Result<()> {
    let cache = get_cache().unwrap_or_else(|_| Cache::default());
    let config = Config::default();
    iced::application("Schist", Gui::update, Gui::view)
        .settings(make_settings(&config.clone()))
        .subscription(gui::subscription)
        .theme(make_theme)
        .window(make_window_settings(&config.clone()))
        .run_with(move || Gui::new(&cache))
        .context("Failed to run Schist GUI")
}