mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-15 17:20:08 +00:00
rename base to home
This commit is contained in:
parent
313122e5c3
commit
532ed65ed8
@ -48,7 +48,7 @@ impl App {
|
||||
let action_page_new = Action::new("win", true, None);
|
||||
let action_page_close = Action::new("win", true, None);
|
||||
let action_page_close_all = Action::new("win", true, None);
|
||||
let action_page_base = Action::new("win", false, None);
|
||||
let action_page_home = Action::new("win", false, None);
|
||||
let action_page_history_back = Action::new("win", false, None);
|
||||
let action_page_history_forward = Action::new("win", false, None);
|
||||
let action_page_reload = Action::new("win", true, None);
|
||||
@ -66,7 +66,7 @@ impl App {
|
||||
gobject.set_accels_for_action(&action_page_new.detailed_name(), &["<Primary>t"]);
|
||||
gobject.set_accels_for_action(&action_page_pin.detailed_name(), &["<Primary>p"]);
|
||||
gobject.set_accels_for_action(&action_page_close.detailed_name(), &["<Primary>q"]);
|
||||
gobject.set_accels_for_action(&action_page_base.detailed_name(), &["<Primary>h"]);
|
||||
gobject.set_accels_for_action(&action_page_home.detailed_name(), &["<Primary>h"]);
|
||||
gobject.set_accels_for_action(
|
||||
&action_page_history_back.detailed_name(),
|
||||
&["<Primary>Left"],
|
||||
@ -87,7 +87,7 @@ impl App {
|
||||
action_page_new.simple(),
|
||||
action_page_close.simple(),
|
||||
action_page_close_all.simple(),
|
||||
action_page_base.simple(),
|
||||
action_page_home.simple(),
|
||||
action_page_history_back.simple(),
|
||||
action_page_history_forward.simple(),
|
||||
action_page_reload.simple(),
|
||||
|
@ -35,7 +35,7 @@ impl Browser {
|
||||
action_page_new: SimpleAction,
|
||||
action_page_close: SimpleAction,
|
||||
action_page_close_all: SimpleAction,
|
||||
action_page_base: SimpleAction,
|
||||
action_page_home: SimpleAction,
|
||||
action_page_history_back: SimpleAction,
|
||||
action_page_history_forward: SimpleAction,
|
||||
action_page_reload: SimpleAction,
|
||||
@ -49,7 +49,7 @@ impl Browser {
|
||||
action_page_new.clone(),
|
||||
action_page_close.clone(),
|
||||
action_page_close_all.clone(),
|
||||
action_page_base.clone(),
|
||||
action_page_home.clone(),
|
||||
action_page_history_back.clone(),
|
||||
action_page_history_forward.clone(),
|
||||
action_page_reload.clone(),
|
||||
@ -67,7 +67,7 @@ impl Browser {
|
||||
widget.gobject().add_action(&action_page_new);
|
||||
widget.gobject().add_action(&action_page_close);
|
||||
widget.gobject().add_action(&action_page_close_all);
|
||||
widget.gobject().add_action(&action_page_base);
|
||||
widget.gobject().add_action(&action_page_home);
|
||||
widget.gobject().add_action(&action_page_history_back);
|
||||
widget.gobject().add_action(&action_page_history_forward);
|
||||
widget.gobject().add_action(&action_page_reload);
|
||||
@ -136,10 +136,10 @@ impl Browser {
|
||||
}
|
||||
});
|
||||
|
||||
action_page_base.connect_activate({
|
||||
action_page_home.connect_activate({
|
||||
let window = window.clone();
|
||||
move |_, _| {
|
||||
window.tab_page_navigation_base();
|
||||
window.tab_page_navigation_home();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -30,7 +30,7 @@ impl Window {
|
||||
action_page_new: SimpleAction,
|
||||
action_page_close: SimpleAction,
|
||||
action_page_close_all: SimpleAction,
|
||||
action_page_base: SimpleAction,
|
||||
action_page_home: SimpleAction,
|
||||
action_page_history_back: SimpleAction,
|
||||
action_page_history_forward: SimpleAction,
|
||||
action_page_reload: SimpleAction,
|
||||
@ -38,7 +38,7 @@ impl Window {
|
||||
) -> Self {
|
||||
// Init components
|
||||
let tab = Tab::new_arc(
|
||||
action_page_base.clone(),
|
||||
action_page_home.clone(),
|
||||
action_page_history_back.clone(),
|
||||
action_page_history_forward.clone(),
|
||||
action_page_reload.clone(),
|
||||
@ -53,7 +53,7 @@ impl Window {
|
||||
action_page_new.clone(),
|
||||
action_page_close.clone(),
|
||||
action_page_close_all.clone(),
|
||||
action_page_base.clone(),
|
||||
action_page_home.clone(),
|
||||
action_page_history_back.clone(),
|
||||
action_page_history_forward.clone(),
|
||||
action_page_reload.clone(),
|
||||
@ -78,8 +78,8 @@ impl Window {
|
||||
self.tab.append(position);
|
||||
}
|
||||
|
||||
pub fn tab_page_navigation_base(&self) {
|
||||
self.tab.page_navigation_base();
|
||||
pub fn tab_page_navigation_home(&self) {
|
||||
self.tab.page_navigation_home();
|
||||
}
|
||||
|
||||
pub fn tab_page_navigation_history_back(&self) {
|
||||
|
@ -22,7 +22,7 @@ impl Header {
|
||||
action_page_new: SimpleAction,
|
||||
action_page_close: SimpleAction,
|
||||
action_page_close_all: SimpleAction,
|
||||
action_page_base: SimpleAction,
|
||||
action_page_home: SimpleAction,
|
||||
action_page_history_back: SimpleAction,
|
||||
action_page_history_forward: SimpleAction,
|
||||
action_page_reload: SimpleAction,
|
||||
@ -38,7 +38,7 @@ impl Header {
|
||||
action_page_new,
|
||||
action_page_close,
|
||||
action_page_close_all,
|
||||
action_page_base,
|
||||
action_page_home,
|
||||
action_page_history_back,
|
||||
action_page_history_forward,
|
||||
action_page_reload,
|
||||
|
@ -25,7 +25,7 @@ impl Bar {
|
||||
action_page_new: SimpleAction,
|
||||
action_page_close: SimpleAction,
|
||||
action_page_close_all: SimpleAction,
|
||||
action_page_base: SimpleAction,
|
||||
action_page_home: SimpleAction,
|
||||
action_page_history_back: SimpleAction,
|
||||
action_page_history_forward: SimpleAction,
|
||||
action_page_reload: SimpleAction,
|
||||
@ -42,7 +42,7 @@ impl Bar {
|
||||
action_page_new,
|
||||
action_page_close,
|
||||
action_page_close_all,
|
||||
action_page_base,
|
||||
action_page_home,
|
||||
action_page_history_back,
|
||||
action_page_history_forward,
|
||||
action_page_reload,
|
||||
|
@ -23,7 +23,7 @@ impl Menu {
|
||||
action_page_new: SimpleAction,
|
||||
action_page_close: SimpleAction,
|
||||
action_page_close_all: SimpleAction,
|
||||
action_page_base: SimpleAction,
|
||||
action_page_home: SimpleAction,
|
||||
action_page_history_back: SimpleAction,
|
||||
action_page_history_forward: SimpleAction,
|
||||
action_page_reload: SimpleAction,
|
||||
@ -40,7 +40,7 @@ impl Menu {
|
||||
|
||||
// Main > Page > Navigation
|
||||
let main_page_navigation = gio::Menu::new();
|
||||
main_page_navigation.append(Some("Base"), Some(&detailed_action_name(action_page_base)));
|
||||
main_page_navigation.append(Some("Home"), Some(&detailed_action_name(action_page_home)));
|
||||
|
||||
// Main > Page > Navigation > History
|
||||
let main_page_navigation_history = gio::Menu::new();
|
||||
|
@ -20,7 +20,7 @@ pub struct Tab {
|
||||
// Local actions
|
||||
action_tab_open: SimpleAction,
|
||||
// Global actions
|
||||
action_page_base: SimpleAction,
|
||||
action_page_home: SimpleAction,
|
||||
action_page_history_back: SimpleAction,
|
||||
action_page_history_forward: SimpleAction,
|
||||
action_page_reload: SimpleAction,
|
||||
@ -35,7 +35,7 @@ impl Tab {
|
||||
// Construct
|
||||
pub fn new_arc(
|
||||
// Actions
|
||||
action_page_base: SimpleAction,
|
||||
action_page_home: SimpleAction,
|
||||
action_page_history_back: SimpleAction,
|
||||
action_page_history_forward: SimpleAction,
|
||||
action_page_reload: SimpleAction,
|
||||
@ -76,7 +76,7 @@ impl Tab {
|
||||
let gobject = widget.gobject().clone();
|
||||
// Actions
|
||||
let action_tab_open = action_tab_open.clone();
|
||||
let action_page_base = action_page_base.clone();
|
||||
let action_page_home = action_page_home.clone();
|
||||
let action_page_history_back = action_page_history_back.clone();
|
||||
let action_page_history_forward = action_page_history_forward.clone();
|
||||
let action_page_reload = action_page_reload.clone();
|
||||
@ -88,7 +88,7 @@ impl Tab {
|
||||
// Local actions
|
||||
action_tab_open.clone(),
|
||||
// Global actions
|
||||
action_page_base.clone(),
|
||||
action_page_home.clone(),
|
||||
action_page_history_back.clone(),
|
||||
action_page_history_forward.clone(),
|
||||
action_page_reload.clone(),
|
||||
@ -120,7 +120,7 @@ impl Tab {
|
||||
// Local actions
|
||||
action_tab_open,
|
||||
// Global actions
|
||||
action_page_base,
|
||||
action_page_home,
|
||||
action_page_history_back,
|
||||
action_page_history_forward,
|
||||
action_page_reload,
|
||||
@ -140,7 +140,7 @@ impl Tab {
|
||||
// Local actions
|
||||
self.action_tab_open.clone(),
|
||||
// Global actions
|
||||
self.action_page_base.clone(),
|
||||
self.action_page_home.clone(),
|
||||
self.action_page_history_back.clone(),
|
||||
self.action_page_history_forward.clone(),
|
||||
self.action_page_reload.clone(),
|
||||
@ -177,10 +177,10 @@ impl Tab {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn page_navigation_base(&self) {
|
||||
pub fn page_navigation_home(&self) {
|
||||
if let Some(id) = self.widget.current_page_keyword() {
|
||||
if let Some(item) = self.index.borrow().get(&id) {
|
||||
item.page_navigation_base();
|
||||
item.page_navigation_home();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -277,7 +277,7 @@ impl Tab {
|
||||
transaction,
|
||||
&record.id,
|
||||
self.action_tab_open.clone(),
|
||||
self.action_page_base.clone(),
|
||||
self.action_page_home.clone(),
|
||||
self.action_page_history_back.clone(),
|
||||
self.action_page_history_forward.clone(),
|
||||
self.action_page_reload.clone(),
|
||||
|
@ -29,7 +29,7 @@ impl Item {
|
||||
tab_view: &TabView,
|
||||
// Actions
|
||||
action_tab_open: SimpleAction,
|
||||
action_page_base: SimpleAction,
|
||||
action_page_home: SimpleAction,
|
||||
action_page_history_back: SimpleAction,
|
||||
action_page_history_forward: SimpleAction,
|
||||
action_page_reload: SimpleAction,
|
||||
@ -47,7 +47,7 @@ impl Item {
|
||||
id.clone(),
|
||||
// Actions
|
||||
action_tab_open.clone(),
|
||||
action_page_base.clone(),
|
||||
action_page_home.clone(),
|
||||
action_page_history_back.clone(),
|
||||
action_page_history_forward.clone(),
|
||||
action_page_reload.clone(),
|
||||
@ -69,8 +69,8 @@ impl Item {
|
||||
}
|
||||
|
||||
// Actions
|
||||
pub fn page_navigation_base(&self) {
|
||||
self.page.navigation_base()
|
||||
pub fn page_navigation_home(&self) {
|
||||
self.page.navigation_home()
|
||||
}
|
||||
|
||||
pub fn page_navigation_history_back(&self) {
|
||||
@ -129,7 +129,7 @@ impl Item {
|
||||
app_browser_window_tab_id: &i64,
|
||||
// Actions
|
||||
action_tab_open: SimpleAction,
|
||||
action_page_base: SimpleAction,
|
||||
action_page_home: SimpleAction,
|
||||
action_page_history_back: SimpleAction,
|
||||
action_page_history_forward: SimpleAction,
|
||||
action_page_reload: SimpleAction,
|
||||
@ -145,7 +145,7 @@ impl Item {
|
||||
tab_view,
|
||||
// Actions
|
||||
action_tab_open.clone(),
|
||||
action_page_base.clone(),
|
||||
action_page_home.clone(),
|
||||
action_page_history_back.clone(),
|
||||
action_page_history_forward.clone(),
|
||||
action_page_reload.clone(),
|
||||
|
@ -52,7 +52,7 @@ impl Page {
|
||||
pub fn new_arc(
|
||||
id: GString,
|
||||
action_tab_open: SimpleAction,
|
||||
action_page_base: SimpleAction,
|
||||
action_page_home: SimpleAction,
|
||||
action_page_history_back: SimpleAction,
|
||||
action_page_history_forward: SimpleAction,
|
||||
action_page_reload: SimpleAction,
|
||||
@ -66,7 +66,7 @@ impl Page {
|
||||
let content = Content::new_arc(action_tab_open.clone(), action_page_open.clone());
|
||||
|
||||
let navigation = Navigation::new_arc(
|
||||
action_page_base.clone(),
|
||||
action_page_home.clone(),
|
||||
action_page_history_back.clone(),
|
||||
action_page_history_forward.clone(),
|
||||
action_page_reload.clone(),
|
||||
@ -128,8 +128,8 @@ impl Page {
|
||||
self.navigation.request_grab_focus();
|
||||
}
|
||||
|
||||
pub fn navigation_base(&self) {
|
||||
if let Some(url) = self.navigation.base_url() {
|
||||
pub fn navigation_home(&self) {
|
||||
if let Some(url) = self.navigation.home_url() {
|
||||
// Update with history record
|
||||
self.action_page_open.activate(Some(&url.to_variant()));
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
mod base;
|
||||
mod bookmark;
|
||||
mod database;
|
||||
mod history;
|
||||
mod home;
|
||||
mod reload;
|
||||
mod request;
|
||||
mod widget;
|
||||
|
||||
use base::Base;
|
||||
use bookmark::Bookmark;
|
||||
use database::Database;
|
||||
use history::History;
|
||||
use home::Home;
|
||||
use reload::Reload;
|
||||
use request::Request;
|
||||
use widget::Widget;
|
||||
@ -20,7 +20,7 @@ use sqlite::Transaction;
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct Navigation {
|
||||
base: Arc<Base>,
|
||||
home: Arc<Home>,
|
||||
bookmark: Arc<Bookmark>,
|
||||
history: Arc<History>,
|
||||
reload: Arc<Reload>,
|
||||
@ -30,28 +30,22 @@ pub struct Navigation {
|
||||
|
||||
impl Navigation {
|
||||
pub fn new_arc(
|
||||
action_page_base: SimpleAction,
|
||||
action_page_home: SimpleAction,
|
||||
action_page_history_back: SimpleAction,
|
||||
action_page_history_forward: SimpleAction,
|
||||
action_page_reload: SimpleAction,
|
||||
action_update: SimpleAction,
|
||||
) -> Arc<Self> {
|
||||
// Init components
|
||||
let base = Base::new_arc(action_page_base);
|
||||
let history = History::new_arc(
|
||||
action_page_history_back,
|
||||
action_page_history_forward,
|
||||
);
|
||||
let home = Home::new_arc(action_page_home);
|
||||
let history = History::new_arc(action_page_history_back, action_page_history_forward);
|
||||
let reload = Reload::new_arc(action_page_reload.clone());
|
||||
let request = Request::new_arc(
|
||||
action_update.clone(),
|
||||
action_page_reload.clone(),
|
||||
);
|
||||
let request = Request::new_arc(action_update.clone(), action_page_reload.clone());
|
||||
let bookmark = Bookmark::new_arc();
|
||||
|
||||
// Init widget
|
||||
let widget = Widget::new_arc(
|
||||
base.gobject(),
|
||||
home.gobject(),
|
||||
history.gobject(),
|
||||
reload.gobject(),
|
||||
request.gobject(),
|
||||
@ -61,7 +55,7 @@ impl Navigation {
|
||||
// Result
|
||||
Arc::new(Self {
|
||||
widget,
|
||||
base,
|
||||
home,
|
||||
history,
|
||||
reload,
|
||||
request,
|
||||
@ -91,7 +85,7 @@ impl Navigation {
|
||||
}
|
||||
|
||||
pub fn update(&self, progress_fraction: Option<f64>) {
|
||||
self.base.update(self.request.uri());
|
||||
self.home.update(self.request.uri());
|
||||
self.history.update();
|
||||
self.reload.update(!self.request.is_empty());
|
||||
self.request.update(progress_fraction);
|
||||
@ -167,8 +161,8 @@ impl Navigation {
|
||||
&self.widget.gobject()
|
||||
}
|
||||
|
||||
pub fn base_url(&self) -> Option<GString> {
|
||||
self.base.url()
|
||||
pub fn home_url(&self) -> Option<GString> {
|
||||
self.home.url()
|
||||
}
|
||||
|
||||
pub fn request_text(&self) -> GString {
|
||||
|
@ -9,19 +9,19 @@ use gtk::{
|
||||
};
|
||||
use std::{cell::RefCell, sync::Arc};
|
||||
|
||||
pub struct Base {
|
||||
action_page_base: SimpleAction,
|
||||
pub struct Home {
|
||||
action_page_home: SimpleAction,
|
||||
uri: RefCell<Option<Uri>>,
|
||||
widget: Arc<Widget>,
|
||||
}
|
||||
|
||||
impl Base {
|
||||
impl Home {
|
||||
// Construct
|
||||
pub fn new_arc(action_page_base: SimpleAction) -> Arc<Self> {
|
||||
pub fn new_arc(action_page_home: SimpleAction) -> Arc<Self> {
|
||||
Arc::new(Self {
|
||||
action_page_base: action_page_base.clone(),
|
||||
action_page_home: action_page_home.clone(),
|
||||
uri: RefCell::new(None),
|
||||
widget: Widget::new_arc(action_page_base),
|
||||
widget: Widget::new_arc(action_page_home),
|
||||
})
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ impl Base {
|
||||
self.uri.replace(uri);
|
||||
|
||||
// Update action status
|
||||
self.action_page_base.set_enabled(status);
|
||||
self.action_page_home.set_enabled(status);
|
||||
|
||||
// Update child components
|
||||
self.widget.update(status);
|
@ -11,19 +11,19 @@ pub struct Widget {
|
||||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(action_page_base: SimpleAction) -> Arc<Self> {
|
||||
pub fn new_arc(action_page_home: SimpleAction) -> Arc<Self> {
|
||||
// Init gobject
|
||||
let gobject = Button::builder()
|
||||
.icon_name("go-home-symbolic")
|
||||
.tooltip_text("Base")
|
||||
.tooltip_text("Home")
|
||||
.sensitive(false)
|
||||
.build();
|
||||
|
||||
// Init events
|
||||
gobject.connect_clicked({
|
||||
let action_page_base = action_page_base.clone();
|
||||
let action_page_home = action_page_home.clone();
|
||||
move |_| {
|
||||
action_page_base.activate(None);
|
||||
action_page_home.activate(None);
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user