mirror of https://github.com/YGGverse/Yoda.git
yggverse
2 weeks ago
4 changed files with 77 additions and 0 deletions
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
mod widget; |
||||
|
||||
use widget::Widget; |
||||
|
||||
use crate::app::browser::window::Action; |
||||
use std::rc::Rc; |
||||
|
||||
pub struct Auth { |
||||
widget: Rc<Widget>, |
||||
} |
||||
|
||||
impl Auth { |
||||
// Construct
|
||||
pub fn new(action: Rc<Action>) -> Self { |
||||
Self { |
||||
widget: Rc::new(Widget::new(action.clone())), |
||||
} |
||||
} |
||||
|
||||
// Actions
|
||||
pub fn update(&self) { |
||||
// @TODO
|
||||
} |
||||
|
||||
// Getters
|
||||
|
||||
pub fn widget(&self) -> &Rc<Widget> { |
||||
&self.widget |
||||
} |
||||
} |
@ -0,0 +1,38 @@
@@ -0,0 +1,38 @@
|
||||
use crate::app::browser::window::Action; |
||||
use gtk::{ |
||||
prelude::{ButtonExt, WidgetExt}, |
||||
Button, |
||||
}; |
||||
use std::rc::Rc; |
||||
|
||||
pub struct Widget { |
||||
gobject: Button, |
||||
} |
||||
|
||||
impl Widget { |
||||
// Construct
|
||||
pub fn new(action: Rc<Action>) -> Self { |
||||
// Init gobject
|
||||
let gobject = Button::builder() |
||||
.icon_name("avatar-default-symbolic") |
||||
.tooltip_text("Auth") |
||||
.sensitive(false) |
||||
.build(); |
||||
|
||||
// Init events @TODO
|
||||
// gobject.connect_clicked(move |_| action.auth().activate());
|
||||
|
||||
// Return activated `Self`
|
||||
Self { gobject } |
||||
} |
||||
|
||||
// Actions
|
||||
pub fn update(&self, is_sensitive: bool) { |
||||
self.gobject.set_sensitive(is_sensitive); |
||||
} |
||||
|
||||
// Getters
|
||||
pub fn gobject(&self) -> &Button { |
||||
&self.gobject |
||||
} |
||||
} |
Loading…
Reference in new issue