@@ -203,16 +203,16 @@ impl Audio {
203203 . icon_button ( GO_NEXT )
204204 . on_press ( Message :: MprisRequest ( MprisRequest :: Next ) )
205205 . into ( ) ,
206- )
206+ ) ;
207207 }
208208
209209 Some ( match self . core . applet . anchor {
210- PanelAnchor :: Left | PanelAnchor :: Right => Column :: with_children ( elements )
211- . align_x ( Alignment :: Center )
212- . into ( ) ,
213- PanelAnchor :: Top | PanelAnchor :: Bottom => Row :: with_children ( elements )
214- . align_y ( Alignment :: Center )
215- . into ( ) ,
210+ PanelAnchor :: Left | PanelAnchor :: Right => {
211+ Column :: from_vec ( elements ) . align_x ( Alignment :: Center ) . into ( )
212+ }
213+ PanelAnchor :: Top | PanelAnchor :: Bottom => {
214+ Row :: from_vec ( elements ) . align_y ( Alignment :: Center ) . into ( )
215+ }
216216 } )
217217 } else {
218218 None
@@ -315,34 +315,34 @@ impl cosmic::Application for Audio {
315315 Message :: TogglePopup => {
316316 if let Some ( p) = self . popup . take ( ) {
317317 return destroy_popup ( p) ;
318- } else {
319- if let Some ( conn) = self . pulse_state . connection ( ) {
320- conn. send ( pulse:: Message :: UpdateConnection ) ;
321- }
322- let new_id = window:: Id :: unique ( ) ;
323- self . popup . replace ( new_id) ;
324- self . timeline = Timeline :: new ( ) ;
325-
326- self . output_amplification = amplification_sink ( ) ;
327- self . input_amplification = amplification_source ( ) ;
328-
329- let popup_settings = self . core . applet . get_popup_settings (
330- self . core . main_window_id ( ) . unwrap ( ) ,
331- new_id,
332- None ,
333- None ,
334- None ,
335- ) ;
318+ }
336319
337- if let Some ( conn) = self . pulse_state . connection ( ) {
338- conn. send ( pulse:: Message :: GetDefaultSink ) ;
339- conn. send ( pulse:: Message :: GetDefaultSource ) ;
340- conn. send ( pulse:: Message :: GetSinks ) ;
341- conn. send ( pulse:: Message :: GetSources ) ;
342- }
320+ if let Some ( conn) = self . pulse_state . connection ( ) {
321+ conn. send ( pulse:: Message :: UpdateConnection ) ;
322+ }
323+ let new_id = window:: Id :: unique ( ) ;
324+ self . popup . replace ( new_id) ;
325+ self . timeline = Timeline :: new ( ) ;
326+
327+ self . output_amplification = amplification_sink ( ) ;
328+ self . input_amplification = amplification_source ( ) ;
329+
330+ let popup_settings = self . core . applet . get_popup_settings (
331+ self . core . main_window_id ( ) . unwrap ( ) ,
332+ new_id,
333+ None ,
334+ None ,
335+ None ,
336+ ) ;
343337
344- return get_popup ( popup_settings) ;
338+ if let Some ( conn) = self . pulse_state . connection ( ) {
339+ conn. send ( pulse:: Message :: GetDefaultSink ) ;
340+ conn. send ( pulse:: Message :: GetDefaultSource ) ;
341+ conn. send ( pulse:: Message :: GetSinks ) ;
342+ conn. send ( pulse:: Message :: GetSources ) ;
345343 }
344+
345+ return get_popup ( popup_settings) ;
346346 }
347347 Message :: SetOutputVolume ( vol) => {
348348 if self . output_volume == vol {
@@ -400,7 +400,7 @@ impl cosmic::Application for Audio {
400400 if let PulseState :: Connected ( connection) = & mut self . pulse_state {
401401 if let Some ( device) = & self . current_input {
402402 if let Some ( name) = & device. name {
403- tracing:: info!( "increasing volume of {}" , name ) ;
403+ tracing:: info!( "increasing volume of {name}" ) ;
404404 connection. send ( pulse:: Message :: SetSourceVolumeByName (
405405 name. clone ( ) ,
406406 device. volume ,
@@ -432,7 +432,7 @@ impl cosmic::Application for Audio {
432432 connection. send ( pulse:: Message :: SetSourceMuteByName (
433433 name. clone ( ) ,
434434 device. mute ,
435- ) )
435+ ) ) ;
436436 }
437437 }
438438 }
@@ -506,7 +506,7 @@ impl cosmic::Application for Audio {
506506 panic ! ( "Subscription error handling is bad. This should never happen." )
507507 }
508508 _ => {
509- tracing:: trace!( "Received misc message" )
509+ tracing:: trace!( "Received misc message" ) ;
510510 }
511511 }
512512 }
@@ -559,35 +559,35 @@ impl cosmic::Application for Audio {
559559 MprisRequest :: Play => tokio:: spawn ( async move {
560560 let res = player. play ( ) . await ;
561561 if let Err ( err) = res {
562- tracing:: error!( "Error playing: {}" , err ) ;
562+ tracing:: error!( "Error playing: {err}" ) ;
563563 }
564564 } ) ,
565565 MprisRequest :: Pause => tokio:: spawn ( async move {
566566 let res = player. pause ( ) . await ;
567567 if let Err ( err) = res {
568- tracing:: error!( "Error pausing: {}" , err ) ;
568+ tracing:: error!( "Error pausing: {err}" ) ;
569569 }
570570 } ) ,
571571 MprisRequest :: Next => tokio:: spawn ( async move {
572572 let res = player. next ( ) . await ;
573573 if let Err ( err) = res {
574- tracing:: error!( "Error playing next: {}" , err ) ;
574+ tracing:: error!( "Error playing next: {err}" ) ;
575575 }
576576 } ) ,
577577 MprisRequest :: Previous => tokio:: spawn ( async move {
578578 let res = player. previous ( ) . await ;
579579 if let Err ( err) = res {
580- tracing:: error!( "Error playing previous: {}" , err ) ;
580+ tracing:: error!( "Error playing previous: {err}" ) ;
581581 }
582582 } ) ,
583583 MprisRequest :: Raise => tokio:: spawn ( async move {
584584 let res = player. media_player ( ) . await ;
585585 if let Err ( err) = res {
586- tracing:: error!( "Error fetching MediaPlayer: {}" , err ) ;
586+ tracing:: error!( "Error fetching MediaPlayer: {err}" ) ;
587587 } else {
588588 let res = res. unwrap ( ) . raise ( ) . await ;
589589 if let Err ( err) = res {
590- tracing:: error!( "Error raising client: {}" , err ) ;
590+ tracing:: error!( "Error raising client: {err}" ) ;
591591 }
592592 }
593593 } ) ,
@@ -626,10 +626,10 @@ impl cosmic::Application for Audio {
626626 self . current_output . as_mut ( ) . map ( |output| {
627627 output
628628 . volume
629- . set ( output. volume . len ( ) , percent_to_volume ( value as f64 ) )
629+ . set ( output. volume . len ( ) , percent_to_volume ( value. into ( ) ) )
630630 } ) ;
631631
632- self . output_volume = value as f64 ;
632+ self . output_volume = value. into ( ) ;
633633 self . output_volume_text = format ! ( "{}%" , self . output_volume. round( ) ) ;
634634 }
635635 sub_pulse:: Event :: SinkMute ( value) => {
@@ -641,10 +641,10 @@ impl cosmic::Application for Audio {
641641 self . current_input . as_mut ( ) . map ( |input| {
642642 input
643643 . volume
644- . set ( input. volume . len ( ) , percent_to_volume ( value as f64 ) )
644+ . set ( input. volume . len ( ) , percent_to_volume ( value. into ( ) ) )
645645 } ) ;
646646
647- self . input_volume = value as f64 ;
647+ self . input_volume = value. into ( ) ;
648648 self . input_volume_text = format ! ( "{}%" , self . input_volume. round( ) ) ;
649649 }
650650 sub_pulse:: Event :: SourceMute ( value) => {
@@ -909,7 +909,7 @@ impl cosmic::Application for Audio {
909909 }
910910 let control_cnt = control_elements. len ( ) as u16 ;
911911 elements. push (
912- Row :: with_children ( control_elements)
912+ Row :: from_vec ( control_elements)
913913 . align_y ( Alignment :: Center )
914914 . width ( Length :: FillPortion ( control_cnt. saturating_add ( 1 ) ) )
915915 . spacing ( 8 )
@@ -920,7 +920,7 @@ impl cosmic::Application for Audio {
920920 . push ( padded_control ( divider:: horizontal:: default ( ) ) . padding ( [ space_xxs, space_s] ) ) ;
921921 audio_content = audio_content. push (
922922 menu_button (
923- Row :: with_children ( elements)
923+ Row :: from_vec ( elements)
924924 . align_y ( Alignment :: Center )
925925 . spacing ( 8 ) ,
926926 )
0 commit comments