mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-03-13 06:01:21 +00:00
move new tab button into the tabs start widget
This commit is contained in:
parent
1ffc5c1edb
commit
6aee2edd75
@ -1,10 +1,8 @@
|
||||
mod append;
|
||||
mod control;
|
||||
mod menu;
|
||||
mod tab;
|
||||
mod widget;
|
||||
|
||||
use append::Append;
|
||||
use control::Control;
|
||||
use menu::Menu;
|
||||
use tab::Tab;
|
||||
@ -36,8 +34,7 @@ impl Bar {
|
||||
) -> Arc<Self> {
|
||||
// Init components
|
||||
let control = Control::new_arc();
|
||||
let tab = Tab::new_arc(view);
|
||||
let append = Append::new_arc(action_tab_append.clone());
|
||||
let tab = Tab::new_arc(action_tab_append.clone(), view);
|
||||
let menu = Menu::new_arc(
|
||||
action_tool_debug,
|
||||
action_tool_profile,
|
||||
@ -54,12 +51,7 @@ impl Bar {
|
||||
|
||||
// Build result
|
||||
Arc::new(Self {
|
||||
widget: Widget::new_arc(
|
||||
control.gobject(),
|
||||
append.gobject(),
|
||||
menu.gobject(),
|
||||
tab.gobject(),
|
||||
),
|
||||
widget: Widget::new_arc(control.gobject(), menu.gobject(), tab.gobject()),
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,11 @@
|
||||
mod append;
|
||||
mod widget;
|
||||
|
||||
use append::Append;
|
||||
use widget::Widget;
|
||||
|
||||
use adw::{TabBar, TabView};
|
||||
use gtk::gio::SimpleAction;
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct Tab {
|
||||
@ -11,9 +14,9 @@ pub struct Tab {
|
||||
|
||||
impl Tab {
|
||||
// Construct
|
||||
pub fn new_arc(view: &TabView) -> Arc<Self> {
|
||||
pub fn new_arc(action_tab_append: SimpleAction, view: &TabView) -> Arc<Self> {
|
||||
Arc::new(Self {
|
||||
widget: Widget::new_arc(view),
|
||||
widget: Widget::new_arc(view, Append::new_arc(action_tab_append).gobject()),
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
use adw::{TabBar, TabView};
|
||||
use gtk::prelude::IsA;
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct Widget {
|
||||
@ -7,11 +8,12 @@ pub struct Widget {
|
||||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(view: &TabView) -> Arc<Self> {
|
||||
pub fn new_arc(view: &TabView, start_action_widget: &impl IsA<gtk::Widget>) -> Arc<Self> {
|
||||
Arc::new(Self {
|
||||
gobject: TabBar::builder()
|
||||
.autohide(false)
|
||||
.expand_tabs(false)
|
||||
.start_action_widget(start_action_widget)
|
||||
.view(&view)
|
||||
.build(),
|
||||
})
|
||||
|
@ -1,5 +1,5 @@
|
||||
use adw::TabBar;
|
||||
use gtk::{prelude::BoxExt, Box, Button, MenuButton, Orientation, WindowControls};
|
||||
use gtk::{prelude::BoxExt, Box, MenuButton, Orientation, WindowControls};
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct Widget {
|
||||
@ -8,19 +8,13 @@ pub struct Widget {
|
||||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(
|
||||
control: &WindowControls,
|
||||
append: &Button,
|
||||
menu: &MenuButton,
|
||||
tab: &TabBar,
|
||||
) -> Arc<Self> {
|
||||
pub fn new_arc(control: &WindowControls, menu: &MenuButton, tab: &TabBar) -> Arc<Self> {
|
||||
let gobject = Box::builder()
|
||||
.orientation(Orientation::Horizontal)
|
||||
.spacing(8)
|
||||
.build();
|
||||
|
||||
gobject.append(tab);
|
||||
gobject.append(append);
|
||||
gobject.append(menu);
|
||||
gobject.append(control);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user