[fractal] account: Downgrade scroll for callbacks



commit 04aca0129c479891ff5fe47417e9217669f0df62
Author: Xiang Fan <sfanxiang gmail com>
Date:   Tue Feb 26 10:27:45 2019 +0800

    account: Downgrade scroll for callbacks

 fractal-gtk/src/app/connect/account.rs | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/fractal-gtk/src/app/connect/account.rs b/fractal-gtk/src/app/connect/account.rs
index 598aea92..eb5b2347 100644
--- a/fractal-gtk/src/app/connect/account.rs
+++ b/fractal-gtk/src/app/connect/account.rs
@@ -288,22 +288,23 @@ impl App {
             op.lock().unwrap().account_destruction();
         }));
 
-        let scroll = builder
+        let scroll_weak = builder
             .get_object::<gtk::ScrolledWindow>("account_settings_scroll")
-            .expect("Can't find account_settings_scroll in ui file.");
-        delete_revealer.connect_size_allocate(clone!(scroll => move |this, _| {
+            .expect("Can't find account_settings_scroll in ui file.")
+            .downgrade();
+        delete_revealer.connect_size_allocate(clone!(scroll_weak => move |this, _| {
             if this.get_reveal_child() && !this.get_child_revealed() {
                 // The revealer is revealing
-                if let Some(adj) = scroll.get_vadjustment() {
+                if let Some(adj) = upgrade_weak!(scroll_weak).get_vadjustment() {
                     let bottom = adj.get_upper() - adj.get_page_size();
                     adj.set_value(bottom);
                 }
             }
         }));
-        advanced_revealer.connect_size_allocate(clone!(scroll => move |this, _| {
+        advanced_revealer.connect_size_allocate(clone!(scroll_weak => move |this, _| {
             if this.get_reveal_child() && !this.get_child_revealed() {
                 // The revealer is revealing
-                if let Some(adj) = scroll.get_vadjustment() {
+                if let Some(adj) = upgrade_weak!(scroll_weak).get_vadjustment() {
                     let bottom = adj.get_upper() - adj.get_page_size();
                     adj.set_value(bottom);
                 }


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