From c843e5b7c0c467b07dcc05887f0bd35e6f388b22 Mon Sep 17 00:00:00 2001 From: yggverse Date: Fri, 8 Nov 2024 05:21:08 +0200 Subject: [PATCH] replace arc with rc --- README.md | 2 +- src/app.rs | 20 +++-------- src/app/browser.rs | 12 +++---- src/app/browser/window.rs | 14 ++++---- src/app/browser/window/header.rs | 14 ++++---- src/app/browser/window/header/bar.rs | 18 +++++----- src/app/browser/window/header/bar/control.rs | 10 +++--- .../window/header/bar/control/widget.rs | 6 ++-- src/app/browser/window/header/bar/menu.rs | 10 +++--- .../browser/window/header/bar/menu/widget.rs | 6 ++-- src/app/browser/window/header/bar/tab.rs | 10 +++--- .../browser/window/header/bar/tab/append.rs | 10 +++--- .../window/header/bar/tab/append/widget.rs | 6 ++-- .../browser/window/header/bar/tab/widget.rs | 6 ++-- src/app/browser/window/header/bar/widget.rs | 6 ++-- src/app/browser/window/header/widget.rs | 6 ++-- src/app/browser/window/tab.rs | 22 ++++++------ src/app/browser/window/tab/item.rs | 20 +++++------ src/app/browser/window/tab/item/page.rs | 34 +++++++++---------- .../browser/window/tab/item/page/content.rs | 6 ++-- .../tab/item/page/content/text/gemini.rs | 10 +++--- .../item/page/content/text/gemini/reader.rs | 12 +++---- .../page/content/text/gemini/reader/widget.rs | 8 ++--- .../item/page/content/text/gemini/widget.rs | 6 ++-- src/app/browser/window/tab/item/page/input.rs | 14 ++++---- .../window/tab/item/page/input/response.rs | 18 +++++----- .../tab/item/page/input/response/control.rs | 18 +++++----- .../page/input/response/control/counter.rs | 10 +++--- .../input/response/control/counter/widget.rs | 6 ++-- .../item/page/input/response/control/send.rs | 10 +++--- .../input/response/control/send/widget.rs | 6 ++-- .../page/input/response/control/widget.rs | 6 ++-- .../tab/item/page/input/response/form.rs | 10 +++--- .../item/page/input/response/form/widget.rs | 6 ++-- .../tab/item/page/input/response/title.rs | 10 +++--- .../item/page/input/response/title/widget.rs | 6 ++-- .../tab/item/page/input/response/widget.rs | 6 ++-- .../window/tab/item/page/input/sensitive.rs | 14 ++++---- .../tab/item/page/input/sensitive/form.rs | 12 +++---- .../item/page/input/sensitive/form/widget.rs | 8 ++--- .../tab/item/page/input/sensitive/widget.rs | 6 ++-- .../window/tab/item/page/input/widget.rs | 6 ++-- src/app/browser/window/tab/item/page/meta.rs | 6 ++-- .../window/tab/item/page/navigation.rs | 32 ++++++++--------- .../tab/item/page/navigation/bookmark.rs | 10 +++--- .../item/page/navigation/bookmark/widget.rs | 6 ++-- .../tab/item/page/navigation/history.rs | 20 +++++------ .../tab/item/page/navigation/history/back.rs | 10 +++--- .../page/navigation/history/back/widget.rs | 9 +++-- .../item/page/navigation/history/forward.rs | 10 +++--- .../page/navigation/history/forward/widget.rs | 9 +++-- .../item/page/navigation/history/widget.rs | 6 ++-- .../window/tab/item/page/navigation/home.rs | 10 +++--- .../tab/item/page/navigation/home/widget.rs | 6 ++-- .../window/tab/item/page/navigation/reload.rs | 10 +++--- .../tab/item/page/navigation/reload/widget.rs | 6 ++-- .../tab/item/page/navigation/request.rs | 12 +++---- .../item/page/navigation/request/widget.rs | 12 +++---- .../window/tab/item/page/navigation/widget.rs | 8 ++--- .../browser/window/tab/item/page/widget.rs | 8 ++--- src/app/browser/window/tab/item/widget.rs | 8 ++--- src/main.rs | 7 ++-- 62 files changed, 317 insertions(+), 334 deletions(-) diff --git a/README.md b/README.md index fb602e86..1a88c239 100644 --- a/README.md +++ b/README.md @@ -176,7 +176,7 @@ Quick start guide and maintenance protocol * implementable `struct` is public, where it members - private * contain main `struct` implementation: * at least one constructor that must: - * have common for application names: `from`, `new` or/and `new_arc`, `new_mutex`, etc - on return object in container + * have common for application names: `from`, `new` or/and `new_rc`, `new_mutex`, etc - on return object in container * grant ownership for new `Self` object created * public `activate` action if the new object can not be activated on construct * public `link` getter for GTK `widget` (parental composition) diff --git a/src/app.rs b/src/app.rs index 8e3e5ae8..899ccbbc 100644 --- a/src/app.rs +++ b/src/app.rs @@ -15,30 +15,18 @@ use gtk::{ }; use sqlite::{Connection, Transaction}; -use std::{ - path::PathBuf, - sync::{Arc, RwLock}, -}; +use std::{path::PathBuf, rc::Rc, sync::RwLock}; const APPLICATION_ID: &str = "io.github.yggverse.Yoda"; pub struct App { - profile_database_connection: Arc>, - // database: Arc, - // Actions - // action_update: SimpleAction, - // Components - // browser: Arc, - // GTK + profile_database_connection: Rc>, gobject: Application, } impl App { // Construct - pub fn new( - profile_database_connection: Arc>, - profile_path: PathBuf, - ) -> Self { + pub fn new(profile_database_connection: Rc>, profile_path: PathBuf) -> Self { // Init defaults let default_state = (-1).to_variant(); @@ -100,7 +88,7 @@ impl App { } // Init components - let browser = Arc::new(Browser::new( + let browser = Rc::new(Browser::new( profile_path, action_about.clone(), action_debug.clone(), diff --git a/src/app/browser.rs b/src/app/browser.rs index a2048027..f24a2623 100644 --- a/src/app/browser.rs +++ b/src/app/browser.rs @@ -16,13 +16,13 @@ use gtk::{ FileLauncher, }; use sqlite::Transaction; -use std::{path::PathBuf, sync::Arc}; +use std::{path::PathBuf, rc::Rc}; pub struct Browser { // Components - // header: Arc
, - window: Arc, - widget: Arc, + // header: Rc
, + window: Rc, + widget: Rc, } impl Browser { @@ -46,7 +46,7 @@ impl Browser { action_page_pin: SimpleAction, ) -> Browser { // Init components - let window = Arc::new(Window::new( + let window = Rc::new(Window::new( action_about.clone(), action_debug.clone(), action_profile.clone(), @@ -63,7 +63,7 @@ impl Browser { )); // Init widget - let widget = Arc::new(Widget::new( + let widget = Rc::new(Widget::new( window.gobject(), &[ action_about.clone(), diff --git a/src/app/browser/window.rs b/src/app/browser/window.rs index 919f61e5..9fbe7af2 100644 --- a/src/app/browser/window.rs +++ b/src/app/browser/window.rs @@ -9,14 +9,14 @@ use sqlite::Transaction; use tab::Tab; use widget::Widget; -use std::sync::Arc; +use std::rc::Rc; use gtk::{gio::SimpleAction, Box}; pub struct Window { - //header: Arc
, - tab: Arc, - widget: Arc, + //header: Rc
, + tab: Rc, + widget: Rc, } impl Window { @@ -38,7 +38,7 @@ impl Window { action_page_pin: SimpleAction, ) -> Self { // Init components - let tab = Tab::new_arc( + let tab = Tab::new_rc( action_page_close.clone(), action_page_close_all.clone(), action_page_home.clone(), @@ -49,7 +49,7 @@ impl Window { action_update.clone(), ); - let header = Header::new_arc( + let header = Header::new_rc( // Actions action_about, action_debug, @@ -68,7 +68,7 @@ impl Window { ); // GTK - let widget = Arc::new(Widget::new(header.gobject(), tab.gobject())); + let widget = Rc::new(Widget::new(header.gobject(), tab.gobject())); // Init struct Self { diff --git a/src/app/browser/window/header.rs b/src/app/browser/window/header.rs index a3605f9a..b0a9f05a 100644 --- a/src/app/browser/window/header.rs +++ b/src/app/browser/window/header.rs @@ -6,15 +6,15 @@ use widget::Widget; use adw::{TabView, ToolbarView}; use gtk::gio::SimpleAction; -use std::sync::Arc; +use std::rc::Rc; pub struct Header { - widget: Arc, + widget: Rc, } impl Header { // Construct - pub fn new_arc( + pub fn new_rc( // Actions action_about: SimpleAction, action_debug: SimpleAction, @@ -30,9 +30,9 @@ impl Header { action_page_pin: SimpleAction, // Widgets tab_view: &TabView, - ) -> Arc { + ) -> Rc { // Init components - let bar = Bar::new_arc( + let bar = Bar::new_rc( action_about, action_debug, action_profile, @@ -49,8 +49,8 @@ impl Header { ); // Return new struct - Arc::new(Self { - widget: Widget::new_arc(bar.gobject()), + Rc::new(Self { + widget: Widget::new_rc(bar.gobject()), }) } diff --git a/src/app/browser/window/header/bar.rs b/src/app/browser/window/header/bar.rs index 9920c41d..dcccca47 100644 --- a/src/app/browser/window/header/bar.rs +++ b/src/app/browser/window/header/bar.rs @@ -10,15 +10,15 @@ use widget::Widget; use adw::TabView; use gtk::{gio::SimpleAction, Box}; -use std::sync::Arc; +use std::rc::Rc; pub struct Bar { - widget: Arc, + widget: Rc, } impl Bar { // Construct - pub fn new_arc( + pub fn new_rc( action_about: SimpleAction, action_debug: SimpleAction, action_profile: SimpleAction, @@ -32,11 +32,11 @@ impl Bar { action_page_reload: SimpleAction, action_page_pin: SimpleAction, view: &TabView, - ) -> Arc { + ) -> Rc { // Init components - let control = Control::new_arc(); - let tab = Tab::new_arc(action_page_new.clone(), view); - let menu = Menu::new_arc( + let control = Control::new_rc(); + let tab = Tab::new_rc(action_page_new.clone(), view); + let menu = Menu::new_rc( action_about, action_debug, action_profile, @@ -52,8 +52,8 @@ impl Bar { ); // Build result - Arc::new(Self { - widget: Widget::new_arc(control.gobject(), menu.gobject(), tab.gobject()), + Rc::new(Self { + widget: Widget::new_rc(control.gobject(), menu.gobject(), tab.gobject()), }) } diff --git a/src/app/browser/window/header/bar/control.rs b/src/app/browser/window/header/bar/control.rs index 3919027d..ddda9117 100644 --- a/src/app/browser/window/header/bar/control.rs +++ b/src/app/browser/window/header/bar/control.rs @@ -3,17 +3,17 @@ mod widget; use widget::Widget; use gtk::WindowControls; -use std::sync::Arc; +use std::rc::Rc; pub struct Control { - widget: Arc, + widget: Rc, } impl Control { // Construct - pub fn new_arc() -> Arc { - Arc::new(Self { - widget: Widget::new_arc(), + pub fn new_rc() -> Rc { + Rc::new(Self { + widget: Widget::new_rc(), }) } diff --git a/src/app/browser/window/header/bar/control/widget.rs b/src/app/browser/window/header/bar/control/widget.rs index 7cb26482..85164384 100644 --- a/src/app/browser/window/header/bar/control/widget.rs +++ b/src/app/browser/window/header/bar/control/widget.rs @@ -1,5 +1,5 @@ use gtk::{PackType, WindowControls}; -use std::sync::Arc; +use std::rc::Rc; pub struct Widget { gobject: WindowControls, @@ -7,8 +7,8 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc() -> Arc { - Arc::new(Self { + pub fn new_rc() -> Rc { + Rc::new(Self { gobject: WindowControls::builder() .side(PackType::End) .margin_end(4) diff --git a/src/app/browser/window/header/bar/menu.rs b/src/app/browser/window/header/bar/menu.rs index 466bbde9..ccc1eece 100644 --- a/src/app/browser/window/header/bar/menu.rs +++ b/src/app/browser/window/header/bar/menu.rs @@ -9,14 +9,14 @@ use gtk::{ MenuButton, }; -use std::sync::Arc; +use std::rc::Rc; pub struct Menu { - widget: Arc, + widget: Rc, } #[rustfmt::skip] // @TODO template builder? impl Menu { - pub fn new_arc( + pub fn new_rc( action_about: SimpleAction, action_debug: SimpleAction, action_profile: SimpleAction, @@ -29,7 +29,7 @@ impl Menu { action_page_history_forward: SimpleAction, action_page_reload: SimpleAction, action_page_pin: SimpleAction, - ) -> Arc { + ) -> Rc { // Main let main = gio::Menu::new(); @@ -72,7 +72,7 @@ impl Menu { main.append(Some("Quit"), Some(&detailed_action_name(action_quit))); // Result - Arc::new(Self { widget:Widget::new_arc(&main) }) + Rc::new(Self { widget:Widget::new_rc(&main) }) } // Getters diff --git a/src/app/browser/window/header/bar/menu/widget.rs b/src/app/browser/window/header/bar/menu/widget.rs index 7056be03..54cf2385 100644 --- a/src/app/browser/window/header/bar/menu/widget.rs +++ b/src/app/browser/window/header/bar/menu/widget.rs @@ -1,5 +1,5 @@ use gtk::{gio::Menu, Align, MenuButton}; -use std::sync::Arc; +use std::rc::Rc; pub struct Widget { gobject: MenuButton, @@ -7,8 +7,8 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc(model: &Menu) -> Arc { - Arc::new(Self { + pub fn new_rc(model: &Menu) -> Rc { + Rc::new(Self { gobject: MenuButton::builder() .css_classes(["flat"]) .icon_name("open-menu-symbolic") diff --git a/src/app/browser/window/header/bar/tab.rs b/src/app/browser/window/header/bar/tab.rs index a2302692..35689a7c 100644 --- a/src/app/browser/window/header/bar/tab.rs +++ b/src/app/browser/window/header/bar/tab.rs @@ -6,17 +6,17 @@ use widget::Widget; use adw::{TabBar, TabView}; use gtk::gio::SimpleAction; -use std::sync::Arc; +use std::rc::Rc; pub struct Tab { - widget: Arc, + widget: Rc, } impl Tab { // Construct - pub fn new_arc(action_page_new: SimpleAction, view: &TabView) -> Arc { - Arc::new(Self { - widget: Widget::new_arc(view, Append::new_arc(action_page_new).gobject()), + pub fn new_rc(action_page_new: SimpleAction, view: &TabView) -> Rc { + Rc::new(Self { + widget: Widget::new_rc(view, Append::new_rc(action_page_new).gobject()), }) } diff --git a/src/app/browser/window/header/bar/tab/append.rs b/src/app/browser/window/header/bar/tab/append.rs index 60a9a8cb..793489b4 100644 --- a/src/app/browser/window/header/bar/tab/append.rs +++ b/src/app/browser/window/header/bar/tab/append.rs @@ -3,17 +3,17 @@ mod widget; use widget::Widget; use gtk::{gio::SimpleAction, Button}; -use std::sync::Arc; +use std::rc::Rc; pub struct Append { - pub widget: Arc, + pub widget: Rc, } impl Append { // Construct - pub fn new_arc(action_page_new: SimpleAction) -> Arc { - Arc::new(Self { - widget: Widget::new_arc(action_page_new), + pub fn new_rc(action_page_new: SimpleAction) -> Rc { + Rc::new(Self { + widget: Widget::new_rc(action_page_new), }) } diff --git a/src/app/browser/window/header/bar/tab/append/widget.rs b/src/app/browser/window/header/bar/tab/append/widget.rs index 047a3cd6..0af05d08 100644 --- a/src/app/browser/window/header/bar/tab/append/widget.rs +++ b/src/app/browser/window/header/bar/tab/append/widget.rs @@ -3,7 +3,7 @@ use gtk::{ prelude::{ActionExt, ButtonExt}, Align, Button, }; -use std::sync::Arc; +use std::rc::Rc; pub struct Widget { gobject: Button, @@ -11,7 +11,7 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc(action_page_new: SimpleAction) -> Arc { + pub fn new_rc(action_page_new: SimpleAction) -> Rc { // Init gobject let gobject = Button::builder() .icon_name("tab-new-symbolic") @@ -25,7 +25,7 @@ impl Widget { action_page_new.activate(None); }); - Arc::new(Self { gobject }) + Rc::new(Self { gobject }) } // Getters diff --git a/src/app/browser/window/header/bar/tab/widget.rs b/src/app/browser/window/header/bar/tab/widget.rs index e874027d..1fbc05cf 100644 --- a/src/app/browser/window/header/bar/tab/widget.rs +++ b/src/app/browser/window/header/bar/tab/widget.rs @@ -1,6 +1,6 @@ use adw::{TabBar, TabView}; use gtk::prelude::IsA; -use std::sync::Arc; +use std::rc::Rc; pub struct Widget { gobject: TabBar, @@ -8,8 +8,8 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc(view: &TabView, start_action_widget: &impl IsA) -> Arc { - Arc::new(Self { + pub fn new_rc(view: &TabView, start_action_widget: &impl IsA) -> Rc { + Rc::new(Self { gobject: TabBar::builder() .autohide(false) .expand_tabs(false) diff --git a/src/app/browser/window/header/bar/widget.rs b/src/app/browser/window/header/bar/widget.rs index 1105c78d..527eb135 100644 --- a/src/app/browser/window/header/bar/widget.rs +++ b/src/app/browser/window/header/bar/widget.rs @@ -1,6 +1,6 @@ use adw::TabBar; use gtk::{prelude::BoxExt, Box, MenuButton, Orientation, WindowControls}; -use std::sync::Arc; +use std::rc::Rc; pub struct Widget { gobject: Box, @@ -8,7 +8,7 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc(control: &WindowControls, menu: &MenuButton, tab: &TabBar) -> Arc { + pub fn new_rc(control: &WindowControls, menu: &MenuButton, tab: &TabBar) -> Rc { let gobject = Box::builder() .orientation(Orientation::Horizontal) .spacing(8) @@ -18,7 +18,7 @@ impl Widget { gobject.append(menu); gobject.append(control); - Arc::new(Self { gobject }) + Rc::new(Self { gobject }) } // Getters diff --git a/src/app/browser/window/header/widget.rs b/src/app/browser/window/header/widget.rs index f9181314..6f6d26fc 100644 --- a/src/app/browser/window/header/widget.rs +++ b/src/app/browser/window/header/widget.rs @@ -1,6 +1,6 @@ use adw::ToolbarView; use gtk::Box; -use std::sync::Arc; +use std::rc::Rc; pub struct Widget { gobject: ToolbarView, @@ -8,12 +8,12 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc(top_bar: &Box) -> Arc { + pub fn new_rc(top_bar: &Box) -> Rc { let gobject = ToolbarView::builder().build(); gobject.add_top_bar(top_bar); - Arc::new(Self { gobject }) + Rc::new(Self { gobject }) } // Getters diff --git a/src/app/browser/window/tab.rs b/src/app/browser/window/tab.rs index f1b5bd59..2bbebf69 100644 --- a/src/app/browser/window/tab.rs +++ b/src/app/browser/window/tab.rs @@ -15,7 +15,7 @@ use gtk::{ prelude::{ActionExt, StaticVariantType, ToVariant}, }; use sqlite::Transaction; -use std::{cell::RefCell, collections::HashMap, sync::Arc}; +use std::{cell::RefCell, collections::HashMap, rc::Rc}; // Main pub struct Tab { @@ -28,14 +28,14 @@ pub struct Tab { action_page_reload: SimpleAction, action_update: SimpleAction, // Dynamically allocated reference index - index: Arc>>>, + index: Rc>>>, // GTK - widget: Arc, + widget: Rc, } impl Tab { // Construct - pub fn new_arc( + pub fn new_rc( action_page_close: SimpleAction, action_page_close_all: SimpleAction, action_page_home: SimpleAction, @@ -44,13 +44,13 @@ impl Tab { action_page_pin: SimpleAction, action_page_reload: SimpleAction, action_update: SimpleAction, - ) -> Arc { + ) -> Rc { // Init local actions 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())); + let index = Rc::new(RefCell::new(HashMap::new())); // Init context menu let menu = Menu::new( @@ -64,7 +64,7 @@ impl Tab { ); // Init widget - let widget = Arc::new(Widget::new(menu.gobject())); + let widget = Rc::new(Widget::new(menu.gobject())); // Init events @@ -80,7 +80,7 @@ impl Tab { let action_update = action_update.clone(); move |_, request| { // Init new tab item - let item = Item::new_arc( + let item = Item::new_rc( &gobject, // Local actions action_tab_open.clone(), @@ -172,7 +172,7 @@ impl Tab { }); // Return activated struct - Arc::new(Self { + Rc::new(Self { // Local actions action_tab_open, // Global actions @@ -189,9 +189,9 @@ impl Tab { } // Actions - pub fn append(&self, position: Option) -> Arc { + pub fn append(&self, position: Option) -> Rc { // Init new tab item - let item = Item::new_arc( + let item = Item::new_rc( self.gobject(), // Local actions self.action_tab_open.clone(), diff --git a/src/app/browser/window/tab/item.rs b/src/app/browser/window/tab/item.rs index 9383529c..90144198 100644 --- a/src/app/browser/window/tab/item.rs +++ b/src/app/browser/window/tab/item.rs @@ -12,20 +12,20 @@ use gtk::{ glib::{uuid_string_random, GString}, }; use sqlite::Transaction; -use std::sync::Arc; +use std::rc::Rc; pub struct Item { // Auto-generated unique item ID // useful as widget name in GTK actions callback id: GString, // Components - page: Arc, - widget: Arc, + page: Rc, + widget: Rc, } impl Item { // Construct - pub fn new_arc( + pub fn new_rc( tab_view: &TabView, // Actions action_tab_open: SimpleAction, @@ -38,12 +38,12 @@ impl Item { position: Option, is_pinned: bool, is_selected: bool, - ) -> Arc { + ) -> Rc { // Generate unique ID for new page components let id = uuid_string_random(); // Init components - let page = Page::new_arc( + let page = Page::new_rc( id.clone(), // Actions action_tab_open.clone(), @@ -54,7 +54,7 @@ impl Item { action_update.clone(), ); - let widget = Widget::new_arc( + let widget = Widget::new_rc( id.as_str(), tab_view, page.gobject(), @@ -65,7 +65,7 @@ impl Item { ); // @TODO // Return struct - Arc::new(Self { id, page, widget }) + Rc::new(Self { id, page, widget }) } // Actions @@ -134,14 +134,14 @@ impl Item { action_page_history_forward: SimpleAction, action_page_reload: SimpleAction, action_update: SimpleAction, - ) -> Result>, String> { + ) -> Result>, String> { let mut items = Vec::new(); match Database::records(transaction, app_browser_window_tab_id) { Ok(records) => { for record in records { // Construct new item object - let item = Item::new_arc( + let item = Item::new_rc( tab_view, // Actions action_tab_open.clone(), diff --git a/src/app/browser/window/tab/item/page.rs b/src/app/browser/window/tab/item/page.rs index 0bc93080..77dfd0a1 100644 --- a/src/app/browser/window/tab/item/page.rs +++ b/src/app/browser/window/tab/item/page.rs @@ -29,7 +29,7 @@ use gtk::{ Box, }; use sqlite::Transaction; -use std::{sync::Arc, time::Duration}; +use std::{rc::Rc, time::Duration}; pub struct Page { id: GString, @@ -38,20 +38,20 @@ pub struct Page { action_page_open: SimpleAction, action_update: SimpleAction, // Components - navigation: Arc, - content: Arc, - input: Arc, + navigation: Rc, + content: Rc, + input: Rc, // Extras - meta: Arc, + meta: Rc, // GTK - widget: Arc, + widget: Rc, } impl Page { // Constructors - /// Create new activated `Arc` - pub fn new_arc( + /// Create new activated `Rc` + pub fn new_rc( id: GString, action_tab_open: SimpleAction, action_page_home: SimpleAction, @@ -59,16 +59,16 @@ impl Page { action_page_history_forward: SimpleAction, action_page_reload: SimpleAction, action_update: SimpleAction, - ) -> Arc { + ) -> Rc { // Init local actions let action_page_load = SimpleAction::new(&uuid_string_random(), None); let action_page_open = SimpleAction::new(&uuid_string_random(), Some(&String::static_variant_type())); // Init components - let content = Content::new_arc(action_tab_open.clone(), action_page_open.clone()); + let content = Content::new_rc(action_tab_open.clone(), action_page_open.clone()); - let navigation = Navigation::new_arc( + let navigation = Navigation::new_rc( action_page_home.clone(), action_page_history_back.clone(), action_page_history_forward.clone(), @@ -77,9 +77,9 @@ impl Page { action_update.clone(), ); - let input = Input::new_arc(); + let input = Input::new_rc(); - let widget = Widget::new_arc( + let widget = Widget::new_rc( &id, action_page_open.clone(), navigation.gobject(), @@ -87,10 +87,10 @@ impl Page { input.gobject(), ); - let meta = Meta::new_arc(Status::New, gformat!("New page")); + let meta = Meta::new_rc(Status::New, gformat!("New page")); // Init `Self` - let this = Arc::new(Self { + let this = Rc::new(Self { id, // Actions action_page_load: action_page_load.clone(), @@ -287,9 +287,9 @@ impl Page { } } } else { - // Plain text given, make search request to default provider + // Plain text given, make seRch request to default provider let request = gformat!( - "gemini://tlgs.one/search?{}", + "gemini://tlgs.one/seRch?{}", Uri::escape_string(&request, None, false) ); diff --git a/src/app/browser/window/tab/item/page/content.rs b/src/app/browser/window/tab/item/page/content.rs index 00a10e76..9d15654e 100644 --- a/src/app/browser/window/tab/item/page/content.rs +++ b/src/app/browser/window/tab/item/page/content.rs @@ -13,7 +13,7 @@ use gtk::{ prelude::{BoxExt, WidgetExt}, Box, Orientation, }; -use std::{sync::Arc, time::Duration}; +use std::{rc::Rc, time::Duration}; pub struct Content { // GTK @@ -27,8 +27,8 @@ impl Content { // Construct /// Create new container for different components - pub fn new_arc(action_tab_open: SimpleAction, action_page_open: SimpleAction) -> Arc { - Arc::new(Self { + pub fn new_rc(action_tab_open: SimpleAction, action_page_open: SimpleAction) -> Rc { + Rc::new(Self { gobject: Box::builder().orientation(Orientation::Vertical).build(), action_tab_open, action_page_open, diff --git a/src/app/browser/window/tab/item/page/content/text/gemini.rs b/src/app/browser/window/tab/item/page/content/text/gemini.rs index b7d7780f..bb26c91e 100644 --- a/src/app/browser/window/tab/item/page/content/text/gemini.rs +++ b/src/app/browser/window/tab/item/page/content/text/gemini.rs @@ -11,11 +11,11 @@ use gtk::{ use adw::ClampScrollable; -use std::sync::Arc; +use std::rc::Rc; pub struct Gemini { - reader: Arc, - widget: Arc, + reader: Rc, + widget: Rc, } impl Gemini { @@ -27,9 +27,9 @@ impl Gemini { action_page_open: SimpleAction, ) -> Self { // Init components - let reader = Reader::new_arc(gemtext, base, action_tab_open, action_page_open); + let reader = Reader::new_rc(gemtext, base, action_tab_open, action_page_open); - let widget = Widget::new_arc(&reader.gobject()); + let widget = Widget::new_rc(&reader.gobject()); // Result Self { reader, widget } diff --git a/src/app/browser/window/tab/item/page/content/text/gemini/reader.rs b/src/app/browser/window/tab/item/page/content/text/gemini/reader.rs index 2cb80708..1045c95e 100644 --- a/src/app/browser/window/tab/item/page/content/text/gemini/reader.rs +++ b/src/app/browser/window/tab/item/page/content/text/gemini/reader.rs @@ -21,21 +21,21 @@ use gtk::{ UriLauncher, Window, WrapMode, }; -use std::{collections::HashMap, sync::Arc}; +use std::{collections::HashMap, rc::Rc}; pub struct Reader { title: Option, - widget: Arc, + widget: Rc, } impl Reader { // Construct - pub fn new_arc( + pub fn new_rc( gemtext: &str, base: &Uri, action_tab_open: SimpleAction, action_page_open: SimpleAction, - ) -> Arc { + ) -> Rc { // Init default values let mut title = None; @@ -223,7 +223,7 @@ impl Reader { let motion_controller = EventControllerMotion::new(); // Init widget - let widget = Widget::new_arc( + let widget = Widget::new_rc( &buffer, primary_button_controller.clone(), middle_button_controller.clone(), @@ -346,7 +346,7 @@ impl Reader { }); // @TODO may be expensive for CPU, add timeout? // Result - Arc::new(Self { title, widget }) + Rc::new(Self { title, widget }) } // Getters diff --git a/src/app/browser/window/tab/item/page/content/text/gemini/reader/widget.rs b/src/app/browser/window/tab/item/page/content/text/gemini/reader/widget.rs index e418236b..17e878c1 100644 --- a/src/app/browser/window/tab/item/page/content/text/gemini/reader/widget.rs +++ b/src/app/browser/window/tab/item/page/content/text/gemini/reader/widget.rs @@ -1,7 +1,7 @@ use gtk::{ prelude::WidgetExt, EventControllerMotion, GestureClick, TextBuffer, TextView, WrapMode, }; -use std::sync::Arc; +use std::rc::Rc; const MARGIN: i32 = 8; @@ -11,12 +11,12 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc( + pub fn new_rc( buffer: &TextBuffer, primary_button_controller: GestureClick, middle_button_controller: GestureClick, motion_controller: EventControllerMotion, - ) -> Arc { + ) -> Rc { let gobject = TextView::builder() .bottom_margin(MARGIN) .buffer(buffer) @@ -33,7 +33,7 @@ impl Widget { gobject.add_controller(middle_button_controller); gobject.add_controller(motion_controller); - Arc::new(Self { gobject }) + Rc::new(Self { gobject }) } // Getters diff --git a/src/app/browser/window/tab/item/page/content/text/gemini/widget.rs b/src/app/browser/window/tab/item/page/content/text/gemini/widget.rs index af60ae77..daf8ebf6 100644 --- a/src/app/browser/window/tab/item/page/content/text/gemini/widget.rs +++ b/src/app/browser/window/tab/item/page/content/text/gemini/widget.rs @@ -1,6 +1,6 @@ use adw::ClampScrollable; use gtk::TextView; -use std::sync::Arc; +use std::rc::Rc; pub struct Widget { gobject: ClampScrollable, @@ -8,8 +8,8 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc(child: &TextView) -> Arc { - Arc::new(Self { + pub fn new_rc(child: &TextView) -> Rc { + Rc::new(Self { gobject: ClampScrollable::builder() .child(child) .css_classes(["view"]) diff --git a/src/app/browser/window/tab/item/page/input.rs b/src/app/browser/window/tab/item/page/input.rs index b1acfcc4..5cb49073 100644 --- a/src/app/browser/window/tab/item/page/input.rs +++ b/src/app/browser/window/tab/item/page/input.rs @@ -8,20 +8,20 @@ use sensitive::Sensitive; use widget::Widget; use adw::Clamp; -use std::sync::Arc; +use std::rc::Rc; pub struct Input { - widget: Arc, + widget: Rc, } impl Input { // Construct - pub fn new_arc() -> Arc { + pub fn new_rc() -> Rc { // Init widget - let widget = Widget::new_arc(); + let widget = Widget::new_rc(); // Result - Arc::new(Self { widget }) + Rc::new(Self { widget }) } // Actions @@ -38,7 +38,7 @@ impl Input { size_limit: Option, ) { self.widget.update(Some( - &Response::new_arc(action_page_open, base, title, size_limit).gobject(), + &Response::new_rc(action_page_open, base, title, size_limit).gobject(), )); } @@ -50,7 +50,7 @@ impl Input { max_length: Option, ) { self.widget.update(Some( - &Sensitive::new_arc(action_page_open, base, title, max_length).gobject(), + &Sensitive::new_rc(action_page_open, base, title, max_length).gobject(), )); } diff --git a/src/app/browser/window/tab/item/page/input/response.rs b/src/app/browser/window/tab/item/page/input/response.rs index 5e3061ba..9c54591e 100644 --- a/src/app/browser/window/tab/item/page/input/response.rs +++ b/src/app/browser/window/tab/item/page/input/response.rs @@ -14,32 +14,32 @@ use gtk::{ prelude::{ActionExt, ToVariant, WidgetExt}, Box, }; -use std::sync::Arc; +use std::rc::Rc; pub struct Response { // Components - widget: Arc, + widget: Rc, } impl Response { // Construct - pub fn new_arc( + pub fn new_rc( action_page_open: SimpleAction, base: Uri, title: Option<&str>, size_limit: Option, - ) -> Arc { + ) -> Rc { // Init local actions 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()); - let form = Form::new_arc(action_update.clone()); - let title = Title::new_arc(title); + let control = Control::new_rc(action_send.clone()); + let form = Form::new_rc(action_update.clone()); + let title = Title::new_rc(title); // Init widget - let widget = Widget::new_arc(title.gobject(), form.gobject(), control.gobject()); + let widget = Widget::new_rc(title.gobject(), form.gobject(), control.gobject()); // Init events action_update.connect_activate({ @@ -76,7 +76,7 @@ impl Response { widget.gobject().connect_realize(move |_| form.focus()); // Return activated struct - Arc::new(Self { widget }) + Rc::new(Self { widget }) } // Getters diff --git a/src/app/browser/window/tab/item/page/input/response/control.rs b/src/app/browser/window/tab/item/page/input/response/control.rs index 744f0622..a23c3df6 100644 --- a/src/app/browser/window/tab/item/page/input/response/control.rs +++ b/src/app/browser/window/tab/item/page/input/response/control.rs @@ -7,26 +7,26 @@ use send::Send; use widget::Widget; use gtk::{gio::SimpleAction, Box}; -use std::sync::Arc; +use std::rc::Rc; pub struct Control { - counter: Arc, - send: Arc, - widget: Arc, + counter: Rc, + send: Rc, + widget: Rc, } impl Control { // Construct - pub fn new_arc(action_send: SimpleAction) -> Arc { + pub fn new_rc(action_send: SimpleAction) -> Rc { // Init components - let counter = Counter::new_arc(); - let send = Send::new_arc(action_send); + let counter = Counter::new_rc(); + let send = Send::new_rc(action_send); // Init widget - let widget = Widget::new_arc(counter.gobject(), send.gobject()); + let widget = Widget::new_rc(counter.gobject(), send.gobject()); // Return activated struct - Arc::new(Self { + Rc::new(Self { counter, send, widget, diff --git a/src/app/browser/window/tab/item/page/input/response/control/counter.rs b/src/app/browser/window/tab/item/page/input/response/control/counter.rs index 9cab69ff..b950eae0 100644 --- a/src/app/browser/window/tab/item/page/input/response/control/counter.rs +++ b/src/app/browser/window/tab/item/page/input/response/control/counter.rs @@ -3,20 +3,20 @@ mod widget; use widget::Widget; use gtk::Label; -use std::sync::Arc; +use std::rc::Rc; pub struct Counter { - widget: Arc, + widget: Rc, } impl Counter { // Construct - pub fn new_arc() -> Arc { + pub fn new_rc() -> Rc { // Init widget - let widget = Widget::new_arc(); + let widget = Widget::new_rc(); // Result - Arc::new(Self { widget }) + Rc::new(Self { widget }) } // Actions diff --git a/src/app/browser/window/tab/item/page/input/response/control/counter/widget.rs b/src/app/browser/window/tab/item/page/input/response/control/counter/widget.rs index 5f386c0f..91da73de 100644 --- a/src/app/browser/window/tab/item/page/input/response/control/counter/widget.rs +++ b/src/app/browser/window/tab/item/page/input/response/control/counter/widget.rs @@ -1,5 +1,5 @@ use gtk::{prelude::WidgetExt, Label}; -use std::sync::Arc; +use std::rc::Rc; pub struct Widget { gobject: Label, @@ -7,10 +7,10 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc() -> Arc { + pub fn new_rc() -> Rc { let gobject = Label::builder().build(); - Arc::new(Self { gobject }) + Rc::new(Self { gobject }) } // Actions diff --git a/src/app/browser/window/tab/item/page/input/response/control/send.rs b/src/app/browser/window/tab/item/page/input/response/control/send.rs index f1884931..a255c798 100644 --- a/src/app/browser/window/tab/item/page/input/response/control/send.rs +++ b/src/app/browser/window/tab/item/page/input/response/control/send.rs @@ -3,20 +3,20 @@ mod widget; use widget::Widget; use gtk::{gio::SimpleAction, Button}; -use std::sync::Arc; +use std::rc::Rc; pub struct Send { - widget: Arc, + widget: Rc, } impl Send { // Construct - pub fn new_arc(action_send: SimpleAction) -> Arc { + pub fn new_rc(action_send: SimpleAction) -> Rc { // Init widget - let widget = Widget::new_arc(action_send); + let widget = Widget::new_rc(action_send); // Result - Arc::new(Self { widget }) + Rc::new(Self { widget }) } // Actions diff --git a/src/app/browser/window/tab/item/page/input/response/control/send/widget.rs b/src/app/browser/window/tab/item/page/input/response/control/send/widget.rs index a86988ab..2b06b120 100644 --- a/src/app/browser/window/tab/item/page/input/response/control/send/widget.rs +++ b/src/app/browser/window/tab/item/page/input/response/control/send/widget.rs @@ -3,7 +3,7 @@ use gtk::{ prelude::{ActionExt, ButtonExt, WidgetExt}, Button, }; -use std::sync::Arc; +use std::rc::Rc; pub struct Widget { gobject: Button, @@ -11,7 +11,7 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc(action_send: SimpleAction) -> Arc { + pub fn new_rc(action_send: SimpleAction) -> Rc { // Init gobject let gobject = Button::builder() //.css_classes(["accent"]) @@ -26,7 +26,7 @@ impl Widget { }); // Return activated struct - Arc::new(Self { gobject }) + Rc::new(Self { gobject }) } // Actions diff --git a/src/app/browser/window/tab/item/page/input/response/control/widget.rs b/src/app/browser/window/tab/item/page/input/response/control/widget.rs index da639d5a..79d94f74 100644 --- a/src/app/browser/window/tab/item/page/input/response/control/widget.rs +++ b/src/app/browser/window/tab/item/page/input/response/control/widget.rs @@ -1,5 +1,5 @@ use gtk::{prelude::BoxExt, Align, Box, Button, Label, Orientation}; -use std::sync::Arc; +use std::rc::Rc; const SPACING: i32 = 8; @@ -9,7 +9,7 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc(limit: &Label, send: &Button) -> Arc { + pub fn new_rc(limit: &Label, send: &Button) -> Rc { // Init gobject let gobject = Box::builder() .halign(Align::End) @@ -21,7 +21,7 @@ impl Widget { gobject.append(send); // Return new struct - Arc::new(Self { gobject }) + Rc::new(Self { gobject }) } // Getters diff --git a/src/app/browser/window/tab/item/page/input/response/form.rs b/src/app/browser/window/tab/item/page/input/response/form.rs index 81c3212c..47a03dd6 100644 --- a/src/app/browser/window/tab/item/page/input/response/form.rs +++ b/src/app/browser/window/tab/item/page/input/response/form.rs @@ -3,20 +3,20 @@ mod widget; use widget::Widget; use gtk::{gio::SimpleAction, glib::GString, TextView}; -use std::sync::Arc; +use std::rc::Rc; pub struct Form { - widget: Arc, + widget: Rc, } impl Form { // Construct - pub fn new_arc(action_update: SimpleAction) -> Arc { + pub fn new_rc(action_update: SimpleAction) -> Rc { // Init widget - let widget = Widget::new_arc(action_update); + let widget = Widget::new_rc(action_update); // Result - Arc::new(Self { widget }) + Rc::new(Self { widget }) } // Actions diff --git a/src/app/browser/window/tab/item/page/input/response/form/widget.rs b/src/app/browser/window/tab/item/page/input/response/form/widget.rs index e881d935..e37a892b 100644 --- a/src/app/browser/window/tab/item/page/input/response/form/widget.rs +++ b/src/app/browser/window/tab/item/page/input/response/form/widget.rs @@ -4,7 +4,7 @@ use gtk::{ prelude::{ActionExt, TextBufferExt, TextViewExt, WidgetExt}, TextView, WrapMode, }; -use std::sync::Arc; +use std::rc::Rc; const MARGIN: i32 = 8; @@ -14,7 +14,7 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc(action_update: SimpleAction) -> Arc { + pub fn new_rc(action_update: SimpleAction) -> Rc { // Init gobject let gobject = TextView::builder() .bottom_margin(MARGIN) @@ -30,7 +30,7 @@ impl Widget { }); // Return activated struct - Arc::new(Self { gobject }) + Rc::new(Self { gobject }) } // Actions diff --git a/src/app/browser/window/tab/item/page/input/response/title.rs b/src/app/browser/window/tab/item/page/input/response/title.rs index 278a299b..9f4e2ade 100644 --- a/src/app/browser/window/tab/item/page/input/response/title.rs +++ b/src/app/browser/window/tab/item/page/input/response/title.rs @@ -3,20 +3,20 @@ mod widget; use widget::Widget; use gtk::Label; -use std::sync::Arc; +use std::rc::Rc; pub struct Title { - widget: Arc, + widget: Rc, } impl Title { // Construct - pub fn new_arc(title: Option<&str>) -> Arc { + pub fn new_rc(title: Option<&str>) -> Rc { // Init widget - let widget = Widget::new_arc(title); + let widget = Widget::new_rc(title); // Result - Arc::new(Self { widget }) + Rc::new(Self { widget }) } // Getters diff --git a/src/app/browser/window/tab/item/page/input/response/title/widget.rs b/src/app/browser/window/tab/item/page/input/response/title/widget.rs index 1e0e5882..45f56521 100644 --- a/src/app/browser/window/tab/item/page/input/response/title/widget.rs +++ b/src/app/browser/window/tab/item/page/input/response/title/widget.rs @@ -1,5 +1,5 @@ use gtk::{prelude::WidgetExt, Align, Label}; -use std::sync::Arc; +use std::rc::Rc; pub struct Widget { gobject: Label, @@ -7,7 +7,7 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc(title: Option<&str>) -> Arc { + pub fn new_rc(title: Option<&str>) -> Rc { let gobject = Label::builder() .css_classes(["heading"]) .halign(Align::Start) @@ -23,7 +23,7 @@ impl Widget { } } - Arc::new(Self { gobject }) + Rc::new(Self { gobject }) } // Getters diff --git a/src/app/browser/window/tab/item/page/input/response/widget.rs b/src/app/browser/window/tab/item/page/input/response/widget.rs index 854f1fa7..cb42204a 100644 --- a/src/app/browser/window/tab/item/page/input/response/widget.rs +++ b/src/app/browser/window/tab/item/page/input/response/widget.rs @@ -1,5 +1,5 @@ use gtk::{prelude::BoxExt, Box, Label, Orientation, TextView}; -use std::sync::Arc; +use std::rc::Rc; const MARGIN: i32 = 6; const SPACING: i32 = 8; @@ -10,7 +10,7 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc(title: &Label, response: &TextView, control: &Box) -> Arc { + pub fn new_rc(title: &Label, response: &TextView, control: &Box) -> Rc { let gobject = Box::builder() .margin_bottom(MARGIN) .margin_end(MARGIN) @@ -24,7 +24,7 @@ impl Widget { gobject.append(response); gobject.append(control); - Arc::new(Self { gobject }) + Rc::new(Self { gobject }) } // Getters diff --git a/src/app/browser/window/tab/item/page/input/sensitive.rs b/src/app/browser/window/tab/item/page/input/sensitive.rs index 0ff505b8..edfeced1 100644 --- a/src/app/browser/window/tab/item/page/input/sensitive.rs +++ b/src/app/browser/window/tab/item/page/input/sensitive.rs @@ -10,26 +10,26 @@ use gtk::{ prelude::{ActionExt, ToVariant, WidgetExt}, Box, }; -use std::sync::Arc; +use std::rc::Rc; pub struct Sensitive { // Components - widget: Arc, + widget: Rc, } impl Sensitive { // Construct - pub fn new_arc( + pub fn new_rc( action_page_open: SimpleAction, base: Uri, title: Option<&str>, max_length: Option, - ) -> Arc { + ) -> Rc { // Init local actions let action_send = SimpleAction::new(&uuid_string_random(), None); // Init components - let form = Form::new_arc( + let form = Form::new_rc( action_send.clone(), title, match max_length { @@ -41,7 +41,7 @@ impl Sensitive { ); // Init widget - let widget = Widget::new_arc(form.gobject()); + let widget = Widget::new_rc(form.gobject()); // Init events action_send.connect_activate({ @@ -61,7 +61,7 @@ impl Sensitive { widget.gobject().connect_realize(move |_| form.focus()); // Return activated struct - Arc::new(Self { widget }) + Rc::new(Self { widget }) } // Getters diff --git a/src/app/browser/window/tab/item/page/input/sensitive/form.rs b/src/app/browser/window/tab/item/page/input/sensitive/form.rs index a9045b12..fc29ec90 100644 --- a/src/app/browser/window/tab/item/page/input/sensitive/form.rs +++ b/src/app/browser/window/tab/item/page/input/sensitive/form.rs @@ -4,24 +4,24 @@ use widget::Widget; use adw::PasswordEntryRow; use gtk::{gio::SimpleAction, glib::GString}; -use std::sync::Arc; +use std::rc::Rc; pub struct Form { - widget: Arc, + widget: Rc, } impl Form { // Construct - pub fn new_arc( + pub fn new_rc( action_send: SimpleAction, title: Option<&str>, max_length: Option, - ) -> Arc { + ) -> Rc { // Init widget - let widget = Widget::new_arc(action_send, title, max_length); + let widget = Widget::new_rc(action_send, title, max_length); // Result - Arc::new(Self { widget }) + Rc::new(Self { widget }) } // Actions diff --git a/src/app/browser/window/tab/item/page/input/sensitive/form/widget.rs b/src/app/browser/window/tab/item/page/input/sensitive/form/widget.rs index 8b89fb23..f122a3e5 100644 --- a/src/app/browser/window/tab/item/page/input/sensitive/form/widget.rs +++ b/src/app/browser/window/tab/item/page/input/sensitive/form/widget.rs @@ -7,7 +7,7 @@ use gtk::{ glib::GString, prelude::{ActionExt, EditableExt, WidgetExt}, }; -use std::sync::Arc; +use std::rc::Rc; pub struct Widget { gobject: PasswordEntryRow, @@ -15,11 +15,11 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc( + pub fn new_rc( action_send: SimpleAction, title: Option<&str>, max_length: Option, - ) -> Arc { + ) -> Rc { // Init gobject let gobject = PasswordEntryRow::builder().show_apply_button(true).build(); @@ -37,7 +37,7 @@ impl Widget { }); // Return activated struct - Arc::new(Self { gobject }) + Rc::new(Self { gobject }) } // Actions diff --git a/src/app/browser/window/tab/item/page/input/sensitive/widget.rs b/src/app/browser/window/tab/item/page/input/sensitive/widget.rs index 525bac42..62301dc4 100644 --- a/src/app/browser/window/tab/item/page/input/sensitive/widget.rs +++ b/src/app/browser/window/tab/item/page/input/sensitive/widget.rs @@ -1,6 +1,6 @@ use adw::PasswordEntryRow; use gtk::{prelude::BoxExt, Box, Orientation}; -use std::sync::Arc; +use std::rc::Rc; const MARGIN: i32 = 6; const SPACING: i32 = 8; @@ -11,7 +11,7 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc(response: &PasswordEntryRow) -> Arc { + pub fn new_rc(response: &PasswordEntryRow) -> Rc { let gobject = Box::builder() .margin_bottom(MARGIN) .margin_end(MARGIN) @@ -23,7 +23,7 @@ impl Widget { gobject.append(response); - Arc::new(Self { gobject }) + Rc::new(Self { gobject }) } // Getters diff --git a/src/app/browser/window/tab/item/page/input/widget.rs b/src/app/browser/window/tab/item/page/input/widget.rs index 60686430..be2494f9 100644 --- a/src/app/browser/window/tab/item/page/input/widget.rs +++ b/src/app/browser/window/tab/item/page/input/widget.rs @@ -1,6 +1,6 @@ use adw::Clamp; use gtk::{prelude::WidgetExt, Box}; -use std::sync::Arc; +use std::rc::Rc; pub struct Widget { gobject: Clamp, @@ -8,14 +8,14 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc() -> Arc { + pub fn new_rc() -> Rc { let gobject = Clamp::builder() .css_classes(["app-notification"]) .maximum_size(800) .visible(false) .build(); - Arc::new(Self { gobject }) + Rc::new(Self { gobject }) } // Actions diff --git a/src/app/browser/window/tab/item/page/meta.rs b/src/app/browser/window/tab/item/page/meta.rs index 4b5d89f7..fc0f179d 100644 --- a/src/app/browser/window/tab/item/page/meta.rs +++ b/src/app/browser/window/tab/item/page/meta.rs @@ -6,7 +6,7 @@ use redirect::Redirect; use gtk::glib::GString; use sqlite::Transaction; -use std::{cell::RefCell, sync::Arc}; +use std::{cell::RefCell, rc::Rc}; #[derive(Debug, Clone)] pub enum Status { @@ -39,8 +39,8 @@ pub struct Meta { impl Meta { // Constructors - pub fn new_arc(status: Status, title: GString) -> Arc { - Arc::new(Self { + pub fn new_rc(status: Status, title: GString) -> Rc { + Rc::new(Self { status: RefCell::new(status), title: RefCell::new(title), redirect: RefCell::new(None), diff --git a/src/app/browser/window/tab/item/page/navigation.rs b/src/app/browser/window/tab/item/page/navigation.rs index 2209dca3..830a6799 100644 --- a/src/app/browser/window/tab/item/page/navigation.rs +++ b/src/app/browser/window/tab/item/page/navigation.rs @@ -17,35 +17,35 @@ use widget::Widget; use gtk::{gio::SimpleAction, glib::GString, prelude::WidgetExt, Box}; use sqlite::Transaction; -use std::sync::Arc; +use std::rc::Rc; pub struct Navigation { - home: Arc, - bookmark: Arc, - history: Arc, - reload: Arc, - request: Arc, - widget: Arc, + home: Rc, + bookmark: Rc, + history: Rc, + reload: Rc, + request: Rc, + widget: Rc, } impl Navigation { - pub fn new_arc( + pub fn new_rc( action_page_home: SimpleAction, action_page_history_back: SimpleAction, action_page_history_forward: SimpleAction, action_page_reload: SimpleAction, action_page_open: SimpleAction, action_update: SimpleAction, - ) -> Arc { + ) -> Rc { // Init components - let home = Home::new_arc(action_page_home); - let history = History::new_arc(action_page_history_back, action_page_history_forward); - let reload = Reload::new_arc(action_page_reload.clone()); - let request = Request::new_arc(action_update.clone(), action_page_open.clone()); - let bookmark = Bookmark::new_arc(); + let home = Home::new_rc(action_page_home); + let history = History::new_rc(action_page_history_back, action_page_history_forward); + let reload = Reload::new_rc(action_page_reload.clone()); + let request = Request::new_rc(action_update.clone(), action_page_open.clone()); + let bookmark = Bookmark::new_rc(); // Init widget - let widget = Widget::new_arc( + let widget = Widget::new_rc( home.gobject(), history.gobject(), reload.gobject(), @@ -54,7 +54,7 @@ impl Navigation { ); // Result - Arc::new(Self { + Rc::new(Self { widget, home, history, diff --git a/src/app/browser/window/tab/item/page/navigation/bookmark.rs b/src/app/browser/window/tab/item/page/navigation/bookmark.rs index a4be9329..ff099eca 100644 --- a/src/app/browser/window/tab/item/page/navigation/bookmark.rs +++ b/src/app/browser/window/tab/item/page/navigation/bookmark.rs @@ -3,17 +3,17 @@ mod widget; use widget::Widget; use gtk::Button; -use std::sync::Arc; +use std::rc::Rc; pub struct Bookmark { - widget: Arc, + widget: Rc, } impl Bookmark { // Construct - pub fn new_arc() -> Arc { - Arc::new(Self { - widget: Widget::new_arc(), + pub fn new_rc() -> Rc { + Rc::new(Self { + widget: Widget::new_rc(), }) } diff --git a/src/app/browser/window/tab/item/page/navigation/bookmark/widget.rs b/src/app/browser/window/tab/item/page/navigation/bookmark/widget.rs index dd9370b6..2a110328 100644 --- a/src/app/browser/window/tab/item/page/navigation/bookmark/widget.rs +++ b/src/app/browser/window/tab/item/page/navigation/bookmark/widget.rs @@ -1,5 +1,5 @@ use gtk::Button; -use std::sync::Arc; +use std::rc::Rc; pub struct Widget { gobject: Button, @@ -7,8 +7,8 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc() -> Arc { - Arc::new(Self { + pub fn new_rc() -> Rc { + Rc::new(Self { gobject: Button::builder() .icon_name("starred-symbolic") .tooltip_text("Bookmark") diff --git a/src/app/browser/window/tab/item/page/navigation/history.rs b/src/app/browser/window/tab/item/page/navigation/history.rs index 906fe3ce..58997b86 100644 --- a/src/app/browser/window/tab/item/page/navigation/history.rs +++ b/src/app/browser/window/tab/item/page/navigation/history.rs @@ -7,7 +7,7 @@ use forward::Forward; use widget::Widget; use gtk::{gio::SimpleAction, glib::GString, Box}; -use std::{cell::RefCell, sync::Arc}; +use std::{cell::RefCell, rc::Rc}; struct Memory { request: GString, @@ -16,27 +16,27 @@ struct Memory { pub struct History { // Components - back: Arc, - forward: Arc, + back: Rc, + forward: Rc, // Extras memory: RefCell>, index: RefCell>, // GTK - widget: Arc, + widget: Rc, } impl History { // Construct - pub fn new_arc( + pub fn new_rc( action_page_history_back: SimpleAction, action_page_history_forward: SimpleAction, - ) -> Arc { + ) -> Rc { // init components - let back = Back::new_arc(action_page_history_back); - let forward = Forward::new_arc(action_page_history_forward); + let back = Back::new_rc(action_page_history_back); + let forward = Forward::new_rc(action_page_history_forward); // Init widget - let widget = Widget::new_arc(back.gobject(), forward.gobject()); + let widget = Widget::new_rc(back.gobject(), forward.gobject()); // Init memory let memory = RefCell::new(Vec::new()); @@ -44,7 +44,7 @@ impl History { // Init index let index = RefCell::new(None); - Arc::new(Self { + Rc::new(Self { back, forward, memory, diff --git a/src/app/browser/window/tab/item/page/navigation/history/back.rs b/src/app/browser/window/tab/item/page/navigation/history/back.rs index 563e0d6a..39bf6e32 100644 --- a/src/app/browser/window/tab/item/page/navigation/history/back.rs +++ b/src/app/browser/window/tab/item/page/navigation/history/back.rs @@ -3,20 +3,20 @@ mod widget; use widget::Widget; use gtk::{gio::SimpleAction, Button}; -use std::sync::Arc; +use std::rc::Rc; pub struct Back { action_page_history_back: SimpleAction, - widget: Arc, + widget: Rc, } impl Back { // Construct - pub fn new_arc(action_page_history_back: SimpleAction) -> Arc { + pub fn new_rc(action_page_history_back: SimpleAction) -> Rc { // Return activated struct - Arc::new(Self { + Rc::new(Self { action_page_history_back: action_page_history_back.clone(), - widget: Widget::new_arc(action_page_history_back), + widget: Widget::new_rc(action_page_history_back), }) } diff --git a/src/app/browser/window/tab/item/page/navigation/history/back/widget.rs b/src/app/browser/window/tab/item/page/navigation/history/back/widget.rs index f4fb19c0..9cd530b9 100644 --- a/src/app/browser/window/tab/item/page/navigation/history/back/widget.rs +++ b/src/app/browser/window/tab/item/page/navigation/history/back/widget.rs @@ -3,7 +3,7 @@ use gtk::{ prelude::{ActionExt, ButtonExt, WidgetExt}, Button, }; -use std::sync::Arc; +use std::rc::Rc; pub struct Widget { gobject: Button, @@ -11,7 +11,7 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc(action_page_history_back: SimpleAction) -> Arc { + pub fn new_rc(action_page_history_back: SimpleAction) -> Rc { // Init gobject let gobject = Button::builder() .icon_name("go-previous-symbolic") @@ -21,15 +21,14 @@ impl Widget { // Init events gobject.connect_clicked({ - let action_page_history_back = - action_page_history_back.clone(); + let action_page_history_back = action_page_history_back.clone(); move |_| { action_page_history_back.activate(None); } }); // Return activated struct - Arc::new(Self { gobject }) + Rc::new(Self { gobject }) } // Actions diff --git a/src/app/browser/window/tab/item/page/navigation/history/forward.rs b/src/app/browser/window/tab/item/page/navigation/history/forward.rs index b126d6a5..10b4550c 100644 --- a/src/app/browser/window/tab/item/page/navigation/history/forward.rs +++ b/src/app/browser/window/tab/item/page/navigation/history/forward.rs @@ -3,20 +3,20 @@ mod widget; use widget::Widget; use gtk::{gio::SimpleAction, Button}; -use std::sync::Arc; +use std::rc::Rc; pub struct Forward { action_page_history_forward: SimpleAction, - widget: Arc, + widget: Rc, } impl Forward { // Construct - pub fn new_arc(action_page_history_forward: SimpleAction) -> Arc { + pub fn new_rc(action_page_history_forward: SimpleAction) -> Rc { // Return activated struct - Arc::new(Self { + Rc::new(Self { action_page_history_forward: action_page_history_forward.clone(), - widget: Widget::new_arc(action_page_history_forward), + widget: Widget::new_rc(action_page_history_forward), }) } diff --git a/src/app/browser/window/tab/item/page/navigation/history/forward/widget.rs b/src/app/browser/window/tab/item/page/navigation/history/forward/widget.rs index aae5fef9..ad0bca89 100644 --- a/src/app/browser/window/tab/item/page/navigation/history/forward/widget.rs +++ b/src/app/browser/window/tab/item/page/navigation/history/forward/widget.rs @@ -3,7 +3,7 @@ use gtk::{ prelude::{ActionExt, ButtonExt, WidgetExt}, Button, }; -use std::sync::Arc; +use std::rc::Rc; pub struct Widget { gobject: Button, @@ -11,7 +11,7 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc(action_page_history_forward: SimpleAction) -> Arc { + pub fn new_rc(action_page_history_forward: SimpleAction) -> Rc { // Init gobject let gobject = Button::builder() .icon_name("go-next-symbolic") @@ -21,15 +21,14 @@ impl Widget { // Init events gobject.connect_clicked({ - let action_page_history_forward = - action_page_history_forward.clone(); + let action_page_history_forward = action_page_history_forward.clone(); move |_| { action_page_history_forward.activate(None); } }); // Return activated struct - Arc::new(Self { gobject }) + Rc::new(Self { gobject }) } // Actions diff --git a/src/app/browser/window/tab/item/page/navigation/history/widget.rs b/src/app/browser/window/tab/item/page/navigation/history/widget.rs index 6a806252..7241d674 100644 --- a/src/app/browser/window/tab/item/page/navigation/history/widget.rs +++ b/src/app/browser/window/tab/item/page/navigation/history/widget.rs @@ -2,7 +2,7 @@ use gtk::{ prelude::{BoxExt, IsA}, Box, Orientation, }; -use std::sync::Arc; +use std::rc::Rc; pub struct Widget { gobject: Box, @@ -10,7 +10,7 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc(back: &impl IsA, forward: &impl IsA) -> Arc { + pub fn new_rc(back: &impl IsA, forward: &impl IsA) -> Rc { // Init widget let gobject = Box::builder() .orientation(Orientation::Horizontal) @@ -24,7 +24,7 @@ impl Widget { gobject.append(forward); // Return activated struct - Arc::new(Self { gobject }) + Rc::new(Self { gobject }) } // Getters diff --git a/src/app/browser/window/tab/item/page/navigation/home.rs b/src/app/browser/window/tab/item/page/navigation/home.rs index 6fd76c9e..2a12a091 100644 --- a/src/app/browser/window/tab/item/page/navigation/home.rs +++ b/src/app/browser/window/tab/item/page/navigation/home.rs @@ -7,21 +7,21 @@ use gtk::{ glib::{gformat, GString, Uri}, Button, }; -use std::{cell::RefCell, sync::Arc}; +use std::{cell::RefCell, rc::Rc}; pub struct Home { action_page_home: SimpleAction, uri: RefCell>, - widget: Arc, + widget: Rc, } impl Home { // Construct - pub fn new_arc(action_page_home: SimpleAction) -> Arc { - Arc::new(Self { + pub fn new_rc(action_page_home: SimpleAction) -> Rc { + Rc::new(Self { action_page_home: action_page_home.clone(), uri: RefCell::new(None), - widget: Widget::new_arc(action_page_home), + widget: Widget::new_rc(action_page_home), }) } diff --git a/src/app/browser/window/tab/item/page/navigation/home/widget.rs b/src/app/browser/window/tab/item/page/navigation/home/widget.rs index 490ab0a7..eaf5aa51 100644 --- a/src/app/browser/window/tab/item/page/navigation/home/widget.rs +++ b/src/app/browser/window/tab/item/page/navigation/home/widget.rs @@ -3,7 +3,7 @@ use gtk::{ prelude::{ActionExt, ButtonExt, WidgetExt}, Button, }; -use std::sync::Arc; +use std::rc::Rc; pub struct Widget { gobject: Button, @@ -11,7 +11,7 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc(action_page_home: SimpleAction) -> Arc { + pub fn new_rc(action_page_home: SimpleAction) -> Rc { // Init gobject let gobject = Button::builder() .icon_name("go-home-symbolic") @@ -28,7 +28,7 @@ impl Widget { }); // Return activated struct - Arc::new(Self { gobject }) + Rc::new(Self { gobject }) } // Actions diff --git a/src/app/browser/window/tab/item/page/navigation/reload.rs b/src/app/browser/window/tab/item/page/navigation/reload.rs index 6458dacd..33cff98a 100644 --- a/src/app/browser/window/tab/item/page/navigation/reload.rs +++ b/src/app/browser/window/tab/item/page/navigation/reload.rs @@ -3,19 +3,19 @@ mod widget; use widget::Widget; use gtk::{gio::SimpleAction, Button}; -use std::sync::Arc; +use std::rc::Rc; pub struct Reload { action_page_reload: SimpleAction, - widget: Arc, + widget: Rc, } impl Reload { // Construct - pub fn new_arc(action_page_reload: SimpleAction) -> Arc { - Arc::new(Self { + pub fn new_rc(action_page_reload: SimpleAction) -> Rc { + Rc::new(Self { action_page_reload: action_page_reload.clone(), - widget: Widget::new_arc(action_page_reload), + widget: Widget::new_rc(action_page_reload), }) } diff --git a/src/app/browser/window/tab/item/page/navigation/reload/widget.rs b/src/app/browser/window/tab/item/page/navigation/reload/widget.rs index e0f13468..7166f02a 100644 --- a/src/app/browser/window/tab/item/page/navigation/reload/widget.rs +++ b/src/app/browser/window/tab/item/page/navigation/reload/widget.rs @@ -3,7 +3,7 @@ use gtk::{ prelude::{ActionExt, ButtonExt, WidgetExt}, Button, }; -use std::sync::Arc; +use std::rc::Rc; pub struct Widget { gobject: Button, @@ -11,7 +11,7 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc(action_page_reload: SimpleAction) -> Arc { + pub fn new_rc(action_page_reload: SimpleAction) -> Rc { // Init gobject let gobject = Button::builder() .icon_name("view-refresh-symbolic") @@ -28,7 +28,7 @@ impl Widget { }); // Return activated struct - Arc::new(Self { gobject }) + Rc::new(Self { gobject }) } // Actions diff --git a/src/app/browser/window/tab/item/page/navigation/request.rs b/src/app/browser/window/tab/item/page/navigation/request.rs index 938f336f..6f637a41 100644 --- a/src/app/browser/window/tab/item/page/navigation/request.rs +++ b/src/app/browser/window/tab/item/page/navigation/request.rs @@ -10,22 +10,22 @@ use gtk::{ Entry, }; use sqlite::Transaction; -use std::sync::Arc; +use std::rc::Rc; // Main pub struct Request { - widget: Arc, + widget: Rc, } impl Request { // Construct - pub fn new_arc( + pub fn new_rc( // Actions action_update: SimpleAction, action_page_reload: SimpleAction, // @TODO local `action_page_open`? - ) -> Arc { - Arc::new(Self { - widget: Widget::new_arc(action_update, action_page_reload), + ) -> Rc { + Rc::new(Self { + widget: Widget::new_rc(action_update, action_page_reload), }) } diff --git a/src/app/browser/window/tab/item/page/navigation/request/widget.rs b/src/app/browser/window/tab/item/page/navigation/request/widget.rs index 37e2dd3e..1133a29c 100644 --- a/src/app/browser/window/tab/item/page/navigation/request/widget.rs +++ b/src/app/browser/window/tab/item/page/navigation/request/widget.rs @@ -9,9 +9,9 @@ use gtk::{ Entry, StateFlags, }; use sqlite::Transaction; -use std::{cell::RefCell, sync::Arc, time::Duration}; +use std::{cell::RefCell, rc::Rc, time::Duration}; -const PLACEHOLDER_TEXT: &str = "URL or search term..."; +const PLACEHOLDER_TEXT: &str = "URL or seRch term..."; // Progress bar animation setup const PROGRESS_ANIMATION_STEP: f64 = 0.05; @@ -24,14 +24,14 @@ struct Progress { pub struct Widget { gobject: Entry, - progress: Arc, + progress: Rc, } impl Widget { // Construct - pub fn new_arc(action_update: SimpleAction, action_page_open: SimpleAction) -> Arc { + pub fn new_rc(action_update: SimpleAction, action_page_open: SimpleAction) -> Rc { // Init animated progress bar state - let progress = Arc::new(Progress { + let progress = Rc::new(Progress { fraction: RefCell::new(0.0), source_id: RefCell::new(None), }); @@ -73,7 +73,7 @@ impl Widget { }); // Return activated struct - Arc::new(Self { gobject, progress }) + Rc::new(Self { gobject, progress }) } // Actions diff --git a/src/app/browser/window/tab/item/page/navigation/widget.rs b/src/app/browser/window/tab/item/page/navigation/widget.rs index 25cf6c7e..5d29ba27 100644 --- a/src/app/browser/window/tab/item/page/navigation/widget.rs +++ b/src/app/browser/window/tab/item/page/navigation/widget.rs @@ -2,7 +2,7 @@ use gtk::{ prelude::{BoxExt, IsA}, Box, Orientation, }; -use std::sync::Arc; +use std::rc::Rc; const MARGIN: i32 = 6; const SPACING: i32 = 6; @@ -13,13 +13,13 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc( + pub fn new_rc( base: &impl IsA, history: &impl IsA, reload: &impl IsA, request: &impl IsA, bookmark: &impl IsA, - ) -> Arc { + ) -> Rc { let gobject = Box::builder() .orientation(Orientation::Horizontal) .spacing(SPACING) @@ -34,7 +34,7 @@ impl Widget { gobject.append(request); gobject.append(bookmark); - Arc::new(Self { gobject }) + Rc::new(Self { gobject }) } // Getters diff --git a/src/app/browser/window/tab/item/page/widget.rs b/src/app/browser/window/tab/item/page/widget.rs index c7675918..7fb279cd 100644 --- a/src/app/browser/window/tab/item/page/widget.rs +++ b/src/app/browser/window/tab/item/page/widget.rs @@ -4,7 +4,7 @@ use gtk::{ prelude::{ActionMapExt, BoxExt, IsA, WidgetExt}, Box, Orientation, }; -use std::sync::Arc; +use std::rc::Rc; pub struct Widget { gobject: Box, @@ -12,7 +12,7 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc( + pub fn new_rc( name: &str, // Actions action_page_open: SimpleAction, @@ -20,7 +20,7 @@ impl Widget { navigation: &impl IsA, content: &impl IsA, input: &impl IsA, - ) -> Arc { + ) -> Rc { // Init additional action group let action_group = SimpleActionGroup::new(); action_group.add_action(&action_page_open); @@ -37,7 +37,7 @@ impl Widget { gobject.insert_action_group(&uuid_string_random(), Some(&action_group)); - Arc::new(Self { gobject }) + Rc::new(Self { gobject }) } // Getters diff --git a/src/app/browser/window/tab/item/widget.rs b/src/app/browser/window/tab/item/widget.rs index 360e41c5..0c927bad 100644 --- a/src/app/browser/window/tab/item/widget.rs +++ b/src/app/browser/window/tab/item/widget.rs @@ -5,7 +5,7 @@ use database::Database; use adw::{TabPage, TabView}; use gtk::prelude::IsA; use sqlite::Transaction; -use std::sync::Arc; +use std::rc::Rc; const DEFAULT_TITLE: &str = "New page"; @@ -15,7 +15,7 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc( + pub fn new_rc( keyword: &str, // ID tab_view: &TabView, child: &impl IsA, @@ -23,7 +23,7 @@ impl Widget { position: Option, is_pinned: bool, is_selected: bool, - ) -> Arc { + ) -> Rc { let gobject = match position { Some(value) => { // If given `position` match pinned tab, GTK will panic with notice: @@ -51,7 +51,7 @@ impl Widget { tab_view.set_selected_page(&gobject); } - Arc::new(Self { gobject }) + Rc::new(Self { gobject }) } // Actions diff --git a/src/main.rs b/src/main.rs index c9717998..5d240d56 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,10 +3,7 @@ mod app; use app::App; use gtk::glib::{user_config_dir, ExitCode}; use sqlite::Connection; -use std::{ - fs::create_dir_all, - sync::{Arc, RwLock}, -}; +use std::{fs::create_dir_all, rc::Rc, sync::RwLock}; const VENDOR: &str = "YGGverse"; const APP_ID: &str = "Yoda"; // env!("CARGO_PKG_NAME"); @@ -36,7 +33,7 @@ fn main() -> ExitCode { // Init database connection let profile_database_connection = match Connection::open(profile_database_path) { - Ok(connection) => Arc::new(RwLock::new(connection)), + Ok(connection) => Rc::new(RwLock::new(connection)), Err(e) => panic!("Failed to connect profile database: {e}"), };