mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-02-10 10:24:13 +00:00
integrate history actions
This commit is contained in:
parent
4e7565297a
commit
b5b30d5873
@ -61,6 +61,8 @@ impl Browser {
|
||||
|
||||
let main = Arc::new(Main::new(
|
||||
action_tab_page_navigation_base.clone(),
|
||||
action_tab_page_navigation_history_back.clone(),
|
||||
action_tab_page_navigation_history_forward.clone(),
|
||||
action_tab_page_navigation_reload.clone(),
|
||||
action_update.clone(),
|
||||
));
|
||||
|
@ -15,12 +15,16 @@ impl Main {
|
||||
// Construct
|
||||
pub fn new(
|
||||
action_tab_page_navigation_base: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_history_back: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_history_forward: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_reload: Arc<SimpleAction>,
|
||||
action_update: Arc<SimpleAction>,
|
||||
) -> Self {
|
||||
// Init components
|
||||
let tab = Arc::new(Tab::new(
|
||||
action_tab_page_navigation_base,
|
||||
action_tab_page_navigation_history_back,
|
||||
action_tab_page_navigation_history_forward,
|
||||
action_tab_page_navigation_reload,
|
||||
action_update,
|
||||
));
|
||||
|
@ -18,6 +18,8 @@ pub struct Tab {
|
||||
widget: Notebook,
|
||||
// Keep action links in memory to not require them on every tab append
|
||||
action_tab_page_navigation_base: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_history_back: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_history_forward: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_reload: Arc<SimpleAction>,
|
||||
action_update: Arc<SimpleAction>,
|
||||
// Dynamically allocated reference index
|
||||
@ -29,6 +31,8 @@ impl Tab {
|
||||
// Construct
|
||||
pub fn new(
|
||||
action_tab_page_navigation_base: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_history_back: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_history_forward: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_reload: Arc<SimpleAction>,
|
||||
action_update: Arc<SimpleAction>,
|
||||
) -> Self {
|
||||
@ -41,6 +45,8 @@ impl Tab {
|
||||
widget,
|
||||
// Define action links
|
||||
action_tab_page_navigation_base,
|
||||
action_tab_page_navigation_history_back,
|
||||
action_tab_page_navigation_history_forward,
|
||||
action_tab_page_navigation_reload,
|
||||
action_update,
|
||||
// Init empty HashMap index as no tabs appended yet
|
||||
@ -80,6 +86,8 @@ impl Tab {
|
||||
id.clone(),
|
||||
page_navigation_request_text.clone(),
|
||||
self.action_tab_page_navigation_base.clone(),
|
||||
self.action_tab_page_navigation_history_back.clone(),
|
||||
self.action_tab_page_navigation_history_forward.clone(),
|
||||
self.action_tab_page_navigation_reload.clone(),
|
||||
self.action_update.clone(),
|
||||
));
|
||||
|
@ -40,6 +40,8 @@ impl Page {
|
||||
name: GString,
|
||||
navigation_request_text: Option<GString>,
|
||||
action_tab_page_navigation_base: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_history_back: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_history_forward: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_reload: Arc<SimpleAction>,
|
||||
action_update: Arc<SimpleAction>,
|
||||
) -> Page {
|
||||
@ -58,6 +60,8 @@ impl Page {
|
||||
let navigation = Arc::new(Navigation::new(
|
||||
navigation_request_text,
|
||||
action_tab_page_navigation_base.clone(),
|
||||
action_tab_page_navigation_history_back.clone(),
|
||||
action_tab_page_navigation_history_forward.clone(),
|
||||
action_tab_page_navigation_reload.clone(),
|
||||
action_update.clone(),
|
||||
));
|
||||
|
@ -34,12 +34,17 @@ impl Navigation {
|
||||
pub fn new(
|
||||
request_text: Option<GString>,
|
||||
action_tab_page_navigation_base: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_history_back: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_history_forward: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_reload: Arc<SimpleAction>,
|
||||
action_update: Arc<SimpleAction>,
|
||||
) -> Self {
|
||||
// Init components
|
||||
let base = Base::new(action_tab_page_navigation_base);
|
||||
let history = History::new();
|
||||
let history = History::new(
|
||||
action_tab_page_navigation_history_back,
|
||||
action_tab_page_navigation_history_forward,
|
||||
);
|
||||
let reload = Reload::new(action_tab_page_navigation_reload.clone());
|
||||
let request = Request::new(
|
||||
request_text,
|
||||
|
@ -3,8 +3,9 @@ mod forward;
|
||||
|
||||
use back::Back;
|
||||
use forward::Forward;
|
||||
use gtk::prelude::BoxExt;
|
||||
use gtk::{Box, Orientation};
|
||||
|
||||
use gtk::{gio::SimpleAction, prelude::BoxExt, Box, Orientation};
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct History {
|
||||
widget: Box,
|
||||
@ -14,10 +15,13 @@ pub struct History {
|
||||
|
||||
impl History {
|
||||
// Construct
|
||||
pub fn new() -> Self {
|
||||
pub fn new(
|
||||
action_tab_page_navigation_history_back: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_history_forward: Arc<SimpleAction>,
|
||||
) -> Self {
|
||||
// init components
|
||||
let back = Back::new();
|
||||
let forward = Forward::new();
|
||||
let back = Back::new(action_tab_page_navigation_history_back);
|
||||
let forward = Forward::new(action_tab_page_navigation_history_forward);
|
||||
|
||||
// Init widget
|
||||
let widget = Box::builder()
|
||||
|
@ -1,4 +1,5 @@
|
||||
use gtk::Button;
|
||||
use gtk::{gio::SimpleAction, Button};
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct Back {
|
||||
widget: Button,
|
||||
@ -6,10 +7,9 @@ pub struct Back {
|
||||
|
||||
impl Back {
|
||||
// Construct
|
||||
pub fn new() -> Self {
|
||||
pub fn new(action_tab_page_navigation_history_back: Arc<SimpleAction>) -> Self {
|
||||
Self {
|
||||
widget: Button::builder()
|
||||
.action_name("win.tab_page_history_back")
|
||||
.icon_name("go-previous-symbolic")
|
||||
.tooltip_text("Back")
|
||||
.sensitive(false)
|
||||
|
@ -1,4 +1,5 @@
|
||||
use gtk::Button;
|
||||
use gtk::{gio::SimpleAction, Button};
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct Forward {
|
||||
widget: Button,
|
||||
@ -6,10 +7,9 @@ pub struct Forward {
|
||||
|
||||
impl Forward {
|
||||
// Construct
|
||||
pub fn new() -> Self {
|
||||
pub fn new(action_tab_page_navigation_history_forward: Arc<SimpleAction>) -> Self {
|
||||
Self {
|
||||
widget: Button::builder()
|
||||
.action_name("win.tab_page_history_forward")
|
||||
.icon_name("go-next-symbolic")
|
||||
.tooltip_text("Forward")
|
||||
.sensitive(false)
|
||||
|
Loading…
x
Reference in New Issue
Block a user