added filters to file pickers
This commit is contained in:
parent
d3ee0bc068
commit
b2efd6917d
18
src/boxes.rs
18
src/boxes.rs
@ -1,6 +1,6 @@
|
||||
use std::rc::Rc;
|
||||
|
||||
use gtk4::{prelude::*, Window};
|
||||
use gtk4::{prelude::*, Window, FileFilter};
|
||||
use gtk4::{
|
||||
glib::*,
|
||||
ApplicationWindow,
|
||||
@ -73,6 +73,14 @@ impl RomBox {
|
||||
|
||||
// here's to set the dialog to be modal
|
||||
dialog.set_modal(true);
|
||||
|
||||
// add a filter!
|
||||
let rom_filter = FileFilter::new();
|
||||
rom_filter.add_mime_type("application/vnd.nintendo.snes.rom");
|
||||
rom_filter.set_name(Some("SNES ROMs"));
|
||||
dialog.add_filter(&rom_filter);
|
||||
|
||||
// run the dialog
|
||||
dialog.run_async(|d, r| {
|
||||
match r {
|
||||
ResponseType::Accept => d.close(),
|
||||
@ -142,6 +150,14 @@ impl PatchBox {
|
||||
|
||||
// here's to set the dialog to be modal
|
||||
dialog.set_modal(true);
|
||||
|
||||
let patch_filter = FileFilter::new();
|
||||
patch_filter.add_mime_type("application/x-bps-patch");
|
||||
patch_filter.add_mime_type("application/x-ips-patch");
|
||||
patch_filter.set_name(Some("Patches"));
|
||||
dialog.add_filter(&patch_filter);
|
||||
|
||||
// run the dialog
|
||||
dialog.run_async(|d, r| {
|
||||
match r {
|
||||
ResponseType::Accept => d.close(),
|
||||
|
Loading…
Reference in New Issue
Block a user