From 0091175d2a8fdc2b8a319905a4d37eca7f307c9d Mon Sep 17 00:00:00 2001 From: yggverse Date: Wed, 20 Nov 2024 11:51:56 +0200 Subject: [PATCH] reload page on identity apply --- src/app/browser/window/tab/item.rs | 5 +++-- src/app/browser/window/tab/item/identity.rs | 5 +++-- src/app/browser/window/tab/item/identity/gemini.rs | 13 +++++++------ 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/app/browser/window/tab/item.rs b/src/app/browser/window/tab/item.rs index 19f2aa6c..9dcda53d 100644 --- a/src/app/browser/window/tab/item.rs +++ b/src/app/browser/window/tab/item.rs @@ -51,7 +51,7 @@ impl Item { let page = Rc::new(Page::new( id.clone(), profile.clone(), - (actions.0, actions.1, action.clone()), + (actions.0, actions.1.clone(), action.clone()), )); let widget = Rc::new(Widget::new( @@ -86,7 +86,8 @@ impl Item { if let Some(uri) = page.navigation().request().uri() { // Rout by scheme 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 diff --git a/src/app/browser/window/tab/item/identity.rs b/src/app/browser/window/tab/item/identity.rs index 8253d5d0..e3216afb 100644 --- a/src/app/browser/window/tab/item/identity.rs +++ b/src/app/browser/window/tab/item/identity.rs @@ -4,13 +4,14 @@ mod unsupported; use gemini::Gemini; use unsupported::Unsupported; +use crate::app::browser::window::Action; use crate::profile::Profile; use gtk::glib::Uri; use std::rc::Rc; /// Create new identity widget for Gemini protocol match given URI -pub fn new_gemini(profile: Rc, auth_uri: Uri) -> Gemini { - Gemini::new(profile, auth_uri) +pub fn new_gemini(profile: Rc, action: Rc, auth_uri: Uri) -> Gemini { + Gemini::new(profile, action, auth_uri) } /// Create new identity widget for unknown request diff --git a/src/app/browser/window/tab/item/identity/gemini.rs b/src/app/browser/window/tab/item/identity/gemini.rs index 14646521..4f5496e5 100644 --- a/src/app/browser/window/tab/item/identity/gemini.rs +++ b/src/app/browser/window/tab/item/identity/gemini.rs @@ -1,6 +1,7 @@ mod widget; use widget::Widget; +use crate::app::browser::window::Action; use crate::profile::Profile; use gtk::{ gio::{prelude::TlsCertificateExt, TlsCertificate}, @@ -18,7 +19,7 @@ impl Gemini { // Construct /// Create new `Self` for given Profile - pub fn new(profile: Rc, auth_uri: Uri) -> Self { + pub fn new(profile: Rc, action: Rc, auth_uri: Uri) -> Self { // Init widget let widget = Rc::new(Widget::new()); @@ -86,15 +87,15 @@ impl Gemini { }; // Activate identity for given `auth_uri` - profile + match profile .identity .gemini .auth .activate(profile_identity_gemini_id, auth_url.as_str()) - .unwrap(); //@TODO handle errors - - // Reload page - // @TODO + { + Ok(_) => action.reload().activate(), + Err(reason) => todo!("{:?}", reason), + } } });