mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
fix auth indicator update on identity apply
This commit is contained in:
parent
4203b91e84
commit
6501738737
3 changed files with 19 additions and 14 deletions
|
|
@ -91,16 +91,22 @@ impl Item {
|
|||
});
|
||||
|
||||
action.ident.connect_activate({
|
||||
let client = client.clone();
|
||||
let page = page.clone();
|
||||
let parent = tab_view.clone().upcast::<gtk::Widget>();
|
||||
let profile = profile.clone();
|
||||
let window_action = window_action.clone();
|
||||
move || {
|
||||
if let Some(uri) = page.navigation.uri() {
|
||||
let scheme = uri.scheme();
|
||||
if scheme == "gemini" || scheme == "titan" {
|
||||
return identity::default(&window_action, &profile, &uri)
|
||||
.present(Some(&parent));
|
||||
if let Some(request) = page.navigation.uri() {
|
||||
if ["gemini", "titan"].contains(&request.scheme().as_str()) {
|
||||
return identity::default(&profile, &request, {
|
||||
let client = client.clone();
|
||||
let page = page.clone();
|
||||
move || {
|
||||
page.navigation.update(); // update indicators immediately
|
||||
client.handle(&page.navigation.request(), false);
|
||||
} // on apply
|
||||
})
|
||||
.present(Some(&parent));
|
||||
}
|
||||
}
|
||||
identity::unsupported().present(Some(&parent));
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@ mod unsupported;
|
|||
use default::Default;
|
||||
use unsupported::Unsupported;
|
||||
|
||||
use super::{Profile, WindowAction};
|
||||
use super::Profile;
|
||||
use gtk::glib::Uri;
|
||||
use std::rc::Rc;
|
||||
|
||||
/// Create new identity widget for Gemini protocol match given URI
|
||||
pub fn default(window_action: &Rc<WindowAction>, profile: &Rc<Profile>, request: &Uri) -> Default {
|
||||
Default::build(window_action, profile, request)
|
||||
pub fn default(profile: &Rc<Profile>, request: &Uri, on_apply: impl Fn() + 'static) -> Default {
|
||||
Default::build(profile, request, on_apply)
|
||||
}
|
||||
|
||||
/// Create new identity widget for unknown request
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
mod widget;
|
||||
use widget::{form::list::item::value::Value, Widget};
|
||||
|
||||
use super::{Profile, WindowAction};
|
||||
use super::Profile;
|
||||
use gtk::{glib::Uri, prelude::IsA};
|
||||
use std::rc::Rc;
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ impl Default {
|
|||
// Construct
|
||||
|
||||
/// Create new `Self` for given `Profile`
|
||||
pub fn build(window_action: &Rc<WindowAction>, profile: &Rc<Profile>, request: &Uri) -> Self {
|
||||
pub fn build(profile: &Rc<Profile>, request: &Uri, on_apply: impl Fn() + 'static) -> Self {
|
||||
// Init widget
|
||||
let widget = Rc::new(Widget::build(profile, request));
|
||||
|
||||
|
|
@ -23,7 +23,6 @@ impl Default {
|
|||
let profile = profile.clone();
|
||||
let request = request.clone();
|
||||
let widget = widget.clone();
|
||||
let window_action = window_action.clone();
|
||||
move |response| {
|
||||
// Get option match user choice
|
||||
let option = match response {
|
||||
|
|
@ -64,8 +63,8 @@ impl Default {
|
|||
}
|
||||
}
|
||||
|
||||
// Apply changes
|
||||
window_action.reload.activate();
|
||||
// Run callback function
|
||||
on_apply()
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue