mirror of
https://gitlab.freedesktop.org/dabrain34/GstPipelineStudio.git
synced 2024-11-24 01:50:59 +00:00
app: get_file_from_dialog restricts to .gps ext
This commit is contained in:
parent
2828930823
commit
f7efe807a3
1 changed files with 9 additions and 2 deletions
11
src/app.rs
11
src/app.rs
|
@ -11,8 +11,8 @@ use gtk::gdk;
|
||||||
use gtk::prelude::*;
|
use gtk::prelude::*;
|
||||||
use gtk::{gio, gio::SimpleAction, glib, graphene};
|
use gtk::{gio, gio::SimpleAction, glib, graphene};
|
||||||
use gtk::{
|
use gtk::{
|
||||||
Application, ApplicationWindow, Builder, Button, FileChooserAction, FileChooserDialog, Paned,
|
Application, ApplicationWindow, Builder, Button, FileChooserAction, FileChooserDialog,
|
||||||
PopoverMenu, ResponseType, Statusbar, Widget,
|
FileFilter, Paned, PopoverMenu, ResponseType, Statusbar, Widget,
|
||||||
};
|
};
|
||||||
use log::error;
|
use log::error;
|
||||||
use std::cell::{Cell, RefCell};
|
use std::cell::{Cell, RefCell};
|
||||||
|
@ -381,6 +381,13 @@ impl GPSApp {
|
||||||
(cancel_button, ResponseType::Cancel),
|
(cancel_button, ResponseType::Cancel),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
if save {
|
||||||
|
file_chooser.set_current_name("untitled.gps");
|
||||||
|
}
|
||||||
|
let filter = FileFilter::new();
|
||||||
|
filter.add_pattern("*.gps");
|
||||||
|
filter.set_name(Some("GPS Files (*.gps)"));
|
||||||
|
file_chooser.add_filter(&filter);
|
||||||
let app_weak = app.downgrade();
|
let app_weak = app.downgrade();
|
||||||
file_chooser.connect_response(move |d: &FileChooserDialog, response: ResponseType| {
|
file_chooser.connect_response(move |d: &FileChooserDialog, response: ResponseType| {
|
||||||
let app = upgrade_weak!(app_weak);
|
let app = upgrade_weak!(app_weak);
|
||||||
|
|
Loading…
Reference in a new issue