mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-15 09:10:08 +00:00
highlight ident button on active auth session, disable on auth unsupported
This commit is contained in:
parent
3064b530ea
commit
5d01786596
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -73,14 +73,23 @@ impl Navigation {
|
||||
// Actions
|
||||
|
||||
pub fn update(&self, progress_fraction: Option<f64>) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ use crate::app::browser::window::tab::item::Action;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Identity {
|
||||
action: Rc<Action>,
|
||||
widget: Rc<Widget>,
|
||||
}
|
||||
|
||||
@ -12,13 +13,18 @@ impl Identity {
|
||||
// Construct
|
||||
pub fn new(action: Rc<Action>) -> 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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user