[fractal/fix-new-direct-chat: 3/5] Fix new direct chat dialog crashing app
- From: Alejandro Domínguez <aledomu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal/fix-new-direct-chat: 3/5] Fix new direct chat dialog crashing app
- Date: Mon, 4 Jan 2021 17:18:35 +0000 (UTC)
commit 2338fc0fe0b358f3857b526e28175d28dfc802ac
Author: Alejandro Domínguez <adomu net-c com>
Date: Sun Jan 3 00:30:55 2021 +0100
Fix new direct chat dialog crashing app
fractal-gtk/src/ui/invite.rs | 42 ++++++++++++++++++------------------------
1 file changed, 18 insertions(+), 24 deletions(-)
---
diff --git a/fractal-gtk/src/ui/invite.rs b/fractal-gtk/src/ui/invite.rs
index a8dd3362..b985bee7 100644
--- a/fractal-gtk/src/ui/invite.rs
+++ b/fractal-gtk/src/ui/invite.rs
@@ -22,16 +22,14 @@ impl UI {
return;
}
- let textviewid = match search_type {
- SearchType::Invite => "invite_entry",
- SearchType::DirectChat => "to_chat_entry",
+ let invite_entry = match search_type {
+ SearchType::Invite => self
+ .builder
+ .get_object::<gtk::TextView>("invite_entry")
+ .expect("Can't find invite_entry in ui file."),
+ SearchType::DirectChat => self.direct_chat_dialog.to_chat_entry.clone(),
};
- let invite_entry = self
- .builder
- .get_object::<gtk::TextView>(textviewid)
- .expect("Can't find invite_entry in ui file.");
-
if let SearchType::DirectChat = search_type {
self.invite_list = vec![];
@@ -202,16 +200,14 @@ impl UI {
}
pub fn set_invite_user_dialog_placeholder(&mut self, search_type: SearchType) {
- let textviewid = match search_type {
- SearchType::Invite => "invite_entry",
- SearchType::DirectChat => "to_chat_entry",
+ let invite_entry = match search_type {
+ SearchType::Invite => self
+ .builder
+ .get_object::<gtk::TextView>("invite_entry")
+ .expect("Can't find invite_entry in ui file."),
+ SearchType::DirectChat => self.direct_chat_dialog.to_chat_entry.clone(),
};
- let invite_entry = self
- .builder
- .get_object::<gtk::TextView>(textviewid)
- .expect("Can't find invite_entry in ui file.");
-
if let Some(buffer) = invite_entry.get_buffer() {
let start = buffer.get_start_iter();
let end = buffer.get_end_iter();
@@ -230,16 +226,14 @@ impl UI {
}
pub fn remove_invite_user_dialog_placeholder(&mut self, search_type: SearchType) {
- let textviewid = match search_type {
- SearchType::Invite => "invite_entry",
- SearchType::DirectChat => "to_chat_entry",
+ let invite_entry = match search_type {
+ SearchType::Invite => self
+ .builder
+ .get_object::<gtk::TextView>("invite_entry")
+ .expect("Can't find invite_entry in ui file."),
+ SearchType::DirectChat => self.direct_chat_dialog.to_chat_entry.clone(),
};
- let invite_entry = self
- .builder
- .get_object::<gtk::TextView>(textviewid)
- .expect("Can't find invite_entry in ui file.");
-
if let Some(buffer) = invite_entry.get_buffer() {
let start = buffer.get_start_iter();
let end = buffer.get_end_iter();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]