From d3ee0bc06860ff656c0ee0ffad6bcea458c65a6f Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Mon, 23 May 2022 22:14:29 -0400 Subject: [PATCH] fixed explict generic type casting bug --- src/boxes.rs | 12 ++++++------ src/main.rs | 7 ++++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/boxes.rs b/src/boxes.rs index 0a1e10b..900334c 100644 --- a/src/boxes.rs +++ b/src/boxes.rs @@ -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) { + pub fn click_button(&self, window: Window) { self.rom_button.connect_clicked(clone!(@strong self as this => move |_| { - let dialog = FileChooserDialog::new::( + 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) { + pub fn click_button(&self, window: Window) { self.patch_button.connect_clicked(clone!(@weak self as this => move |_| { - let dialog = FileChooserDialog::new::( + let dialog = FileChooserDialog::new( Some("Choose a Patch"), - Some(&app), + Some(&window), FileChooserAction::Open, &[("_Cancel", ResponseType::Cancel), ("_Open", ResponseType::Accept)] ); diff --git a/src/main.rs b/src/main.rs index fca61e7..25fca49 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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 = 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);