@@ -32,6 +32,7 @@ const DROPDOWN_PHOTO: usize = 5;
3232const DROPDOWN_CALENDAR : usize = 6 ;
3333const DROPDOWN_TERMINAL : usize = 7 ;
3434const DROPDOWN_TEXT_EDITOR : usize = 8 ;
35+ const DROPDOWN_ARCHIVES : usize = 9 ;
3536
3637#[ derive( Clone , Copy , Debug , Eq , Hash , PartialEq , PartialOrd , Ord ) ]
3738pub enum Category {
@@ -45,6 +46,7 @@ pub enum Category {
4546 Video ,
4647 WebBrowser ,
4748 TextEditor ,
49+ Archives ,
4850}
4951
5052#[ derive( Clone , Debug ) ]
@@ -139,6 +141,18 @@ impl page::Page<crate::pages::Message> for Page {
139141 load_defaults( & assocs, & [ "text/calendar" ] ) . await ,
140142 load_terminal_apps( & assocs) . await ,
141143 load_defaults( & assocs, & [ "text/plain" ] ) . await ,
144+ load_defaults( & assocs, & [
145+ "application/gzip" ,
146+ "application/x-compressed-tar" ,
147+ "application/x-tar" ,
148+ "application/zip" ,
149+ "application/x-bzip" ,
150+ "application/x-bzip-compressed-tar" ,
151+ "application/x-bzip2" ,
152+ "application/x-bzip2-compressed-tar" ,
153+ "application/x-xz" ,
154+ "application/x-xz-compressed-tar" ,
155+ ] ) . await ,
142156 ] ;
143157
144158 Message :: Update ( CachedMimeApps {
@@ -236,6 +250,18 @@ impl Page {
236250 ] ,
237251 ) ,
238252 Category :: TextEditor => ( DROPDOWN_TEXT_EDITOR , & [ "text/plain" ] ) ,
253+ Category :: Archives => ( DROPDOWN_ARCHIVES , & [
254+ "application/gzip" ,
255+ "application/x-compressed-tar" ,
256+ "application/x-tar" ,
257+ "application/zip" ,
258+ "application/x-bzip" ,
259+ "application/x-bzip-compressed-tar" ,
260+ "application/x-bzip2" ,
261+ "application/x-bzip2-compressed-tar" ,
262+ "application/x-xz" ,
263+ "application/x-xz-compressed-tar" ,
264+ ] ) ,
239265 Category :: Mime ( _mime_type) => return Task :: none ( ) ,
240266 } ;
241267
@@ -524,6 +550,32 @@ fn apps() -> Section<crate::pages::Message> {
524550 )
525551 }
526552 } )
553+ . add ( {
554+ let meta = & mime_apps. apps [ DROPDOWN_ARCHIVES ] ;
555+ if meta. apps . is_empty ( ) {
556+ settings:: flex_item (
557+ fl ! ( "default-apps" , "archives" ) ,
558+ widget:: text ( fl ! ( "default-apps" , "not-installed" ) ) ,
559+ )
560+ } else {
561+ settings:: flex_item (
562+ fl ! ( "default-apps" , "archives" ) ,
563+ dropdown:: popup_dropdown (
564+ & meta. apps ,
565+ meta. selected ,
566+ |id| Message :: SetDefault ( Category :: Archives , id) ,
567+ cosmic:: iced:: window:: Id :: RESERVED ,
568+ Message :: Surface ,
569+ |a| {
570+ crate :: app:: Message :: PageMessage (
571+ crate :: pages:: Message :: DefaultApps ( a) ,
572+ )
573+ } ,
574+ )
575+ . icons ( Cow :: Borrowed ( & meta. icons ) ) ,
576+ )
577+ }
578+ } )
527579 . apply ( Element :: from)
528580 . map ( crate :: pages:: Message :: DefaultApps )
529581 } )
0 commit comments