File tree Expand file tree Collapse file tree 1 file changed +27
-17
lines changed
Expand file tree Collapse file tree 1 file changed +27
-17
lines changed Original file line number Diff line number Diff line change @@ -1505,6 +1505,24 @@ impl PacketApplicationWindow {
15051505 ) ) ;
15061506 }
15071507
1508+ async fn on_visibility_changed ( & self , visibility : bool ) {
1509+ let imp = self . imp ( ) ;
1510+
1511+ self . bottom_bar_status_indicator_ui_update ( visibility) ;
1512+
1513+ if let Some ( rqs) = imp. rqs . lock ( ) . await . as_mut ( ) {
1514+ let visibility = if visibility {
1515+ rqs_lib:: Visibility :: Visible
1516+ } else {
1517+ rqs_lib:: Visibility :: Invisible
1518+ } ;
1519+
1520+ rqs. change_visibility ( visibility) ;
1521+ } else {
1522+ tracing:: warn!( "Couldn't set device visibility due RQS not being set" ) ;
1523+ }
1524+ }
1525+
15081526 fn bottom_bar_status_indicator_ui_update ( & self , is_visible : bool ) {
15091527 let imp = self . imp ( ) ;
15101528
@@ -1588,23 +1606,15 @@ impl PacketApplicationWindow {
15881606 #[ weak]
15891607 imp,
15901608 move |obj| {
1591- imp. obj( )
1592- . bottom_bar_status_indicator_ui_update( obj. is_active( ) ) ;
1593-
1594- let visibility = if obj. is_active( ) {
1595- rqs_lib:: Visibility :: Visible
1596- } else {
1597- rqs_lib:: Visibility :: Invisible
1598- } ;
1599-
1600- glib:: spawn_future_local( async move {
1601- imp. rqs
1602- . lock( )
1603- . await
1604- . as_mut( )
1605- . unwrap( )
1606- . change_visibility( visibility) ;
1607- } ) ;
1609+ glib:: spawn_future_local( clone!(
1610+ #[ weak]
1611+ imp,
1612+ #[ weak]
1613+ obj,
1614+ async move {
1615+ imp. obj( ) . on_visibility_changed( obj. is_active( ) ) . await ;
1616+ }
1617+ ) ) ;
16081618 }
16091619 ) ) ;
16101620 }
You can’t perform that action at this time.
0 commit comments