mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05:27 +00:00
drop Arc from SimpleAction #1
This commit is contained in:
parent
08ad677ba4
commit
920721412e
40 changed files with 162 additions and 175 deletions
|
|
@ -35,9 +35,9 @@ use std::{cell::RefCell, sync::Arc};
|
|||
pub struct Page {
|
||||
id: GString,
|
||||
// Actions
|
||||
action_page_open: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_reload: Arc<SimpleAction>,
|
||||
action_update: Arc<SimpleAction>,
|
||||
action_page_open: SimpleAction,
|
||||
action_tab_page_navigation_reload: SimpleAction,
|
||||
action_update: SimpleAction,
|
||||
// Components
|
||||
navigation: Arc<Navigation>,
|
||||
content: Arc<Content>,
|
||||
|
|
@ -52,18 +52,16 @@ impl Page {
|
|||
// Construct
|
||||
pub fn new_arc(
|
||||
id: GString,
|
||||
action_tab_open: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_base: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_history_back: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_history_forward: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_reload: Arc<SimpleAction>,
|
||||
action_update: Arc<SimpleAction>,
|
||||
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_update: SimpleAction,
|
||||
) -> Arc<Self> {
|
||||
// Init local actions
|
||||
let action_page_open = Arc::new(SimpleAction::new(
|
||||
&uuid_string_random(),
|
||||
Some(&String::static_variant_type()),
|
||||
));
|
||||
let action_page_open =
|
||||
SimpleAction::new(&uuid_string_random(), Some(&String::static_variant_type()));
|
||||
|
||||
// Init components
|
||||
let content = Arc::new(Content::new(
|
||||
|
|
|
|||
|
|
@ -13,20 +13,17 @@ use gtk::{
|
|||
prelude::{BoxExt, WidgetExt},
|
||||
Box, Orientation,
|
||||
};
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct Content {
|
||||
// GTK
|
||||
gobject: Box,
|
||||
// Actions
|
||||
action_tab_open: Arc<SimpleAction>,
|
||||
action_page_open: Arc<SimpleAction>,
|
||||
action_tab_open: SimpleAction,
|
||||
action_page_open: SimpleAction,
|
||||
}
|
||||
|
||||
impl Content {
|
||||
// Construct
|
||||
pub fn new(action_tab_open: Arc<SimpleAction>, action_page_open: Arc<SimpleAction>) -> Self {
|
||||
pub fn new(action_tab_open: SimpleAction, action_page_open: SimpleAction) -> Self {
|
||||
Self {
|
||||
gobject: Box::builder().orientation(Orientation::Vertical).build(),
|
||||
action_tab_open,
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ use gtk::{
|
|||
ScrolledWindow,
|
||||
};
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct Meta {
|
||||
title: Option<GString>,
|
||||
}
|
||||
|
|
@ -24,8 +22,8 @@ impl Text {
|
|||
pub fn gemini(
|
||||
gemtext: &str,
|
||||
base: &Uri,
|
||||
action_tab_append: Arc<SimpleAction>,
|
||||
action_page_open: Arc<SimpleAction>,
|
||||
action_tab_append: SimpleAction,
|
||||
action_page_open: SimpleAction,
|
||||
) -> Self {
|
||||
// Init components
|
||||
let gemini = Gemini::new(gemtext, base, action_tab_append, action_page_open);
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ impl Gemini {
|
|||
pub fn new(
|
||||
gemtext: &str,
|
||||
base: &Uri,
|
||||
action_tab_open: Arc<SimpleAction>,
|
||||
action_page_open: Arc<SimpleAction>,
|
||||
action_tab_open: SimpleAction,
|
||||
action_page_open: SimpleAction,
|
||||
) -> Self {
|
||||
// Init components
|
||||
let reader = Reader::new_arc(gemtext, base, action_tab_open, action_page_open);
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ impl Reader {
|
|||
pub fn new_arc(
|
||||
gemtext: &str,
|
||||
base: &Uri,
|
||||
action_tab_open: Arc<SimpleAction>,
|
||||
action_page_open: Arc<SimpleAction>,
|
||||
action_tab_open: SimpleAction,
|
||||
action_page_open: SimpleAction,
|
||||
) -> Arc<Self> {
|
||||
// Init default values
|
||||
let mut title = None;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ impl Input {
|
|||
// Setters
|
||||
pub fn set_new_response(
|
||||
&self,
|
||||
action_page_open: Arc<SimpleAction>,
|
||||
action_page_open: SimpleAction,
|
||||
base: Uri,
|
||||
title: Option<&str>,
|
||||
size_limit: Option<usize>,
|
||||
|
|
@ -44,7 +44,7 @@ impl Input {
|
|||
|
||||
pub fn set_new_sensitive(
|
||||
&self,
|
||||
action_page_open: Arc<SimpleAction>,
|
||||
action_page_open: SimpleAction,
|
||||
base: Uri,
|
||||
title: Option<&str>,
|
||||
max_length: Option<i32>,
|
||||
|
|
|
|||
|
|
@ -24,14 +24,14 @@ pub struct Response {
|
|||
impl Response {
|
||||
// Construct
|
||||
pub fn new_arc(
|
||||
action_page_open: Arc<SimpleAction>,
|
||||
action_page_open: SimpleAction,
|
||||
base: Uri,
|
||||
title: Option<&str>,
|
||||
size_limit: Option<usize>,
|
||||
) -> Arc<Self> {
|
||||
// Init local actions
|
||||
let action_update = Arc::new(SimpleAction::new(&uuid_string_random(), None));
|
||||
let action_send = Arc::new(SimpleAction::new(&uuid_string_random(), None));
|
||||
let action_update = SimpleAction::new(&uuid_string_random(), None);
|
||||
let action_send = SimpleAction::new(&uuid_string_random(), None);
|
||||
|
||||
// Init components
|
||||
let control = Control::new_arc(action_send.clone());
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ pub struct Control {
|
|||
|
||||
impl Control {
|
||||
// Construct
|
||||
pub fn new_arc(action_send: Arc<SimpleAction>) -> Arc<Self> {
|
||||
pub fn new_arc(action_send: SimpleAction) -> Arc<Self> {
|
||||
// Init components
|
||||
let counter = Counter::new_arc();
|
||||
let send = Send::new_arc(action_send);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ pub struct Send {
|
|||
|
||||
impl Send {
|
||||
// Construct
|
||||
pub fn new_arc(action_send: Arc<SimpleAction>) -> Arc<Self> {
|
||||
pub fn new_arc(action_send: SimpleAction) -> Arc<Self> {
|
||||
// Init widget
|
||||
let widget = Widget::new_arc(action_send);
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(action_send: Arc<SimpleAction>) -> Arc<Self> {
|
||||
pub fn new_arc(action_send: SimpleAction) -> Arc<Self> {
|
||||
// Init gobject
|
||||
let gobject = Button::builder()
|
||||
//.css_classes(["accent"])
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ pub struct Form {
|
|||
|
||||
impl Form {
|
||||
// Construct
|
||||
pub fn new_arc(action_update: Arc<SimpleAction>) -> Arc<Self> {
|
||||
pub fn new_arc(action_update: SimpleAction) -> Arc<Self> {
|
||||
// Init widget
|
||||
let widget = Widget::new_arc(action_update);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(action_update: Arc<SimpleAction>) -> Arc<Self> {
|
||||
pub fn new_arc(action_update: SimpleAction) -> Arc<Self> {
|
||||
// Init gobject
|
||||
let gobject = TextView::builder()
|
||||
.bottom_margin(MARGIN)
|
||||
|
|
|
|||
|
|
@ -20,13 +20,13 @@ pub struct Sensitive {
|
|||
impl Sensitive {
|
||||
// Construct
|
||||
pub fn new_arc(
|
||||
action_page_open: Arc<SimpleAction>,
|
||||
action_page_open: SimpleAction,
|
||||
base: Uri,
|
||||
title: Option<&str>,
|
||||
max_length: Option<i32>,
|
||||
) -> Arc<Self> {
|
||||
// Init local actions
|
||||
let action_send = Arc::new(SimpleAction::new(&uuid_string_random(), None));
|
||||
let action_send = SimpleAction::new(&uuid_string_random(), None);
|
||||
|
||||
// Init components
|
||||
let form = Form::new_arc(
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ pub struct Form {
|
|||
impl Form {
|
||||
// Construct
|
||||
pub fn new_arc(
|
||||
action_send: Arc<SimpleAction>,
|
||||
action_send: SimpleAction,
|
||||
title: Option<&str>,
|
||||
max_length: Option<i32>,
|
||||
) -> Arc<Self> {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ pub struct Widget {
|
|||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(
|
||||
action_send: Arc<SimpleAction>,
|
||||
action_send: SimpleAction,
|
||||
title: Option<&str>,
|
||||
max_length: Option<i32>,
|
||||
) -> Arc<Self> {
|
||||
|
|
|
|||
|
|
@ -30,11 +30,11 @@ pub struct Navigation {
|
|||
|
||||
impl Navigation {
|
||||
pub fn new_arc(
|
||||
action_tab_page_navigation_base: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_history_back: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_history_forward: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_reload: Arc<SimpleAction>,
|
||||
action_update: Arc<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_update: SimpleAction,
|
||||
) -> Arc<Self> {
|
||||
// Init components
|
||||
let base = Base::new_arc(action_tab_page_navigation_base);
|
||||
|
|
|
|||
|
|
@ -10,14 +10,14 @@ use gtk::{
|
|||
use std::{cell::RefCell, sync::Arc};
|
||||
|
||||
pub struct Base {
|
||||
action_tab_page_navigation_base: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_base: SimpleAction,
|
||||
uri: RefCell<Option<Uri>>,
|
||||
widget: Arc<Widget>,
|
||||
}
|
||||
|
||||
impl Base {
|
||||
// Construct
|
||||
pub fn new_arc(action_tab_page_navigation_base: Arc<SimpleAction>) -> Arc<Self> {
|
||||
pub fn new_arc(action_tab_page_navigation_base: SimpleAction) -> Arc<Self> {
|
||||
Arc::new(Self {
|
||||
action_tab_page_navigation_base: action_tab_page_navigation_base.clone(),
|
||||
uri: RefCell::new(None),
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(action_tab_page_navigation_base: Arc<SimpleAction>) -> Arc<Self> {
|
||||
pub fn new_arc(action_tab_page_navigation_base: SimpleAction) -> Arc<Self> {
|
||||
// Init gobject
|
||||
let gobject = Button::builder()
|
||||
.icon_name("go-home-symbolic")
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ pub struct History {
|
|||
impl History {
|
||||
// Construct
|
||||
pub fn new_arc(
|
||||
action_tab_page_navigation_history_back: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_history_forward: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_history_back: SimpleAction,
|
||||
action_tab_page_navigation_history_forward: SimpleAction,
|
||||
) -> Arc<Self> {
|
||||
// init components
|
||||
let back = Back::new_arc(action_tab_page_navigation_history_back);
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@ use gtk::{gio::SimpleAction, Button};
|
|||
use std::sync::Arc;
|
||||
|
||||
pub struct Back {
|
||||
action_tab_page_navigation_history_back: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_history_back: SimpleAction,
|
||||
widget: Arc<Widget>,
|
||||
}
|
||||
|
||||
impl Back {
|
||||
// Construct
|
||||
pub fn new_arc(action_tab_page_navigation_history_back: Arc<SimpleAction>) -> Arc<Self> {
|
||||
pub fn new_arc(action_tab_page_navigation_history_back: SimpleAction) -> Arc<Self> {
|
||||
// Return activated struct
|
||||
Arc::new(Self {
|
||||
action_tab_page_navigation_history_back: action_tab_page_navigation_history_back
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(action_tab_page_navigation_history_back: Arc<SimpleAction>) -> Arc<Self> {
|
||||
pub fn new_arc(action_tab_page_navigation_history_back: SimpleAction) -> Arc<Self> {
|
||||
// Init gobject
|
||||
let gobject = Button::builder()
|
||||
.icon_name("go-previous-symbolic")
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@ use gtk::{gio::SimpleAction, Button};
|
|||
use std::sync::Arc;
|
||||
|
||||
pub struct Forward {
|
||||
action_tab_page_navigation_history_forward: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_history_forward: SimpleAction,
|
||||
widget: Arc<Widget>,
|
||||
}
|
||||
|
||||
impl Forward {
|
||||
// Construct
|
||||
pub fn new_arc(action_tab_page_navigation_history_forward: Arc<SimpleAction>) -> Arc<Self> {
|
||||
pub fn new_arc(action_tab_page_navigation_history_forward: SimpleAction) -> Arc<Self> {
|
||||
// Return activated struct
|
||||
Arc::new(Self {
|
||||
action_tab_page_navigation_history_forward: action_tab_page_navigation_history_forward
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(action_tab_page_navigation_history_forward: Arc<SimpleAction>) -> Arc<Self> {
|
||||
pub fn new_arc(action_tab_page_navigation_history_forward: SimpleAction) -> Arc<Self> {
|
||||
// Init gobject
|
||||
let gobject = Button::builder()
|
||||
.icon_name("go-next-symbolic")
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@ use gtk::{gio::SimpleAction, Button};
|
|||
use std::sync::Arc;
|
||||
|
||||
pub struct Reload {
|
||||
action_tab_page_navigation_reload: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_reload: SimpleAction,
|
||||
widget: Arc<Widget>,
|
||||
}
|
||||
|
||||
impl Reload {
|
||||
// Construct
|
||||
pub fn new_arc(action_tab_page_navigation_reload: Arc<SimpleAction>) -> Arc<Self> {
|
||||
pub fn new_arc(action_tab_page_navigation_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),
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(action_tab_page_navigation_reload: Arc<SimpleAction>) -> Arc<Self> {
|
||||
pub fn new_arc(action_tab_page_navigation_reload: SimpleAction) -> Arc<Self> {
|
||||
// Init gobject
|
||||
let gobject = Button::builder()
|
||||
.icon_name("view-refresh-symbolic")
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ impl Request {
|
|||
// Construct
|
||||
pub fn new_arc(
|
||||
// Actions
|
||||
action_update: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_reload: Arc<SimpleAction>, // @TODO local `action_page_open`?
|
||||
action_update: SimpleAction,
|
||||
action_tab_page_navigation_reload: SimpleAction, // @TODO local `action_page_open`?
|
||||
) -> Arc<Self> {
|
||||
Arc::new(Self {
|
||||
widget: Widget::new_arc(action_update, action_tab_page_navigation_reload),
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ pub struct Widget {
|
|||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(
|
||||
action_update: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_reload: Arc<SimpleAction>, // @TODO local `action_page_open`?
|
||||
action_update: SimpleAction,
|
||||
action_tab_page_navigation_reload: SimpleAction, // @TODO local `action_page_open`?
|
||||
) -> Arc<Self> {
|
||||
// Init animated progress bar state
|
||||
let progress = Arc::new(Progress {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ impl Widget {
|
|||
pub fn new_arc(
|
||||
name: &str,
|
||||
// Actions
|
||||
action_page_open: Arc<SimpleAction>,
|
||||
action_page_open: SimpleAction,
|
||||
// Components
|
||||
navigation: &Box,
|
||||
content: &Box,
|
||||
|
|
@ -24,7 +24,7 @@ impl Widget {
|
|||
) -> Arc<Self> {
|
||||
// Init additional action group
|
||||
let action_group = SimpleActionGroup::new();
|
||||
action_group.add_action(action_page_open.as_ref());
|
||||
action_group.add_action(&action_page_open);
|
||||
|
||||
// Init self
|
||||
let gobject = Box::builder()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue