mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 09:35:28 +00:00
rename actions
This commit is contained in:
parent
2d08e8386d
commit
313122e5c3
26 changed files with 274 additions and 290 deletions
|
|
@ -10,18 +10,18 @@ use gtk::{
|
|||
use std::{cell::RefCell, sync::Arc};
|
||||
|
||||
pub struct Base {
|
||||
action_tab_page_navigation_base: SimpleAction,
|
||||
action_page_base: SimpleAction,
|
||||
uri: RefCell<Option<Uri>>,
|
||||
widget: Arc<Widget>,
|
||||
}
|
||||
|
||||
impl Base {
|
||||
// Construct
|
||||
pub fn new_arc(action_tab_page_navigation_base: SimpleAction) -> Arc<Self> {
|
||||
pub fn new_arc(action_page_base: SimpleAction) -> Arc<Self> {
|
||||
Arc::new(Self {
|
||||
action_tab_page_navigation_base: action_tab_page_navigation_base.clone(),
|
||||
action_page_base: action_page_base.clone(),
|
||||
uri: RefCell::new(None),
|
||||
widget: Widget::new_arc(action_tab_page_navigation_base),
|
||||
widget: Widget::new_arc(action_page_base),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ impl Base {
|
|||
self.uri.replace(uri);
|
||||
|
||||
// Update action status
|
||||
self.action_tab_page_navigation_base.set_enabled(status);
|
||||
self.action_page_base.set_enabled(status);
|
||||
|
||||
// Update child components
|
||||
self.widget.update(status);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(action_tab_page_navigation_base: SimpleAction) -> Arc<Self> {
|
||||
pub fn new_arc(action_page_base: SimpleAction) -> Arc<Self> {
|
||||
// Init gobject
|
||||
let gobject = Button::builder()
|
||||
.icon_name("go-home-symbolic")
|
||||
|
|
@ -21,9 +21,9 @@ impl Widget {
|
|||
|
||||
// Init events
|
||||
gobject.connect_clicked({
|
||||
let action_tab_page_navigation_base = action_tab_page_navigation_base.clone();
|
||||
let action_page_base = action_page_base.clone();
|
||||
move |_| {
|
||||
action_tab_page_navigation_base.activate(None);
|
||||
action_page_base.activate(None);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -28,12 +28,12 @@ pub struct History {
|
|||
impl History {
|
||||
// Construct
|
||||
pub fn new_arc(
|
||||
action_tab_page_navigation_history_back: SimpleAction,
|
||||
action_tab_page_navigation_history_forward: SimpleAction,
|
||||
action_page_history_back: SimpleAction,
|
||||
action_page_history_forward: SimpleAction,
|
||||
) -> Arc<Self> {
|
||||
// init components
|
||||
let back = Back::new_arc(action_tab_page_navigation_history_back);
|
||||
let forward = Forward::new_arc(action_tab_page_navigation_history_forward);
|
||||
let back = Back::new_arc(action_page_history_back);
|
||||
let forward = Forward::new_arc(action_page_history_forward);
|
||||
|
||||
// Init widget
|
||||
let widget = Widget::new_arc(back.gobject(), forward.gobject());
|
||||
|
|
|
|||
|
|
@ -6,25 +6,25 @@ use gtk::{gio::SimpleAction, Button};
|
|||
use std::sync::Arc;
|
||||
|
||||
pub struct Back {
|
||||
action_tab_page_navigation_history_back: SimpleAction,
|
||||
action_page_history_back: SimpleAction,
|
||||
widget: Arc<Widget>,
|
||||
}
|
||||
|
||||
impl Back {
|
||||
// Construct
|
||||
pub fn new_arc(action_tab_page_navigation_history_back: SimpleAction) -> Arc<Self> {
|
||||
pub fn new_arc(action_page_history_back: SimpleAction) -> Arc<Self> {
|
||||
// Return activated struct
|
||||
Arc::new(Self {
|
||||
action_tab_page_navigation_history_back: action_tab_page_navigation_history_back
|
||||
action_page_history_back: action_page_history_back
|
||||
.clone(),
|
||||
widget: Widget::new_arc(action_tab_page_navigation_history_back),
|
||||
widget: Widget::new_arc(action_page_history_back),
|
||||
})
|
||||
}
|
||||
|
||||
// Actions
|
||||
pub fn update(&self, status: bool) {
|
||||
// Update actions
|
||||
self.action_tab_page_navigation_history_back
|
||||
self.action_page_history_back
|
||||
.set_enabled(status);
|
||||
|
||||
// Update child components
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(action_tab_page_navigation_history_back: SimpleAction) -> Arc<Self> {
|
||||
pub fn new_arc(action_page_history_back: SimpleAction) -> Arc<Self> {
|
||||
// Init gobject
|
||||
let gobject = Button::builder()
|
||||
.icon_name("go-previous-symbolic")
|
||||
|
|
@ -21,10 +21,10 @@ impl Widget {
|
|||
|
||||
// Init events
|
||||
gobject.connect_clicked({
|
||||
let action_tab_page_navigation_history_back =
|
||||
action_tab_page_navigation_history_back.clone();
|
||||
let action_page_history_back =
|
||||
action_page_history_back.clone();
|
||||
move |_| {
|
||||
action_tab_page_navigation_history_back.activate(None);
|
||||
action_page_history_back.activate(None);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -6,25 +6,25 @@ use gtk::{gio::SimpleAction, Button};
|
|||
use std::sync::Arc;
|
||||
|
||||
pub struct Forward {
|
||||
action_tab_page_navigation_history_forward: SimpleAction,
|
||||
action_page_history_forward: SimpleAction,
|
||||
widget: Arc<Widget>,
|
||||
}
|
||||
|
||||
impl Forward {
|
||||
// Construct
|
||||
pub fn new_arc(action_tab_page_navigation_history_forward: SimpleAction) -> Arc<Self> {
|
||||
pub fn new_arc(action_page_history_forward: SimpleAction) -> Arc<Self> {
|
||||
// Return activated struct
|
||||
Arc::new(Self {
|
||||
action_tab_page_navigation_history_forward: action_tab_page_navigation_history_forward
|
||||
action_page_history_forward: action_page_history_forward
|
||||
.clone(),
|
||||
widget: Widget::new_arc(action_tab_page_navigation_history_forward),
|
||||
widget: Widget::new_arc(action_page_history_forward),
|
||||
})
|
||||
}
|
||||
|
||||
// Actions
|
||||
pub fn update(&self, status: bool) {
|
||||
// Update actions
|
||||
self.action_tab_page_navigation_history_forward
|
||||
self.action_page_history_forward
|
||||
.set_enabled(status);
|
||||
|
||||
// Update child components
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(action_tab_page_navigation_history_forward: SimpleAction) -> Arc<Self> {
|
||||
pub fn new_arc(action_page_history_forward: SimpleAction) -> Arc<Self> {
|
||||
// Init gobject
|
||||
let gobject = Button::builder()
|
||||
.icon_name("go-next-symbolic")
|
||||
|
|
@ -21,10 +21,10 @@ impl Widget {
|
|||
|
||||
// Init events
|
||||
gobject.connect_clicked({
|
||||
let action_tab_page_navigation_history_forward =
|
||||
action_tab_page_navigation_history_forward.clone();
|
||||
let action_page_history_forward =
|
||||
action_page_history_forward.clone();
|
||||
move |_| {
|
||||
action_tab_page_navigation_history_forward.activate(None);
|
||||
action_page_history_forward.activate(None);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -6,23 +6,23 @@ use gtk::{gio::SimpleAction, Button};
|
|||
use std::sync::Arc;
|
||||
|
||||
pub struct Reload {
|
||||
action_tab_page_navigation_reload: SimpleAction,
|
||||
action_page_reload: SimpleAction,
|
||||
widget: Arc<Widget>,
|
||||
}
|
||||
|
||||
impl Reload {
|
||||
// Construct
|
||||
pub fn new_arc(action_tab_page_navigation_reload: SimpleAction) -> Arc<Self> {
|
||||
pub fn new_arc(action_page_reload: SimpleAction) -> Arc<Self> {
|
||||
Arc::new(Self {
|
||||
action_tab_page_navigation_reload: action_tab_page_navigation_reload.clone(),
|
||||
widget: Widget::new_arc(action_tab_page_navigation_reload),
|
||||
action_page_reload: action_page_reload.clone(),
|
||||
widget: Widget::new_arc(action_page_reload),
|
||||
})
|
||||
}
|
||||
|
||||
// Actions
|
||||
pub fn update(&self, is_enabled: bool) {
|
||||
// Update actions
|
||||
self.action_tab_page_navigation_reload
|
||||
self.action_page_reload
|
||||
.set_enabled(is_enabled);
|
||||
|
||||
// Update child components
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(action_tab_page_navigation_reload: SimpleAction) -> Arc<Self> {
|
||||
pub fn new_arc(action_page_reload: SimpleAction) -> Arc<Self> {
|
||||
// Init gobject
|
||||
let gobject = Button::builder()
|
||||
.icon_name("view-refresh-symbolic")
|
||||
|
|
@ -21,9 +21,9 @@ impl Widget {
|
|||
|
||||
// Init events
|
||||
gobject.connect_clicked({
|
||||
let action_tab_page_navigation_reload = action_tab_page_navigation_reload.clone();
|
||||
let action_page_reload = action_page_reload.clone();
|
||||
move |_| {
|
||||
action_tab_page_navigation_reload.activate(None);
|
||||
action_page_reload.activate(None);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -22,10 +22,10 @@ impl Request {
|
|||
pub fn new_arc(
|
||||
// Actions
|
||||
action_update: SimpleAction,
|
||||
action_tab_page_navigation_reload: SimpleAction, // @TODO local `action_page_open`?
|
||||
action_page_reload: SimpleAction, // @TODO local `action_page_open`?
|
||||
) -> Arc<Self> {
|
||||
Arc::new(Self {
|
||||
widget: Widget::new_arc(action_update, action_tab_page_navigation_reload),
|
||||
widget: Widget::new_arc(action_update, action_page_reload),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ impl Widget {
|
|||
// Construct
|
||||
pub fn new_arc(
|
||||
action_update: SimpleAction,
|
||||
action_tab_page_navigation_reload: SimpleAction, // @TODO local `action_page_open`?
|
||||
action_page_reload: SimpleAction, // @TODO local `action_page_open`?
|
||||
) -> Arc<Self> {
|
||||
// Init animated progress bar state
|
||||
let progress = Arc::new(Progress {
|
||||
|
|
@ -60,7 +60,7 @@ impl Widget {
|
|||
});
|
||||
|
||||
gobject.connect_activate(move |_| {
|
||||
action_tab_page_navigation_reload.activate(None);
|
||||
action_page_reload.activate(None);
|
||||
});
|
||||
|
||||
primary_button_controller.connect_pressed({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue