mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-03-13 06:01:21 +00:00
use FileLauncher
This commit is contained in:
parent
5c28a405ee
commit
da3618aa0a
@ -8,8 +8,9 @@ use window::Window;
|
|||||||
|
|
||||||
use adw::ApplicationWindow;
|
use adw::ApplicationWindow;
|
||||||
use gtk::{
|
use gtk::{
|
||||||
gio::{AppInfo, AppLaunchContext, SimpleAction},
|
gio::{Cancellable, File, SimpleAction},
|
||||||
prelude::{ActionMapExt, GtkWindowExt},
|
prelude::{ActionMapExt, GtkWindowExt},
|
||||||
|
FileLauncher,
|
||||||
};
|
};
|
||||||
use sqlite::Transaction;
|
use sqlite::Transaction;
|
||||||
use std::{path::PathBuf, sync::Arc};
|
use std::{path::PathBuf, sync::Arc};
|
||||||
@ -90,10 +91,15 @@ impl Browser {
|
|||||||
|
|
||||||
action_tool_profile.connect_activate({
|
action_tool_profile.connect_activate({
|
||||||
move |_, _| {
|
move |_, _| {
|
||||||
// @TODO [4_10] https://docs.gtk.org/gtk4/class.FileLauncher.html
|
FileLauncher::new(Some(&File::for_path(&profile_path))).launch(
|
||||||
let _ = AppInfo::launch_default_for_uri(
|
None::<>k::Window>,
|
||||||
&format!("file://{}", profile_path.to_string_lossy()),
|
None::<&Cancellable>,
|
||||||
Some(&AppLaunchContext::new()),
|
|result| {
|
||||||
|
if let Err(error) = result {
|
||||||
|
// @TODO
|
||||||
|
println!("Could not delegate launch action: {error}")
|
||||||
|
}
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user