fix auth indicator update on identity apply

This commit is contained in:
yggverse 2025-01-28 15:49:35 +02:00
parent 4203b91e84
commit 6501738737
3 changed files with 19 additions and 14 deletions

View file

@ -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

View file

@ -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()
}
});