mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-08-02 14:18:49 +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::*};
|
use relm4::{adw::traits::MessageDialogExt, prelude::*};
|
||||||
|
|
||||||
pub fn alert(title: &str, msg: Option<&str>, parent: Option<>k::Window>) {
|
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() {
|
if parent.is_some() {
|
||||||
d.set_transient_for(parent);
|
d.set_transient_for(parent);
|
||||||
|
} else {
|
||||||
|
d.set_transient_for(gtk::Application::default().active_window().as_ref());
|
||||||
}
|
}
|
||||||
d.add_response("ok", "_Ok");
|
d.add_response("ok", "_Ok");
|
||||||
d.present();
|
d.present();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue