mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-30 13:04:13 +00:00
enshort action namespace
This commit is contained in:
parent
03d97da6c7
commit
ec95ae2580
@ -1,6 +1,6 @@
|
|||||||
use gtk::{prelude::ButtonExt, Button};
|
use gtk::{prelude::ButtonExt, Button};
|
||||||
|
|
||||||
use crate::app::browser::window::action::Action as WindowAction;
|
use crate::app::browser::window::Action;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
const ICON_YES: &str = "starred-symbolic";
|
const ICON_YES: &str = "starred-symbolic";
|
||||||
@ -13,7 +13,7 @@ pub struct Widget {
|
|||||||
impl Widget {
|
impl Widget {
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
pub fn new(action: Rc<WindowAction>) -> Self {
|
pub fn new(action: Rc<Action>) -> Self {
|
||||||
// Init gobject
|
// Init gobject
|
||||||
let gobject = Button::builder()
|
let gobject = Button::builder()
|
||||||
.icon_name(ICON_NON)
|
.icon_name(ICON_NON)
|
||||||
|
@ -2,21 +2,21 @@ mod widget;
|
|||||||
|
|
||||||
use widget::Widget;
|
use widget::Widget;
|
||||||
|
|
||||||
use crate::app::browser::window::action::Action as WindowAction;
|
use crate::app::browser::window::Action;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
pub struct Back {
|
pub struct Back {
|
||||||
window_action: Rc<WindowAction>,
|
action: Rc<Action>,
|
||||||
widget: Rc<Widget>,
|
widget: Rc<Widget>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Back {
|
impl Back {
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
pub fn new(window_action: Rc<WindowAction>) -> Self {
|
pub fn new(action: Rc<Action>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
window_action: window_action.clone(),
|
action: action.clone(),
|
||||||
widget: Rc::new(Widget::new(window_action)),
|
widget: Rc::new(Widget::new(action)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,10 +24,7 @@ impl Back {
|
|||||||
|
|
||||||
pub fn update(&self, status: bool) {
|
pub fn update(&self, status: bool) {
|
||||||
// Update actions
|
// Update actions
|
||||||
self.window_action
|
self.action.history_back().gobject().set_enabled(status);
|
||||||
.history_back()
|
|
||||||
.gobject()
|
|
||||||
.set_enabled(status);
|
|
||||||
|
|
||||||
// Update child components
|
// Update child components
|
||||||
self.widget.update(status);
|
self.widget.update(status);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use crate::app::browser::window::action::Action as WindowAction;
|
use crate::app::browser::window::Action;
|
||||||
use gtk::{
|
use gtk::{
|
||||||
prelude::{ButtonExt, WidgetExt},
|
prelude::{ButtonExt, WidgetExt},
|
||||||
Button,
|
Button,
|
||||||
@ -11,7 +11,7 @@ pub struct Widget {
|
|||||||
|
|
||||||
impl Widget {
|
impl Widget {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn new(window_action: Rc<WindowAction>) -> Self {
|
pub fn new(action: Rc<Action>) -> Self {
|
||||||
// Init gobject
|
// Init gobject
|
||||||
let gobject = Button::builder()
|
let gobject = Button::builder()
|
||||||
.icon_name("go-previous-symbolic")
|
.icon_name("go-previous-symbolic")
|
||||||
@ -20,7 +20,7 @@ impl Widget {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Init events
|
// Init events
|
||||||
gobject.connect_clicked(move |_| window_action.history_back().activate());
|
gobject.connect_clicked(move |_| action.history_back().activate());
|
||||||
|
|
||||||
// Return activated `Self`
|
// Return activated `Self`
|
||||||
Self { gobject }
|
Self { gobject }
|
||||||
|
@ -2,30 +2,27 @@ mod widget;
|
|||||||
|
|
||||||
use widget::Widget;
|
use widget::Widget;
|
||||||
|
|
||||||
use crate::app::browser::window::action::Action as WindowAction;
|
use crate::app::browser::window::Action;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
pub struct Forward {
|
pub struct Forward {
|
||||||
window_action: Rc<WindowAction>,
|
action: Rc<Action>,
|
||||||
widget: Rc<Widget>,
|
widget: Rc<Widget>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Forward {
|
impl Forward {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn new(window_action: Rc<WindowAction>) -> Self {
|
pub fn new(action: Rc<Action>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
window_action: window_action.clone(),
|
action: action.clone(),
|
||||||
widget: Rc::new(Widget::new(window_action)),
|
widget: Rc::new(Widget::new(action)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
pub fn update(&self, status: bool) {
|
pub fn update(&self, status: bool) {
|
||||||
// Update actions
|
// Update actions
|
||||||
self.window_action
|
self.action.history_forward().gobject().set_enabled(status);
|
||||||
.history_forward()
|
|
||||||
.gobject()
|
|
||||||
.set_enabled(status);
|
|
||||||
|
|
||||||
// Update child components
|
// Update child components
|
||||||
self.widget.update(status);
|
self.widget.update(status);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use crate::app::browser::window::action::Action as WindowAction;
|
use crate::app::browser::window::Action;
|
||||||
use gtk::{
|
use gtk::{
|
||||||
prelude::{ButtonExt, WidgetExt},
|
prelude::{ButtonExt, WidgetExt},
|
||||||
Button,
|
Button,
|
||||||
@ -11,7 +11,7 @@ pub struct Widget {
|
|||||||
|
|
||||||
impl Widget {
|
impl Widget {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn new(window_action: Rc<WindowAction>) -> Self {
|
pub fn new(action: Rc<Action>) -> Self {
|
||||||
// Init gobject
|
// Init gobject
|
||||||
let gobject = Button::builder()
|
let gobject = Button::builder()
|
||||||
.icon_name("go-next-symbolic")
|
.icon_name("go-next-symbolic")
|
||||||
@ -20,7 +20,7 @@ impl Widget {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Init events
|
// Init events
|
||||||
gobject.connect_clicked(move |_| window_action.history_forward().activate());
|
gobject.connect_clicked(move |_| action.history_forward().activate());
|
||||||
|
|
||||||
// Return activated `Self`
|
// Return activated `Self`
|
||||||
Self { gobject }
|
Self { gobject }
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use crate::app::browser::window::action::Action as WindowAction;
|
use crate::app::browser::window::Action;
|
||||||
use gtk::{
|
use gtk::{
|
||||||
prelude::{ButtonExt, WidgetExt},
|
prelude::{ButtonExt, WidgetExt},
|
||||||
Button,
|
Button,
|
||||||
@ -11,7 +11,7 @@ pub struct Widget {
|
|||||||
|
|
||||||
impl Widget {
|
impl Widget {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn new(action: Rc<WindowAction>) -> Self {
|
pub fn new(action: Rc<Action>) -> Self {
|
||||||
// Init gobject
|
// Init gobject
|
||||||
let gobject = Button::builder()
|
let gobject = Button::builder()
|
||||||
.icon_name("go-home-symbolic")
|
.icon_name("go-home-symbolic")
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use crate::app::browser::window::action::Action as WindowAction;
|
use crate::app::browser::window::Action;
|
||||||
use gtk::{
|
use gtk::{
|
||||||
prelude::{ButtonExt, WidgetExt},
|
prelude::{ButtonExt, WidgetExt},
|
||||||
Button,
|
Button,
|
||||||
@ -11,7 +11,7 @@ pub struct Widget {
|
|||||||
|
|
||||||
impl Widget {
|
impl Widget {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn new(action: Rc<WindowAction>) -> Self {
|
pub fn new(action: Rc<Action>) -> Self {
|
||||||
// Init gobject
|
// Init gobject
|
||||||
let gobject = Button::builder()
|
let gobject = Button::builder()
|
||||||
.icon_name("view-refresh-symbolic")
|
.icon_name("view-refresh-symbolic")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user