[fractal/ui-refactor: 7/7] Remove Rc<RefCell<T>> pattern in widgets::members_list
- From: Alejandro Domínguez <aledomu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal/ui-refactor: 7/7] Remove Rc<RefCell<T>> pattern in widgets::members_list
- Date: Fri, 11 Dec 2020 15:54:48 +0000 (UTC)
commit d92a3b4626f9844ed2c59be74feadb725190680b
Author: Alejandro Domínguez <adomu net-c com>
Date: Wed Nov 18 23:37:52 2020 +0100
Remove Rc<RefCell<T>> pattern in widgets::members_list
fractal-gtk/src/widgets/members_list.rs | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/fractal-gtk/src/widgets/members_list.rs b/fractal-gtk/src/widgets/members_list.rs
index e6f9933d..9a885bcd 100644
--- a/fractal-gtk/src/widgets/members_list.rs
+++ b/fractal-gtk/src/widgets/members_list.rs
@@ -1,8 +1,6 @@
use glib::clone;
use matrix_sdk::identifiers::UserId;
-use std::cell::RefCell;
-use std::collections::hash_map::HashMap;
-use std::rc::Rc;
+use std::{cell::RefCell, collections::hash_map::HashMap};
use glib::signal;
use gtk::prelude::*;
@@ -69,12 +67,11 @@ impl MembersList {
Some(w.get_text().to_string()),
);
});
- /* we need to remove the handler when the member list is destroyed */
- let id: Rc<RefCell<Option<signal::SignalHandlerId>>> = Rc::new(RefCell::new(Some(id)));
+ // We need to remove the handler when the member list is destroyed
+ let id = RefCell::new(Some(id));
let search_entry = self.search_entry.clone();
self.container.connect_destroy(move |_| {
- let id = id.borrow_mut().take();
- if let Some(id) = id {
+ if let Some(id) = id.borrow_mut().take() {
signal::signal_handler_disconnect(&search_entry, id);
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]