diff --git a/src/main_window.rs b/src/main_window.rs index b6c611bb..5ed58852 100644 --- a/src/main_window.rs +++ b/src/main_window.rs @@ -47,6 +47,17 @@ impl MainWindow { let window: gtk::ApplicationWindow = builder.get_object("main_window").unwrap(); let popup: gtk::Window = builder.get_object("about_popup").unwrap(); + builder.connect_signals(|_, handler_name| { + match handler_name { + // handler_name as defined in the glade file + "about_popup_close" => { + let popup = popup.clone(); + Box::new(about_popup_close(popup)) + } + _ => Box::new(|_| None), + } + }); + MainWindow { window, popup, @@ -108,7 +119,7 @@ impl MainWindow { self.window.set_application(Some(&application)); } - self.build_system_menu(application, connection); + self.build_system_menu(connection); self.window.connect_delete_event(|_, _| Inhibit(false)); @@ -163,11 +174,7 @@ impl MainWindow { }); } - fn build_system_menu( - &mut self, - application: >k::Application, - connection: Arc>, - ) { + fn build_system_menu(&mut self, connection: Arc>) { let titlebar = gtk::HeaderBarBuilder::new() .show_close_button(true) .title("Authenticator RS") @@ -386,3 +393,10 @@ async fn progress_bar_interval(tx: Sender) { .expect("Couldn't send data to channel"); } } + +fn about_popup_close(popup: gtk::Window) -> Box Option> { + Box::new(move |param: &[glib::Value]| { + popup.hide(); + None + }) +} diff --git a/src/mainwindow.glade b/src/mainwindow.glade index 84041913..a5b43e51 100644 --- a/src/mainwindow.glade +++ b/src/mainwindow.glade @@ -532,7 +532,6 @@ 400 320 False - True False True center-on-parent @@ -574,6 +573,7 @@ True True about_close_button_image + 0