mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-03-13 06:01:21 +00:00
rename component
This commit is contained in:
parent
2f423c5d7e
commit
dad227c9be
@ -1,8 +1,8 @@
|
|||||||
mod left;
|
mod counter;
|
||||||
mod send;
|
mod send;
|
||||||
mod widget;
|
mod widget;
|
||||||
|
|
||||||
use left::Left;
|
use counter::Counter;
|
||||||
use send::Send;
|
use send::Send;
|
||||||
use widget::Widget;
|
use widget::Widget;
|
||||||
|
|
||||||
@ -10,7 +10,7 @@ use gtk::{gio::SimpleAction, Box};
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
pub struct Control {
|
pub struct Control {
|
||||||
left: Arc<Left>,
|
counter: Arc<Counter>,
|
||||||
send: Arc<Send>,
|
send: Arc<Send>,
|
||||||
widget: Arc<Widget>,
|
widget: Arc<Widget>,
|
||||||
}
|
}
|
||||||
@ -19,20 +19,24 @@ impl Control {
|
|||||||
// Construct
|
// Construct
|
||||||
pub fn new_arc(action_send: Arc<SimpleAction>) -> Arc<Self> {
|
pub fn new_arc(action_send: Arc<SimpleAction>) -> Arc<Self> {
|
||||||
// Init components
|
// Init components
|
||||||
let left = Left::new_arc();
|
let counter = Counter::new_arc();
|
||||||
let send = Send::new_arc(action_send);
|
let send = Send::new_arc(action_send);
|
||||||
|
|
||||||
// Init widget
|
// Init widget
|
||||||
let widget = Widget::new_arc(left.gobject(), send.gobject());
|
let widget = Widget::new_arc(counter.gobject(), send.gobject());
|
||||||
|
|
||||||
// Return activated struct
|
// Return activated struct
|
||||||
Arc::new(Self { left, send, widget })
|
Arc::new(Self {
|
||||||
|
counter,
|
||||||
|
send,
|
||||||
|
widget,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
pub fn update(&self, chars_left: Option<i32>) {
|
pub fn update(&self, chars_left: Option<i32>) {
|
||||||
// Update children components
|
// Update children components
|
||||||
self.left.update(chars_left);
|
self.counter.update(chars_left);
|
||||||
self.send.update(match chars_left {
|
self.send.update(match chars_left {
|
||||||
Some(value) => value > 0,
|
Some(value) => value > 0,
|
||||||
None => false,
|
None => false,
|
||||||
|
@ -5,11 +5,11 @@ use widget::Widget;
|
|||||||
use gtk::Label;
|
use gtk::Label;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
pub struct Left {
|
pub struct Counter {
|
||||||
widget: Arc<Widget>,
|
widget: Arc<Widget>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Left {
|
impl Counter {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn new_arc() -> Arc<Self> {
|
pub fn new_arc() -> Arc<Self> {
|
||||||
// Init widget
|
// Init widget
|
Loading…
x
Reference in New Issue
Block a user