mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
replace Cell with RefCell
This commit is contained in:
parent
f0e36e711d
commit
24160d39eb
2 changed files with 5 additions and 4 deletions
|
|
@ -124,7 +124,7 @@ fn find(
|
|||
}
|
||||
|
||||
fn update(entry: &Entry, navigation: &Rc<Navigation>) {
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -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<Cell<Vec<(TextIter, TextIter)>>>,
|
||||
pub matches: Rc<RefCell<Vec<(TextIter, TextIter)>>>,
|
||||
}
|
||||
|
||||
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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue