use gtk4::prelude::*; use gtk4::{ AboutDialog, glib::*, Button, Popover, License, Box, Orientation, }; #[derive(Debug, Clone, Downgrade)] pub struct CustomPopoverMenu { pub popover: Popover, pub pop_box: Box, pub test_text_view:Button, pub subtest_text_view: Button, } impl CustomPopoverMenu { pub fn new() -> CustomPopoverMenu { CustomPopoverMenu { popover: Popover::new(), pop_box: Box::new(Orientation::Vertical, 0), test_text_view: Button::new(), subtest_text_view: Button::new(), } } pub fn set_texts(&self) { self.test_text_view.set_label("About"); self.subtest_text_view.set_label("Psyche!"); self.pop_box.append(&self.test_text_view); self.pop_box.append(&self.subtest_text_view); self.pop_box.set_visible(true); self.popover.set_child(Some(&self.pop_box)); } pub fn click_about_button(&self, //window: Rc ) { self.test_text_view.connect_clicked(clone!(@strong self as this => move |_| { let about_dialog = AboutDialog::builder() .program_name("SNESPatcher") .version("0.1.0") .comments("GTK4 app to patch your SNES ROMs!") .authors(["Wyatt J. Miller".to_string()].to_vec()) .documenters(["Wyatt J. Miller".to_string()].to_vec()) .license_type(License::Mpl20) .website("https://scm.wyattjmiller.com/wymiller/snespatcher") .website_label("Website?") .modal(false) .can_focus(true) //.child(&window) .build(); about_dialog.show(); })); } }