rename base to home

This commit is contained in:
yggverse 2024-11-01 03:14:11 +02:00
parent 313122e5c3
commit 532ed65ed8
12 changed files with 61 additions and 67 deletions

View File

@ -48,7 +48,7 @@ impl App {
let action_page_new = Action::new("win", true, None); let action_page_new = Action::new("win", true, None);
let action_page_close = 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_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_back = Action::new("win", false, None);
let action_page_history_forward = Action::new("win", false, None); let action_page_history_forward = Action::new("win", false, None);
let action_page_reload = Action::new("win", true, 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_new.detailed_name(), &["<Primary>t"]);
gobject.set_accels_for_action(&action_page_pin.detailed_name(), &["<Primary>p"]); 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_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( gobject.set_accels_for_action(
&action_page_history_back.detailed_name(), &action_page_history_back.detailed_name(),
&["<Primary>Left"], &["<Primary>Left"],
@ -87,7 +87,7 @@ impl App {
action_page_new.simple(), action_page_new.simple(),
action_page_close.simple(), action_page_close.simple(),
action_page_close_all.simple(), action_page_close_all.simple(),
action_page_base.simple(), action_page_home.simple(),
action_page_history_back.simple(), action_page_history_back.simple(),
action_page_history_forward.simple(), action_page_history_forward.simple(),
action_page_reload.simple(), action_page_reload.simple(),

View File

@ -35,7 +35,7 @@ impl Browser {
action_page_new: SimpleAction, action_page_new: SimpleAction,
action_page_close: SimpleAction, action_page_close: SimpleAction,
action_page_close_all: SimpleAction, action_page_close_all: SimpleAction,
action_page_base: SimpleAction, action_page_home: SimpleAction,
action_page_history_back: SimpleAction, action_page_history_back: SimpleAction,
action_page_history_forward: SimpleAction, action_page_history_forward: SimpleAction,
action_page_reload: SimpleAction, action_page_reload: SimpleAction,
@ -49,7 +49,7 @@ impl Browser {
action_page_new.clone(), action_page_new.clone(),
action_page_close.clone(), action_page_close.clone(),
action_page_close_all.clone(), action_page_close_all.clone(),
action_page_base.clone(), action_page_home.clone(),
action_page_history_back.clone(), action_page_history_back.clone(),
action_page_history_forward.clone(), action_page_history_forward.clone(),
action_page_reload.clone(), action_page_reload.clone(),
@ -67,7 +67,7 @@ impl Browser {
widget.gobject().add_action(&action_page_new); widget.gobject().add_action(&action_page_new);
widget.gobject().add_action(&action_page_close); widget.gobject().add_action(&action_page_close);
widget.gobject().add_action(&action_page_close_all); 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_back);
widget.gobject().add_action(&action_page_history_forward); widget.gobject().add_action(&action_page_history_forward);
widget.gobject().add_action(&action_page_reload); 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(); let window = window.clone();
move |_, _| { move |_, _| {
window.tab_page_navigation_base(); window.tab_page_navigation_home();
} }
}); });

View File

@ -30,7 +30,7 @@ impl Window {
action_page_new: SimpleAction, action_page_new: SimpleAction,
action_page_close: SimpleAction, action_page_close: SimpleAction,
action_page_close_all: SimpleAction, action_page_close_all: SimpleAction,
action_page_base: SimpleAction, action_page_home: SimpleAction,
action_page_history_back: SimpleAction, action_page_history_back: SimpleAction,
action_page_history_forward: SimpleAction, action_page_history_forward: SimpleAction,
action_page_reload: SimpleAction, action_page_reload: SimpleAction,
@ -38,7 +38,7 @@ impl Window {
) -> Self { ) -> Self {
// Init components // Init components
let tab = Tab::new_arc( let tab = Tab::new_arc(
action_page_base.clone(), action_page_home.clone(),
action_page_history_back.clone(), action_page_history_back.clone(),
action_page_history_forward.clone(), action_page_history_forward.clone(),
action_page_reload.clone(), action_page_reload.clone(),
@ -53,7 +53,7 @@ impl Window {
action_page_new.clone(), action_page_new.clone(),
action_page_close.clone(), action_page_close.clone(),
action_page_close_all.clone(), action_page_close_all.clone(),
action_page_base.clone(), action_page_home.clone(),
action_page_history_back.clone(), action_page_history_back.clone(),
action_page_history_forward.clone(), action_page_history_forward.clone(),
action_page_reload.clone(), action_page_reload.clone(),
@ -78,8 +78,8 @@ impl Window {
self.tab.append(position); self.tab.append(position);
} }
pub fn tab_page_navigation_base(&self) { pub fn tab_page_navigation_home(&self) {
self.tab.page_navigation_base(); self.tab.page_navigation_home();
} }
pub fn tab_page_navigation_history_back(&self) { pub fn tab_page_navigation_history_back(&self) {

View File

@ -22,7 +22,7 @@ impl Header {
action_page_new: SimpleAction, action_page_new: SimpleAction,
action_page_close: SimpleAction, action_page_close: SimpleAction,
action_page_close_all: SimpleAction, action_page_close_all: SimpleAction,
action_page_base: SimpleAction, action_page_home: SimpleAction,
action_page_history_back: SimpleAction, action_page_history_back: SimpleAction,
action_page_history_forward: SimpleAction, action_page_history_forward: SimpleAction,
action_page_reload: SimpleAction, action_page_reload: SimpleAction,
@ -38,7 +38,7 @@ impl Header {
action_page_new, action_page_new,
action_page_close, action_page_close,
action_page_close_all, action_page_close_all,
action_page_base, action_page_home,
action_page_history_back, action_page_history_back,
action_page_history_forward, action_page_history_forward,
action_page_reload, action_page_reload,

View File

@ -25,7 +25,7 @@ impl Bar {
action_page_new: SimpleAction, action_page_new: SimpleAction,
action_page_close: SimpleAction, action_page_close: SimpleAction,
action_page_close_all: SimpleAction, action_page_close_all: SimpleAction,
action_page_base: SimpleAction, action_page_home: SimpleAction,
action_page_history_back: SimpleAction, action_page_history_back: SimpleAction,
action_page_history_forward: SimpleAction, action_page_history_forward: SimpleAction,
action_page_reload: SimpleAction, action_page_reload: SimpleAction,
@ -42,7 +42,7 @@ impl Bar {
action_page_new, action_page_new,
action_page_close, action_page_close,
action_page_close_all, action_page_close_all,
action_page_base, action_page_home,
action_page_history_back, action_page_history_back,
action_page_history_forward, action_page_history_forward,
action_page_reload, action_page_reload,

View File

@ -23,7 +23,7 @@ impl Menu {
action_page_new: SimpleAction, action_page_new: SimpleAction,
action_page_close: SimpleAction, action_page_close: SimpleAction,
action_page_close_all: SimpleAction, action_page_close_all: SimpleAction,
action_page_base: SimpleAction, action_page_home: SimpleAction,
action_page_history_back: SimpleAction, action_page_history_back: SimpleAction,
action_page_history_forward: SimpleAction, action_page_history_forward: SimpleAction,
action_page_reload: SimpleAction, action_page_reload: SimpleAction,
@ -40,7 +40,7 @@ impl Menu {
// Main > Page > Navigation // Main > Page > Navigation
let main_page_navigation = gio::Menu::new(); 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 // Main > Page > Navigation > History
let main_page_navigation_history = gio::Menu::new(); let main_page_navigation_history = gio::Menu::new();

View File

@ -20,7 +20,7 @@ pub struct Tab {
// Local actions // Local actions
action_tab_open: SimpleAction, action_tab_open: SimpleAction,
// Global actions // Global actions
action_page_base: SimpleAction, action_page_home: SimpleAction,
action_page_history_back: SimpleAction, action_page_history_back: SimpleAction,
action_page_history_forward: SimpleAction, action_page_history_forward: SimpleAction,
action_page_reload: SimpleAction, action_page_reload: SimpleAction,
@ -35,7 +35,7 @@ impl Tab {
// Construct // Construct
pub fn new_arc( pub fn new_arc(
// Actions // Actions
action_page_base: SimpleAction, action_page_home: SimpleAction,
action_page_history_back: SimpleAction, action_page_history_back: SimpleAction,
action_page_history_forward: SimpleAction, action_page_history_forward: SimpleAction,
action_page_reload: SimpleAction, action_page_reload: SimpleAction,
@ -76,7 +76,7 @@ impl Tab {
let gobject = widget.gobject().clone(); let gobject = widget.gobject().clone();
// Actions // Actions
let action_tab_open = action_tab_open.clone(); 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_back = action_page_history_back.clone();
let action_page_history_forward = action_page_history_forward.clone(); let action_page_history_forward = action_page_history_forward.clone();
let action_page_reload = action_page_reload.clone(); let action_page_reload = action_page_reload.clone();
@ -88,7 +88,7 @@ impl Tab {
// Local actions // Local actions
action_tab_open.clone(), action_tab_open.clone(),
// Global actions // Global actions
action_page_base.clone(), action_page_home.clone(),
action_page_history_back.clone(), action_page_history_back.clone(),
action_page_history_forward.clone(), action_page_history_forward.clone(),
action_page_reload.clone(), action_page_reload.clone(),
@ -120,7 +120,7 @@ impl Tab {
// Local actions // Local actions
action_tab_open, action_tab_open,
// Global actions // Global actions
action_page_base, action_page_home,
action_page_history_back, action_page_history_back,
action_page_history_forward, action_page_history_forward,
action_page_reload, action_page_reload,
@ -140,7 +140,7 @@ impl Tab {
// Local actions // Local actions
self.action_tab_open.clone(), self.action_tab_open.clone(),
// Global actions // Global actions
self.action_page_base.clone(), self.action_page_home.clone(),
self.action_page_history_back.clone(), self.action_page_history_back.clone(),
self.action_page_history_forward.clone(), self.action_page_history_forward.clone(),
self.action_page_reload.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(id) = self.widget.current_page_keyword() {
if let Some(item) = self.index.borrow().get(&id) { if let Some(item) = self.index.borrow().get(&id) {
item.page_navigation_base(); item.page_navigation_home();
} }
} }
} }
@ -277,7 +277,7 @@ impl Tab {
transaction, transaction,
&record.id, &record.id,
self.action_tab_open.clone(), 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_back.clone(),
self.action_page_history_forward.clone(), self.action_page_history_forward.clone(),
self.action_page_reload.clone(), self.action_page_reload.clone(),

View File

@ -29,7 +29,7 @@ impl Item {
tab_view: &TabView, tab_view: &TabView,
// Actions // Actions
action_tab_open: SimpleAction, action_tab_open: SimpleAction,
action_page_base: SimpleAction, action_page_home: SimpleAction,
action_page_history_back: SimpleAction, action_page_history_back: SimpleAction,
action_page_history_forward: SimpleAction, action_page_history_forward: SimpleAction,
action_page_reload: SimpleAction, action_page_reload: SimpleAction,
@ -47,7 +47,7 @@ impl Item {
id.clone(), id.clone(),
// Actions // Actions
action_tab_open.clone(), action_tab_open.clone(),
action_page_base.clone(), action_page_home.clone(),
action_page_history_back.clone(), action_page_history_back.clone(),
action_page_history_forward.clone(), action_page_history_forward.clone(),
action_page_reload.clone(), action_page_reload.clone(),
@ -69,8 +69,8 @@ impl Item {
} }
// Actions // Actions
pub fn page_navigation_base(&self) { pub fn page_navigation_home(&self) {
self.page.navigation_base() self.page.navigation_home()
} }
pub fn page_navigation_history_back(&self) { pub fn page_navigation_history_back(&self) {
@ -129,7 +129,7 @@ impl Item {
app_browser_window_tab_id: &i64, app_browser_window_tab_id: &i64,
// Actions // Actions
action_tab_open: SimpleAction, action_tab_open: SimpleAction,
action_page_base: SimpleAction, action_page_home: SimpleAction,
action_page_history_back: SimpleAction, action_page_history_back: SimpleAction,
action_page_history_forward: SimpleAction, action_page_history_forward: SimpleAction,
action_page_reload: SimpleAction, action_page_reload: SimpleAction,
@ -145,7 +145,7 @@ impl Item {
tab_view, tab_view,
// Actions // Actions
action_tab_open.clone(), action_tab_open.clone(),
action_page_base.clone(), action_page_home.clone(),
action_page_history_back.clone(), action_page_history_back.clone(),
action_page_history_forward.clone(), action_page_history_forward.clone(),
action_page_reload.clone(), action_page_reload.clone(),

View File

@ -52,7 +52,7 @@ impl Page {
pub fn new_arc( pub fn new_arc(
id: GString, id: GString,
action_tab_open: SimpleAction, action_tab_open: SimpleAction,
action_page_base: SimpleAction, action_page_home: SimpleAction,
action_page_history_back: SimpleAction, action_page_history_back: SimpleAction,
action_page_history_forward: SimpleAction, action_page_history_forward: SimpleAction,
action_page_reload: 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 content = Content::new_arc(action_tab_open.clone(), action_page_open.clone());
let navigation = Navigation::new_arc( let navigation = Navigation::new_arc(
action_page_base.clone(), action_page_home.clone(),
action_page_history_back.clone(), action_page_history_back.clone(),
action_page_history_forward.clone(), action_page_history_forward.clone(),
action_page_reload.clone(), action_page_reload.clone(),
@ -128,8 +128,8 @@ impl Page {
self.navigation.request_grab_focus(); self.navigation.request_grab_focus();
} }
pub fn navigation_base(&self) { pub fn navigation_home(&self) {
if let Some(url) = self.navigation.base_url() { if let Some(url) = self.navigation.home_url() {
// Update with history record // Update with history record
self.action_page_open.activate(Some(&url.to_variant())); self.action_page_open.activate(Some(&url.to_variant()));
} }

View File

@ -1,15 +1,15 @@
mod base;
mod bookmark; mod bookmark;
mod database; mod database;
mod history; mod history;
mod home;
mod reload; mod reload;
mod request; mod request;
mod widget; mod widget;
use base::Base;
use bookmark::Bookmark; use bookmark::Bookmark;
use database::Database; use database::Database;
use history::History; use history::History;
use home::Home;
use reload::Reload; use reload::Reload;
use request::Request; use request::Request;
use widget::Widget; use widget::Widget;
@ -20,7 +20,7 @@ use sqlite::Transaction;
use std::sync::Arc; use std::sync::Arc;
pub struct Navigation { pub struct Navigation {
base: Arc<Base>, home: Arc<Home>,
bookmark: Arc<Bookmark>, bookmark: Arc<Bookmark>,
history: Arc<History>, history: Arc<History>,
reload: Arc<Reload>, reload: Arc<Reload>,
@ -30,28 +30,22 @@ pub struct Navigation {
impl Navigation { impl Navigation {
pub fn new_arc( pub fn new_arc(
action_page_base: SimpleAction, action_page_home: SimpleAction,
action_page_history_back: SimpleAction, action_page_history_back: SimpleAction,
action_page_history_forward: SimpleAction, action_page_history_forward: SimpleAction,
action_page_reload: SimpleAction, action_page_reload: SimpleAction,
action_update: SimpleAction, action_update: SimpleAction,
) -> Arc<Self> { ) -> Arc<Self> {
// Init components // Init components
let base = Base::new_arc(action_page_base); let home = Home::new_arc(action_page_home);
let history = History::new_arc( let history = History::new_arc(action_page_history_back, action_page_history_forward);
action_page_history_back,
action_page_history_forward,
);
let reload = Reload::new_arc(action_page_reload.clone()); let reload = Reload::new_arc(action_page_reload.clone());
let request = Request::new_arc( let request = Request::new_arc(action_update.clone(), action_page_reload.clone());
action_update.clone(),
action_page_reload.clone(),
);
let bookmark = Bookmark::new_arc(); let bookmark = Bookmark::new_arc();
// Init widget // Init widget
let widget = Widget::new_arc( let widget = Widget::new_arc(
base.gobject(), home.gobject(),
history.gobject(), history.gobject(),
reload.gobject(), reload.gobject(),
request.gobject(), request.gobject(),
@ -61,7 +55,7 @@ impl Navigation {
// Result // Result
Arc::new(Self { Arc::new(Self {
widget, widget,
base, home,
history, history,
reload, reload,
request, request,
@ -91,7 +85,7 @@ impl Navigation {
} }
pub fn update(&self, progress_fraction: Option<f64>) { pub fn update(&self, progress_fraction: Option<f64>) {
self.base.update(self.request.uri()); self.home.update(self.request.uri());
self.history.update(); self.history.update();
self.reload.update(!self.request.is_empty()); self.reload.update(!self.request.is_empty());
self.request.update(progress_fraction); self.request.update(progress_fraction);
@ -167,8 +161,8 @@ impl Navigation {
&self.widget.gobject() &self.widget.gobject()
} }
pub fn base_url(&self) -> Option<GString> { pub fn home_url(&self) -> Option<GString> {
self.base.url() self.home.url()
} }
pub fn request_text(&self) -> GString { pub fn request_text(&self) -> GString {

View File

@ -9,19 +9,19 @@ use gtk::{
}; };
use std::{cell::RefCell, sync::Arc}; use std::{cell::RefCell, sync::Arc};
pub struct Base { pub struct Home {
action_page_base: SimpleAction, action_page_home: SimpleAction,
uri: RefCell<Option<Uri>>, uri: RefCell<Option<Uri>>,
widget: Arc<Widget>, widget: Arc<Widget>,
} }
impl Base { impl Home {
// Construct // Construct
pub fn new_arc(action_page_base: SimpleAction) -> Arc<Self> { pub fn new_arc(action_page_home: SimpleAction) -> Arc<Self> {
Arc::new(Self { Arc::new(Self {
action_page_base: action_page_base.clone(), action_page_home: action_page_home.clone(),
uri: RefCell::new(None), 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); self.uri.replace(uri);
// Update action status // Update action status
self.action_page_base.set_enabled(status); self.action_page_home.set_enabled(status);
// Update child components // Update child components
self.widget.update(status); self.widget.update(status);

View File

@ -11,19 +11,19 @@ pub struct Widget {
impl Widget { impl Widget {
// Construct // Construct
pub fn new_arc(action_page_base: SimpleAction) -> Arc<Self> { pub fn new_arc(action_page_home: SimpleAction) -> Arc<Self> {
// Init gobject // Init gobject
let gobject = Button::builder() let gobject = Button::builder()
.icon_name("go-home-symbolic") .icon_name("go-home-symbolic")
.tooltip_text("Base") .tooltip_text("Home")
.sensitive(false) .sensitive(false)
.build(); .build();
// Init events // Init events
gobject.connect_clicked({ gobject.connect_clicked({
let action_page_base = action_page_base.clone(); let action_page_home = action_page_home.clone();
move |_| { move |_| {
action_page_base.activate(None); action_page_home.activate(None);
} }
}); });