From 3cc6b9a76a93fa32adaf713c9a7009cd3cc61b6e Mon Sep 17 00:00:00 2001 From: yggverse Date: Sat, 8 Mar 2025 08:36:34 +0200 Subject: [PATCH] update app launcher --- src/main.rs | 36 ++++++++++++++++-------------------- src/profile.rs | 2 +- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/main.rs b/src/main.rs index 89296304..03926106 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,29 +2,25 @@ mod app; mod profile; mod tool; -use app::App; use gtk::glib::ExitCode; use profile::Profile; -use std::rc::Rc; fn main() -> ExitCode { - match Profile::new() { - Ok(profile) => { - if let Err(e) = gtk::init() { - eprintln!("Failed to initialize GTK: {e}"); - return ExitCode::FAILURE; - } - match App::build(&Rc::new(profile)).run() { - Ok(result) => result, - Err(e) => { - eprintln!("Failed to initialize application: {e}"); - ExitCode::FAILURE - } - } - } - Err(e) => { - eprintln!("Failed to initialize profile: {e}"); - ExitCode::FAILURE - } + use app::App; + use std::rc::Rc; + + if let Err(e) = gtk::init() { + eprintln!("Failed to initialize GTK: {e}"); + return ExitCode::FAILURE; } + + match Profile::init() { + Ok(profile) => match App::build(&Rc::new(profile)).run() { + Ok(app) => return app, + Err(e) => eprintln!("Failed to initialize application: {e}"), + }, + Err(e) => eprintln!("Failed to initialize profile: {e}"), + } + + ExitCode::FAILURE } diff --git a/src/profile.rs b/src/profile.rs index 50761035..062127b4 100644 --- a/src/profile.rs +++ b/src/profile.rs @@ -33,7 +33,7 @@ pub struct Profile { impl Profile { // Constructors - pub fn new() -> Result { + pub fn init() -> Result { // Init profile path let mut config_path = user_config_dir();