rename actions

This commit is contained in:
yggverse 2024-11-01 03:09:09 +02:00
parent 2d08e8386d
commit 313122e5c3
26 changed files with 274 additions and 290 deletions

View File

@ -41,18 +41,18 @@ impl App {
profile_path: PathBuf,
) -> Self {
// Init actions
let action_tool_debug = Action::new("win", true, None);
let action_tool_profile = Action::new("win", true, None);
let action_debug = Action::new("win", true, None);
let action_profile = Action::new("win", true, None);
let action_quit = Action::new("win", true, None);
let action_update = Action::new("win", true, Some(&String::static_variant_type()));
let action_tab_append = Action::new("win", true, None);
let action_tab_close = Action::new("win", true, None);
let action_tab_close_all = Action::new("win", true, None);
let action_tab_page_navigation_base = Action::new("win", false, None);
let action_tab_page_navigation_history_back = Action::new("win", false, None);
let action_tab_page_navigation_history_forward = Action::new("win", false, None);
let action_tab_page_navigation_reload = Action::new("win", true, None);
let action_tab_pin = 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_all = Action::new("win", true, None);
let action_page_base = 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);
let action_page_pin = Action::new("win", true, None);
// Init GTK
let gobject = Application::builder()
@ -60,44 +60,38 @@ impl App {
.build();
// Init accels
gobject.set_accels_for_action(&action_tool_debug.detailed_name(), &["<Primary>i"]);
gobject.set_accels_for_action(&action_debug.detailed_name(), &["<Primary>i"]);
gobject.set_accels_for_action(&action_update.detailed_name(), &["<Primary>u"]);
gobject.set_accels_for_action(&action_quit.detailed_name(), &["<Primary>Escape"]);
gobject.set_accels_for_action(&action_tab_append.detailed_name(), &["<Primary>t"]);
gobject.set_accels_for_action(&action_tab_pin.detailed_name(), &["<Primary>p"]);
gobject.set_accels_for_action(&action_tab_close.detailed_name(), &["<Primary>q"]);
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_tab_page_navigation_base.detailed_name(),
&["<Primary>h"],
);
gobject.set_accels_for_action(
&action_tab_page_navigation_history_back.detailed_name(),
&action_page_history_back.detailed_name(),
&["<Primary>Left"],
);
gobject.set_accels_for_action(
&action_tab_page_navigation_history_forward.detailed_name(),
&action_page_history_forward.detailed_name(),
&["<Primary>Right"],
);
gobject.set_accels_for_action(
&action_tab_page_navigation_reload.detailed_name(),
&["<Primary>r"],
);
gobject.set_accels_for_action(&action_page_reload.detailed_name(), &["<Primary>r"]);
// Init components
let browser = Arc::new(Browser::new(
profile_path,
action_tool_debug.simple(),
action_tool_profile.simple(),
action_debug.simple(),
action_profile.simple(),
action_quit.simple(),
action_update.simple(),
action_tab_append.simple(),
action_tab_close.simple(),
action_tab_close_all.simple(),
action_tab_page_navigation_base.simple(),
action_tab_page_navigation_history_back.simple(),
action_tab_page_navigation_history_forward.simple(),
action_tab_page_navigation_reload.simple(),
action_tab_pin.simple(),
action_page_new.simple(),
action_page_close.simple(),
action_page_close_all.simple(),
action_page_base.simple(),
action_page_history_back.simple(),
action_page_history_forward.simple(),
action_page_reload.simple(),
action_page_pin.simple(),
));
// Init events

View File

