2020
2121use crate :: l10n;
2222use crate :: message;
23- use agama_lib:: install_settings:: InstallSettings ;
2423use agama_utils:: actor:: { self , Actor , Handler , MessageHandler } ;
24+ use agama_utils:: api:: event;
2525use agama_utils:: api:: status:: State ;
26- use agama_utils:: api:: { event , Action , Event , Proposal , Scope , Status , SystemInfo } ;
26+ use agama_utils:: api:: { Action , Config , Event , Proposal , Scope , Status , SystemInfo } ;
2727use agama_utils:: issue;
2828use agama_utils:: progress;
2929use async_trait:: async_trait;
@@ -52,7 +52,7 @@ pub struct Service {
5252 issues : Handler < issue:: Service > ,
5353 progress : Handler < progress:: Service > ,
5454 state : State ,
55- config : InstallSettings ,
55+ config : Config ,
5656 events : event:: Sender ,
5757}
5858
@@ -69,7 +69,7 @@ impl Service {
6969 progress,
7070 events,
7171 state : State :: Configuring ,
72- config : InstallSettings :: default ( ) ,
72+ config : Config :: default ( ) ,
7373 }
7474 }
7575
@@ -125,13 +125,10 @@ impl MessageHandler<message::GetExtendedConfig> for Service {
125125 /// Gets the current configuration.
126126 ///
127127 /// It includes user and default values.
128- async fn handle (
129- & mut self ,
130- _message : message:: GetExtendedConfig ,
131- ) -> Result < InstallSettings , Error > {
132- let l10n_config = self . l10n . call ( l10n:: message:: GetConfig ) . await ?;
133- Ok ( InstallSettings {
134- localization : Some ( l10n_config) ,
128+ async fn handle ( & mut self , _message : message:: GetExtendedConfig ) -> Result < Config , Error > {
129+ let l10n = self . l10n . call ( l10n:: message:: GetConfig ) . await ?;
130+ Ok ( Config {
131+ l10n : Some ( l10n) ,
135132 ..Default :: default ( )
136133 } )
137134 }
@@ -142,7 +139,7 @@ impl MessageHandler<message::GetConfig> for Service {
142139 /// Gets the current configuration set by the user.
143140 ///
144141 /// It includes only the values that were set by the user.
145- async fn handle ( & mut self , _message : message:: GetConfig ) -> Result < InstallSettings , Error > {
142+ async fn handle ( & mut self , _message : message:: GetConfig ) -> Result < Config , Error > {
146143 Ok ( self . config . clone ( ) )
147144 }
148145}
@@ -157,9 +154,9 @@ impl MessageHandler<message::SetConfig> for Service {
157154 /// FIXME: We should replace not given sections with the default ones.
158155 /// After all, now we have config/user/:scope URLs.
159156 async fn handle ( & mut self , message : message:: SetConfig ) -> Result < ( ) , Error > {
160- if let Some ( l10n_config ) = & message. config . localization {
157+ if let Some ( l10n ) = & message. config . l10n {
161158 self . l10n
162- . call ( l10n:: message:: SetConfig :: new ( l10n_config . clone ( ) ) )
159+ . call ( l10n:: message:: SetConfig :: new ( l10n . clone ( ) ) )
163160 . await ?;
164161 }
165162 self . config = message. config ;
0 commit comments