From 9696627bfb6a678e57e1625a83b0149517b73b3b Mon Sep 17 00:00:00 2001 From: Julian Sparber Date: Fri, 17 Dec 2021 18:37:57 +0100 Subject: [PATCH] verification: Use IdentityVerificationWidget::is_finished() where possible --- src/session/content/mod.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/session/content/mod.rs b/src/session/content/mod.rs index bafe566e..b8f6f4f6 100644 --- a/src/session/content/mod.rs +++ b/src/session/content/mod.rs @@ -14,7 +14,7 @@ use self::verification::IdentityVerificationWidget; use crate::session::sidebar::{Entry, EntryType}; -use crate::session::verification::{IdentityVerification, VerificationMode}; +use crate::session::verification::IdentityVerification; use adw::subclass::prelude::*; use gtk::{gio, glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate}; @@ -219,12 +219,15 @@ impl Content { } if item.is::() { - let handler_id = item.connect_notify_local(Some("mode"), clone!(@weak self as obj => move |request, _| { - let request = request.downcast_ref::().unwrap(); - if request.mode() == VerificationMode::Cancelled || request.mode() == VerificationMode::Error || request.mode() == VerificationMode::Dismissed { - obj.set_item(None); - } - })); + let handler_id = item.connect_notify_local( + Some("mode"), + clone!(@weak self as obj => move |request, _| { + let request = request.downcast_ref::().unwrap(); + if request.is_finished() { + obj.set_item(None); + } + }), + ); priv_.signal_handler.replace(Some(handler_id)); } }