From d022ed7bc19a242c53672fe56825377c6edd4b4c Mon Sep 17 00:00:00 2001 From: Nefo Fortressia Date: Sat, 13 Nov 2021 21:08:32 +0700 Subject: [PATCH] feat: implement closure for GettingStartedPage's "Open File" button --- src/components/getting_started/mod.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/components/getting_started/mod.rs b/src/components/getting_started/mod.rs index e51368e..bff671f 100644 --- a/src/components/getting_started/mod.rs +++ b/src/components/getting_started/mod.rs @@ -19,10 +19,17 @@ impl GettingStartedPage { glib::Object::new(&[]).expect("Failed to create 'GettingStartedPage' component.") } - pub fn setup_actions>(&self, window: &P) - where - P: FileImplementedEditor, - { - let imp_class = imp::GettingStartedPage::from_instance(self); + pub fn to_imp(&self) -> &imp::GettingStartedPage { + imp::GettingStartedPage::from_instance(self) + } + pub fn setup_actions(&self, window: &crate::components::EchidnaWindow) -> &Self { + let imp_class = self.to_imp(); + imp_class + .link_open_file + .connect_clicked(clone!(@weak window => + move |_| { + window.action_open_file(); + })); + self } }