[fractal/fractal-next] verification: Use IdentityVerificationWidget::is_finished() where possible



commit 9696627bfb6a678e57e1625a83b0149517b73b3b
Author: Julian Sparber <julian sparber net>
Date:   Fri Dec 17 18:37:57 2021 +0100

    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::<IdentityVerification>() {
-                let handler_id = item.connect_notify_local(Some("mode"), clone!(@weak self as obj => move 
|request, _| {
-                    let request = request.downcast_ref::<IdentityVerification>().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::<IdentityVerification>().unwrap();
+                        if request.is_finished() {
+                            obj.set_item(None);
+                        }
+                    }),
+                );
                 priv_.signal_handler.replace(Some(handler_id));
             }
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]