mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05:27 +00:00
rename actions
This commit is contained in:
parent
2d08e8386d
commit
313122e5c3
26 changed files with 274 additions and 290 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue