require profile ownership for app

This commit is contained in:
yggverse 2025-03-08 08:40:16 +02:00
parent 3cc6b9a76a
commit f150e716b9
2 changed files with 4 additions and 4 deletions

View file

@ -23,14 +23,15 @@ impl App {
// Constructors // Constructors
/// Build new `Self` /// Build new `Self`
pub fn build(profile: &Rc<Profile>) -> Self { pub fn build(profile: Profile) -> Self {
// Init GTK // Init GTK
let application = Application::builder() let application = Application::builder()
.application_id(APPLICATION_ID) .application_id(APPLICATION_ID)
.build(); .build();
// Init components // Init components
let browser = Rc::new(Browser::build(profile)); let profile = Rc::new(profile);
let browser = Rc::new(Browser::build(&profile));
// Prevent startup warning @TODO // Prevent startup warning @TODO
application.connect_activate(|_| {}); application.connect_activate(|_| {});

View file

@ -7,7 +7,6 @@ use profile::Profile;
fn main() -> ExitCode { fn main() -> ExitCode {
use app::App; use app::App;
use std::rc::Rc;
if let Err(e) = gtk::init() { if let Err(e) = gtk::init() {
eprintln!("Failed to initialize GTK: {e}"); eprintln!("Failed to initialize GTK: {e}");
@ -15,7 +14,7 @@ fn main() -> ExitCode {
} }
match Profile::init() { match Profile::init() {
Ok(profile) => match App::build(&Rc::new(profile)).run() { Ok(profile) => match App::build(profile).run() {
Ok(app) => return app, Ok(app) => return app,
Err(e) => eprintln!("Failed to initialize application: {e}"), Err(e) => eprintln!("Failed to initialize application: {e}"),
}, },