diff --git a/src/app/browser/window/tab/item/action/ident.rs b/src/app/browser/window/tab/item/action/ident.rs index 5537efe5..43654e3f 100644 --- a/src/app/browser/window/tab/item/action/ident.rs +++ b/src/app/browser/window/tab/item/action/ident.rs @@ -30,4 +30,10 @@ impl Ident { pub fn connect_activate(&self, callback: impl Fn() + 'static) { self.gobject.connect_activate(move |_, _| callback()); } + + // Getters + + pub fn gobject(&self) -> &SimpleAction { + &self.gobject + } } diff --git a/src/app/browser/window/tab/item/page/navigation.rs b/src/app/browser/window/tab/item/page/navigation.rs index 1dd08805..37f28592 100644 --- a/src/app/browser/window/tab/item/page/navigation.rs +++ b/src/app/browser/window/tab/item/page/navigation.rs @@ -73,14 +73,23 @@ impl Navigation { // Actions pub fn update(&self, progress_fraction: Option) { - let request = self.request.widget().gobject().text(); + let request_text = self.request.widget().gobject().text(); - self.identity.update(); + self.identity.update( + self.profile + .identity + .gemini + .auth + .memory + .match_priority(&request_text) + .is_some(), + !request_text.is_empty() && request_text.starts_with("gemini"), + ); self.bookmark - .update(self.profile.bookmark.get(&request).is_ok()); + .update(self.profile.bookmark.get(&request_text).is_ok()); self.history.update(); self.home.update(self.request.uri()); - self.reload.update(!request.is_empty()); + self.reload.update(!request_text.is_empty()); self.request.update(progress_fraction); } diff --git a/src/app/browser/window/tab/item/page/navigation/identity.rs b/src/app/browser/window/tab/item/page/navigation/identity.rs index b56cdbc1..65e36377 100644 --- a/src/app/browser/window/tab/item/page/navigation/identity.rs +++ b/src/app/browser/window/tab/item/page/navigation/identity.rs @@ -5,6 +5,7 @@ use crate::app::browser::window::tab::item::Action; use std::rc::Rc; pub struct Identity { + action: Rc, widget: Rc, } @@ -12,13 +13,18 @@ impl Identity { // Construct pub fn new(action: Rc) -> Self { Self { - widget: Rc::new(Widget::new(action.clone())), + action: action.clone(), + widget: Rc::new(Widget::new(action)), } } // Actions - pub fn update(&self) { - self.widget.update(false) // @TODO + pub fn update(&self, is_auth: bool, is_enabled: bool) { + // Update action status + self.action.ident().gobject().set_enabled(is_enabled); + + // Update widget + self.widget.update(is_auth, is_enabled) } // Getters diff --git a/src/app/browser/window/tab/item/page/navigation/identity/widget.rs b/src/app/browser/window/tab/item/page/navigation/identity/widget.rs index 7242dc58..b8bd3fc3 100644 --- a/src/app/browser/window/tab/item/page/navigation/identity/widget.rs +++ b/src/app/browser/window/tab/item/page/navigation/identity/widget.rs @@ -27,8 +27,10 @@ impl Widget { } // Actions - pub fn update(&self, is_sensitive: bool) { - //self.gobject.set_sensitive(is_sensitive); + pub fn update(&self, is_auth: bool, is_enabled: bool) { + self.gobject.set_sensitive(is_enabled); + self.gobject + .set_css_classes(if is_auth { &["success"] } else { &[] }); } // Getters