mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-03-10 04:31:14 +00:00
use UriLauncher
This commit is contained in:
parent
deafe0845d
commit
5c28a405ee
@ -15,10 +15,11 @@ use widget::Widget;
|
|||||||
use adw::StyleManager;
|
use adw::StyleManager;
|
||||||
use gtk::{
|
use gtk::{
|
||||||
gdk::{BUTTON_MIDDLE, BUTTON_PRIMARY},
|
gdk::{BUTTON_MIDDLE, BUTTON_PRIMARY},
|
||||||
gio::{AppInfo, AppLaunchContext, SimpleAction},
|
gio::{Cancellable, SimpleAction},
|
||||||
glib::{GString, TimeZone, Uri},
|
glib::{GString, TimeZone, Uri},
|
||||||
prelude::{ActionExt, TextBufferExt, TextBufferExtManual, TextViewExt, ToVariant, WidgetExt},
|
prelude::{ActionExt, TextBufferExt, TextBufferExtManual, TextViewExt, ToVariant, WidgetExt},
|
||||||
EventControllerMotion, GestureClick, TextBuffer, TextTag, TextView, TextWindowType, WrapMode,
|
EventControllerMotion, GestureClick, TextBuffer, TextTag, TextView, TextWindowType,
|
||||||
|
UriLauncher, Window, WrapMode,
|
||||||
};
|
};
|
||||||
|
|
||||||
use std::{collections::HashMap, sync::Arc};
|
use std::{collections::HashMap, sync::Arc};
|
||||||
@ -253,14 +254,17 @@ impl Reader {
|
|||||||
// Open new page in browser
|
// Open new page in browser
|
||||||
action_page_open.activate(Some(&uri.to_str().to_variant()));
|
action_page_open.activate(Some(&uri.to_str().to_variant()));
|
||||||
}
|
}
|
||||||
// Scheme not supported, delegate link to the external app
|
// Scheme not supported, delegate
|
||||||
_ => match AppInfo::launch_default_for_uri(
|
_ => UriLauncher::new(&uri.to_str()).launch(
|
||||||
&uri.to_str(),
|
None::<&Window>,
|
||||||
Some(&AppLaunchContext::new()),
|
None::<&Cancellable>,
|
||||||
) {
|
|result| {
|
||||||
Ok(_) => (),
|
if let Err(error) = result {
|
||||||
Err(e) => todo!("{e}"),
|
// @TODO
|
||||||
},
|
println!("Could not delegate launch action: {error}")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user