mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05:27 +00:00
reload page on identity apply
This commit is contained in:
parent
5128324f8e
commit
0091175d2a
3 changed files with 13 additions and 10 deletions
|
|
@ -51,7 +51,7 @@ impl Item {
|
||||||
let page = Rc::new(Page::new(
|
let page = Rc::new(Page::new(
|
||||||
id.clone(),
|
id.clone(),
|
||||||
profile.clone(),
|
profile.clone(),
|
||||||
(actions.0, actions.1, action.clone()),
|
(actions.0, actions.1.clone(), action.clone()),
|
||||||
));
|
));
|
||||||
|
|
||||||
let widget = Rc::new(Widget::new(
|
let widget = Rc::new(Widget::new(
|
||||||
|
|
@ -86,7 +86,8 @@ impl Item {
|
||||||
if let Some(uri) = page.navigation().request().uri() {
|
if let Some(uri) = page.navigation().request().uri() {
|
||||||
// Rout by scheme
|
// Rout by scheme
|
||||||
if uri.scheme().to_lowercase() == "gemini" {
|
if uri.scheme().to_lowercase() == "gemini" {
|
||||||
return identity::new_gemini(profile.clone(), uri).present(Some(&parent));
|
return identity::new_gemini(profile.clone(), actions.1.clone(), uri)
|
||||||
|
.present(Some(&parent));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Show dialog with unsupported request message
|
// Show dialog with unsupported request message
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,14 @@ mod unsupported;
|
||||||
use gemini::Gemini;
|
use gemini::Gemini;
|
||||||
use unsupported::Unsupported;
|
use unsupported::Unsupported;
|
||||||
|
|
||||||
|
use crate::app::browser::window::Action;
|
||||||
use crate::profile::Profile;
|
use crate::profile::Profile;
|
||||||
use gtk::glib::Uri;
|
use gtk::glib::Uri;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
/// Create new identity widget for Gemini protocol match given URI
|
/// Create new identity widget for Gemini protocol match given URI
|
||||||
pub fn new_gemini(profile: Rc<Profile>, auth_uri: Uri) -> Gemini {
|
pub fn new_gemini(profile: Rc<Profile>, action: Rc<Action>, auth_uri: Uri) -> Gemini {
|
||||||
Gemini::new(profile, auth_uri)
|
Gemini::new(profile, action, auth_uri)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create new identity widget for unknown request
|
/// Create new identity widget for unknown request
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
mod widget;
|
mod widget;
|
||||||
use widget::Widget;
|
use widget::Widget;
|
||||||
|
|
||||||
|
use crate::app::browser::window::Action;
|
||||||
use crate::profile::Profile;
|
use crate::profile::Profile;
|
||||||
use gtk::{
|
use gtk::{
|
||||||
gio::{prelude::TlsCertificateExt, TlsCertificate},
|
gio::{prelude::TlsCertificateExt, TlsCertificate},
|
||||||
|
|
@ -18,7 +19,7 @@ impl Gemini {
|
||||||
// Construct
|
// Construct
|
||||||
|
|
||||||
/// Create new `Self` for given Profile
|
/// Create new `Self` for given Profile
|
||||||
pub fn new(profile: Rc<Profile>, auth_uri: Uri) -> Self {
|
pub fn new(profile: Rc<Profile>, action: Rc<Action>, auth_uri: Uri) -> Self {
|
||||||
// Init widget
|
// Init widget
|
||||||
let widget = Rc::new(Widget::new());
|
let widget = Rc::new(Widget::new());
|
||||||
|
|
||||||
|
|
@ -86,15 +87,15 @@ impl Gemini {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Activate identity for given `auth_uri`
|
// Activate identity for given `auth_uri`
|
||||||
profile
|
match profile
|
||||||
.identity
|
.identity
|
||||||
.gemini
|
.gemini
|
||||||
.auth
|
.auth
|
||||||
.activate(profile_identity_gemini_id, auth_url.as_str())
|
.activate(profile_identity_gemini_id, auth_url.as_str())
|
||||||
.unwrap(); //@TODO handle errors
|
{
|
||||||
|
Ok(_) => action.reload().activate(),
|
||||||
// Reload page
|
Err(reason) => todo!("{:?}", reason),
|
||||||
// @TODO
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue