fixed explict generic type casting bug

This commit is contained in:
Wyatt J. Miller 2022-05-23 22:14:29 -04:00
parent 03fb0071ef
commit d3ee0bc068
2 changed files with 10 additions and 9 deletions

View File

@ -1,6 +1,6 @@
use std::rc::Rc;
use gtk4::prelude::*;
use gtk4::{prelude::*, Window};
use gtk4::{
glib::*,
ApplicationWindow,
@ -61,10 +61,10 @@ impl RomBox {
}
}
pub fn click_button(&self, window: Rc<ApplicationWindow>) {
pub fn click_button(&self, window: Window) {
self.rom_button.connect_clicked(clone!(@strong self as this =>
move |_| {
let dialog = FileChooserDialog::new::<ApplicationWindow>(
let dialog = FileChooserDialog::new(
Some("Choose a ROM"),
Some(&window),
FileChooserAction::Open,
@ -130,12 +130,12 @@ impl PatchBox {
}
}
pub fn click_button(&self, app: Rc<ApplicationWindow>) {
pub fn click_button(&self, window: Window) {
self.patch_button.connect_clicked(clone!(@weak self as this =>
move |_| {
let dialog = FileChooserDialog::new::<ApplicationWindow>(
let dialog = FileChooserDialog::new(
Some("Choose a Patch"),
Some(&app),
Some(&window),
FileChooserAction::Open,
&[("_Cancel", ResponseType::Cancel), ("_Open", ResponseType::Accept)]
);

View File

@ -11,7 +11,7 @@ use popover::CustomPopoverMenu;
use std::path::PathBuf;
use std::rc::Rc;
use gtk4::prelude::*;
use gtk4::{prelude::*, Window};
use gtk4::{
gdk::{
Display
@ -48,6 +48,7 @@ fn build_ui(app: &Application) {
//println!("{:?}", builder.list_properties());
let app_window: Rc<ApplicationWindow> = Rc::new(ApplicationWindow::new(app));
let file_picker_window: Window = Window::new();
let popover_menu: CustomPopoverMenu = CustomPopoverMenu::new();
let header_bar: CustomTitleBar = CustomTitleBar::new(&popover_menu);
let app_box: AppBox = AppBox::new();
@ -70,13 +71,13 @@ fn build_ui(app: &Application) {
patch_box.set_label();
patch_box.set_button();
patch_box.set_box();
patch_box.click_button(app_window.clone());
patch_box.click_button(file_picker_window.clone());
// set rom box methods
rom_box.set_label();
rom_box.set_button();
rom_box.set_box();
rom_box.click_button(app_window.clone());
rom_box.click_button(file_picker_window.clone());
// set app box methods
app_box.set_box(&rom_box, &patch_box);