mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-04-20 03:24:52 +00:00
feat: alert can autodetect parent window
This commit is contained in:
parent
c133d18f42
commit
9b5750632e
1 changed files with 3 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
use gtk::traits::GtkWindowExt;
|
||||
use gtk::traits::{GtkApplicationExt, GtkWindowExt};
|
||||
use relm4::{adw::traits::MessageDialogExt, prelude::*};
|
||||
|
||||
pub fn alert(title: &str, msg: Option<&str>, parent: Option<>k::Window>) {
|
||||
|
@ -11,6 +11,8 @@ pub fn alert(title: &str, msg: Option<&str>, parent: Option<>k::Window>) {
|
|||
}
|
||||
if parent.is_some() {
|
||||
d.set_transient_for(parent);
|
||||
} else {
|
||||
d.set_transient_for(gtk::Application::default().active_window().as_ref());
|
||||
}
|
||||
d.add_response("ok", "_Ok");
|
||||
d.present();
|
||||
|
|
Loading…
Add table
Reference in a new issue