mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 09:35:28 +00:00
replace arc with rc
This commit is contained in:
parent
a0e923eb7d
commit
c843e5b7c0
62 changed files with 317 additions and 334 deletions
|
|
@ -7,26 +7,26 @@ use send::Send;
|
|||
use widget::Widget;
|
||||
|
||||
use gtk::{gio::SimpleAction, Box};
|
||||
use std::sync::Arc;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Control {
|
||||
counter: Arc<Counter>,
|
||||
send: Arc<Send>,
|
||||
widget: Arc<Widget>,
|
||||
counter: Rc<Counter>,
|
||||
send: Rc<Send>,
|
||||
widget: Rc<Widget>,
|
||||
}
|
||||
|
||||
impl Control {
|
||||
// Construct
|
||||
pub fn new_arc(action_send: SimpleAction) -> Arc<Self> {
|
||||
pub fn new_rc(action_send: SimpleAction) -> Rc<Self> {
|
||||
// Init components
|
||||
let counter = Counter::new_arc();
|
||||
let send = Send::new_arc(action_send);
|
||||
let counter = Counter::new_rc();
|
||||
let send = Send::new_rc(action_send);
|
||||
|
||||
// Init widget
|
||||
let widget = Widget::new_arc(counter.gobject(), send.gobject());
|
||||
let widget = Widget::new_rc(counter.gobject(), send.gobject());
|
||||
|
||||
// Return activated struct
|
||||
Arc::new(Self {
|
||||
Rc::new(Self {
|
||||
counter,
|
||||
send,
|
||||
widget,
|
||||
|
|
|
|||
|
|
@ -3,20 +3,20 @@ mod widget;
|
|||
use widget::Widget;
|
||||
|
||||
use gtk::Label;
|
||||
use std::sync::Arc;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Counter {
|
||||
widget: Arc<Widget>,
|
||||
widget: Rc<Widget>,
|
||||
}
|
||||
|
||||
impl Counter {
|
||||
// Construct
|
||||
pub fn new_arc() -> Arc<Self> {
|
||||
pub fn new_rc() -> Rc<Self> {
|
||||
// Init widget
|
||||
let widget = Widget::new_arc();
|
||||
let widget = Widget::new_rc();
|
||||
|
||||
// Result
|
||||
Arc::new(Self { widget })
|
||||
Rc::new(Self { widget })
|
||||
}
|
||||
|
||||
// Actions
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use gtk::{prelude::WidgetExt, Label};
|
||||
use std::sync::Arc;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Widget {
|
||||
gobject: Label,
|
||||
|
|
@ -7,10 +7,10 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc() -> Arc<Self> {
|
||||
pub fn new_rc() -> Rc<Self> {
|
||||
let gobject = Label::builder().build();
|
||||
|
||||
Arc::new(Self { gobject })
|
||||
Rc::new(Self { gobject })
|
||||
}
|
||||
|
||||
// Actions
|
||||
|
|
|
|||
|
|
@ -3,20 +3,20 @@ mod widget;
|
|||
use widget::Widget;
|
||||
|
||||
use gtk::{gio::SimpleAction, Button};
|
||||
use std::sync::Arc;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Send {
|
||||
widget: Arc<Widget>,
|
||||
widget: Rc<Widget>,
|
||||
}
|
||||
|
||||
impl Send {
|
||||
// Construct
|
||||
pub fn new_arc(action_send: SimpleAction) -> Arc<Self> {
|
||||
pub fn new_rc(action_send: SimpleAction) -> Rc<Self> {
|
||||
// Init widget
|
||||
let widget = Widget::new_arc(action_send);
|
||||
let widget = Widget::new_rc(action_send);
|
||||
|
||||
// Result
|
||||
Arc::new(Self { widget })
|
||||
Rc::new(Self { widget })
|
||||
}
|
||||
|
||||
// Actions
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use gtk::{
|
|||
prelude::{ActionExt, ButtonExt, WidgetExt},
|
||||
Button,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Widget {
|
||||
gobject: Button,
|
||||
|
|
@ -11,7 +11,7 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(action_send: SimpleAction) -> Arc<Self> {
|
||||
pub fn new_rc(action_send: SimpleAction) -> Rc<Self> {
|
||||
// Init gobject
|
||||
let gobject = Button::builder()
|
||||
//.css_classes(["accent"])
|
||||
|
|
@ -26,7 +26,7 @@ impl Widget {
|
|||
});
|
||||
|
||||
// Return activated struct
|
||||
Arc::new(Self { gobject })
|
||||
Rc::new(Self { gobject })
|
||||
}
|
||||
|
||||
// Actions
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use gtk::{prelude::BoxExt, Align, Box, Button, Label, Orientation};
|
||||
use std::sync::Arc;
|
||||
use std::rc::Rc;
|
||||
|
||||
const SPACING: i32 = 8;
|
||||
|
||||
|
|
@ -9,7 +9,7 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(limit: &Label, send: &Button) -> Arc<Self> {
|
||||
pub fn new_rc(limit: &Label, send: &Button) -> Rc<Self> {
|
||||
// Init gobject
|
||||
let gobject = Box::builder()
|
||||
.halign(Align::End)
|
||||
|
|
@ -21,7 +21,7 @@ impl Widget {
|
|||
gobject.append(send);
|
||||
|
||||
// Return new struct
|
||||
Arc::new(Self { gobject })
|
||||
Rc::new(Self { gobject })
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
|
|
@ -3,20 +3,20 @@ mod widget;
|
|||
use widget::Widget;
|
||||
|
||||
use gtk::{gio::SimpleAction, glib::GString, TextView};
|
||||
use std::sync::Arc;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Form {
|
||||
widget: Arc<Widget>,
|
||||
widget: Rc<Widget>,
|
||||
}
|
||||
|
||||
impl Form {
|
||||
// Construct
|
||||
pub fn new_arc(action_update: SimpleAction) -> Arc<Self> {
|
||||
pub fn new_rc(action_update: SimpleAction) -> Rc<Self> {
|
||||
// Init widget
|
||||
let widget = Widget::new_arc(action_update);
|
||||
let widget = Widget::new_rc(action_update);
|
||||
|
||||
// Result
|
||||
Arc::new(Self { widget })
|
||||
Rc::new(Self { widget })
|
||||
}
|
||||
|
||||
// Actions
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use gtk::{
|
|||
prelude::{ActionExt, TextBufferExt, TextViewExt, WidgetExt},
|
||||
TextView, WrapMode,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
use std::rc::Rc;
|
||||
|
||||
const MARGIN: i32 = 8;
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(action_update: SimpleAction) -> Arc<Self> {
|
||||
pub fn new_rc(action_update: SimpleAction) -> Rc<Self> {
|
||||
// Init gobject
|
||||
let gobject = TextView::builder()
|
||||
.bottom_margin(MARGIN)
|
||||
|
|
@ -30,7 +30,7 @@ impl Widget {
|
|||
});
|
||||
|
||||
// Return activated struct
|
||||
Arc::new(Self { gobject })
|
||||
Rc::new(Self { gobject })
|
||||
}
|
||||
|
||||
// Actions
|
||||
|
|
|
|||
|
|
@ -3,20 +3,20 @@ mod widget;
|
|||
use widget::Widget;
|
||||
|
||||
use gtk::Label;
|
||||
use std::sync::Arc;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Title {
|
||||
widget: Arc<Widget>,
|
||||
widget: Rc<Widget>,
|
||||
}
|
||||
|
||||
impl Title {
|
||||
// Construct
|
||||
pub fn new_arc(title: Option<&str>) -> Arc<Self> {
|
||||
pub fn new_rc(title: Option<&str>) -> Rc<Self> {
|
||||
// Init widget
|
||||
let widget = Widget::new_arc(title);
|
||||
let widget = Widget::new_rc(title);
|
||||
|
||||
// Result
|
||||
Arc::new(Self { widget })
|
||||
Rc::new(Self { widget })
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use gtk::{prelude::WidgetExt, Align, Label};
|
||||
use std::sync::Arc;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Widget {
|
||||
gobject: Label,
|
||||
|
|
@ -7,7 +7,7 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(title: Option<&str>) -> Arc<Self> {
|
||||
pub fn new_rc(title: Option<&str>) -> Rc<Self> {
|
||||
let gobject = Label::builder()
|
||||
.css_classes(["heading"])
|
||||
.halign(Align::Start)
|
||||
|
|
@ -23,7 +23,7 @@ impl Widget {
|
|||
}
|
||||
}
|
||||
|
||||
Arc::new(Self { gobject })
|
||||
Rc::new(Self { gobject })
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use gtk::{prelude::BoxExt, Box, Label, Orientation, TextView};
|
||||
use std::sync::Arc;
|
||||
use std::rc::Rc;
|
||||
|
||||
const MARGIN: i32 = 6;
|
||||
const SPACING: i32 = 8;
|
||||
|
|
@ -10,7 +10,7 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(title: &Label, response: &TextView, control: &Box) -> Arc<Self> {
|
||||
pub fn new_rc(title: &Label, response: &TextView, control: &Box) -> Rc<Self> {
|
||||
let gobject = Box::builder()
|
||||
.margin_bottom(MARGIN)
|
||||
.margin_end(MARGIN)
|
||||
|
|
@ -24,7 +24,7 @@ impl Widget {
|
|||
gobject.append(response);
|
||||
gobject.append(control);
|
||||
|
||||
Arc::new(Self { gobject })
|
||||
Rc::new(Self { gobject })
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue