Commit 80555ede authored by Wyatt Turner's avatar Wyatt Turner
Browse files

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.
parent 33016578
......@@ -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,
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment