[fractal] Moved clearing of "join_room_name" entry
- From: Julian Sparber <jsparber src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal] Moved clearing of "join_room_name" entry
- Date: Tue, 6 Apr 2021 17:30:12 +0000 (UTC)
commit 80555ede369228713ba567fc17b4564e36b3df6f
Author: Wyatt Turner <wyatturner 45 gmail com>
Date: Tue Mar 30 23:17:49 2021 -0700
Moved clearing of "join_room_name" entry
The entry's text was originally getting cleared before it was actually used
to join a new room. I moved where the entry value is cleared to after it is used
to avoid the race condition.
fractal-gtk/src/appop/room.rs | 10 ++++------
fractal-gtk/src/ui/connect/join_room.rs | 10 +++-------
2 files changed, 7 insertions(+), 13 deletions(-)
---
diff --git a/fractal-gtk/src/appop/room.rs b/fractal-gtk/src/appop/room.rs
index 9002b821..0ec69514 100644
--- a/fractal-gtk/src/appop/room.rs
+++ b/fractal-gtk/src/appop/room.rs
@@ -523,15 +523,13 @@ impl AppOp {
pub fn join_to_room(&mut self) {
let login_data = unwrap_or_unit_return!(self.login_data.clone());
- let try_room_id = self
+ let entry = self
.ui
.builder
.get_object::<gtk::Entry>("join_room_name")
- .expect("Can't find join_room_name in ui file.")
- .get_text()
- .to_string()
- .trim()
- .try_into();
+ .expect("Can't find join_room_name in ui file.");
+ let try_room_id = entry.get_text().to_string().trim().try_into();
+ entry.set_text("");
let room_id = match try_room_id {
Ok(room_id) => room_id,
diff --git a/fractal-gtk/src/ui/connect/join_room.rs b/fractal-gtk/src/ui/connect/join_room.rs
index 4bb3f8e6..c6bd5151 100644
--- a/fractal-gtk/src/ui/connect/join_room.rs
+++ b/fractal-gtk/src/ui/connect/join_room.rs
@@ -32,18 +32,14 @@ pub fn connect(ui: &UI, app_runtime: AppRuntime) {
glib::signal::Inhibit(true)
}));
- confirm.connect_clicked(
- clone!(@strong entry, @strong dialog, @strong app_runtime => move |_| {
+ confirm.connect_clicked(clone!(@strong dialog, @strong app_runtime => move |_| {
dialog.hide();
app_runtime.update_state_with(|state| state.join_to_room());
- entry.set_text("");
- }),
- );
+ }));
- entry.connect_activate(clone!(@strong dialog => move |entry| {
+ entry.connect_activate(clone!(@strong dialog => move |_| {
dialog.hide();
app_runtime.update_state_with(|state| state.join_to_room());
- entry.set_text("");
}));
entry.connect_changed(clone!(@strong confirm => move |entry| {
confirm.set_sensitive(entry.get_buffer().get_length() > 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]