@@ -2,14 +2,14 @@ use crate::{
22 distrobox:: { ContainerInfo , ExportableApp , Status } ,
33 distrobox_task:: DistroboxTask ,
44 fakers:: CommandRunner ,
5+ gtk_utils:: TypedListStore ,
56 known_distros:: { known_distro_by_image, KnownDistro } ,
67 query:: Query ,
78 root_store:: RootStore ,
89 fakers:: Command
910} ;
1011
1112use gtk:: {
12- gio,
1313 glib:: { derived_properties, BoxedAnyObject , Properties } ,
1414} ;
1515
@@ -38,8 +38,8 @@ mod imp {
3838 pub image : RefCell < String > ,
3939 #[ property( get, set) ]
4040 pub distro : RefCell < Option < KnownDistro > > ,
41- pub apps : Query < gio :: ListStore , anyhow:: Error > ,
42- pub binaries : Query < gio :: ListStore , anyhow:: Error > ,
41+ pub apps : Query < TypedListStore < glib :: BoxedAnyObject > , anyhow:: Error > ,
42+ pub binaries : Query < TypedListStore < glib :: BoxedAnyObject > , anyhow:: Error > ,
4343 }
4444
4545 impl Default for Container {
@@ -52,10 +52,10 @@ mod imp {
5252 image : RefCell :: new ( String :: new ( ) ) ,
5353 distro : RefCell :: new ( None ) ,
5454 apps : Query :: new ( "apps" . into ( ) , || async {
55- Ok ( gio :: ListStore :: new :: < BoxedAnyObject > ( ) )
55+ Ok ( TypedListStore :: new ( ) )
5656 } ) ,
5757 binaries : Query :: new ( "binaries" . into ( ) , || async {
58- Ok ( gio :: ListStore :: new :: < BoxedAnyObject > ( ) )
58+ Ok ( TypedListStore :: new ( ) )
5959 } ) ,
6060 }
6161 }
@@ -106,8 +106,7 @@ impl Container {
106106 . list_apps ( & this. name ( ) )
107107 . await ?;
108108
109- let mut apps_list = gio:: ListStore :: new :: < BoxedAnyObject > ( ) ;
110- apps_list. extend ( apps. into_iter ( ) . map ( BoxedAnyObject :: new) ) ;
109+ let apps_list: TypedListStore < BoxedAnyObject > = TypedListStore :: from_iter ( apps. into_iter ( ) . map ( BoxedAnyObject :: new) ) ;
111110
112111 // Listing the apps starts the container, we need to update its status
113112 this. root_store ( ) . load_containers ( ) ;
@@ -125,8 +124,7 @@ impl Container {
125124 . get_exported_binaries ( & this. name ( ) )
126125 . await ?;
127126
128- let mut binaries_list = gio:: ListStore :: new :: < BoxedAnyObject > ( ) ;
129- binaries_list. extend ( binaries. into_iter ( ) . map ( BoxedAnyObject :: new) ) ;
127+ let binaries_list: TypedListStore < BoxedAnyObject > = TypedListStore :: from_iter ( binaries. into_iter ( ) . map ( BoxedAnyObject :: new) ) ;
130128
131129 // Listing the binaries starts the container, we need to update its status
132130 this. root_store ( ) . load_containers ( ) ;
@@ -137,11 +135,11 @@ impl Container {
137135 this
138136 }
139137
140- pub fn apps ( & self ) -> Query < gio :: ListStore , anyhow:: Error > {
138+ pub fn apps ( & self ) -> Query < TypedListStore < BoxedAnyObject > , anyhow:: Error > {
141139 self . imp ( ) . apps . clone ( )
142140 }
143141
144- pub fn binaries ( & self ) -> Query < gio :: ListStore , anyhow:: Error > {
142+ pub fn binaries ( & self ) -> Query < TypedListStore < BoxedAnyObject > , anyhow:: Error > {
145143 self . imp ( ) . binaries . clone ( )
146144 }
147145
0 commit comments