mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-02-10 18:34:14 +00:00
drop Arc from SimpleAction #1
This commit is contained in:
parent
08ad677ba4
commit
920721412e
@ -27,7 +27,7 @@ pub struct App {
|
||||
profile_database_connection: Arc<RwLock<Connection>>,
|
||||
// database: Arc<Database>,
|
||||
// Actions
|
||||
// action_update: Arc<SimpleAction>,
|
||||
// action_update: SimpleAction,
|
||||
// Components
|
||||
// browser: Arc<Browser>,
|
||||
// GTK
|
||||
|
@ -2,8 +2,6 @@
|
||||
// and replace them with objects (to follow encapsulation for children mods)
|
||||
// @TODO find alternative implementation, if exist for GTK 4
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use gtk::{
|
||||
gio::SimpleAction,
|
||||
glib::{gformat, uuid_string_random, GString, VariantTy},
|
||||
@ -12,14 +10,14 @@ use gtk::{
|
||||
|
||||
pub struct Action {
|
||||
group: GString,
|
||||
simple: Arc<SimpleAction>,
|
||||
simple: SimpleAction,
|
||||
}
|
||||
|
||||
impl Action {
|
||||
// Construct
|
||||
pub fn new(group: &str, is_enabled: bool, parameter_type: Option<&VariantTy>) -> Self {
|
||||
// Create random action name as no static values should be in use
|
||||
let simple = Arc::new(SimpleAction::new(&uuid_string_random(), parameter_type));
|
||||
let simple = SimpleAction::new(&uuid_string_random(), parameter_type);
|
||||
simple.set_enabled(is_enabled);
|
||||
|
||||
// Assign action to the group
|
||||
@ -36,7 +34,7 @@ impl Action {
|
||||
}
|
||||
|
||||
// App mods work with simple and system-wide data types, let them take it
|
||||
pub fn simple(&self) -> Arc<SimpleAction> {
|
||||
pub fn simple(&self) -> SimpleAction {
|
||||
self.simple.clone()
|
||||
}
|
||||
}
|
||||
|
@ -28,18 +28,18 @@ impl Browser {
|
||||
// Extras
|
||||
profile_path: PathBuf,
|
||||
// Actions
|
||||
action_tool_debug: Arc<SimpleAction>,
|
||||
action_tool_profile: Arc<SimpleAction>,
|
||||
action_quit: Arc<SimpleAction>,
|
||||
action_update: Arc<SimpleAction>,
|
||||
action_tab_append: Arc<SimpleAction>,
|
||||
action_tab_close: Arc<SimpleAction>,
|
||||
action_tab_close_all: 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_tab_pin: Arc<SimpleAction>,
|
||||
action_tool_debug: SimpleAction,
|
||||
action_tool_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,
|
||||
) -> Browser {
|
||||
let window = Arc::new(Window::new(
|
||||
action_tool_debug.clone(),
|
||||
@ -60,26 +60,26 @@ impl Browser {
|
||||
let widget = Arc::new(Widget::new(window.gobject()));
|
||||
|
||||
// Assign actions
|
||||
widget.gobject().add_action(action_tool_debug.as_ref());
|
||||
widget.gobject().add_action(action_tool_profile.as_ref());
|
||||
widget.gobject().add_action(action_quit.as_ref());
|
||||
widget.gobject().add_action(action_update.as_ref());
|
||||
widget.gobject().add_action(action_tab_append.as_ref());
|
||||
widget.gobject().add_action(action_tab_close.as_ref());
|
||||
widget.gobject().add_action(action_tab_close_all.as_ref());
|
||||
widget.gobject().add_action(&action_tool_debug);
|
||||
widget.gobject().add_action(&action_tool_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.as_ref());
|
||||
.add_action(&action_tab_page_navigation_base);
|
||||
widget
|
||||
.gobject()
|
||||
.add_action(action_tab_page_navigation_history_back.as_ref());
|
||||
.add_action(&action_tab_page_navigation_history_back);
|
||||
widget
|
||||
.gobject()
|
||||
.add_action(action_tab_page_navigation_history_forward.as_ref());
|
||||
.add_action(&action_tab_page_navigation_history_forward);
|
||||
widget
|
||||
.gobject()
|
||||
.add_action(action_tab_page_navigation_reload.as_ref());
|
||||
widget.gobject().add_action(action_tab_pin.as_ref());
|
||||
.add_action(&action_tab_page_navigation_reload);
|
||||
widget.gobject().add_action(&action_tab_pin);
|
||||
|
||||
// Init events
|
||||
action_tool_debug.connect_activate({
|
||||
|
@ -23,18 +23,18 @@ impl Window {
|
||||
// Construct
|
||||
pub fn new(
|
||||
// Actions
|
||||
action_tool_debug: Arc<SimpleAction>,
|
||||
action_tool_profile: Arc<SimpleAction>,
|
||||
action_quit: Arc<SimpleAction>,
|
||||
action_update: Arc<SimpleAction>,
|
||||
action_tab_append: Arc<SimpleAction>,
|
||||
action_tab_close: Arc<SimpleAction>,
|
||||
action_tab_close_all: 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_tab_pin: Arc<SimpleAction>,
|
||||
action_tool_debug: SimpleAction,
|
||||
action_tool_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,
|
||||
) -> Self {
|
||||
// Init components
|
||||
let tab = Tab::new_arc(
|
||||
|
@ -16,17 +16,17 @@ impl Header {
|
||||
// Construct
|
||||
pub fn new_arc(
|
||||
// Actions
|
||||
action_tool_debug: Arc<SimpleAction>,
|
||||
action_tool_profile: Arc<SimpleAction>,
|
||||
action_quit: Arc<SimpleAction>,
|
||||
action_tab_append: Arc<SimpleAction>,
|
||||
action_tab_close: Arc<SimpleAction>,
|
||||
action_tab_close_all: 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_tab_pin: Arc<SimpleAction>,
|
||||
action_tool_debug: SimpleAction,
|
||||
action_tool_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,
|
||||
// Widgets
|
||||
tab_view: &TabView,
|
||||
) -> Arc<Self> {
|
||||
|
@ -21,17 +21,17 @@ pub struct Bar {
|
||||
impl Bar {
|
||||
// Construct
|
||||
pub fn new_arc(
|
||||
action_tool_debug: Arc<SimpleAction>,
|
||||
action_tool_profile: Arc<SimpleAction>,
|
||||
action_quit: Arc<SimpleAction>,
|
||||
action_tab_append: Arc<SimpleAction>,
|
||||
action_tab_close: Arc<SimpleAction>,
|
||||
action_tab_close_all: 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_tab_pin: Arc<SimpleAction>,
|
||||
action_tool_debug: SimpleAction,
|
||||
action_tool_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,
|
||||
view: &TabView,
|
||||
) -> Arc<Self> {
|
||||
// Init components
|
||||
|
@ -11,7 +11,7 @@ pub struct Append {
|
||||
|
||||
impl Append {
|
||||
// Construct
|
||||
pub fn new_arc(action_tab_append: Arc<SimpleAction>) -> Arc<Self> {
|
||||
pub fn new_arc(action_tab_append: SimpleAction) -> Arc<Self> {
|
||||
Arc::new(Self {
|
||||
widget: Widget::new_arc(action_tab_append),
|
||||
})
|
||||
|
@ -11,7 +11,7 @@ pub struct Widget {
|
||||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(action_tab_append: Arc<SimpleAction>) -> Arc<Self> {
|
||||
pub fn new_arc(action_tab_append: SimpleAction) -> Arc<Self> {
|
||||
// Init gobject
|
||||
let gobject = Button::builder()
|
||||
.icon_name("tab-new-symbolic")
|
||||
|
@ -17,17 +17,17 @@ pub struct Menu {
|
||||
#[rustfmt::skip] // @TODO template builder?
|
||||
impl Menu {
|
||||
pub fn new_arc(
|
||||
action_tool_debug: Arc<SimpleAction>,
|
||||
action_tool_profile: Arc<SimpleAction>,
|
||||
action_quit: Arc<SimpleAction>,
|
||||
action_tab_append: Arc<SimpleAction>,
|
||||
action_tab_close: Arc<SimpleAction>,
|
||||
action_tab_close_all: 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_tab_pin: Arc<SimpleAction>,
|
||||
action_tool_debug: SimpleAction,
|
||||
action_tool_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,
|
||||
) -> Arc<Self> {
|
||||
// Init model
|
||||
let model = gio::Menu::new();
|
||||
@ -80,7 +80,7 @@ impl Menu {
|
||||
}
|
||||
|
||||
// Private helpers
|
||||
fn detailed_action_name(action: Arc<SimpleAction>) -> GString {
|
||||
fn detailed_action_name(action: SimpleAction) -> GString {
|
||||
gformat!("win.{}", action.name()) // @TODO find the way to ident parent group
|
||||
// without application-wide dependencies import
|
||||
// see also src/app/action.rs
|
||||
|
@ -18,13 +18,13 @@ use std::{cell::RefCell, collections::HashMap, sync::Arc};
|
||||
// Main
|
||||
pub struct Tab {
|
||||
// Local actions
|
||||
action_tab_open: Arc<SimpleAction>,
|
||||
action_tab_open: SimpleAction,
|
||||
// Global actions
|
||||
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,
|
||||
// Dynamically allocated reference index
|
||||
index: Arc<RefCell<HashMap<GString, Arc<Item>>>>,
|
||||
// GTK
|
||||
@ -35,17 +35,15 @@ impl Tab {
|
||||
// Construct
|
||||
pub fn new_arc(
|
||||
// Actions
|
||||
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 local actions
|
||||
let action_tab_open = Arc::new(SimpleAction::new(
|
||||
&uuid_string_random(),
|
||||
Some(&String::static_variant_type()),
|
||||
));
|
||||
let action_tab_open =
|
||||
SimpleAction::new(&uuid_string_random(), Some(&String::static_variant_type()));
|
||||
|
||||
// Init empty HashMap index as no tabs appended yet
|
||||
let index = Arc::new(RefCell::new(HashMap::new()));
|
||||
|
@ -28,12 +28,12 @@ impl Item {
|
||||
pub fn new_arc(
|
||||
tab_view: &TabView,
|
||||
// Actions
|
||||
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,
|
||||
// Options
|
||||
position: Option<i32>,
|
||||
is_pinned: bool,
|
||||
@ -128,12 +128,12 @@ impl Item {
|
||||
transaction: &Transaction,
|
||||
app_browser_window_tab_id: &i64,
|
||||
// Actions
|
||||
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,
|
||||
) -> Result<Vec<Arc<Item>>, String> {
|
||||
let mut items = Vec::new();
|
||||
|
||||
|
@ -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()
|
||||
|
@ -1,5 +1,3 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use adw::TabView;
|
||||
use gtk::{
|
||||
gio::{Icon, SimpleAction, SimpleActionGroup},
|
||||
@ -13,10 +11,10 @@ pub struct Widget {
|
||||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new(action_tab_append: Arc<SimpleAction>) -> Self {
|
||||
pub fn new(action_tab_append: SimpleAction) -> Self {
|
||||
// Init additional action group
|
||||
let action_group = SimpleActionGroup::new();
|
||||
action_group.add_action(action_tab_append.as_ref());
|
||||
action_group.add_action(&action_tab_append);
|
||||
|
||||
// Init gobject
|
||||
let gobject = TabView::new();
|
||||
|
Loading…
x
Reference in New Issue
Block a user