@@ -109,8 +109,10 @@ static SYSTEM: Lazy<String> = Lazy::new(|| fl!("system"));
109
109
110
110
pub ( crate ) static WINDOW_ID : Lazy < SurfaceId > = Lazy :: new ( || SurfaceId :: unique ( ) ) ;
111
111
static NEW_GROUP_WINDOW_ID : Lazy < SurfaceId > = Lazy :: new ( || SurfaceId :: unique ( ) ) ;
112
+ static NEW_GROUP_AUTOSIZE_ID : Lazy < cosmic:: widget:: Id > = Lazy :: new ( || cosmic:: widget:: Id :: unique ( ) ) ;
112
113
static DELETE_GROUP_WINDOW_ID : Lazy < SurfaceId > = Lazy :: new ( || SurfaceId :: unique ( ) ) ;
113
- pub ( crate ) static DND_ICON_ID : Lazy < SurfaceId > = Lazy :: new ( || SurfaceId :: unique ( ) ) ;
114
+ static DELETE_GROUP_AUTOSIZE_ID : Lazy < cosmic:: widget:: Id > =
115
+ Lazy :: new ( || cosmic:: widget:: Id :: unique ( ) ) ;
114
116
pub ( crate ) static MENU_ID : Lazy < SurfaceId > = Lazy :: new ( || SurfaceId :: unique ( ) ) ;
115
117
pub ( crate ) static MENU_AUTOSIZE_ID : Lazy < cosmic:: widget:: Id > =
116
118
Lazy :: new ( || cosmic:: widget:: Id :: unique ( ) ) ;
@@ -789,18 +791,6 @@ impl cosmic::Application for CosmicAppLibrary {
789
791
..
790
792
} = theme:: active ( ) . cosmic ( ) . spacing ;
791
793
792
- if id == DND_ICON_ID . clone ( ) {
793
- let Some ( icon_source) = self
794
- . dnd_icon
795
- . and_then ( |i| self . entry_path_input . get ( i) . map ( |e| & e. icon ) )
796
- else {
797
- return container ( horizontal_space ( ) )
798
- . width ( Length :: Fixed ( 1.0 ) )
799
- . height ( Length :: Fixed ( 1.0 ) )
800
- . into ( ) ;
801
- } ;
802
- return icon_source. as_cosmic_icon ( ) . size ( 32 ) . into ( ) ;
803
- }
804
794
if id == MENU_ID . clone ( ) {
805
795
let Some ( ( menu, i) ) = self
806
796
. menu
@@ -965,24 +955,27 @@ impl cosmic::Application for CosmicAppLibrary {
965
955
]
966
956
. align_x ( Alignment :: Center )
967
957
. spacing ( space_s) ;
968
- return container ( dialog)
969
- . class ( theme:: Container :: Custom ( Box :: new ( |theme| {
970
- container:: Style {
971
- text_color : Some ( theme. cosmic ( ) . on_bg_color ( ) . into ( ) ) ,
972
- icon_color : Some ( theme. cosmic ( ) . on_bg_color ( ) . into ( ) ) ,
973
- background : Some ( Color :: from ( theme. cosmic ( ) . background . base ) . into ( ) ) ,
974
- border : Border {
975
- color : theme. cosmic ( ) . bg_divider ( ) . into ( ) ,
976
- radius : theme. cosmic ( ) . corner_radii . radius_m . into ( ) ,
977
- width : 1.0 ,
978
- } ,
979
- shadow : Shadow :: default ( ) ,
980
- }
981
- } ) ) )
982
- . width ( Length :: Shrink )
983
- . height ( Length :: Shrink )
984
- . padding ( space_s)
985
- . into ( ) ;
958
+ return autosize (
959
+ container ( dialog)
960
+ . class ( theme:: Container :: Custom ( Box :: new ( |theme| {
961
+ container:: Style {
962
+ text_color : Some ( theme. cosmic ( ) . on_bg_color ( ) . into ( ) ) ,
963
+ icon_color : Some ( theme. cosmic ( ) . on_bg_color ( ) . into ( ) ) ,
964
+ background : Some ( Color :: from ( theme. cosmic ( ) . background . base ) . into ( ) ) ,
965
+ border : Border {
966
+ color : theme. cosmic ( ) . bg_divider ( ) . into ( ) ,
967
+ radius : theme. cosmic ( ) . corner_radii . radius_m . into ( ) ,
968
+ width : 1.0 ,
969
+ } ,
970
+ shadow : Shadow :: default ( ) ,
971
+ }
972
+ } ) ) )
973
+ . width ( Length :: Shrink )
974
+ . height ( Length :: Shrink )
975
+ . padding ( space_s) ,
976
+ NEW_GROUP_AUTOSIZE_ID . clone ( ) ,
977
+ )
978
+ . into ( ) ;
986
979
}
987
980
if id == DELETE_GROUP_WINDOW_ID . clone ( ) {
988
981
let dialog = column ! [
@@ -1029,24 +1022,27 @@ impl cosmic::Application for CosmicAppLibrary {
1029
1022
]
1030
1023
. align_x ( Alignment :: Center )
1031
1024
. spacing ( space_l) ;
1032
- return container ( dialog)
1033
- . class ( theme:: Container :: Custom ( Box :: new ( |theme| {
1034
- container:: Style {
1035
- text_color : Some ( theme. cosmic ( ) . on_bg_color ( ) . into ( ) ) ,
1036
- icon_color : Some ( theme. cosmic ( ) . on_bg_color ( ) . into ( ) ) ,
1037
- background : Some ( Color :: from ( theme. cosmic ( ) . background . base ) . into ( ) ) ,
1038
- border : Border {
1039
- color : theme. cosmic ( ) . bg_divider ( ) . into ( ) ,
1040
- radius : theme. cosmic ( ) . corner_radii . radius_m . into ( ) ,
1041
- width : 1.0 ,
1042
- } ,
1043
- shadow : Shadow :: default ( ) ,
1044
- }
1045
- } ) ) )
1046
- . width ( Length :: Shrink )
1047
- . height ( Length :: Shrink )
1048
- . padding ( space_m)
1049
- . into ( ) ;
1025
+ return autosize (
1026
+ container ( dialog)
1027
+ . class ( theme:: Container :: Custom ( Box :: new ( |theme| {
1028
+ container:: Style {
1029
+ text_color : Some ( theme. cosmic ( ) . on_bg_color ( ) . into ( ) ) ,
1030
+ icon_color : Some ( theme. cosmic ( ) . on_bg_color ( ) . into ( ) ) ,
1031
+ background : Some ( Color :: from ( theme. cosmic ( ) . background . base ) . into ( ) ) ,
1032
+ border : Border {
1033
+ color : theme. cosmic ( ) . bg_divider ( ) . into ( ) ,
1034
+ radius : theme. cosmic ( ) . corner_radii . radius_m . into ( ) ,
1035
+ width : 1.0 ,
1036
+ } ,
1037
+ shadow : Shadow :: default ( ) ,
1038
+ }
1039
+ } ) ) )
1040
+ . width ( Length :: Shrink )
1041
+ . height ( Length :: Shrink )
1042
+ . padding ( space_m) ,
1043
+ DELETE_GROUP_AUTOSIZE_ID . clone ( ) ,
1044
+ )
1045
+ . into ( ) ;
1050
1046
}
1051
1047
1052
1048
let cur_group = self . config . groups ( ) [ self . cur_group ] ;
0 commit comments