From da3618aa0a62e06be6d9dc8048bb928c92419f38 Mon Sep 17 00:00:00 2001 From: yggverse Date: Fri, 18 Oct 2024 10:16:23 +0300 Subject: [PATCH] use FileLauncher --- src/app/browser.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/app/browser.rs b/src/app/browser.rs index 6369246d..3eaafc50 100644 --- a/src/app/browser.rs +++ b/src/app/browser.rs @@ -8,8 +8,9 @@ use window::Window; use adw::ApplicationWindow; use gtk::{ - gio::{AppInfo, AppLaunchContext, SimpleAction}, + gio::{Cancellable, File, SimpleAction}, prelude::{ActionMapExt, GtkWindowExt}, + FileLauncher, }; use sqlite::Transaction; use std::{path::PathBuf, sync::Arc}; @@ -90,10 +91,15 @@ impl Browser { action_tool_profile.connect_activate({ move |_, _| { - // @TODO [4_10] https://docs.gtk.org/gtk4/class.FileLauncher.html - let _ = AppInfo::launch_default_for_uri( - &format!("file://{}", profile_path.to_string_lossy()), - Some(&AppLaunchContext::new()), + FileLauncher::new(Some(&File::for_path(&profile_path))).launch( + None::<>k::Window>, + None::<&Cancellable>, + |result| { + if let Err(error) = result { + // @TODO + println!("Could not delegate launch action: {error}") + } + }, ); } });