mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 09:35:28 +00:00
replace arc with rc
This commit is contained in:
parent
a0e923eb7d
commit
c843e5b7c0
62 changed files with 317 additions and 334 deletions
|
|
@ -11,11 +11,11 @@ use gtk::{
|
|||
|
||||
use adw::ClampScrollable;
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Gemini {
|
||||
reader: Arc<Reader>,
|
||||
widget: Arc<Widget>,
|
||||
reader: Rc<Reader>,
|
||||
widget: Rc<Widget>,
|
||||
}
|
||||
|
||||
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 }
|
||||
|
|
|
|||
|
|
@ -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<GString>,
|
||||
widget: Arc<Widget>,
|
||||
widget: Rc<Widget>,
|
||||
}
|
||||
|
||||
impl Reader {
|
||||
// Construct
|
||||
pub fn new_arc(
|
||||
pub fn new_rc(
|
||||
gemtext: &str,
|
||||
base: &Uri,
|
||||
action_tab_open: SimpleAction,
|
||||
action_page_open: SimpleAction,
|
||||
) -> Arc<Self> {
|
||||
) -> Rc<Self> {
|
||||
// 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
|
||||
|
|
|
|||
|
|
@ -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<Self> {
|
||||
) -> Rc<Self> {
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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<Self> {
|
||||
Arc::new(Self {
|
||||
pub fn new_rc(child: &TextView) -> Rc<Self> {
|
||||
Rc::new(Self {
|
||||
gobject: ClampScrollable::builder()
|
||||
.child(child)
|
||||
.css_classes(["view"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue