@@ -88,7 +88,6 @@ pub struct Impactor {
8888 main_window : Option < window:: Id > ,
8989 account_store : Option < AccountStore > ,
9090 accent_color : appearance:: AccentColor ,
91- accent_picker_open : bool ,
9291 login_windows : std:: collections:: HashMap < window:: Id , login_window:: LoginWindow > ,
9392 pending_installation : bool ,
9493}
@@ -136,7 +135,6 @@ impl Impactor {
136135 main_window,
137136 account_store : Some ( store) ,
138137 accent_color,
139- accent_picker_open : false ,
140138 login_windows : std:: collections:: HashMap :: new ( ) ,
141139 pending_installation : false ,
142140 } ,
@@ -465,59 +463,10 @@ impl Impactor {
465463 }
466464 Task :: none ( )
467465 }
468- settings:: Message :: RequestAccentColorPicker => {
469- if self . accent_picker_open {
470- return Task :: none ( ) ;
471- }
472-
473- self . accent_picker_open = true ;
474-
475- Task :: perform ( async { } , |_| {
476- Message :: SettingsScreen ( settings:: Message :: OpenAccentColorPicker )
477- } )
478- }
479- settings:: Message :: OpenAccentColorPicker => {
480- let current_accent = self . accent_color ;
481-
482- Task :: perform (
483- async move {
484- let ( tx, rx) = std:: sync:: mpsc:: channel ( ) ;
485-
486- std:: thread:: spawn ( move || {
487- let default_rgb = [
488- current_accent. red ( ) ,
489- current_accent. green ( ) ,
490- current_accent. blue ( ) ,
491- ] ;
492-
493- let picked = tinyfiledialogs:: color_chooser_dialog (
494- "Choose Accent Color" ,
495- tinyfiledialogs:: DefaultColorValue :: RGB ( & default_rgb) ,
496- )
497- . map ( |( _, rgb) | {
498- appearance:: AccentColor :: new ( rgb[ 0 ] , rgb[ 1 ] , rgb[ 2 ] )
499- } ) ;
500-
501- let _ = tx. send ( picked) ;
502- } ) ;
503-
504- rx. recv ( ) . ok ( ) . flatten ( )
505- } ,
506- |accent| {
507- Message :: SettingsScreen ( settings:: Message :: AccentColorPicked (
508- accent,
509- ) )
510- } ,
511- )
512- }
513- settings:: Message :: AccentColorPicked ( accent) => {
514- self . accent_picker_open = false ;
515-
516- if let Some ( accent_color) = accent {
517- self . accent_color = accent_color;
518- if let Err ( err) = defaults:: save_accent_color ( self . accent_color ) {
519- log:: error!( "Failed to save accent color: {err}" ) ;
520- }
466+ settings:: Message :: AccentColorPicked ( accent_color) => {
467+ self . accent_color = accent_color;
468+ if let Err ( err) = defaults:: save_accent_color ( self . accent_color ) {
469+ log:: error!( "Failed to save accent color: {err}" ) ;
521470 }
522471
523472 Task :: none ( )
@@ -840,11 +789,7 @@ impl Impactor {
840789 ImpactorScreen :: Main ( screen) => screen. view ( ) . map ( Message :: MainScreen ) ,
841790 ImpactorScreen :: Utilities ( screen) => screen. view ( ) . map ( Message :: UtilitiesScreen ) ,
842791 ImpactorScreen :: Settings ( screen) => screen
843- . view (
844- & self . account_store ,
845- self . accent_color ,
846- self . accent_picker_open ,
847- )
792+ . view ( & self . account_store , self . accent_color )
848793 . map ( Message :: SettingsScreen ) ,
849794 ImpactorScreen :: Installer ( screen) => {
850795 screen. view ( has_device) . map ( Message :: InstallerScreen )
0 commit comments