mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-29 20:44:25 +00:00
rename actions
This commit is contained in:
parent
2d08e8386d
commit
313122e5c3
62
src/app.rs
62
src/app.rs
@ -41,18 +41,18 @@ impl App {
|
|||||||
profile_path: PathBuf,
|
profile_path: PathBuf,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
// Init actions
|
// Init actions
|
||||||
let action_tool_debug = Action::new("win", true, None);
|
let action_debug = Action::new("win", true, None);
|
||||||
let action_tool_profile = Action::new("win", true, None);
|
let action_profile = Action::new("win", true, None);
|
||||||
let action_quit = 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_update = Action::new("win", true, Some(&String::static_variant_type()));
|
||||||
let action_tab_append = Action::new("win", true, None);
|
let action_page_new = Action::new("win", true, None);
|
||||||
let action_tab_close = Action::new("win", true, None);
|
let action_page_close = Action::new("win", true, None);
|
||||||
let action_tab_close_all = Action::new("win", true, None);
|
let action_page_close_all = Action::new("win", true, None);
|
||||||
let action_tab_page_navigation_base = Action::new("win", false, None);
|
let action_page_base = Action::new("win", false, None);
|
||||||
let action_tab_page_navigation_history_back = Action::new("win", false, None);
|
let action_page_history_back = Action::new("win", false, None);
|
||||||
let action_tab_page_navigation_history_forward = Action::new("win", false, None);
|
let action_page_history_forward = Action::new("win", false, None);
|
||||||
let action_tab_page_navigation_reload = Action::new("win", true, None);
|
let action_page_reload = Action::new("win", true, None);
|
||||||
let action_tab_pin = Action::new("win", true, None);
|
let action_page_pin = Action::new("win", true, None);
|
||||||
|
|
||||||
// Init GTK
|
// Init GTK
|
||||||
let gobject = Application::builder()
|
let gobject = Application::builder()
|
||||||
@ -60,44 +60,38 @@ impl App {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Init accels
|
// 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_update.detailed_name(), &["<Primary>u"]);
|
||||||
gobject.set_accels_for_action(&action_quit.detailed_name(), &["<Primary>Escape"]);
|
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_page_new.detailed_name(), &["<Primary>t"]);
|
||||||
gobject.set_accels_for_action(&action_tab_pin.detailed_name(), &["<Primary>p"]);
|
gobject.set_accels_for_action(&action_page_pin.detailed_name(), &["<Primary>p"]);
|
||||||
gobject.set_accels_for_action(&action_tab_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(
|
gobject.set_accels_for_action(
|
||||||
&action_tab_page_navigation_base.detailed_name(),
|
&action_page_history_back.detailed_name(),
|
||||||
&["<Primary>h"],
|
|
||||||
);
|
|
||||||
gobject.set_accels_for_action(
|
|
||||||
&action_tab_page_navigation_history_back.detailed_name(),
|
|
||||||
&["<Primary>Left"],
|
&["<Primary>Left"],
|
||||||
);
|
);
|
||||||
gobject.set_accels_for_action(
|
gobject.set_accels_for_action(
|
||||||
&action_tab_page_navigation_history_forward.detailed_name(),
|
&action_page_history_forward.detailed_name(),
|
||||||
&["<Primary>Right"],
|
&["<Primary>Right"],
|
||||||
);
|
);
|
||||||
gobject.set_accels_for_action(
|
gobject.set_accels_for_action(&action_page_reload.detailed_name(), &["<Primary>r"]);
|
||||||
&action_tab_page_navigation_reload.detailed_name(),
|
|
||||||
&["<Primary>r"],
|
|
||||||
);
|
|
||||||
|
|
||||||
// Init components
|
// Init components
|
||||||
let browser = Arc::new(Browser::new(
|
let browser = Arc::new(Browser::new(
|
||||||
profile_path,
|
profile_path,
|
||||||
action_tool_debug.simple(),
|
action_debug.simple(),
|
||||||
action_tool_profile.simple(),
|
action_profile.simple(),
|
||||||
action_quit.simple(),
|
action_quit.simple(),
|
||||||
action_update.simple(),
|
action_update.simple(),
|
||||||
action_tab_append.simple(),
|
action_page_new.simple(),
|
||||||
action_tab_close.simple(),
|
action_page_close.simple(),
|
||||||
action_tab_close_all.simple(),
|
action_page_close_all.simple(),
|
||||||
action_tab_page_navigation_base.simple(),
|
action_page_base.simple(),
|
||||||
action_tab_page_navigation_history_back.simple(),
|
action_page_history_back.simple(),
|
||||||
action_tab_page_navigation_history_forward.simple(),
|
action_page_history_forward.simple(),
|
||||||
action_tab_page_navigation_reload.simple(),
|
action_page_reload.simple(),
|
||||||
action_tab_pin.simple(),
|
action_page_pin.simple(),
|
||||||
));
|
));
|
||||||
|
|
||||||
// Init events
|
// Init events
|
||||||
|
@ -28,68 +28,60 @@ impl Browser {
|
|||||||
// Extras
|
// Extras
|
||||||
profile_path: PathBuf,
|
profile_path: PathBuf,
|
||||||
// Actions
|
// Actions
|
||||||
action_tool_debug: SimpleAction,
|
action_debug: SimpleAction,
|
||||||
action_tool_profile: SimpleAction,
|
action_profile: SimpleAction,
|
||||||
action_quit: SimpleAction,
|
action_quit: SimpleAction,
|
||||||
action_update: SimpleAction,
|
action_update: SimpleAction,
|
||||||
action_tab_append: SimpleAction,
|
action_page_new: SimpleAction,
|
||||||
action_tab_close: SimpleAction,
|
action_page_close: SimpleAction,
|
||||||
action_tab_close_all: SimpleAction,
|
action_page_close_all: SimpleAction,
|
||||||
action_tab_page_navigation_base: SimpleAction,
|
action_page_base: SimpleAction,
|
||||||
action_tab_page_navigation_history_back: SimpleAction,
|
action_page_history_back: SimpleAction,
|
||||||
action_tab_page_navigation_history_forward: SimpleAction,
|
action_page_history_forward: SimpleAction,
|
||||||
action_tab_page_navigation_reload: SimpleAction,
|
action_page_reload: SimpleAction,
|
||||||
action_tab_pin: SimpleAction,
|
action_page_pin: SimpleAction,
|
||||||
) -> Browser {
|
) -> Browser {
|
||||||
let window = Arc::new(Window::new(
|
let window = Arc::new(Window::new(
|
||||||
action_tool_debug.clone(),
|
action_debug.clone(),
|
||||||
action_tool_profile.clone(),
|
action_profile.clone(),
|
||||||
action_quit.clone(),
|
action_quit.clone(),
|
||||||
action_update.clone(),
|
action_update.clone(),
|
||||||
action_tab_append.clone(),
|
action_page_new.clone(),
|
||||||
action_tab_close.clone(),
|
action_page_close.clone(),
|
||||||
action_tab_close_all.clone(),
|
action_page_close_all.clone(),
|
||||||
action_tab_page_navigation_base.clone(),
|
action_page_base.clone(),
|
||||||
action_tab_page_navigation_history_back.clone(),
|
action_page_history_back.clone(),
|
||||||
action_tab_page_navigation_history_forward.clone(),
|
action_page_history_forward.clone(),
|
||||||
action_tab_page_navigation_reload.clone(),
|
action_page_reload.clone(),
|
||||||
action_tab_pin.clone(),
|
action_page_pin.clone(),
|
||||||
));
|
));
|
||||||
|
|
||||||
// Init widget
|
// Init widget
|
||||||
let widget = Arc::new(Widget::new(window.gobject()));
|
let widget = Arc::new(Widget::new(window.gobject()));
|
||||||
|
|
||||||
// Assign actions
|
// Assign actions
|
||||||
widget.gobject().add_action(&action_tool_debug);
|
widget.gobject().add_action(&action_debug);
|
||||||
widget.gobject().add_action(&action_tool_profile);
|
widget.gobject().add_action(&action_profile);
|
||||||
widget.gobject().add_action(&action_quit);
|
widget.gobject().add_action(&action_quit);
|
||||||
widget.gobject().add_action(&action_update);
|
widget.gobject().add_action(&action_update);
|
||||||
widget.gobject().add_action(&action_tab_append);
|
widget.gobject().add_action(&action_page_new);
|
||||||
widget.gobject().add_action(&action_tab_close);
|
widget.gobject().add_action(&action_page_close);
|
||||||
widget.gobject().add_action(&action_tab_close_all);
|
widget.gobject().add_action(&action_page_close_all);
|
||||||
widget
|
widget.gobject().add_action(&action_page_base);
|
||||||
.gobject()
|
widget.gobject().add_action(&action_page_history_back);
|
||||||
.add_action(&action_tab_page_navigation_base);
|
widget.gobject().add_action(&action_page_history_forward);
|
||||||
widget
|
widget.gobject().add_action(&action_page_reload);
|
||||||
.gobject()
|
widget.gobject().add_action(&action_page_pin);
|
||||||
.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);
|
|
||||||
|
|
||||||
// Init events
|
// Init events
|
||||||
action_tool_debug.connect_activate({
|
action_debug.connect_activate({
|
||||||
let widget = widget.clone();
|
let widget = widget.clone();
|
||||||
move |_, _| {
|
move |_, _| {
|
||||||
widget.gobject().emit_enable_debugging(true);
|
widget.gobject().emit_enable_debugging(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
action_tool_profile.connect_activate({
|
action_profile.connect_activate({
|
||||||
move |_, _| {
|
move |_, _| {
|
||||||
FileLauncher::new(Some(&File::for_path(&profile_path))).launch(
|
FileLauncher::new(Some(&File::for_path(&profile_path))).launch(
|
||||||
None::<>k::Window>,
|
None::<>k::Window>,
|
||||||
@ -123,56 +115,56 @@ impl Browser {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
action_tab_append.connect_activate({
|
action_page_new.connect_activate({
|
||||||
let window = window.clone();
|
let window = window.clone();
|
||||||
move |_, _| {
|
move |_, _| {
|
||||||
window.tab_append(None);
|
window.tab_append(None);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
action_tab_close.connect_activate({
|
action_page_close.connect_activate({
|
||||||
let window = window.clone();
|
let window = window.clone();
|
||||||
move |_, _| {
|
move |_, _| {
|
||||||
window.tab_close();
|
window.tab_close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
action_tab_close_all.connect_activate({
|
action_page_close_all.connect_activate({
|
||||||
let window = window.clone();
|
let window = window.clone();
|
||||||
move |_, _| {
|
move |_, _| {
|
||||||
window.tab_close_all();
|
window.tab_close_all();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
action_tab_page_navigation_base.connect_activate({
|
action_page_base.connect_activate({
|
||||||
let window = window.clone();
|
let window = window.clone();
|
||||||
move |_, _| {
|
move |_, _| {
|
||||||
window.tab_page_navigation_base();
|
window.tab_page_navigation_base();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
action_tab_page_navigation_history_back.connect_activate({
|
action_page_history_back.connect_activate({
|
||||||
let window = window.clone();
|
let window = window.clone();
|
||||||
move |_, _| {
|
move |_, _| {
|
||||||
window.tab_page_navigation_history_back();
|
window.tab_page_navigation_history_back();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
action_tab_page_navigation_history_forward.connect_activate({
|
action_page_history_forward.connect_activate({
|
||||||
let window = window.clone();
|
let window = window.clone();
|
||||||
move |_, _| {
|
move |_, _| {
|
||||||
window.tab_page_navigation_history_forward();
|
window.tab_page_navigation_history_forward();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
action_tab_page_navigation_reload.connect_activate({
|
action_page_reload.connect_activate({
|
||||||
let window = window.clone();
|
let window = window.clone();
|
||||||
move |_, _| {
|
move |_, _| {
|
||||||
window.tab_page_navigation_reload();
|
window.tab_page_navigation_reload();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
action_tab_pin.connect_activate({
|
action_page_pin.connect_activate({
|
||||||
let window = window.clone();
|
let window = window.clone();
|
||||||
move |_, _| {
|
move |_, _| {
|
||||||
window.tab_pin();
|
window.tab_pin();
|
||||||
|
@ -23,41 +23,41 @@ impl Window {
|
|||||||
// Construct
|
// Construct
|
||||||
pub fn new(
|
pub fn new(
|
||||||
// Actions
|
// Actions
|
||||||
action_tool_debug: SimpleAction,
|
action_debug: SimpleAction,
|
||||||
action_tool_profile: SimpleAction,
|
action_profile: SimpleAction,
|
||||||
action_quit: SimpleAction,
|
action_quit: SimpleAction,
|
||||||
action_update: SimpleAction,
|
action_update: SimpleAction,
|
||||||
action_tab_append: SimpleAction,
|
action_page_new: SimpleAction,
|
||||||
action_tab_close: SimpleAction,
|
action_page_close: SimpleAction,
|
||||||
action_tab_close_all: SimpleAction,
|
action_page_close_all: SimpleAction,
|
||||||
action_tab_page_navigation_base: SimpleAction,
|
action_page_base: SimpleAction,
|
||||||
action_tab_page_navigation_history_back: SimpleAction,
|
action_page_history_back: SimpleAction,
|
||||||
action_tab_page_navigation_history_forward: SimpleAction,
|
action_page_history_forward: SimpleAction,
|
||||||
action_tab_page_navigation_reload: SimpleAction,
|
action_page_reload: SimpleAction,
|
||||||
action_tab_pin: SimpleAction,
|
action_page_pin: SimpleAction,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
// Init components
|
// Init components
|
||||||
let tab = Tab::new_arc(
|
let tab = Tab::new_arc(
|
||||||
action_tab_page_navigation_base.clone(),
|
action_page_base.clone(),
|
||||||
action_tab_page_navigation_history_back.clone(),
|
action_page_history_back.clone(),
|
||||||
action_tab_page_navigation_history_forward.clone(),
|
action_page_history_forward.clone(),
|
||||||
action_tab_page_navigation_reload.clone(),
|
action_page_reload.clone(),
|
||||||
action_update.clone(),
|
action_update.clone(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let header = Header::new_arc(
|
let header = Header::new_arc(
|
||||||
// Actions
|
// Actions
|
||||||
action_tool_debug.clone(),
|
action_debug.clone(),
|
||||||
action_tool_profile.clone(),
|
action_profile.clone(),
|
||||||
action_quit.clone(),
|
action_quit.clone(),
|
||||||
action_tab_append.clone(),
|
action_page_new.clone(),
|
||||||
action_tab_close.clone(),
|
action_page_close.clone(),
|
||||||
action_tab_close_all.clone(),
|
action_page_close_all.clone(),
|
||||||
action_tab_page_navigation_base.clone(),
|
action_page_base.clone(),
|
||||||
action_tab_page_navigation_history_back.clone(),
|
action_page_history_back.clone(),
|
||||||
action_tab_page_navigation_history_forward.clone(),
|
action_page_history_forward.clone(),
|
||||||
action_tab_page_navigation_reload.clone(),
|
action_page_reload.clone(),
|
||||||
action_tab_pin.clone(),
|
action_page_pin.clone(),
|
||||||
// Widgets
|
// Widgets
|
||||||
tab.gobject(),
|
tab.gobject(),
|
||||||
);
|
);
|
||||||
|
@ -16,33 +16,33 @@ impl Header {
|
|||||||
// Construct
|
// Construct
|
||||||
pub fn new_arc(
|
pub fn new_arc(
|
||||||
// Actions
|
// Actions
|
||||||
action_tool_debug: SimpleAction,
|
action_debug: SimpleAction,
|
||||||
action_tool_profile: SimpleAction,
|
action_profile: SimpleAction,
|
||||||
action_quit: SimpleAction,
|
action_quit: SimpleAction,
|
||||||
action_tab_append: SimpleAction,
|
action_page_new: SimpleAction,
|
||||||
action_tab_close: SimpleAction,
|
action_page_close: SimpleAction,
|
||||||
action_tab_close_all: SimpleAction,
|
action_page_close_all: SimpleAction,
|
||||||
action_tab_page_navigation_base: SimpleAction,
|
action_page_base: SimpleAction,
|
||||||
action_tab_page_navigation_history_back: SimpleAction,
|
action_page_history_back: SimpleAction,
|
||||||
action_tab_page_navigation_history_forward: SimpleAction,
|
action_page_history_forward: SimpleAction,
|
||||||
action_tab_page_navigation_reload: SimpleAction,
|
action_page_reload: SimpleAction,
|
||||||
action_tab_pin: SimpleAction,
|
action_page_pin: SimpleAction,
|
||||||
// Widgets
|
// Widgets
|
||||||
tab_view: &TabView,
|
tab_view: &TabView,
|
||||||
) -> Arc<Self> {
|
) -> Arc<Self> {
|
||||||
// Init components
|
// Init components
|
||||||
let bar = Bar::new_arc(
|
let bar = Bar::new_arc(
|
||||||
action_tool_debug,
|
action_debug,
|
||||||
action_tool_profile,
|
action_profile,
|
||||||
action_quit,
|
action_quit,
|
||||||
action_tab_append,
|
action_page_new,
|
||||||
action_tab_close,
|
action_page_close,
|
||||||
action_tab_close_all,
|
action_page_close_all,
|
||||||
action_tab_page_navigation_base,
|
action_page_base,
|
||||||
action_tab_page_navigation_history_back,
|
action_page_history_back,
|
||||||
action_tab_page_navigation_history_forward,
|
action_page_history_forward,
|
||||||
action_tab_page_navigation_reload,
|
action_page_reload,
|
||||||
action_tab_pin,
|
action_page_pin,
|
||||||
tab_view,
|
tab_view,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -19,34 +19,34 @@ pub struct Bar {
|
|||||||
impl Bar {
|
impl Bar {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn new_arc(
|
pub fn new_arc(
|
||||||
action_tool_debug: SimpleAction,
|
action_debug: SimpleAction,
|
||||||
action_tool_profile: SimpleAction,
|
action_profile: SimpleAction,
|
||||||
action_quit: SimpleAction,
|
action_quit: SimpleAction,
|
||||||
action_tab_append: SimpleAction,
|
action_page_new: SimpleAction,
|
||||||
action_tab_close: SimpleAction,
|
action_page_close: SimpleAction,
|
||||||
action_tab_close_all: SimpleAction,
|
action_page_close_all: SimpleAction,
|
||||||
action_tab_page_navigation_base: SimpleAction,
|
action_page_base: SimpleAction,
|
||||||
action_tab_page_navigation_history_back: SimpleAction,
|
action_page_history_back: SimpleAction,
|
||||||
action_tab_page_navigation_history_forward: SimpleAction,
|
action_page_history_forward: SimpleAction,
|
||||||
action_tab_page_navigation_reload: SimpleAction,
|
action_page_reload: SimpleAction,
|
||||||
action_tab_pin: SimpleAction,
|
action_page_pin: SimpleAction,
|
||||||
view: &TabView,
|
view: &TabView,
|
||||||
) -> Arc<Self> {
|
) -> Arc<Self> {
|
||||||
// Init components
|
// Init components
|
||||||
let control = Control::new_arc();
|
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(
|
let menu = Menu::new_arc(
|
||||||
action_tool_debug,
|
action_debug,
|
||||||
action_tool_profile,
|
action_profile,
|
||||||
action_quit,
|
action_quit,
|
||||||
action_tab_append,
|
action_page_new,
|
||||||
action_tab_close,
|
action_page_close,
|
||||||
action_tab_close_all,
|
action_page_close_all,
|
||||||
action_tab_page_navigation_base,
|
action_page_base,
|
||||||
action_tab_page_navigation_history_back,
|
action_page_history_back,
|
||||||
action_tab_page_navigation_history_forward,
|
action_page_history_forward,
|
||||||
action_tab_page_navigation_reload,
|
action_page_reload,
|
||||||
action_tab_pin,
|
action_page_pin,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Build result
|
// Build result
|
||||||
|
@ -17,35 +17,35 @@ pub struct Menu {
|
|||||||
#[rustfmt::skip] // @TODO template builder?
|
#[rustfmt::skip] // @TODO template builder?
|
||||||
impl Menu {
|
impl Menu {
|
||||||
pub fn new_arc(
|
pub fn new_arc(
|
||||||
action_tool_debug: SimpleAction,
|
action_debug: SimpleAction,
|
||||||
action_tool_profile: SimpleAction,
|
action_profile: SimpleAction,
|
||||||
action_quit: SimpleAction,
|
action_quit: SimpleAction,
|
||||||
action_tab_append: SimpleAction,
|
action_page_new: SimpleAction,
|
||||||
action_tab_close: SimpleAction,
|
action_page_close: SimpleAction,
|
||||||
action_tab_close_all: SimpleAction,
|
action_page_close_all: SimpleAction,
|
||||||
action_tab_page_navigation_base: SimpleAction,
|
action_page_base: SimpleAction,
|
||||||
action_tab_page_navigation_history_back: SimpleAction,
|
action_page_history_back: SimpleAction,
|
||||||
action_tab_page_navigation_history_forward: SimpleAction,
|
action_page_history_forward: SimpleAction,
|
||||||
action_tab_page_navigation_reload: SimpleAction,
|
action_page_reload: SimpleAction,
|
||||||
action_tab_pin: SimpleAction,
|
action_page_pin: SimpleAction,
|
||||||
) -> Arc<Self> {
|
) -> Arc<Self> {
|
||||||
// Main
|
// Main
|
||||||
let main = gio::Menu::new();
|
let main = gio::Menu::new();
|
||||||
|
|
||||||
// Main > Page
|
// Main > Page
|
||||||
let main_page = gio::Menu::new();
|
let main_page = gio::Menu::new();
|
||||||
main_page.append(Some("New"), Some(&detailed_action_name(action_tab_append)));
|
main_page.append(Some("New"), Some(&detailed_action_name(action_page_new)));
|
||||||
main_page.append(Some("Reload"), Some(&detailed_action_name(action_tab_page_navigation_reload)));
|
main_page.append(Some("Reload"), Some(&detailed_action_name(action_page_reload)));
|
||||||
main_page.append(Some("Pin"), Some(&detailed_action_name(action_tab_pin)));
|
main_page.append(Some("Pin"), Some(&detailed_action_name(action_page_pin)));
|
||||||
|
|
||||||
// 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_tab_page_navigation_base)));
|
main_page_navigation.append(Some("Base"), Some(&detailed_action_name(action_page_base)));
|
||||||
|
|
||||||
// Main > Page > Navigation > History
|
// Main > Page > Navigation > History
|
||||||
let main_page_navigation_history = gio::Menu::new();
|
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("Back"), Some(&detailed_action_name(action_page_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("Forward"), Some(&detailed_action_name(action_page_history_forward)));
|
||||||
|
|
||||||
main_page_navigation.append_submenu(Some("History"), &main_page_navigation_history);
|
main_page_navigation.append_submenu(Some("History"), &main_page_navigation_history);
|
||||||
|
|
||||||
@ -53,8 +53,8 @@ impl Menu {
|
|||||||
|
|
||||||
// Main > Page > Close
|
// Main > Page > Close
|
||||||
let main_page_close = gio::Menu::new();
|
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("Current"), Some(&detailed_action_name(action_page_close)));
|
||||||
main_page_close.append(Some("All"), Some(&detailed_action_name(action_tab_close_all)));
|
main_page_close.append(Some("All"), Some(&detailed_action_name(action_page_close_all)));
|
||||||
|
|
||||||
main_page.append_submenu(Some("Close"), &main_page_close);
|
main_page.append_submenu(Some("Close"), &main_page_close);
|
||||||
|
|
||||||
@ -62,8 +62,8 @@ impl Menu {
|
|||||||
|
|
||||||
// Main > Tool
|
// Main > Tool
|
||||||
let main_tool = gio::Menu::new();
|
let main_tool = gio::Menu::new();
|
||||||
main_tool.append(Some("Debug"), Some(&detailed_action_name(action_tool_debug)));
|
main_tool.append(Some("Debug"), Some(&detailed_action_name(action_debug)));
|
||||||
main_tool.append(Some("Profile"), Some(&detailed_action_name(action_tool_profile)));
|
main_tool.append(Some("Profile"), Some(&detailed_action_name(action_profile)));
|
||||||
|
|
||||||
main.append_submenu(Some("Tool"), &main_tool);
|
main.append_submenu(Some("Tool"), &main_tool);
|
||||||
|
|
||||||
|
@ -14,9 +14,9 @@ pub struct Tab {
|
|||||||
|
|
||||||
impl Tab {
|
impl Tab {
|
||||||
// Construct
|
// 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 {
|
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()),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,9 +11,9 @@ pub struct Append {
|
|||||||
|
|
||||||
impl Append {
|
impl Append {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn new_arc(action_tab_append: SimpleAction) -> Arc<Self> {
|
pub fn new_arc(action_page_new: SimpleAction) -> Arc<Self> {
|
||||||
Arc::new(Self {
|
Arc::new(Self {
|
||||||
widget: Widget::new_arc(action_tab_append),
|
widget: Widget::new_arc(action_page_new),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ pub struct Widget {
|
|||||||
|
|
||||||
impl Widget {
|
impl Widget {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn new_arc(action_tab_append: SimpleAction) -> Arc<Self> {
|
pub fn new_arc(action_page_new: SimpleAction) -> Arc<Self> {
|
||||||
// Init gobject
|
// Init gobject
|
||||||
let gobject = Button::builder()
|
let gobject = Button::builder()
|
||||||
.icon_name("tab-new-symbolic")
|
.icon_name("tab-new-symbolic")
|
||||||
@ -22,7 +22,7 @@ impl Widget {
|
|||||||
|
|
||||||
// Init events
|
// Init events
|
||||||
gobject.connect_clicked(move |_| {
|
gobject.connect_clicked(move |_| {
|
||||||
action_tab_append.activate(None);
|
action_page_new.activate(None);
|
||||||
});
|
});
|
||||||
|
|
||||||
Arc::new(Self { gobject })
|
Arc::new(Self { gobject })
|
||||||
|
@ -20,10 +20,10 @@ pub struct Tab {
|
|||||||
// Local actions
|
// Local actions
|
||||||
action_tab_open: SimpleAction,
|
action_tab_open: SimpleAction,
|
||||||
// Global actions
|
// Global actions
|
||||||
action_tab_page_navigation_base: SimpleAction,
|
action_page_base: SimpleAction,
|
||||||
action_tab_page_navigation_history_back: SimpleAction,
|
action_page_history_back: SimpleAction,
|
||||||
action_tab_page_navigation_history_forward: SimpleAction,
|
action_page_history_forward: SimpleAction,
|
||||||
action_tab_page_navigation_reload: SimpleAction,
|
action_page_reload: SimpleAction,
|
||||||
action_update: SimpleAction,
|
action_update: SimpleAction,
|
||||||
// Dynamically allocated reference index
|
// Dynamically allocated reference index
|
||||||
index: Arc<RefCell<HashMap<GString, Arc<Item>>>>,
|
index: Arc<RefCell<HashMap<GString, Arc<Item>>>>,
|
||||||
@ -35,10 +35,10 @@ impl Tab {
|
|||||||
// Construct
|
// Construct
|
||||||
pub fn new_arc(
|
pub fn new_arc(
|
||||||
// Actions
|
// Actions
|
||||||
action_tab_page_navigation_base: SimpleAction,
|
action_page_base: SimpleAction,
|
||||||
action_tab_page_navigation_history_back: SimpleAction,
|
action_page_history_back: SimpleAction,
|
||||||
action_tab_page_navigation_history_forward: SimpleAction,
|
action_page_history_forward: SimpleAction,
|
||||||
action_tab_page_navigation_reload: SimpleAction,
|
action_page_reload: SimpleAction,
|
||||||
action_update: SimpleAction,
|
action_update: SimpleAction,
|
||||||
) -> Arc<Self> {
|
) -> Arc<Self> {
|
||||||
// Init local actions
|
// Init local actions
|
||||||
@ -76,12 +76,10 @@ 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_tab_page_navigation_base = action_tab_page_navigation_base.clone();
|
let action_page_base = action_page_base.clone();
|
||||||
let action_tab_page_navigation_history_back =
|
let action_page_history_back = action_page_history_back.clone();
|
||||||
action_tab_page_navigation_history_back.clone();
|
let action_page_history_forward = action_page_history_forward.clone();
|
||||||
let action_tab_page_navigation_history_forward =
|
let action_page_reload = action_page_reload.clone();
|
||||||
action_tab_page_navigation_history_forward.clone();
|
|
||||||
let action_tab_page_navigation_reload = action_tab_page_navigation_reload.clone();
|
|
||||||
let action_update = action_update.clone();
|
let action_update = action_update.clone();
|
||||||
move |_, request| {
|
move |_, request| {
|
||||||
// Init new tab item
|
// Init new tab item
|
||||||
@ -90,10 +88,10 @@ impl Tab {
|
|||||||
// Local actions
|
// Local actions
|
||||||
action_tab_open.clone(),
|
action_tab_open.clone(),
|
||||||
// Global actions
|
// Global actions
|
||||||
action_tab_page_navigation_base.clone(),
|
action_page_base.clone(),
|
||||||
action_tab_page_navigation_history_back.clone(),
|
action_page_history_back.clone(),
|
||||||
action_tab_page_navigation_history_forward.clone(),
|
action_page_history_forward.clone(),
|
||||||
action_tab_page_navigation_reload.clone(),
|
action_page_reload.clone(),
|
||||||
action_update.clone(),
|
action_update.clone(),
|
||||||
// Options
|
// Options
|
||||||
match gobject.selected_page() {
|
match gobject.selected_page() {
|
||||||
@ -122,10 +120,10 @@ impl Tab {
|
|||||||
// Local actions
|
// Local actions
|
||||||
action_tab_open,
|
action_tab_open,
|
||||||
// Global actions
|
// Global actions
|
||||||
action_tab_page_navigation_base,
|
action_page_base,
|
||||||
action_tab_page_navigation_history_back,
|
action_page_history_back,
|
||||||
action_tab_page_navigation_history_forward,
|
action_page_history_forward,
|
||||||
action_tab_page_navigation_reload,
|
action_page_reload,
|
||||||
action_update,
|
action_update,
|
||||||
// Init empty HashMap index as no tabs appended yet
|
// Init empty HashMap index as no tabs appended yet
|
||||||
index,
|
index,
|
||||||
@ -142,10 +140,10 @@ impl Tab {
|
|||||||
// Local actions
|
// Local actions
|
||||||
self.action_tab_open.clone(),
|
self.action_tab_open.clone(),
|
||||||
// Global actions
|
// Global actions
|
||||||
self.action_tab_page_navigation_base.clone(),
|
self.action_page_base.clone(),
|
||||||
self.action_tab_page_navigation_history_back.clone(),
|
self.action_page_history_back.clone(),
|
||||||
self.action_tab_page_navigation_history_forward.clone(),
|
self.action_page_history_forward.clone(),
|
||||||
self.action_tab_page_navigation_reload.clone(),
|
self.action_page_reload.clone(),
|
||||||
self.action_update.clone(),
|
self.action_update.clone(),
|
||||||
// Options
|
// Options
|
||||||
position,
|
position,
|
||||||
@ -279,10 +277,10 @@ impl Tab {
|
|||||||
transaction,
|
transaction,
|
||||||
&record.id,
|
&record.id,
|
||||||
self.action_tab_open.clone(),
|
self.action_tab_open.clone(),
|
||||||
self.action_tab_page_navigation_base.clone(),
|
self.action_page_base.clone(),
|
||||||
self.action_tab_page_navigation_history_back.clone(),
|
self.action_page_history_back.clone(),
|
||||||
self.action_tab_page_navigation_history_forward.clone(),
|
self.action_page_history_forward.clone(),
|
||||||
self.action_tab_page_navigation_reload.clone(),
|
self.action_page_reload.clone(),
|
||||||
self.action_update.clone(),
|
self.action_update.clone(),
|
||||||
) {
|
) {
|
||||||
Ok(items) => {
|
Ok(items) => {
|
||||||
|
@ -29,10 +29,10 @@ impl Item {
|
|||||||
tab_view: &TabView,
|
tab_view: &TabView,
|
||||||
// Actions
|
// Actions
|
||||||
action_tab_open: SimpleAction,
|
action_tab_open: SimpleAction,
|
||||||
action_tab_page_navigation_base: SimpleAction,
|
action_page_base: SimpleAction,
|
||||||
action_tab_page_navigation_history_back: SimpleAction,
|
action_page_history_back: SimpleAction,
|
||||||
action_tab_page_navigation_history_forward: SimpleAction,
|
action_page_history_forward: SimpleAction,
|
||||||
action_tab_page_navigation_reload: SimpleAction,
|
action_page_reload: SimpleAction,
|
||||||
action_update: SimpleAction,
|
action_update: SimpleAction,
|
||||||
// Options
|
// Options
|
||||||
position: Option<i32>,
|
position: Option<i32>,
|
||||||
@ -47,10 +47,10 @@ impl Item {
|
|||||||
id.clone(),
|
id.clone(),
|
||||||
// Actions
|
// Actions
|
||||||
action_tab_open.clone(),
|
action_tab_open.clone(),
|
||||||
action_tab_page_navigation_base.clone(),
|
action_page_base.clone(),
|
||||||
action_tab_page_navigation_history_back.clone(),
|
action_page_history_back.clone(),
|
||||||
action_tab_page_navigation_history_forward.clone(),
|
action_page_history_forward.clone(),
|
||||||
action_tab_page_navigation_reload.clone(),
|
action_page_reload.clone(),
|
||||||
action_update.clone(),
|
action_update.clone(),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -129,10 +129,10 @@ 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_tab_page_navigation_base: SimpleAction,
|
action_page_base: SimpleAction,
|
||||||
action_tab_page_navigation_history_back: SimpleAction,
|
action_page_history_back: SimpleAction,
|
||||||
action_tab_page_navigation_history_forward: SimpleAction,
|
action_page_history_forward: SimpleAction,
|
||||||
action_tab_page_navigation_reload: SimpleAction,
|
action_page_reload: SimpleAction,
|
||||||
action_update: SimpleAction,
|
action_update: SimpleAction,
|
||||||
) -> Result<Vec<Arc<Item>>, String> {
|
) -> Result<Vec<Arc<Item>>, String> {
|
||||||
let mut items = Vec::new();
|
let mut items = Vec::new();
|
||||||
@ -145,10 +145,10 @@ impl Item {
|
|||||||
tab_view,
|
tab_view,
|
||||||
// Actions
|
// Actions
|
||||||
action_tab_open.clone(),
|
action_tab_open.clone(),
|
||||||
action_tab_page_navigation_base.clone(),
|
action_page_base.clone(),
|
||||||
action_tab_page_navigation_history_back.clone(),
|
action_page_history_back.clone(),
|
||||||
action_tab_page_navigation_history_forward.clone(),
|
action_page_history_forward.clone(),
|
||||||
action_tab_page_navigation_reload.clone(),
|
action_page_reload.clone(),
|
||||||
action_update.clone(),
|
action_update.clone(),
|
||||||
// Options
|
// Options
|
||||||
None,
|
None,
|
||||||
|
@ -35,7 +35,7 @@ pub struct Page {
|
|||||||
id: GString,
|
id: GString,
|
||||||
// Actions
|
// Actions
|
||||||
action_page_open: SimpleAction,
|
action_page_open: SimpleAction,
|
||||||
action_tab_page_navigation_reload: SimpleAction,
|
action_page_reload: SimpleAction,
|
||||||
action_update: SimpleAction,
|
action_update: SimpleAction,
|
||||||
// Components
|
// Components
|
||||||
navigation: Arc<Navigation>,
|
navigation: Arc<Navigation>,
|
||||||
@ -52,10 +52,10 @@ impl Page {
|
|||||||
pub fn new_arc(
|
pub fn new_arc(
|
||||||
id: GString,
|
id: GString,
|
||||||
action_tab_open: SimpleAction,
|
action_tab_open: SimpleAction,
|
||||||
action_tab_page_navigation_base: SimpleAction,
|
action_page_base: SimpleAction,
|
||||||
action_tab_page_navigation_history_back: SimpleAction,
|
action_page_history_back: SimpleAction,
|
||||||
action_tab_page_navigation_history_forward: SimpleAction,
|
action_page_history_forward: SimpleAction,
|
||||||
action_tab_page_navigation_reload: SimpleAction,
|
action_page_reload: SimpleAction,
|
||||||
action_update: SimpleAction,
|
action_update: SimpleAction,
|
||||||
) -> Arc<Self> {
|
) -> Arc<Self> {
|
||||||
// Init local actions
|
// Init local actions
|
||||||
@ -66,10 +66,10 @@ 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_tab_page_navigation_base.clone(),
|
action_page_base.clone(),
|
||||||
action_tab_page_navigation_history_back.clone(),
|
action_page_history_back.clone(),
|
||||||
action_tab_page_navigation_history_forward.clone(),
|
action_page_history_forward.clone(),
|
||||||
action_tab_page_navigation_reload.clone(),
|
action_page_reload.clone(),
|
||||||
action_update.clone(),
|
action_update.clone(),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ impl Page {
|
|||||||
// Init events
|
// Init events
|
||||||
action_page_open.connect_activate({
|
action_page_open.connect_activate({
|
||||||
let navigation = navigation.clone();
|
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| {
|
move |_, request| {
|
||||||
// Update request
|
// Update request
|
||||||
navigation.set_request_text(
|
navigation.set_request_text(
|
||||||
@ -101,7 +101,7 @@ impl Page {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Reload page
|
// Reload page
|
||||||
action_tab_page_navigation_reload.activate(None);
|
action_page_reload.activate(None);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ impl Page {
|
|||||||
id,
|
id,
|
||||||
// Actions
|
// Actions
|
||||||
action_page_open,
|
action_page_open,
|
||||||
action_tab_page_navigation_reload,
|
action_page_reload,
|
||||||
action_update,
|
action_update,
|
||||||
// Components
|
// Components
|
||||||
content,
|
content,
|
||||||
@ -141,7 +141,7 @@ impl Page {
|
|||||||
self.navigation.set_request_text(&request);
|
self.navigation.set_request_text(&request);
|
||||||
|
|
||||||
// Reload page
|
// 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);
|
self.navigation.set_request_text(&request);
|
||||||
|
|
||||||
// Reload page
|
// 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);
|
self.navigation.set_request_text(&request_text);
|
||||||
|
|
||||||
// Reload page
|
// Reload page
|
||||||
self.action_tab_page_navigation_reload.activate(None);
|
self.action_page_reload.activate(None);
|
||||||
}
|
}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
// @TODO any action here?
|
// @TODO any action here?
|
||||||
@ -235,7 +235,7 @@ impl Page {
|
|||||||
self.navigation.set_request_text(&request_text);
|
self.navigation.set_request_text(&request_text);
|
||||||
|
|
||||||
// Reload page
|
// Reload page
|
||||||
self.action_tab_page_navigation_reload.activate(None);
|
self.action_page_reload.activate(None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}; // Uri::parse
|
}; // Uri::parse
|
||||||
|
@ -22,11 +22,11 @@ impl Text {
|
|||||||
pub fn gemini(
|
pub fn gemini(
|
||||||
gemtext: &str,
|
gemtext: &str,
|
||||||
base: &Uri,
|
base: &Uri,
|
||||||
action_tab_append: SimpleAction,
|
action_page_new: SimpleAction,
|
||||||
action_page_open: SimpleAction,
|
action_page_open: SimpleAction,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
// Init components
|
// 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
|
// Init meta
|
||||||
let meta = Meta {
|
let meta = Meta {
|
||||||
|
@ -30,22 +30,22 @@ pub struct Navigation {
|
|||||||
|
|
||||||
impl Navigation {
|
impl Navigation {
|
||||||
pub fn new_arc(
|
pub fn new_arc(
|
||||||
action_tab_page_navigation_base: SimpleAction,
|
action_page_base: SimpleAction,
|
||||||
action_tab_page_navigation_history_back: SimpleAction,
|
action_page_history_back: SimpleAction,
|
||||||
action_tab_page_navigation_history_forward: SimpleAction,
|
action_page_history_forward: SimpleAction,
|
||||||
action_tab_page_navigation_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_tab_page_navigation_base);
|
let base = Base::new_arc(action_page_base);
|
||||||
let history = History::new_arc(
|
let history = History::new_arc(
|
||||||
action_tab_page_navigation_history_back,
|
action_page_history_back,
|
||||||
action_tab_page_navigation_history_forward,
|
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(
|
let request = Request::new_arc(
|
||||||
action_update.clone(),
|
action_update.clone(),
|
||||||
action_tab_page_navigation_reload.clone(),
|
action_page_reload.clone(),
|
||||||
);
|
);
|
||||||
let bookmark = Bookmark::new_arc();
|
let bookmark = Bookmark::new_arc();
|
||||||
|
|
||||||
|
@ -10,18 +10,18 @@ use gtk::{
|
|||||||
use std::{cell::RefCell, sync::Arc};
|
use std::{cell::RefCell, sync::Arc};
|
||||||
|
|
||||||
pub struct Base {
|
pub struct Base {
|
||||||
action_tab_page_navigation_base: SimpleAction,
|
action_page_base: SimpleAction,
|
||||||
uri: RefCell<Option<Uri>>,
|
uri: RefCell<Option<Uri>>,
|
||||||
widget: Arc<Widget>,
|
widget: Arc<Widget>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Base {
|
impl Base {
|
||||||
// Construct
|
// 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 {
|
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),
|
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);
|
self.uri.replace(uri);
|
||||||
|
|
||||||
// Update action status
|
// Update action status
|
||||||
self.action_tab_page_navigation_base.set_enabled(status);
|
self.action_page_base.set_enabled(status);
|
||||||
|
|
||||||
// Update child components
|
// Update child components
|
||||||
self.widget.update(status);
|
self.widget.update(status);
|
||||||
|
@ -11,7 +11,7 @@ pub struct Widget {
|
|||||||
|
|
||||||
impl Widget {
|
impl Widget {
|
||||||
// Construct
|
// 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
|
// Init gobject
|
||||||
let gobject = Button::builder()
|
let gobject = Button::builder()
|
||||||
.icon_name("go-home-symbolic")
|
.icon_name("go-home-symbolic")
|
||||||
@ -21,9 +21,9 @@ impl Widget {
|
|||||||
|
|
||||||
// Init events
|
// Init events
|
||||||
gobject.connect_clicked({
|
gobject.connect_clicked({
|
||||||
let action_tab_page_navigation_base = action_tab_page_navigation_base.clone();
|
let action_page_base = action_page_base.clone();
|
||||||
move |_| {
|
move |_| {
|
||||||
action_tab_page_navigation_base.activate(None);
|
action_page_base.activate(None);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -28,12 +28,12 @@ pub struct History {
|
|||||||
impl History {
|
impl History {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn new_arc(
|
pub fn new_arc(
|
||||||
action_tab_page_navigation_history_back: SimpleAction,
|
action_page_history_back: SimpleAction,
|
||||||
action_tab_page_navigation_history_forward: SimpleAction,
|
action_page_history_forward: SimpleAction,
|
||||||
) -> Arc<Self> {
|
) -> Arc<Self> {
|
||||||
// init components
|
// init components
|
||||||
let back = Back::new_arc(action_tab_page_navigation_history_back);
|
let back = Back::new_arc(action_page_history_back);
|
||||||
let forward = Forward::new_arc(action_tab_page_navigation_history_forward);
|
let forward = Forward::new_arc(action_page_history_forward);
|
||||||
|
|
||||||
// Init widget
|
// Init widget
|
||||||
let widget = Widget::new_arc(back.gobject(), forward.gobject());
|
let widget = Widget::new_arc(back.gobject(), forward.gobject());
|
||||||
|
@ -6,25 +6,25 @@ use gtk::{gio::SimpleAction, Button};
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
pub struct Back {
|
pub struct Back {
|
||||||
action_tab_page_navigation_history_back: SimpleAction,
|
action_page_history_back: SimpleAction,
|
||||||
widget: Arc<Widget>,
|
widget: Arc<Widget>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Back {
|
impl Back {
|
||||||
// Construct
|
// 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
|
// Return activated struct
|
||||||
Arc::new(Self {
|
Arc::new(Self {
|
||||||
action_tab_page_navigation_history_back: action_tab_page_navigation_history_back
|
action_page_history_back: action_page_history_back
|
||||||
.clone(),
|
.clone(),
|
||||||
widget: Widget::new_arc(action_tab_page_navigation_history_back),
|
widget: Widget::new_arc(action_page_history_back),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
pub fn update(&self, status: bool) {
|
pub fn update(&self, status: bool) {
|
||||||
// Update actions
|
// Update actions
|
||||||
self.action_tab_page_navigation_history_back
|
self.action_page_history_back
|
||||||
.set_enabled(status);
|
.set_enabled(status);
|
||||||
|
|
||||||
// Update child components
|
// Update child components
|
||||||
|
@ -11,7 +11,7 @@ pub struct Widget {
|
|||||||
|
|
||||||
impl Widget {
|
impl Widget {
|
||||||
// Construct
|
// 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
|
// Init gobject
|
||||||
let gobject = Button::builder()
|
let gobject = Button::builder()
|
||||||
.icon_name("go-previous-symbolic")
|
.icon_name("go-previous-symbolic")
|
||||||
@ -21,10 +21,10 @@ impl Widget {
|
|||||||
|
|
||||||
// Init events
|
// Init events
|
||||||
gobject.connect_clicked({
|
gobject.connect_clicked({
|
||||||
let action_tab_page_navigation_history_back =
|
let action_page_history_back =
|
||||||
action_tab_page_navigation_history_back.clone();
|
action_page_history_back.clone();
|
||||||
move |_| {
|
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;
|
use std::sync::Arc;
|
||||||
|
|
||||||
pub struct Forward {
|
pub struct Forward {
|
||||||
action_tab_page_navigation_history_forward: SimpleAction,
|
action_page_history_forward: SimpleAction,
|
||||||
widget: Arc<Widget>,
|
widget: Arc<Widget>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Forward {
|
impl Forward {
|
||||||
// Construct
|
// 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
|
// Return activated struct
|
||||||
Arc::new(Self {
|
Arc::new(Self {
|
||||||
action_tab_page_navigation_history_forward: action_tab_page_navigation_history_forward
|
action_page_history_forward: action_page_history_forward
|
||||||
.clone(),
|
.clone(),
|
||||||
widget: Widget::new_arc(action_tab_page_navigation_history_forward),
|
widget: Widget::new_arc(action_page_history_forward),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
pub fn update(&self, status: bool) {
|
pub fn update(&self, status: bool) {
|
||||||
// Update actions
|
// Update actions
|
||||||
self.action_tab_page_navigation_history_forward
|
self.action_page_history_forward
|
||||||
.set_enabled(status);
|
.set_enabled(status);
|
||||||
|
|
||||||
// Update child components
|
// Update child components
|
||||||
|
@ -11,7 +11,7 @@ pub struct Widget {
|
|||||||
|
|
||||||
impl Widget {
|
impl Widget {
|
||||||
// Construct
|
// 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
|
// Init gobject
|
||||||
let gobject = Button::builder()
|
let gobject = Button::builder()
|
||||||
.icon_name("go-next-symbolic")
|
.icon_name("go-next-symbolic")
|
||||||
@ -21,10 +21,10 @@ impl Widget {
|
|||||||
|
|
||||||
// Init events
|
// Init events
|
||||||
gobject.connect_clicked({
|
gobject.connect_clicked({
|
||||||
let action_tab_page_navigation_history_forward =
|
let action_page_history_forward =
|
||||||
action_tab_page_navigation_history_forward.clone();
|
action_page_history_forward.clone();
|
||||||
move |_| {
|
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;
|
use std::sync::Arc;
|
||||||
|
|
||||||
pub struct Reload {
|
pub struct Reload {
|
||||||
action_tab_page_navigation_reload: SimpleAction,
|
action_page_reload: SimpleAction,
|
||||||
widget: Arc<Widget>,
|
widget: Arc<Widget>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Reload {
|
impl Reload {
|
||||||
// Construct
|
// 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 {
|
Arc::new(Self {
|
||||||
action_tab_page_navigation_reload: action_tab_page_navigation_reload.clone(),
|
action_page_reload: action_page_reload.clone(),
|
||||||
widget: Widget::new_arc(action_tab_page_navigation_reload),
|
widget: Widget::new_arc(action_page_reload),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
pub fn update(&self, is_enabled: bool) {
|
pub fn update(&self, is_enabled: bool) {
|
||||||
// Update actions
|
// Update actions
|
||||||
self.action_tab_page_navigation_reload
|
self.action_page_reload
|
||||||
.set_enabled(is_enabled);
|
.set_enabled(is_enabled);
|
||||||
|
|
||||||
// Update child components
|
// Update child components
|
||||||
|
@ -11,7 +11,7 @@ pub struct Widget {
|
|||||||
|
|
||||||
impl Widget {
|
impl Widget {
|
||||||
// Construct
|
// 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
|
// Init gobject
|
||||||
let gobject = Button::builder()
|
let gobject = Button::builder()
|
||||||
.icon_name("view-refresh-symbolic")
|
.icon_name("view-refresh-symbolic")
|
||||||
@ -21,9 +21,9 @@ impl Widget {
|
|||||||
|
|
||||||
// Init events
|
// Init events
|
||||||
gobject.connect_clicked({
|
gobject.connect_clicked({
|
||||||
let action_tab_page_navigation_reload = action_tab_page_navigation_reload.clone();
|
let action_page_reload = action_page_reload.clone();
|
||||||
move |_| {
|
move |_| {
|
||||||
action_tab_page_navigation_reload.activate(None);
|
action_page_reload.activate(None);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -22,10 +22,10 @@ impl Request {
|
|||||||
pub fn new_arc(
|
pub fn new_arc(
|
||||||
// Actions
|
// Actions
|
||||||
action_update: SimpleAction,
|
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<Self> {
|
||||||
Arc::new(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
|
// Construct
|
||||||
pub fn new_arc(
|
pub fn new_arc(
|
||||||
action_update: SimpleAction,
|
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<Self> {
|
||||||
// Init animated progress bar state
|
// Init animated progress bar state
|
||||||
let progress = Arc::new(Progress {
|
let progress = Arc::new(Progress {
|
||||||
@ -60,7 +60,7 @@ impl Widget {
|
|||||||
});
|
});
|
||||||
|
|
||||||
gobject.connect_activate(move |_| {
|
gobject.connect_activate(move |_| {
|
||||||
action_tab_page_navigation_reload.activate(None);
|
action_page_reload.activate(None);
|
||||||
});
|
});
|
||||||
|
|
||||||
primary_button_controller.connect_pressed({
|
primary_button_controller.connect_pressed({
|
||||||
|
@ -11,10 +11,10 @@ pub struct Widget {
|
|||||||
|
|
||||||
impl Widget {
|
impl Widget {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn new(action_tab_append: SimpleAction) -> Self {
|
pub fn new(action_page_new: SimpleAction) -> Self {
|
||||||
// Init additional action group
|
// Init additional action group
|
||||||
let action_group = SimpleActionGroup::new();
|
let action_group = SimpleActionGroup::new();
|
||||||
action_group.add_action(&action_tab_append);
|
action_group.add_action(&action_page_new);
|
||||||
|
|
||||||
// Init gobject
|
// Init gobject
|
||||||
let gobject = TabView::new();
|
let gobject = TabView::new();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user