@@ -19,6 +19,11 @@ use std::{collections::HashMap, time::Duration};
1919
2020use crate :: pages:: desktop:: appearance:: Roundness ;
2121
22+ pub enum PanelInnerDialog {
23+ /// Confirmation dialog for reseting all panel settings
24+ ResetPanelConfirmation ,
25+ }
26+
2227pub struct PageInner {
2328 pub ( crate ) config_helper : Option < cosmic_config:: Config > ,
2429 pub ( crate ) panel_config : Option < CosmicPanelConfig > ,
@@ -28,6 +33,7 @@ pub struct PageInner {
2833 pub outputs : Vec < String > ,
2934 pub anchors : Vec < String > ,
3035 pub backgrounds : Vec < String > ,
36+ pub ( crate ) dialog : Option < PanelInnerDialog > ,
3137 pub ( crate ) container_config : Option < CosmicPanelContainerConfig > ,
3238 // TODO move these into panel config
3339 pub ( crate ) outputs_map : HashMap < ObjectId , ( String , WlOutput ) > ,
@@ -55,6 +61,7 @@ impl Default for PageInner {
5561 Appearance :: Light . to_string( ) ,
5662 Appearance :: Dark . to_string( ) ,
5763 ] ,
64+ dialog : None ,
5865 container_config : Option :: default ( ) ,
5966 outputs_map : HashMap :: default ( ) ,
6067 system_default : None ,
@@ -347,7 +354,7 @@ pub fn reset_button<
347354 Element :: from ( space ( ) )
348355 } else {
349356 button:: standard ( & descriptions[ reset_to_default] )
350- . on_press ( Message :: ResetPanel )
357+ . on_press ( Message :: ConfirmResetPanel )
351358 . into ( )
352359 }
353360 . map ( msg_map)
@@ -432,6 +439,8 @@ pub enum Message {
432439 OutputRemoved ( WlOutput ) ,
433440 PanelConfig ( Box < CosmicPanelConfig > ) ,
434441 ResetPanel ,
442+ ConfirmResetPanel ,
443+ CloseDialog ,
435444 FullReset ,
436445 Surface ( surface:: Action ) ,
437446}
@@ -673,7 +682,13 @@ impl PageInner {
673682 self . panel_config = Some ( * c) ;
674683 return Task :: none ( ) ;
675684 }
676- Message :: ResetPanel | Message :: FullReset => { }
685+ Message :: ConfirmResetPanel => {
686+ self . dialog = Some ( PanelInnerDialog :: ResetPanelConfirmation ) ;
687+ }
688+ Message :: CloseDialog | Message :: ResetPanel => {
689+ self . dialog = None ;
690+ }
691+ Message :: FullReset => { }
677692 Message :: Surface ( _) => {
678693 unimplemented ! ( )
679694 }
0 commit comments