@@ -34,6 +34,7 @@ const DROPDOWN_PHOTO: usize = 5;
3434const DROPDOWN_CALENDAR : usize = 6 ;
3535const DROPDOWN_TERMINAL : usize = 7 ;
3636const DROPDOWN_TEXT_EDITOR : usize = 8 ;
37+ const DROPDOWN_ARCHIVES : usize = 9 ;
3738
3839#[ derive( Clone , Copy , Debug , Eq , Hash , PartialEq , PartialOrd , Ord ) ]
3940pub enum Category {
@@ -47,6 +48,7 @@ pub enum Category {
4748 Video ,
4849 WebBrowser ,
4950 TextEditor ,
51+ Archives ,
5052}
5153
5254#[ derive( Clone , Debug ) ]
@@ -141,6 +143,18 @@ impl page::Page<crate::pages::Message> for Page {
141143 load_defaults( & assocs, & [ "text/calendar" ] ) . await ,
142144 load_terminal_apps( & assocs) . await ,
143145 load_defaults( & assocs, & [ "text/plain" ] ) . await ,
146+ load_defaults( & assocs, & [
147+ "application/gzip" ,
148+ "application/x-compressed-tar" ,
149+ "application/x-tar" ,
150+ "application/zip" ,
151+ "application/x-bzip" ,
152+ "application/x-bzip-compressed-tar" ,
153+ "application/x-bzip2" ,
154+ "application/x-bzip2-compressed-tar" ,
155+ "application/x-xz" ,
156+ "application/x-xz-compressed-tar" ,
157+ ] ) . await ,
144158 ] ;
145159
146160 Message :: Update ( CachedMimeApps {
@@ -238,6 +252,18 @@ impl Page {
238252 ] ,
239253 ) ,
240254 Category :: TextEditor => ( DROPDOWN_TEXT_EDITOR , & [ "text/plain" ] ) ,
255+ Category :: Archives => ( DROPDOWN_ARCHIVES , & [
256+ "application/gzip" ,
257+ "application/x-compressed-tar" ,
258+ "application/x-tar" ,
259+ "application/zip" ,
260+ "application/x-bzip" ,
261+ "application/x-bzip-compressed-tar" ,
262+ "application/x-bzip2" ,
263+ "application/x-bzip2-compressed-tar" ,
264+ "application/x-xz" ,
265+ "application/x-xz-compressed-tar" ,
266+ ] ) ,
241267 Category :: Mime ( _mime_type) => return Task :: none ( ) ,
242268 } ;
243269
@@ -544,6 +570,32 @@ fn apps() -> Section<crate::pages::Message> {
544570 . align_items ( Alignment :: Center )
545571 }
546572 } )
573+ . add ( {
574+ let meta = & mime_apps. apps [ DROPDOWN_ARCHIVES ] ;
575+ if meta. apps . is_empty ( ) {
576+ settings:: flex_item (
577+ fl ! ( "default-apps" , "archives" ) ,
578+ widget:: text ( fl ! ( "default-apps" , "not-installed" ) ) ,
579+ )
580+ } else {
581+ settings:: flex_item (
582+ fl ! ( "default-apps" , "archives" ) ,
583+ dropdown:: popup_dropdown (
584+ & meta. apps ,
585+ meta. selected ,
586+ |id| Message :: SetDefault ( Category :: Archives , id) ,
587+ cosmic:: iced:: window:: Id :: RESERVED ,
588+ Message :: Surface ,
589+ |a| {
590+ crate :: app:: Message :: PageMessage (
591+ crate :: pages:: Message :: DefaultApps ( a) ,
592+ )
593+ } ,
594+ )
595+ . icons ( Cow :: Borrowed ( & meta. icons ) ) ,
596+ )
597+ }
598+ } )
547599 . apply ( Element :: from)
548600 . map ( crate :: pages:: Message :: DefaultApps )
549601 } )
0 commit comments