@ -28,68 +28,60 @@ impl Browser {
// Extras
profile_path: PathBuf,
// Actions
action_tool_debug: SimpleAction,
action_tool_profile: SimpleAction,
action_debug: SimpleAction,
action_profile: SimpleAction,
action_quit: SimpleAction,
action_update: SimpleAction,
action_tab_append: SimpleAction,
action_tab_close: SimpleAction,
action_tab_close_all: SimpleAction,
action_tab_page_navigation_base: SimpleAction,
action_tab_page_navigation_history_back: SimpleAction,
action_tab_page_navigation_history_forward: SimpleAction,
action_tab_page_navigation_reload: SimpleAction,
action_tab_pin: SimpleAction,
action_page_new: SimpleAction,
action_page_close: SimpleAction,
action_page_close_all: SimpleAction,
action_page_base: SimpleAction,
action_page_history_back: SimpleAction,
action_page_history_forward: SimpleAction,
action_page_reload: SimpleAction,
action_page_pin: SimpleAction,
) -> Browser {
let window = Arc::new(Window::new(
action_tool_debug.clone(),
action_tool_profile.clone(),
action_debug.clone(),
action_profile.clone(),
action_quit.clone(),
action_update.clone(),
action_tab_append.clone(),
action_tab_close.clone(),
action_tab_close_all.clone(),
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_tab_pin.clone(),
action_page_new.clone(),
action_page_close.clone(),
action_page_close_all.clone(),
action_page_base.clone(),
action_page_history_back.clone(),
action_page_history_forward.clone(),
action_page_reload.clone(),
action_page_pin.clone(),
));
// Init widget
let widget = Arc::new(Widget::new(window.gobject()));
// Assign actions
widget.gobject().add_action(&action_tool_debug);
widget.gobject().add_action(&action_tool_profile);
widget.gobject().add_action(&action_debug);
widget.gobject().add_action(&action_profile);
widget.gobject().add_action(&action_quit);
widget.gobject().add_action(&action_update);
widget.gobject().add_action(&action_tab_append);
widget.gobject().add_action(&action_tab_close);
widget.gobject().add_action(&action_tab_close_all);
widget
.gobject()
.add_action(&action_tab_page_navigation_base);
widget
.gobject()
.add_action(&action_tab_page_navigation_history_back);
widget
.gobject()
.add_action(&action_tab_page_navigation_history_forward);
widget
.gobject()
.add_action(&action_tab_page_navigation_reload);
widget.gobject().add_action(&action_tab_pin);
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_history_back);
widget.gobject().add_action(&action_page_history_forward);
widget.gobject().add_action(&action_page_reload);
widget.gobject().add_action(&action_page_pin);
// Init events
action_tool_debug.connect_activate({
action_debug.connect_activate({
let widget = widget.clone();
move |_, _| {
widget.gobject().emit_enable_debugging(true);
}
});
action_tool_profile.connect_activate({
action_profile.connect_activate({
move |_, _| {
FileLauncher::new(Some(&File::for_path(&profile_path))).launch(
None::<&gtk::Window>,
@ -123,56 +115,56 @@ impl Browser {
}
});
action_tab_append.connect_activate({
action_page_new.connect_activate({
let window = window.clone();
move |_, _| {
window.tab_append(None);
}
});
action_tab_close.connect_activate({
action_page_close.connect_activate({
let window = window.clone();
move |_, _| {
window.tab_close();
}
});
action_tab_close_all.connect_activate({
action_page_close_all.connect_activate({
let window = window.clone();
move |_, _| {
window.tab_close_all();
}
});
action_tab_page_navigation_base.connect_activate({
action_page_base.connect_activate({
let window = window.clone();
move |_, _| {
window.tab_page_navigation_base();
}
});
action_tab_page_navigation_history_back.connect_activate({
action_page_history_back.connect_activate({
let window = window.clone();
move |_, _| {
window.tab_page_navigation_history_back();
}
});
action_tab_page_navigation_history_forward.connect_activate({
action_page_history_forward.connect_activate({
let window = window.clone();
move |_, _| {
window.tab_page_navigation_history_forward();
}
});
action_tab_page_navigation_reload.connect_activate({
action_page_reload.connect_activate({
let window = window.clone();
move |_, _| {
window.tab_page_navigation_reload();
}
});
action_tab_pin.connect_activate({
action_page_pin.connect_activate({
let window = window.clone();
move |_, _| {
window.tab_pin();

View File

@ -23,41 +23,41 @@ impl Window {
// Construct
pub fn new(
// Actions
action_tool_debug: SimpleAction,
action_tool_profile: SimpleAction,
action_debug: SimpleAction,
action_profile: SimpleAction,
action_quit: SimpleAction,
action_update: SimpleAction,
action_tab_append: SimpleAction,
action_tab_close: SimpleAction,
action_tab_close_all: SimpleAction,
action_tab_page_navigation_base: SimpleAction,
action_tab_page_navigation_history_back: SimpleAction,
action_tab_page_navigation_history_forward: SimpleAction,
action_tab_page_navigation_reload: SimpleAction,
action_tab_pin: SimpleAction,
action_page_new: SimpleAction,
action_page_close: SimpleAction,
action_page_close_all: SimpleAction,
action_page_base: SimpleAction,
action_page_history_back: SimpleAction,
action_page_history_forward: SimpleAction,
action_page_reload: SimpleAction,
action_page_pin: SimpleAction,
) -> Self {
// Init components
let tab = Tab::new_arc(
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_page_base.clone(),
action_page_history_back.clone(),
action_page_history_forward.clone(),
action_page_reload.clone(),
action_update.clone(),
);
let header = Header::new_arc(
// Actions
action_tool_debug.clone(),
action_tool_profile.clone(),
action_debug.clone(),
action_profile.clone(),
action_quit.clone(),
action_tab_append.clone(),
action_tab_close.clone(),
action_tab_close_all.clone(),
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_tab_pin.clone(),
action_page_new.clone(),
action_page_close.clone(),
action_page_close_all.clone(),
action_page_base.clone(),
action_page_history_back.clone(),
action_page_history_forward.clone(),
action_page_reload.clone(),
action_page_pin.clone(),
// Widgets
tab.gobject(),
);

View File

@ -16,33 +16,33 @@ impl Header {
// Construct
pub fn new_arc(
// Actions
action_tool_debug: SimpleAction,
action_tool_profile: SimpleAction,
action_debug: SimpleAction,
action_profile: SimpleAction,
action_quit: SimpleAction,
action_tab_append: SimpleAction,
action_tab_close: SimpleAction,
action_tab_close_all: SimpleAction,
action_tab_page_navigation_base: SimpleAction,
action_tab_page_navigation_history_back: SimpleAction,
action_tab_page_navigation_history_forward: SimpleAction,
action_tab_page_navigation_reload: SimpleAction,
action_tab_pin: SimpleAction,
action_page_new: SimpleAction,
action_page_close: SimpleAction,
action_page_close_all: SimpleAction,
action_page_base: SimpleAction,
action_page_history_back: SimpleAction,
action_page_history_forward: SimpleAction,
action_page_reload: SimpleAction,
action_page_pin: SimpleAction,
// Widgets
tab_view: &TabView,
) -> Arc<Self> {
// Init components
let bar = Bar::new_arc(
action_tool_debug,
action_tool_profile,
action_debug,
action_profile,
action_quit,
action_tab_append,
action_tab_close,
action_tab_close_all,
action_tab_page_navigation_base,
action_tab_page_navigation_history_back,
action_tab_page_navigation_history_forward,
action_tab_page_navigation_reload,
action_tab_pin,
action_page_new,
action_page_close,
action_page_close_all,
action_page_base,
action_page_history_back,
action_page_history_forward,
action_page_reload,
action_page_pin,
tab_view,
);

View File

@ -19,34 +19,34 @@ pub struct Bar {
impl Bar {
// Construct
pub fn new_arc(
action_tool_debug: SimpleAction,
action_tool_profile: SimpleAction,
action_debug: SimpleAction,
action_profile: SimpleAction,
action_quit: SimpleAction,
action_tab_append: SimpleAction,
action_tab_close: SimpleAction,
action_tab_close_all: SimpleAction,
action_tab_page_navigation_base: SimpleAction,
action_tab_page_navigation_history_back: SimpleAction,
action_tab_page_navigation_history_forward: SimpleAction,
action_tab_page_navigation_reload: SimpleAction,
action_tab_pin: SimpleAction,
action_page_new: SimpleAction,
action_page_close: SimpleAction,
action_page_close_all: SimpleAction,
action_page_base: SimpleAction,
action_page_history_back: SimpleAction,
action_page_history_forward: SimpleAction,
action_page_reload: SimpleAction,
action_page_pin: SimpleAction,
view: &TabView,
) -> Arc<Self> {
// Init components
let control = Control::new_arc();
let tab = Tab::new_arc(action_tab_append.clone(), view);
let tab = Tab::new_arc(action_page_new.clone(), view);
let menu = Menu::new_arc(
action_tool_debug,
action_tool_profile,
action_debug,
action_profile,
action_quit,
action_tab_append,
action_tab_close,
action_tab_close_all,
action_tab_page_navigation_base,
action_tab_page_navigation_history_back,
action_tab_page_navigation_history_forward,
action_tab_page_navigation_reload,
action_tab_pin,
action_page_new,
action_page_close,
action_page_close_all,
action_page_base,
action_page_history_back,
action_page_history_forward,
action_page_reload,
action_page_pin,
);
// Build result

View File

@ -17,35 +17,35 @@ pub struct Menu {
#[rustfmt::skip] // @TODO template builder?
impl Menu {
pub fn new_arc(
action_tool_debug: SimpleAction,
action_tool_profile: SimpleAction,
action_debug: SimpleAction,
action_profile: SimpleAction,
action_quit: SimpleAction,
action_tab_append: SimpleAction,
action_tab_close: SimpleAction,
action_tab_close_all: SimpleAction,
action_tab_page_navigation_base: SimpleAction,
action_tab_page_navigation_history_back: SimpleAction,
action_tab_page_navigation_history_forward: SimpleAction,
action_tab_page_navigation_reload: SimpleAction,
action_tab_pin: SimpleAction,
action_page_new: SimpleAction,
action_page_close: SimpleAction,
action_page_close_all: SimpleAction,
action_page_base: SimpleAction,
action_page_history_back: SimpleAction,
action_page_history_forward: SimpleAction,
action_page_reload: SimpleAction,
action_page_pin: SimpleAction,
) -> Arc<Self> {
// Main
let main = gio::Menu::new();
// Main > Page
let main_page = gio::Menu::new();
main_page.append(Some("New"), Some(&detailed_action_name(action_tab_append)));
main_page.append(Some("Reload"), Some(&detailed_action_name(action_tab_page_navigation_reload)));
main_page.append(Some("Pin"), Some(&detailed_action_name(action_tab_pin)));
main_page.append(Some("New"), Some(&detailed_action_name(action_page_new)));
main_page.append(Some("Reload"), Some(&detailed_action_name(action_page_reload)));
main_page.append(Some("Pin"), Some(&detailed_action_name(action_page_pin)));
// Main > Page > Navigation
let main_page_navigation = gio::Menu::new();
main_page_navigation.append(Some("Base"), Some(&detailed_action_name(action_tab_page_navigation_base)));
main_page_navigation.append(Some("Base"), Some(&detailed_action_name(action_page_base)));
// Main > Page > Navigation > History
let main_page_navigation_history = gio::Menu::new();
main_page_navigation_history.append(Some("Back"), Some(&detailed_action_name(action_tab_page_navigation_history_back)));
main_page_navigation_history.append(Some("Forward"), Some(&detailed_action_name(action_tab_page_navigation_history_forward)));
main_page_navigation_history.append(Some("Back"), Some(&detailed_action_name(action_page_history_back)));
main_page_navigation_history.append(Some("Forward"), Some(&detailed_action_name(action_page_history_forward)));
main_page_navigation.append_submenu(Some("History"), &main_page_navigation_history);
@ -53,8 +53,8 @@ impl Menu {
// Main > Page > Close
let main_page_close = gio::Menu::new();
main_page_close.append(Some("Current"), Some(&detailed_action_name(action_tab_close)));
main_page_close.append(Some("All"), Some(&detailed_action_name(action_tab_close_all)));
main_page_close.append(Some("Current"), Some(&detailed_action_name(action_page_close)));
main_page_close.append(Some("All"), Some(&detailed_action_name(action_page_close_all)));
main_page.append_submenu(Some("Close"), &main_page_close);
@ -62,8 +62,8 @@ impl Menu {
// Main > Tool
let main_tool = gio::Menu::new();
main_tool.append(Some("Debug"), Some(&detailed_action_name(action_tool_debug)));
main_tool.append(Some("Profile"), Some(&detailed_action_name(action_tool_profile)));
main_tool.append(Some("Debug"), Some(&detailed_action_name(action_debug)));
main_tool.append(Some("Profile"), Some(&detailed_action_name(action_profile)));
main.append_submenu(Some("Tool"), &main_tool);

View File

@ -14,9 +14,9 @@ pub struct Tab {
impl Tab {
// Construct
pub fn new_arc(action_tab_append: SimpleAction, view: &TabView) -> Arc<Self> {
pub fn new_arc(action_page_new: SimpleAction, view: &TabView) -> Arc<Self> {
Arc::new(Self {
widget: Widget::new_arc(view, Append::new_arc(action_tab_append).gobject()),
widget: Widget::new_arc(view, Append::new_arc(action_page_new).gobject()),
})
}

View File

@ -11,9 +11,9 @@ pub struct Append {
impl Append {
// Construct
pub fn new_arc(action_tab_append: SimpleAction) -> Arc<Self> {
pub fn new_arc(action_page_new: SimpleAction) -> Arc<Self> {
Arc::new(Self {
widget: Widget::new_arc(action_tab_append),
widget: Widget::new_arc(action_page_new),
})
}

View File

@ -11,7 +11,7 @@ pub struct Widget {
impl Widget {
// Construct
pub fn new_arc(action_tab_append: SimpleAction) -> Arc<Self> {
pub fn new_arc(action_page_new: SimpleAction) -> Arc<Self> {
// Init gobject
let gobject = Button::builder()
.icon_name("tab-new-symbolic")
@ -22,7 +22,7 @@ impl Widget {
// Init events
gobject.connect_clicked(move |_| {
action_tab_append.activate(None);
action_page_new.activate(None);
});
Arc::new(Self { gobject })

View File

@ -20,10 +20,10 @@ pub struct Tab {
// Local actions
action_tab_open: SimpleAction,
// Global actions
action_tab_page_navigation_base: SimpleAction,
action_tab_page_navigation_history_back: SimpleAction,
action_tab_page_navigation_history_forward: SimpleAction,
action_tab_page_navigation_reload: SimpleAction,
action_page_base: SimpleAction,
action_page_history_back: SimpleAction,
action_page_history_forward: SimpleAction,
action_page_reload: SimpleAction,
action_update: SimpleAction,
// Dynamically allocated reference index
index: Arc<RefCell<HashMap<GString, Arc<Item>>>>,
@ -35,10 +35,10 @@ impl Tab {
// Construct
pub fn new_arc(
// Actions
action_tab_page_navigation_base: SimpleAction,
action_tab_page_navigation_history_back: SimpleAction,
action_tab_page_navigation_history_forward: SimpleAction,
action_tab_page_navigation_reload: SimpleAction,
action_page_base: SimpleAction,
action_page_history_back: SimpleAction,
action_page_history_forward: SimpleAction,
action_page_reload: SimpleAction,
action_update: SimpleAction,
) -> Arc<Self> {
// Init local actions
@ -76,12 +76,10 @@ impl Tab {
let gobject = widget.gobject().clone();
// Actions
let action_tab_open = action_tab_open.clone();
let action_tab_page_navigation_base = action_tab_page_navigation_base.clone();
let action_tab_page_navigation_history_back =
action_tab_page_navigation_history_back.clone();
let action_tab_page_navigation_history_forward =
action_tab_page_navigation_history_forward.clone();
let action_tab_page_navigation_reload = action_tab_page_navigation_reload.clone();
let action_page_base = action_page_base.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();
let action_update = action_update.clone();
move |_, request| {
// Init new tab item
@ -90,10 +88,10 @@ impl Tab {
// Local actions
action_tab_open.clone(),
// Global actions
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_page_base.clone(),
action_page_history_back.clone(),
action_page_history_forward.clone(),
action_page_reload.clone(),
action_update.clone(),
// Options
match gobject.selected_page() {
@ -122,10 +120,10 @@ impl Tab {
// Local actions
action_tab_open,
// Global actions
action_tab_page_navigation_base,
action_tab_page_navigation_history_back,
action_tab_page_navigation_history_forward,
action_tab_page_navigation_reload,
action_page_base,
action_page_history_back,
action_page_history_forward,
action_page_reload,
action_update,
// Init empty HashMap index as no tabs appended yet
index,
@ -142,10 +140,10 @@ impl Tab {
// Local actions
self.action_tab_open.clone(),
// Global actions
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_page_base.clone(),
self.action_page_history_back.clone(),
self.action_page_history_forward.clone(),
self.action_page_reload.clone(),
self.action_update.clone(),
// Options
position,
@ -279,10 +277,10 @@ impl Tab {
transaction,
&record.id,
self.action_tab_open.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_page_base.clone(),
self.action_page_history_back.clone(),
self.action_page_history_forward.clone(),
self.action_page_reload.clone(),
self.action_update.clone(),
) {
Ok(items) => {

View File

@ -29,10 +29,10 @@ impl Item {
tab_view: &TabView,
// Actions
action_tab_open: SimpleAction,
action_tab_page_navigation_base: SimpleAction,
action_tab_page_navigation_history_back: SimpleAction,
action_tab_page_navigation_history_forward: SimpleAction,
action_tab_page_navigation_reload: SimpleAction,
action_page_base: SimpleAction,
action_page_history_back: SimpleAction,
action_page_history_forward: SimpleAction,
action_page_reload: SimpleAction,
action_update: SimpleAction,
// Options
position: Option<i32>,
@ -47,10 +47,10 @@ impl Item {
id.clone(),
// Actions
action_tab_open.clone(),
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_page_base.clone(),
action_page_history_back.clone(),
action_page_history_forward.clone(),
action_page_reload.clone(),
action_update.clone(),
);
@ -129,10 +129,10 @@ impl Item {
app_browser_window_tab_id: &i64,
// Actions
action_tab_open: SimpleAction,
action_tab_page_navigation_base: SimpleAction,
action_tab_page_navigation_history_back: SimpleAction,
action_tab_page_navigation_history_forward: SimpleAction,
action_tab_page_navigation_reload: SimpleAction,
action_page_base: SimpleAction,
action_page_history_back: SimpleAction,
action_page_history_forward: SimpleAction,
action_page_reload: SimpleAction,
action_update: SimpleAction,
) -> Result<Vec<Arc<Item>>, String> {
let mut items = Vec::new();
@ -145,10 +145,10 @@ impl Item {
tab_view,
// Actions
action_tab_open.clone(),
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_page_base.clone(),
action_page_history_back.clone(),
action_page_history_forward.clone(),
action_page_reload.clone(),
action_update.clone(),
// Options
None,

View File

@ -35,7 +35,7 @@ pub struct Page {
id: GString,
// Actions
action_page_open: SimpleAction,
action_tab_page_navigation_reload: SimpleAction,
action_page_reload: SimpleAction,
action_update: SimpleAction,
// Components
navigation: Arc<Navigation>,
@ -52,10 +52,10 @@ impl Page {
pub fn new_arc(
id: GString,
action_tab_open: SimpleAction,
action_tab_page_navigation_base: SimpleAction,
action_tab_page_navigation_history_back: SimpleAction,
action_tab_page_navigation_history_forward: SimpleAction,
action_tab_page_navigation_reload: SimpleAction,
action_page_base: SimpleAction,
action_page_history_back: SimpleAction,
action_page_history_forward: SimpleAction,
action_page_reload: SimpleAction,
action_update: SimpleAction,
) -> Arc<Self> {
// Init local actions
@ -66,10 +66,10 @@ impl Page {
let content = Content::new_arc(action_tab_open.clone(), action_page_open.clone());
let navigation = Navigation::new_arc(
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_page_base.clone(),
action_page_history_back.clone(),
action_page_history_forward.clone(),
action_page_reload.clone(),
action_update.clone(),
);
@ -89,7 +89,7 @@ impl Page {
// Init events
action_page_open.connect_activate({
let navigation = navigation.clone();
let action_tab_page_navigation_reload = action_tab_page_navigation_reload.clone();
let action_page_reload = action_page_reload.clone();
move |_, request| {
// Update request
navigation.set_request_text(
@ -101,7 +101,7 @@ impl Page {
);
// Reload page
action_tab_page_navigation_reload.activate(None);
action_page_reload.activate(None);
}
});
@ -110,7 +110,7 @@ impl Page {
id,
// Actions
action_page_open,
action_tab_page_navigation_reload,
action_page_reload,
action_update,
// Components
content,
@ -141,7 +141,7 @@ impl Page {
self.navigation.set_request_text(&request);
// Reload page
self.action_tab_page_navigation_reload.activate(None);
self.action_page_reload.activate(None);
}
}
@ -151,7 +151,7 @@ impl Page {
self.navigation.set_request_text(&request);
// Reload page
self.action_tab_page_navigation_reload.activate(None);
self.action_page_reload.activate(None);
}
}
@ -218,7 +218,7 @@ impl Page {
self.navigation.set_request_text(&request_text);
// Reload page
self.action_tab_page_navigation_reload.activate(None);
self.action_page_reload.activate(None);
}
Err(_) => {
// @TODO any action here?
@ -235,7 +235,7 @@ impl Page {
self.navigation.set_request_text(&request_text);
// Reload page
self.action_tab_page_navigation_reload.activate(None);
self.action_page_reload.activate(None);
}
}
}; // Uri::parse

View File

@ -22,11 +22,11 @@ impl Text {
pub fn gemini(
gemtext: &str,
base: &Uri,
action_tab_append: SimpleAction,
action_page_new: SimpleAction,
action_page_open: SimpleAction,
) -> Self {
// Init components
let gemini = Gemini::new(gemtext, base, action_tab_append, action_page_open);
let gemini = Gemini::new(gemtext, base, action_page_new, action_page_open);
// Init meta
let meta = Meta {

View File

@ -30,22 +30,22 @@ pub struct Navigation {
impl Navigation {
pub fn new_arc(
action_tab_page_navigation_base: SimpleAction,
action_tab_page_navigation_history_back: SimpleAction,
action_tab_page_navigation_history_forward: SimpleAction,
action_tab_page_navigation_reload: SimpleAction,
action_page_base: 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_tab_page_navigation_base);
let base = Base::new_arc(action_page_base);
let history = History::new_arc(
action_tab_page_navigation_history_back,
action_tab_page_navigation_history_forward,
action_page_history_back,
action_page_history_forward,
);
let reload = Reload::new_arc(action_tab_page_navigation_reload.clone());
let reload = Reload::new_arc(action_page_reload.clone());
let request = Request::new_arc(
action_update.clone(),
action_tab_page_navigation_reload.clone(),
action_page_reload.clone(),
);
let bookmark = Bookmark::new_arc();

View File

@ -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);

View File

@ -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);
}
});

View File

@ -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());

View File

@ -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

View File

@ -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);
}
});

View File

@ -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

View File

@ -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);
}
});

View File

@ -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

View File

@ -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);
}
});

View File

@ -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),
})
}

View File

@ -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({

View File

@ -11,10 +11,10 @@ pub struct Widget {
impl Widget {
// Construct
pub fn new(action_tab_append: SimpleAction) -> Self {
pub fn new(action_page_new: SimpleAction) -> Self {
// Init additional action group
let action_group = SimpleActionGroup::new();
action_group.add_action(&action_tab_append);
action_group.add_action(&action_page_new);
// Init gobject
let gobject = TabView::new();