mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05:27 +00:00
replace arc with rc
This commit is contained in:
parent
a0e923eb7d
commit
c843e5b7c0
62 changed files with 317 additions and 334 deletions
|
|
@ -10,15 +10,15 @@ use widget::Widget;
|
|||
|
||||
use adw::TabView;
|
||||
use gtk::{gio::SimpleAction, Box};
|
||||
use std::sync::Arc;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Bar {
|
||||
widget: Arc<Widget>,
|
||||
widget: Rc<Widget>,
|
||||
}
|
||||
|
||||
impl Bar {
|
||||
// Construct
|
||||
pub fn new_arc(
|
||||
pub fn new_rc(
|
||||
action_about: SimpleAction,
|
||||
action_debug: SimpleAction,
|
||||
action_profile: SimpleAction,
|
||||
|
|
@ -32,11 +32,11 @@ impl Bar {
|
|||
action_page_reload: SimpleAction,
|
||||
action_page_pin: SimpleAction,
|
||||
view: &TabView,
|
||||
) -> Arc<Self> {
|
||||
) -> Rc<Self> {
|
||||
// Init components
|
||||
let control = Control::new_arc();
|
||||
let tab = Tab::new_arc(action_page_new.clone(), view);
|
||||
let menu = Menu::new_arc(
|
||||
let control = Control::new_rc();
|
||||
let tab = Tab::new_rc(action_page_new.clone(), view);
|
||||
let menu = Menu::new_rc(
|
||||
action_about,
|
||||
action_debug,
|
||||
action_profile,
|
||||
|
|
@ -52,8 +52,8 @@ impl Bar {
|
|||
);
|
||||
|
||||
// Build result
|
||||
Arc::new(Self {
|
||||
widget: Widget::new_arc(control.gobject(), menu.gobject(), tab.gobject()),
|
||||
Rc::new(Self {
|
||||
widget: Widget::new_rc(control.gobject(), menu.gobject(), tab.gobject()),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,17 +3,17 @@ mod widget;
|
|||
use widget::Widget;
|
||||
|
||||
use gtk::WindowControls;
|
||||
use std::sync::Arc;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Control {
|
||||
widget: Arc<Widget>,
|
||||
widget: Rc<Widget>,
|
||||
}
|
||||
|
||||
impl Control {
|
||||
// Construct
|
||||
pub fn new_arc() -> Arc<Self> {
|
||||
Arc::new(Self {
|
||||
widget: Widget::new_arc(),
|
||||
pub fn new_rc() -> Rc<Self> {
|
||||
Rc::new(Self {
|
||||
widget: Widget::new_rc(),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use gtk::{PackType, WindowControls};
|
||||
use std::sync::Arc;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Widget {
|
||||
gobject: WindowControls,
|
||||
|
|
@ -7,8 +7,8 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc() -> Arc<Self> {
|
||||
Arc::new(Self {
|
||||
pub fn new_rc() -> Rc<Self> {
|
||||
Rc::new(Self {
|
||||
gobject: WindowControls::builder()
|
||||
.side(PackType::End)
|
||||
.margin_end(4)
|
||||
|
|
|
|||
|
|
@ -9,14 +9,14 @@ use gtk::{
|
|||
MenuButton,
|
||||
};
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Menu {
|
||||
widget: Arc<Widget>,
|
||||
widget: Rc<Widget>,
|
||||
}
|
||||
#[rustfmt::skip] // @TODO template builder?
|
||||
impl Menu {
|
||||
pub fn new_arc(
|
||||
pub fn new_rc(
|
||||
action_about: SimpleAction,
|
||||
action_debug: SimpleAction,
|
||||
action_profile: SimpleAction,
|
||||
|
|
@ -29,7 +29,7 @@ impl Menu {
|
|||
action_page_history_forward: SimpleAction,
|
||||
action_page_reload: SimpleAction,
|
||||
action_page_pin: SimpleAction,
|
||||
) -> Arc<Self> {
|
||||
) -> Rc<Self> {
|
||||
// Main
|
||||
let main = gio::Menu::new();
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ impl Menu {
|
|||
main.append(Some("Quit"), Some(&detailed_action_name(action_quit)));
|
||||
|
||||
// Result
|
||||
Arc::new(Self { widget:Widget::new_arc(&main) })
|
||||
Rc::new(Self { widget:Widget::new_rc(&main) })
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use gtk::{gio::Menu, Align, MenuButton};
|
||||
use std::sync::Arc;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Widget {
|
||||
gobject: MenuButton,
|
||||
|
|
@ -7,8 +7,8 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(model: &Menu) -> Arc<Self> {
|
||||
Arc::new(Self {
|
||||
pub fn new_rc(model: &Menu) -> Rc<Self> {
|
||||
Rc::new(Self {
|
||||
gobject: MenuButton::builder()
|
||||
.css_classes(["flat"])
|
||||
.icon_name("open-menu-symbolic")
|
||||
|
|
|
|||
|
|
@ -6,17 +6,17 @@ use widget::Widget;
|
|||
|
||||
use adw::{TabBar, TabView};
|
||||
use gtk::gio::SimpleAction;
|
||||
use std::sync::Arc;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Tab {
|
||||
widget: Arc<Widget>,
|
||||
widget: Rc<Widget>,
|
||||
}
|
||||
|
||||
impl Tab {
|
||||
// Construct
|
||||
pub fn new_arc(action_page_new: SimpleAction, view: &TabView) -> Arc<Self> {
|
||||
Arc::new(Self {
|
||||
widget: Widget::new_arc(view, Append::new_arc(action_page_new).gobject()),
|
||||
pub fn new_rc(action_page_new: SimpleAction, view: &TabView) -> Rc<Self> {
|
||||
Rc::new(Self {
|
||||
widget: Widget::new_rc(view, Append::new_rc(action_page_new).gobject()),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,17 +3,17 @@ mod widget;
|
|||
use widget::Widget;
|
||||
|
||||
use gtk::{gio::SimpleAction, Button};
|
||||
use std::sync::Arc;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Append {
|
||||
pub widget: Arc<Widget>,
|
||||
pub widget: Rc<Widget>,
|
||||
}
|
||||
|
||||
impl Append {
|
||||
// Construct
|
||||
pub fn new_arc(action_page_new: SimpleAction) -> Arc<Self> {
|
||||
Arc::new(Self {
|
||||
widget: Widget::new_arc(action_page_new),
|
||||
pub fn new_rc(action_page_new: SimpleAction) -> Rc<Self> {
|
||||
Rc::new(Self {
|
||||
widget: Widget::new_rc(action_page_new),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use gtk::{
|
|||
prelude::{ActionExt, ButtonExt},
|
||||
Align, 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_page_new: SimpleAction) -> Arc<Self> {
|
||||
pub fn new_rc(action_page_new: SimpleAction) -> Rc<Self> {
|
||||
// Init gobject
|
||||
let gobject = Button::builder()
|
||||
.icon_name("tab-new-symbolic")
|
||||
|
|
@ -25,7 +25,7 @@ impl Widget {
|
|||
action_page_new.activate(None);
|
||||
});
|
||||
|
||||
Arc::new(Self { gobject })
|
||||
Rc::new(Self { gobject })
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use adw::{TabBar, TabView};
|
||||
use gtk::prelude::IsA;
|
||||
use std::sync::Arc;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Widget {
|
||||
gobject: TabBar,
|
||||
|
|
@ -8,8 +8,8 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(view: &TabView, start_action_widget: &impl IsA<gtk::Widget>) -> Arc<Self> {
|
||||
Arc::new(Self {
|
||||
pub fn new_rc(view: &TabView, start_action_widget: &impl IsA<gtk::Widget>) -> Rc<Self> {
|
||||
Rc::new(Self {
|
||||
gobject: TabBar::builder()
|
||||
.autohide(false)
|
||||
.expand_tabs(false)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use adw::TabBar;
|
||||
use gtk::{prelude::BoxExt, Box, MenuButton, Orientation, WindowControls};
|
||||
use std::sync::Arc;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Widget {
|
||||
gobject: Box,
|
||||
|
|
@ -8,7 +8,7 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(control: &WindowControls, menu: &MenuButton, tab: &TabBar) -> Arc<Self> {
|
||||
pub fn new_rc(control: &WindowControls, menu: &MenuButton, tab: &TabBar) -> Rc<Self> {
|
||||
let gobject = Box::builder()
|
||||
.orientation(Orientation::Horizontal)
|
||||
.spacing(8)
|
||||
|
|
@ -18,7 +18,7 @@ impl Widget {
|
|||
gobject.append(menu);
|
||||
gobject.append(control);
|
||||
|
||||
Arc::new(Self { gobject })
|
||||
Rc::new(Self { gobject })
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use adw::ToolbarView;
|
||||
use gtk::Box;
|
||||
use std::sync::Arc;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Widget {
|
||||
gobject: ToolbarView,
|
||||
|
|
@ -8,12 +8,12 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(top_bar: &Box) -> Arc<Self> {
|
||||
pub fn new_rc(top_bar: &Box) -> Rc<Self> {
|
||||
let gobject = ToolbarView::builder().build();
|
||||
|
||||
gobject.add_top_bar(top_bar);
|
||||
|
||||
Arc::new(Self { gobject })
|
||||
Rc::new(Self { gobject })
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue