@@ -33,6 +33,7 @@ use slotmap::SlotMap;
3333use tokio:: io:: AsyncBufReadExt ;
3434
3535use crate :: app;
36+ use crate :: widget:: color_picker_context_view;
3637
3738use super :: wallpaper:: widgets:: color_image;
3839
@@ -423,40 +424,6 @@ impl Page {
423424 Ok ( ( ) )
424425 }
425426
426- fn color_picker_context_view (
427- & self ,
428- description : Option < Cow < ' static , str > > ,
429- reset : Cow < ' static , str > ,
430- on_update : fn ( ColorPickerUpdate ) -> Message ,
431- model : impl Fn ( & Self ) -> & ColorPickerModel ,
432- ) -> Element < ' _ , crate :: pages:: Message > {
433- cosmic:: widget:: column ( )
434- . push_maybe ( description. map ( |description| text:: body ( description) . width ( Length :: Fill ) ) )
435- . push (
436- model ( self )
437- . builder ( on_update)
438- . reset_label ( reset)
439- . height ( Length :: Fixed ( 158.0 ) )
440- . build (
441- fl ! ( "recent-colors" ) ,
442- fl ! ( "copy-to-clipboard" ) ,
443- fl ! ( "copied-to-clipboard" ) ,
444- )
445- . apply ( container)
446- . width ( Length :: Fixed ( 248.0 ) )
447- . align_x ( alignment:: Horizontal :: Center )
448- . apply ( container)
449- . width ( Length :: Fill )
450- . align_x ( alignment:: Horizontal :: Center ) ,
451- )
452- . padding ( self . theme_builder . spacing . space_l )
453- . align_items ( cosmic:: iced_core:: Alignment :: Center )
454- . spacing ( self . theme_builder . spacing . space_m )
455- . width ( Length :: Fill )
456- . apply ( Element :: from)
457- . map ( crate :: pages:: Message :: Appearance )
458- }
459-
460427 fn experimental_context_view ( & self ) -> Element < ' _ , crate :: pages:: Message > {
461428 let active = self . icon_theme_active ;
462429 let theme = cosmic:: theme:: active ( ) ;
@@ -1084,49 +1051,55 @@ impl page::Page<crate::pages::Message> for Page {
10841051
10851052 fn context_drawer ( & self ) -> Option < Element < ' _ , crate :: pages:: Message > > {
10861053 let view = match self . context_view ? {
1087- ContextView :: AccentWindowHint => self . color_picker_context_view (
1054+ ContextView :: AccentWindowHint => color_picker_context_view (
10881055 None ,
10891056 RESET_TO_DEFAULT . as_str ( ) . into ( ) ,
10901057 Message :: AccentWindowHint ,
1091- |this| & this. accent_window_hint ,
1092- ) ,
1058+ & self . accent_window_hint ,
1059+ )
1060+ . map ( crate :: pages:: Message :: Appearance ) ,
10931061
1094- ContextView :: ApplicationBackground => self . color_picker_context_view (
1062+ ContextView :: ApplicationBackground => color_picker_context_view (
10951063 None ,
10961064 RESET_TO_DEFAULT . as_str ( ) . into ( ) ,
10971065 Message :: ApplicationBackground ,
1098- |this| & this. application_background ,
1099- ) ,
1066+ & self . application_background ,
1067+ )
1068+ . map ( crate :: pages:: Message :: Appearance ) ,
11001069
1101- ContextView :: ContainerBackground => self . color_picker_context_view (
1070+ ContextView :: ContainerBackground => color_picker_context_view (
11021071 Some ( fl ! ( "container-background" , "desc-detail" ) . into ( ) ) ,
11031072 fl ! ( "container-background" , "reset" ) . into ( ) ,
11041073 Message :: ContainerBackground ,
1105- |this| & this. container_background ,
1106- ) ,
1074+ & self . container_background ,
1075+ )
1076+ . map ( crate :: pages:: Message :: Appearance ) ,
11071077
1108- ContextView :: ControlComponent => self . color_picker_context_view (
1078+ ContextView :: ControlComponent => color_picker_context_view (
11091079 None ,
11101080 RESET_TO_DEFAULT . as_str ( ) . into ( ) ,
11111081 Message :: ControlComponent ,
1112- |this| & this. control_component ,
1113- ) ,
1082+ & self . control_component ,
1083+ )
1084+ . map ( crate :: pages:: Message :: Appearance ) ,
11141085
1115- ContextView :: CustomAccent => self . color_picker_context_view (
1086+ ContextView :: CustomAccent => color_picker_context_view (
11161087 None ,
11171088 RESET_TO_DEFAULT . as_str ( ) . into ( ) ,
11181089 Message :: CustomAccent ,
1119- |this| & this. custom_accent ,
1120- ) ,
1090+ & self . custom_accent ,
1091+ )
1092+ . map ( crate :: pages:: Message :: Appearance ) ,
11211093
11221094 ContextView :: Experimental => self . experimental_context_view ( ) ,
11231095
1124- ContextView :: InterfaceText => self . color_picker_context_view (
1096+ ContextView :: InterfaceText => color_picker_context_view (
11251097 None ,
11261098 RESET_TO_DEFAULT . as_str ( ) . into ( ) ,
11271099 Message :: InterfaceText ,
1128- |this| & this. interface_text ,
1129- ) ,
1100+ & self . interface_text ,
1101+ )
1102+ . map ( crate :: pages:: Message :: Appearance ) ,
11301103 } ;
11311104
11321105 Some ( view)
0 commit comments