mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05:27 +00:00
define ptr container outside
This commit is contained in:
parent
7b2c07ac45
commit
a5fc2a7475
58 changed files with 230 additions and 272 deletions
|
|
@ -11,10 +11,10 @@ pub struct Control {
|
|||
|
||||
impl Control {
|
||||
// Construct
|
||||
pub fn new_rc() -> Rc<Self> {
|
||||
Rc::new(Self {
|
||||
widget: Widget::new_rc(),
|
||||
})
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
widget: Rc::new(Widget::new()),
|
||||
}
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
use gtk::{PackType, WindowControls};
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Widget {
|
||||
gobject: WindowControls,
|
||||
|
|
@ -7,13 +6,13 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_rc() -> Rc<Self> {
|
||||
Rc::new(Self {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
gobject: WindowControls::builder()
|
||||
.side(PackType::End)
|
||||
.margin_end(4)
|
||||
.build(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@ pub struct Menu {
|
|||
}
|
||||
#[rustfmt::skip] // @TODO template builder?
|
||||
impl Menu {
|
||||
pub fn new_rc(
|
||||
pub fn new(
|
||||
browser_action: Rc<BrowserAction>,
|
||||
window_action: Rc<WindowAction>,
|
||||
) -> Rc<Self> {
|
||||
) -> Self {
|
||||
// Main
|
||||
let main = gio::Menu::new();
|
||||
|
||||
|
|
@ -120,7 +120,7 @@ impl Menu {
|
|||
)));
|
||||
|
||||
// Result
|
||||
Rc::new(Self { widget:Widget::new_rc(&main) })
|
||||
Self { widget:Rc::new(Widget::new(&main)) }
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
use gtk::{gio::Menu, Align, MenuButton};
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Widget {
|
||||
gobject: MenuButton,
|
||||
|
|
@ -7,8 +6,8 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_rc(model: &Menu) -> Rc<Self> {
|
||||
Rc::new(Self {
|
||||
pub fn new(model: &Menu) -> Self {
|
||||
Self {
|
||||
gobject: MenuButton::builder()
|
||||
.css_classes(["flat"])
|
||||
.icon_name("open-menu-symbolic")
|
||||
|
|
@ -16,7 +15,7 @@ impl Widget {
|
|||
.tooltip_text("Menu")
|
||||
.valign(Align::Center)
|
||||
.build(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ pub struct Tab {
|
|||
|
||||
impl Tab {
|
||||
// Construct
|
||||
pub fn new_rc(window_action: Rc<WindowAction>, view: &TabView) -> Rc<Self> {
|
||||
Rc::new(Self {
|
||||
widget: Widget::new_rc(view, Append::new_rc(window_action).gobject()),
|
||||
})
|
||||
pub fn new(window_action: Rc<WindowAction>, view: &TabView) -> Self {
|
||||
Self {
|
||||
widget: Rc::new(Widget::new(view, Append::new(window_action).gobject())),
|
||||
}
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@ pub struct Append {
|
|||
|
||||
impl Append {
|
||||
// Construct
|
||||
pub fn new_rc(window_action: Rc<WindowAction>) -> Rc<Self> {
|
||||
Rc::new(Self {
|
||||
widget: Widget::new_rc(window_action),
|
||||
})
|
||||
pub fn new(window_action: Rc<WindowAction>) -> Self {
|
||||
Self {
|
||||
widget: Rc::new(Widget::new(window_action)),
|
||||
}
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_rc(window_action: Rc<WindowAction>) -> Rc<Self> {
|
||||
pub fn new(window_action: Rc<WindowAction>) -> Self {
|
||||
// Init gobject
|
||||
let gobject = Button::builder()
|
||||
.icon_name("tab-new-symbolic")
|
||||
|
|
@ -20,7 +20,7 @@ impl Widget {
|
|||
// Init events
|
||||
gobject.connect_clicked(move |_| window_action.append().activate());
|
||||
|
||||
Rc::new(Self { gobject })
|
||||
Self { gobject }
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
use adw::{TabBar, TabView};
|
||||
use gtk::prelude::IsA;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Widget {
|
||||
gobject: TabBar,
|
||||
|
|
@ -8,15 +7,15 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_rc(view: &TabView, start_action_widget: &impl IsA<gtk::Widget>) -> Rc<Self> {
|
||||
Rc::new(Self {
|
||||
pub fn new(view: &TabView, start_action_widget: &impl IsA<gtk::Widget>) -> Self {
|
||||
Self {
|
||||
gobject: TabBar::builder()
|
||||
.autohide(false)
|
||||
.expand_tabs(false)
|
||||
.end_action_widget(start_action_widget) // @TODO find solution to append after tabs
|
||||
.view(view)
|
||||
.build(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
use adw::TabBar;
|
||||
use gtk::{prelude::BoxExt, Box, MenuButton, Orientation, WindowControls};
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Widget {
|
||||
gobject: Box,
|
||||
|
|
@ -8,7 +7,7 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_rc(control: &WindowControls, menu: &MenuButton, tab: &TabBar) -> Rc<Self> {
|
||||
pub fn new(control: &WindowControls, menu: &MenuButton, tab: &TabBar) -> Self {
|
||||
let gobject = Box::builder()
|
||||
.orientation(Orientation::Horizontal)
|
||||
.spacing(8)
|
||||
|
|
@ -18,7 +17,7 @@ impl Widget {
|
|||
gobject.append(menu);
|
||||
gobject.append(control);
|
||||
|
||||
Rc::new(Self { gobject })
|
||||
Self { gobject }
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue