From 24160d39ebf9b4415c5e7eccb4eb292a3c63b2eb Mon Sep 17 00:00:00 2001 From: yggverse Date: Sun, 15 Dec 2024 18:05:39 +0200 Subject: [PATCH] replace Cell with RefCell --- .../item/page/content/text/gemini/reader/widget/find.rs | 2 +- .../content/text/gemini/reader/widget/find/navigation.rs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/app/browser/window/tab/item/page/content/text/gemini/reader/widget/find.rs b/src/app/browser/window/tab/item/page/content/text/gemini/reader/widget/find.rs index 685742b4..1644e288 100644 --- a/src/app/browser/window/tab/item/page/content/text/gemini/reader/widget/find.rs +++ b/src/app/browser/window/tab/item/page/content/text/gemini/reader/widget/find.rs @@ -124,7 +124,7 @@ fn find( } fn update(entry: &Entry, navigation: &Rc) { - if navigation.matches.take().is_empty() { + if navigation.matches.borrow().is_empty() { entry.add_css_class("error"); navigation.back.set_sensitive(false); navigation.forward.set_sensitive(false); diff --git a/src/app/browser/window/tab/item/page/content/text/gemini/reader/widget/find/navigation.rs b/src/app/browser/window/tab/item/page/content/text/gemini/reader/widget/find/navigation.rs index 23656f5f..ffae654e 100644 --- a/src/app/browser/window/tab/item/page/content/text/gemini/reader/widget/find/navigation.rs +++ b/src/app/browser/window/tab/item/page/content/text/gemini/reader/widget/find/navigation.rs @@ -2,7 +2,7 @@ mod back; mod forward; use gtk::{prelude::BoxExt, Box, Button, Orientation, TextIter}; -use std::{cell::Cell, rc::Rc}; +use std::{cell::RefCell, rc::Rc}; const MARGIN: i32 = 6; @@ -10,7 +10,7 @@ pub struct Navigation { pub back: Button, pub forward: Button, pub g_box: Box, - pub matches: Rc>>, + pub matches: Rc>>, } impl Navigation { @@ -18,7 +18,8 @@ impl Navigation { /// Create new `Self` pub fn new() -> Self { - let matches = Rc::new(Cell::new(Vec::new())); + // Init shared matches holder + let matches = Rc::new(RefCell::new(Vec::new())); // Init components let back = back::new();