@@ -120,7 +120,6 @@ impl page::Page<crate::pages::Message> for Page {
120120 sections : & mut SlotMap < section:: Entity , Section < crate :: pages:: Message > > ,
121121 ) -> Option < page:: Content > {
122122 Some ( vec ! [
123- sections. insert( alerts( ) ) ,
124123 sections. insert( output( ) ) ,
125124 sections. insert( input( ) ) ,
126125 sections. insert( device_profiles( ) ) ,
@@ -345,6 +344,7 @@ fn output() -> Section<crate::pages::Message> {
345344 let mut descriptions = Slab :: new ( ) ;
346345
347346 let volume = descriptions. insert ( fl ! ( "sound-output" , "volume" ) ) ;
347+ let alerts_volume = descriptions. insert ( format ! ( "\t {}" , fl!( "sound-alerts" , "volume" ) ) ) ;
348348 let device = descriptions. insert ( fl ! ( "sound-output" , "device" ) ) ;
349349 let _level = descriptions. insert ( fl ! ( "sound-output" , "level" ) ) ;
350350 let balance = descriptions. insert ( fl ! ( "sound-output" , "balance" ) ) ;
@@ -387,6 +387,35 @@ fn output() -> Section<crate::pages::Message> {
387387 . push ( widget:: horizontal_space ( ) . width ( 8 ) )
388388 . push ( slider) ;
389389
390+ let alerts_slider = if page. amplification_sink {
391+ widget:: slider ( 0 ..=150 , page. model . notification_volume , |change| {
392+ Message :: SetNotificationVolume ( change) . into ( )
393+ } )
394+ . breakpoints ( & [ 100 ] )
395+ } else {
396+ widget:: slider ( 0 ..=100 , page. model . notification_volume , |change| {
397+ Message :: SetNotificationVolume ( change) . into ( )
398+ } )
399+ } ;
400+
401+ let alerts_volume_control = widget:: row:: with_capacity ( 4 )
402+ . align_y ( Alignment :: Center )
403+ . push (
404+ widget:: button:: icon ( if page. model . notification_mute {
405+ widget:: icon:: from_name ( "audio-volume-muted-symbolic" )
406+ } else {
407+ widget:: icon:: from_name ( "audio-volume-high-symbolic" )
408+ } )
409+ . on_press ( Message :: ToggleNotificationMute . into ( ) ) ,
410+ )
411+ . push (
412+ widget:: text:: body ( & page. model . notification_volume_text )
413+ . width ( Length :: Fixed ( 22.0 ) )
414+ . align_x ( Alignment :: Center ) ,
415+ )
416+ . push ( widget:: horizontal_space ( ) . width ( 8 ) )
417+ . push ( alerts_slider) ;
418+
390419 let devices = widget:: dropdown:: popup_dropdown (
391420 page. model . sinks ( ) ,
392421 Some ( page. model . active_sink ( ) . unwrap_or ( 0 ) ) ,
@@ -404,6 +433,10 @@ fn output() -> Section<crate::pages::Message> {
404433 & * section. descriptions [ volume] ,
405434 volume_control,
406435 ) )
436+ . add ( settings:: flex_item (
437+ & * section. descriptions [ alerts_volume] ,
438+ alerts_volume_control,
439+ ) )
407440 . add ( settings:: item ( & * section. descriptions [ device] , devices) )
408441 . add ( settings:: item (
409442 & * section. descriptions [ balance] ,
@@ -473,54 +506,6 @@ fn device_profiles() -> Section<crate::pages::Message> {
473506 } )
474507}
475508
476- fn alerts ( ) -> Section < crate :: pages:: Message > {
477- let mut descriptions = Slab :: new ( ) ;
478- let volume = descriptions. insert ( fl ! ( "sound-alerts" , "volume" ) ) ;
479- let sound = descriptions. insert ( fl ! ( "sound-alerts" , "sound" ) ) ;
480-
481- Section :: default ( )
482- . title ( fl ! ( "sound-alerts" ) )
483- . descriptions ( descriptions)
484- . view :: < Page > ( move |_binder, page, section| {
485- let slider = if page. amplification_sink {
486- widget:: slider ( 0 ..=150 , page. model . notification_volume , |change| {
487- Message :: SetNotificationVolume ( change) . into ( )
488- } )
489- . breakpoints ( & [ 100 ] )
490- } else {
491- widget:: slider ( 0 ..=100 , page. model . notification_volume , |change| {
492- Message :: SetNotificationVolume ( change) . into ( )
493- } )
494- } ;
495-
496- let volume_control = widget:: row:: with_capacity ( 4 )
497- . align_y ( Alignment :: Center )
498- . push (
499- widget:: button:: icon ( if page. model . notification_mute {
500- widget:: icon:: from_name ( "audio-volume-muted-symbolic" )
501- } else {
502- widget:: icon:: from_name ( "audio-volume-high-symbolic" )
503- } )
504- . on_press ( Message :: ToggleNotificationMute . into ( ) ) ,
505- )
506- . push (
507- widget:: text:: body ( & page. model . notification_volume_text )
508- . width ( Length :: Fixed ( 22.0 ) )
509- . align_x ( Alignment :: Center ) ,
510- )
511- . push ( widget:: horizontal_space ( ) . width ( 8 ) )
512- . push ( slider) ;
513-
514- settings:: section ( )
515- . title ( & section. title )
516- . add ( settings:: flex_item (
517- & * section. descriptions [ volume] ,
518- volume_control,
519- ) )
520- . into ( )
521- } )
522- }
523-
524509// fn applications() -> Section<crate::pages::Message> {
525510// let mut descriptions = Slab::new();
526511
0 commit comments