mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05:27 +00:00
remove extra getters
This commit is contained in:
parent
3ce272cd70
commit
0af69d99f6
56 changed files with 240 additions and 710 deletions
|
|
@ -11,11 +11,10 @@ use widget::Widget;
|
|||
use crate::app::browser::action::Action as BrowserAction;
|
||||
use crate::app::browser::window::action::Action as WindowAction;
|
||||
use adw::TabView;
|
||||
use gtk::Box;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Bar {
|
||||
widget: Rc<Widget>,
|
||||
pub widget: Rc<Widget>,
|
||||
}
|
||||
|
||||
impl Bar {
|
||||
|
|
@ -31,16 +30,10 @@ impl Bar {
|
|||
let menu = Menu::new(browser_action, window_action);
|
||||
Self {
|
||||
widget: Rc::new(Widget::new(
|
||||
control.gobject(),
|
||||
menu.gobject(),
|
||||
tab.gobject(),
|
||||
&control.widget.gobject,
|
||||
&menu.widget.gobject,
|
||||
&tab.widget.gobject,
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
||||
pub fn gobject(&self) -> &Box {
|
||||
self.widget.gobject()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
mod widget;
|
||||
|
||||
use widget::Widget;
|
||||
|
||||
use gtk::WindowControls;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Control {
|
||||
widget: Rc<Widget>,
|
||||
pub widget: Rc<Widget>,
|
||||
}
|
||||
|
||||
impl Control {
|
||||
|
|
@ -16,9 +14,4 @@ impl Control {
|
|||
widget: Rc::new(Widget::new()),
|
||||
}
|
||||
}
|
||||
|
||||
// Getters
|
||||
pub fn gobject(&self) -> &WindowControls {
|
||||
self.widget.gobject()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use gtk::{PackType, WindowControls};
|
||||
|
||||
pub struct Widget {
|
||||
gobject: WindowControls,
|
||||
pub gobject: WindowControls,
|
||||
}
|
||||
|
||||
impl Widget {
|
||||
|
|
@ -14,9 +14,4 @@ impl Widget {
|
|||
.build(),
|
||||
}
|
||||
}
|
||||
|
||||
// Getters
|
||||
pub fn gobject(&self) -> &WindowControls {
|
||||
&self.gobject
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ use crate::app::browser::action::Action as BrowserAction;
|
|||
use crate::app::browser::window::action::Action as WindowAction;
|
||||
use gtk::{
|
||||
gio::{self},
|
||||
MenuButton,
|
||||
prelude::ActionExt,
|
||||
};
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Menu {
|
||||
widget: Rc<Widget>,
|
||||
pub widget: Rc<Widget>,
|
||||
}
|
||||
#[rustfmt::skip] // @TODO template builder?
|
||||
impl Menu {
|
||||
|
|
@ -26,14 +26,14 @@ impl Menu {
|
|||
let main_page = gio::Menu::new();
|
||||
main_page.append(Some("New"), Some(&format!(
|
||||
"{}.{}",
|
||||
window_action.id(),
|
||||
window_action.append().id()
|
||||
window_action.id,
|
||||
window_action.append.gobject.name()
|
||||
)));
|
||||
|
||||
main_page.append(Some("Reload"), Some(&format!(
|
||||
"{}.{}",
|
||||
window_action.id(),
|
||||
window_action.reload().id()
|
||||
window_action.id,
|
||||
window_action.reload.gobject.name()
|
||||
)));
|
||||
|
||||
// Main > Page > Mark
|
||||
|
|
@ -41,14 +41,14 @@ impl Menu {
|
|||
|
||||
main_page_mark.append(Some("Bookmark"), Some(&format!(
|
||||
"{}.{}",
|
||||
window_action.id(),
|
||||
window_action.bookmark().id()
|
||||
window_action.id,
|
||||
window_action.bookmark.gobject.name()
|
||||
)));
|
||||
|
||||
main_page_mark.append(Some("Pin"), Some(&format!(
|
||||
"{}.{}",
|
||||
window_action.id(),
|
||||
window_action.pin().id()
|
||||
window_action.id,
|
||||
window_action.pin.gobject.name()
|
||||
)));
|
||||
|
||||
main_page.append_section(None, &main_page_mark);
|
||||
|
|
@ -58,8 +58,8 @@ impl Menu {
|
|||
|
||||
main_page_navigation.append(Some("Home"), Some(&format!(
|
||||
"{}.{}",
|
||||
window_action.id(),
|
||||
window_action.home().id()
|
||||
window_action.id,
|
||||
window_action.home.gobject.name()
|
||||
)));
|
||||
|
||||
// Main > Page > Navigation > History
|
||||
|
|
@ -67,14 +67,14 @@ impl Menu {
|
|||
|
||||
main_page_navigation_history.append(Some("Back"), Some(&format!(
|
||||
"{}.{}",
|
||||
window_action.id(),
|
||||
window_action.history_back().id()
|
||||
window_action.id,
|
||||
window_action.history_back.gobject.name()
|
||||
)));
|
||||
|
||||
main_page_navigation_history.append(Some("Forward"), Some(&format!(
|
||||
"{}.{}",
|
||||
window_action.id(),
|
||||
window_action.history_forward().id()
|
||||
window_action.id,
|
||||
window_action.history_forward.gobject.name()
|
||||
)));
|
||||
|
||||
main_page_navigation.append_submenu(Some("History"), &main_page_navigation_history);
|
||||
|
|
@ -86,14 +86,14 @@ impl Menu {
|
|||
|
||||
main_page_close.append(Some("Current"), Some(&format!(
|
||||
"{}.{}",
|
||||
window_action.id(),
|
||||
window_action.close().id()
|
||||
window_action.id,
|
||||
window_action.close.gobject.name()
|
||||
)));
|
||||
|
||||
main_page_close.append(Some("All"), Some(&format!(
|
||||
"{}.{}",
|
||||
window_action.id(),
|
||||
window_action.close_all().id()
|
||||
window_action.id,
|
||||
window_action.close_all.gobject.name()
|
||||
)));
|
||||
|
||||
main_page.append_submenu(Some("Close"), &main_page_close);
|
||||
|
|
@ -106,36 +106,31 @@ impl Menu {
|
|||
// Debug
|
||||
main_tool.append(Some("Debug"), Some(&format!(
|
||||
"{}.{}",
|
||||
browser_action.id(),
|
||||
browser_action.debug().id()
|
||||
browser_action.id,
|
||||
browser_action.debug.gobject.name()
|
||||
)));
|
||||
|
||||
main_tool.append(Some("Profile"), Some(&format!(
|
||||
"{}.{}",
|
||||
browser_action.id(),
|
||||
browser_action.profile().id()
|
||||
browser_action.id,
|
||||
browser_action.profile.gobject.name()
|
||||
)));
|
||||
|
||||
main_tool.append(Some("About"), Some(&format!(
|
||||
"{}.{}",
|
||||
browser_action.id(),
|
||||
browser_action.about().id()
|
||||
browser_action.id,
|
||||
browser_action.about.gobject.name()
|
||||
)));
|
||||
|
||||
main.append_submenu(Some("Tool"), &main_tool);
|
||||
|
||||
main.append(Some("Quit"), Some(&format!(
|
||||
"{}.{}",
|
||||
browser_action.id(),
|
||||
browser_action.close().id()
|
||||
browser_action.id,
|
||||
browser_action.close.gobject.name()
|
||||
)));
|
||||
|
||||
// Result
|
||||
Self { widget:Rc::new(Widget::new(&main)) }
|
||||
}
|
||||
|
||||
// Getters
|
||||
pub fn gobject(&self) -> &MenuButton {
|
||||
self.widget.gobject()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use gtk::{gio::Menu, Align, MenuButton};
|
||||
|
||||
pub struct Widget {
|
||||
gobject: MenuButton,
|
||||
pub gobject: MenuButton,
|
||||
}
|
||||
|
||||
impl Widget {
|
||||
|
|
@ -17,9 +17,4 @@ impl Widget {
|
|||
.build(),
|
||||
}
|
||||
}
|
||||
|
||||
// Getters
|
||||
pub fn gobject(&self) -> &MenuButton {
|
||||
&self.gobject
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,23 +5,21 @@ use append::Append;
|
|||
use widget::Widget;
|
||||
|
||||
use crate::app::browser::window::action::Action as WindowAction;
|
||||
use adw::{TabBar, TabView};
|
||||
use adw::TabView;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Tab {
|
||||
widget: Rc<Widget>,
|
||||
pub widget: Rc<Widget>,
|
||||
}
|
||||
|
||||
impl Tab {
|
||||
// Construct
|
||||
pub fn new(window_action: Rc<WindowAction>, view: &TabView) -> Self {
|
||||
Self {
|
||||
widget: Rc::new(Widget::new(view, Append::new(window_action).gobject())),
|
||||
widget: Rc::new(Widget::new(
|
||||
view,
|
||||
&Append::new(window_action).widget.gobject,
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
// Getters
|
||||
pub fn gobject(&self) -> &TabBar {
|
||||
self.widget.gobject()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ mod widget;
|
|||
use widget::Widget;
|
||||
|
||||
use crate::app::browser::window::action::Action as WindowAction;
|
||||
use gtk::Button;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Append {
|
||||
|
|
@ -17,9 +16,4 @@ impl Append {
|
|||
widget: Rc::new(Widget::new(window_action)),
|
||||
}
|
||||
}
|
||||
|
||||
// Getters
|
||||
pub fn gobject(&self) -> &Button {
|
||||
self.widget.gobject()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use gtk::{prelude::ButtonExt, Align, Button};
|
|||
use std::rc::Rc;
|
||||
|
||||
pub struct Widget {
|
||||
gobject: Button,
|
||||
pub gobject: Button,
|
||||
}
|
||||
|
||||
impl Widget {
|
||||
|
|
@ -18,13 +18,8 @@ impl Widget {
|
|||
.build();
|
||||
|
||||
// Init events
|
||||
gobject.connect_clicked(move |_| window_action.append().activate_default_once());
|
||||
gobject.connect_clicked(move |_| window_action.append.activate_default_once());
|
||||
|
||||
Self { gobject }
|
||||
}
|
||||
|
||||
// Getters
|
||||
pub fn gobject(&self) -> &Button {
|
||||
&self.gobject
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use adw::{TabBar, TabView};
|
|||
use gtk::prelude::IsA;
|
||||
|
||||
pub struct Widget {
|
||||
gobject: TabBar,
|
||||
pub gobject: TabBar,
|
||||
}
|
||||
|
||||
impl Widget {
|
||||
|
|
@ -17,9 +17,4 @@ impl Widget {
|
|||
.build(),
|
||||
}
|
||||
}
|
||||
|
||||
// Getters
|
||||
pub fn gobject(&self) -> &TabBar {
|
||||
&self.gobject
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use adw::TabBar;
|
|||
use gtk::{prelude::BoxExt, Box, MenuButton, Orientation, WindowControls};
|
||||
|
||||
pub struct Widget {
|
||||
gobject: Box,
|
||||
pub gobject: Box,
|
||||
}
|
||||
|
||||
impl Widget {
|
||||
|
|
@ -19,9 +19,4 @@ impl Widget {
|
|||
|
||||
Self { gobject }
|
||||
}
|
||||
|
||||
// Getters
|
||||
pub fn gobject(&self) -> &Box {
|
||||
&self.gobject
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use adw::ToolbarView;
|
|||
use gtk::Box;
|
||||
|
||||
pub struct Widget {
|
||||
gobject: ToolbarView,
|
||||
pub gobject: ToolbarView,
|
||||
}
|
||||
|
||||
impl Widget {
|
||||
|
|
@ -14,9 +14,4 @@ impl Widget {
|
|||
|
||||
Self { gobject }
|
||||
}
|
||||
|
||||
// Getters
|
||||
pub fn gobject(&self) -> &ToolbarView {
|
||||
&self.gobject
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue