From f0f69b73237cfc5f14a8d5863012315cde8f3980 Mon Sep 17 00:00:00 2001 From: Erica Z Date: Tue, 12 Nov 2024 11:11:34 +0100 Subject: [PATCH] try this --- src/application.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/application.rs b/src/application.rs index 4ad0547..05a63b8 100644 --- a/src/application.rs +++ b/src/application.rs @@ -17,15 +17,19 @@ mod imp { impl ObjectImpl for Application {} impl ApplicationImpl for Application { + // called once by the primary instance + fn startup(&self) { + self.parent_startup(); + ui::Window::new(self.obj().as_ref()); + } + + // executed by the primary instance fn activate(&self) { self.parent_activate(); - match self.obj().active_window() { - None => { - let window = ui::Window::new(self.obj().as_ref()); - window.present(); - } - Some(win) => win.present(), - } + self.obj() + .active_window() + .expect("no window was active") + .present(); } }