fix: replace assert! calls in UI activities with graceful error handling

This commit is contained in:
Christian Visintin
2026-02-28 13:50:31 +00:00
parent be237c39a6
commit 4fdaf82314
9 changed files with 1622 additions and 1759 deletions
File diff suppressed because it is too large Load Diff
+265 -325
View File
@@ -28,26 +28,26 @@ impl AuthActivity {
let key_color = self.theme().misc_keys; let key_color = self.theme().misc_keys;
let info_color = self.theme().misc_info_dialog; let info_color = self.theme().misc_info_dialog;
// Headers // Headers
assert!( if let Err(err) = self
self.app .app
.mount(Id::Title, Box::<components::Title>::default(), vec![]) .mount(Id::Title, Box::<components::Title>::default(), vec![])
.is_ok() {
); error!("Failed to mount component: {err}");
assert!( }
if let Err(err) =
self.app self.app
.mount(Id::Subtitle, Box::<components::Subtitle>::default(), vec![]) .mount(Id::Subtitle, Box::<components::Subtitle>::default(), vec![])
.is_ok() {
); error!("Failed to mount component: {err}");
}
// Footer // Footer
assert!( if let Err(err) = self.app.mount(
self.app
.mount(
Id::HelpFooter, Id::HelpFooter,
Box::new(components::HelpFooter::new(key_color)), Box::new(components::HelpFooter::new(key_color)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to mount component: {err}");
); }
// Host bridge auth form // Host bridge auth form
self.mount_host_bridge_protocol(HostBridgeProtocol::Localhost); self.mount_host_bridge_protocol(HostBridgeProtocol::Localhost);
@@ -116,18 +116,16 @@ impl AuthActivity {
.get_string(super::STORE_KEY_LATEST_VERSION) .get_string(super::STORE_KEY_LATEST_VERSION)
{ {
let version: String = version.to_string(); let version: String = version.to_string();
assert!( if let Err(err) = self.app.mount(
self.app
.mount(
Id::NewVersionDisclaimer, Id::NewVersionDisclaimer,
Box::new(components::NewVersionDisclaimer::new( Box::new(components::NewVersionDisclaimer::new(
version.as_str(), version.as_str(),
info_color info_color,
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to mount component: {err}");
); }
} }
// Load bookmarks // Load bookmarks
self.view_bookmarks(); self.view_bookmarks();
@@ -135,7 +133,9 @@ impl AuthActivity {
// Global listener // Global listener
self.init_global_listener(); self.init_global_listener();
// Active protocol // Active protocol
assert!(self.app.active(&Id::Remote(AuthFormId::Protocol)).is_ok()); if let Err(err) = self.app.active(&Id::Remote(AuthFormId::Protocol)) {
error!("Failed to activate component: {err}");
}
} }
/// Display view on canvas /// Display view on canvas
@@ -459,15 +459,13 @@ impl AuthActivity {
}) })
.collect(); .collect();
let bookmarks_color = self.theme().auth_bookmarks; let bookmarks_color = self.theme().auth_bookmarks;
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::BookmarksList, Id::BookmarksList,
Box::new(components::BookmarksList::new(&bookmarks, bookmarks_color)), Box::new(components::BookmarksList::new(&bookmarks, bookmarks_color)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
/// View recent connections /// View recent connections
@@ -478,15 +476,13 @@ impl AuthActivity {
.map(|x| Self::fmt_recent(self.bookmarks_client().unwrap().get_recent(x).unwrap())) .map(|x| Self::fmt_recent(self.bookmarks_client().unwrap().get_recent(x).unwrap()))
.collect(); .collect();
let recents_color = self.theme().auth_recents; let recents_color = self.theme().auth_recents;
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::RecentsList, Id::RecentsList,
Box::new(components::RecentsList::new(&bookmarks, recents_color)), Box::new(components::RecentsList::new(&bookmarks, recents_color)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
// -- mount // -- mount
@@ -494,16 +490,16 @@ impl AuthActivity {
/// Mount error box /// Mount error box
pub(super) fn mount_error<S: AsRef<str>>(&mut self, text: S) { pub(super) fn mount_error<S: AsRef<str>>(&mut self, text: S) {
let err_color = self.theme().misc_error_dialog; let err_color = self.theme().misc_error_dialog;
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::ErrorPopup, Id::ErrorPopup,
Box::new(components::ErrorPopup::new(text, err_color)), Box::new(components::ErrorPopup::new(text, err_color)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!(self.app.active(&Id::ErrorPopup).is_ok()); if let Err(err) = self.app.active(&Id::ErrorPopup) {
error!("Failed to activate component: {err}");
}
} }
/// Umount error message /// Umount error message
@@ -514,16 +510,16 @@ impl AuthActivity {
/// Mount info box /// Mount info box
pub(super) fn mount_info<S: AsRef<str>>(&mut self, text: S) { pub(super) fn mount_info<S: AsRef<str>>(&mut self, text: S) {
let color = self.theme().misc_info_dialog; let color = self.theme().misc_info_dialog;
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::InfoPopup, Id::InfoPopup,
Box::new(components::InfoPopup::new(text, color)), Box::new(components::InfoPopup::new(text, color)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!(self.app.active(&Id::InfoPopup).is_ok()); if let Err(err) = self.app.active(&Id::InfoPopup) {
error!("Failed to activate component: {err}");
}
} }
/// Umount info message /// Umount info message
@@ -534,16 +530,16 @@ impl AuthActivity {
/// Mount wait box /// Mount wait box
pub(super) fn mount_wait(&mut self, text: &str) { pub(super) fn mount_wait(&mut self, text: &str) {
let wait_color = self.theme().misc_info_dialog; let wait_color = self.theme().misc_info_dialog;
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::WaitPopup, Id::WaitPopup,
Box::new(components::WaitPopup::new(text, wait_color)), Box::new(components::WaitPopup::new(text, wait_color)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!(self.app.active(&Id::WaitPopup).is_ok()); if let Err(err) = self.app.active(&Id::WaitPopup) {
error!("Failed to activate component: {err}");
}
} }
/// Umount wait message /// Umount wait message
@@ -554,16 +550,16 @@ impl AuthActivity {
/// Mount size error /// Mount size error
pub(super) fn mount_size_err(&mut self) { pub(super) fn mount_size_err(&mut self) {
// Mount // Mount
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::WindowSizeError, Id::WindowSizeError,
Box::new(components::WindowSizeError::new(Color::Red)), Box::new(components::WindowSizeError::new(Color::Red)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!(self.app.active(&Id::WindowSizeError).is_ok()); if let Err(err) = self.app.active(&Id::WindowSizeError) {
error!("Failed to activate component: {err}");
}
} }
/// Umount error size error /// Umount error size error
@@ -575,16 +571,16 @@ impl AuthActivity {
pub(super) fn mount_quit(&mut self) { pub(super) fn mount_quit(&mut self) {
// Protocol // Protocol
let quit_color = self.theme().misc_quit_dialog; let quit_color = self.theme().misc_quit_dialog;
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::QuitPopup, Id::QuitPopup,
Box::new(components::QuitPopup::new(quit_color)), Box::new(components::QuitPopup::new(quit_color)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!(self.app.active(&Id::QuitPopup).is_ok()); if let Err(err) = self.app.active(&Id::QuitPopup) {
error!("Failed to activate component: {err}");
}
} }
/// Umount quit popup /// Umount quit popup
@@ -595,16 +591,16 @@ impl AuthActivity {
/// Mount bookmark delete dialog /// Mount bookmark delete dialog
pub(super) fn mount_bookmark_del_dialog(&mut self) { pub(super) fn mount_bookmark_del_dialog(&mut self) {
let warn_color = self.theme().misc_warn_dialog; let warn_color = self.theme().misc_warn_dialog;
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::DeleteBookmarkPopup, Id::DeleteBookmarkPopup,
Box::new(components::DeleteBookmarkPopup::new(warn_color)), Box::new(components::DeleteBookmarkPopup::new(warn_color)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!(self.app.active(&Id::DeleteBookmarkPopup).is_ok()); if let Err(err) = self.app.active(&Id::DeleteBookmarkPopup) {
error!("Failed to activate component: {err}");
}
} }
/// umount delete bookmark dialog /// umount delete bookmark dialog
@@ -615,16 +611,16 @@ impl AuthActivity {
/// Mount recent delete dialog /// Mount recent delete dialog
pub(super) fn mount_recent_del_dialog(&mut self) { pub(super) fn mount_recent_del_dialog(&mut self) {
let warn_color = self.theme().misc_warn_dialog; let warn_color = self.theme().misc_warn_dialog;
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::DeleteRecentPopup, Id::DeleteRecentPopup,
Box::new(components::DeleteRecentPopup::new(warn_color)), Box::new(components::DeleteRecentPopup::new(warn_color)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!(self.app.active(&Id::DeleteRecentPopup).is_ok()); if let Err(err) = self.app.active(&Id::DeleteRecentPopup) {
error!("Failed to activate component: {err}");
}
} }
/// umount delete recent dialog /// umount delete recent dialog
@@ -636,26 +632,24 @@ impl AuthActivity {
pub(super) fn mount_bookmark_save_dialog(&mut self, form_tab: FormTab) { pub(super) fn mount_bookmark_save_dialog(&mut self, form_tab: FormTab) {
let save_color = self.theme().misc_save_dialog; let save_color = self.theme().misc_save_dialog;
let warn_color = self.theme().misc_warn_dialog; let warn_color = self.theme().misc_warn_dialog;
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::BookmarkName, Id::BookmarkName,
Box::new(components::BookmarkName::new(form_tab, save_color)), Box::new(components::BookmarkName::new(form_tab, save_color)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::BookmarkSavePassword, Id::BookmarkSavePassword,
Box::new(components::BookmarkSavePassword::new(form_tab, warn_color)), Box::new(components::BookmarkSavePassword::new(form_tab, warn_color)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
// Give focus to input bookmark name // Give focus to input bookmark name
assert!(self.app.active(&Id::BookmarkName).is_ok()); if let Err(err) = self.app.active(&Id::BookmarkName) {
error!("Failed to activate component: {err}");
}
} }
/// Umount bookmark save dialog /// Umount bookmark save dialog
@@ -667,17 +661,17 @@ impl AuthActivity {
/// Mount keybindings /// Mount keybindings
pub(super) fn mount_keybindings(&mut self) { pub(super) fn mount_keybindings(&mut self) {
let key_color = self.theme().misc_keys; let key_color = self.theme().misc_keys;
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Keybindings, Id::Keybindings,
Box::new(components::Keybindings::new(key_color)), Box::new(components::Keybindings::new(key_color)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
// Active help // Active help
assert!(self.app.active(&Id::Keybindings).is_ok()); if let Err(err) = self.app.active(&Id::Keybindings) {
error!("Failed to activate component: {err}");
}
} }
/// Umount help /// Umount help
@@ -692,25 +686,23 @@ impl AuthActivity {
{ {
// make spans // make spans
let info_color = self.theme().misc_info_dialog; let info_color = self.theme().misc_info_dialog;
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::NewVersionChangelog, Id::NewVersionChangelog,
Box::new(components::ReleaseNotes::new(release_notes, info_color)), Box::new(components::ReleaseNotes::new(release_notes, info_color)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::InstallUpdatePopup, Id::InstallUpdatePopup,
Box::new(components::InstallUpdatePopup::new(info_color)), Box::new(components::InstallUpdatePopup::new(info_color)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!(self.app.active(&Id::InstallUpdatePopup).is_ok()); if let Err(err) = self.app.active(&Id::InstallUpdatePopup) {
error!("Failed to activate component: {err}");
}
} }
} }
@@ -722,34 +714,30 @@ impl AuthActivity {
pub(super) fn mount_host_bridge_protocol(&mut self, protocol: HostBridgeProtocol) { pub(super) fn mount_host_bridge_protocol(&mut self, protocol: HostBridgeProtocol) {
let protocol_color = self.theme().auth_protocol; let protocol_color = self.theme().auth_protocol;
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::HostBridge(AuthFormId::Protocol), Id::HostBridge(AuthFormId::Protocol),
Box::new(components::HostBridgeProtocolRadio::new( Box::new(components::HostBridgeProtocolRadio::new(
protocol, protocol,
protocol_color protocol_color,
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
pub(super) fn mount_remote_protocol(&mut self, protocol: FileTransferProtocol) { pub(super) fn mount_remote_protocol(&mut self, protocol: FileTransferProtocol) {
let protocol_color = self.theme().auth_protocol; let protocol_color = self.theme().auth_protocol;
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Remote(AuthFormId::Protocol), Id::Remote(AuthFormId::Protocol),
Box::new(components::RemoteProtocolRadio::new( Box::new(components::RemoteProtocolRadio::new(
protocol, protocol,
protocol_color protocol_color,
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
pub(super) fn mount_remote_directory<S: AsRef<str>>( pub(super) fn mount_remote_directory<S: AsRef<str>>(
@@ -759,19 +747,17 @@ impl AuthActivity {
) { ) {
let id = Self::form_tab_id(form_tab, AuthFormId::RemoteDirectory); let id = Self::form_tab_id(form_tab, AuthFormId::RemoteDirectory);
let protocol_color = self.theme().auth_protocol; let protocol_color = self.theme().auth_protocol;
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
id, id,
Box::new(components::InputRemoteDirectory::new( Box::new(components::InputRemoteDirectory::new(
remote_path.as_ref(), remote_path.as_ref(),
form_tab, form_tab,
protocol_color protocol_color,
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
pub(super) fn mount_local_directory<S: AsRef<str>>( pub(super) fn mount_local_directory<S: AsRef<str>>(
@@ -781,337 +767,293 @@ impl AuthActivity {
) { ) {
let id = Self::form_tab_id(form_tab, AuthFormId::LocalDirectory); let id = Self::form_tab_id(form_tab, AuthFormId::LocalDirectory);
let color = self.theme().auth_username; let color = self.theme().auth_username;
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
id, id,
Box::new(components::InputLocalDirectory::new( Box::new(components::InputLocalDirectory::new(
local_path.as_ref(), local_path.as_ref(),
form_tab, form_tab,
color color,
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
pub(super) fn mount_address(&mut self, form_tab: FormTab, address: &str) { pub(super) fn mount_address(&mut self, form_tab: FormTab, address: &str) {
let addr_color = self.theme().auth_address; let addr_color = self.theme().auth_address;
let id = Self::form_tab_id(form_tab, AuthFormId::Address); let id = Self::form_tab_id(form_tab, AuthFormId::Address);
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
id, id,
Box::new(components::InputAddress::new(address, form_tab, addr_color)), Box::new(components::InputAddress::new(address, form_tab, addr_color)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
pub(super) fn mount_port(&mut self, form_tab: FormTab, port: u16) { pub(super) fn mount_port(&mut self, form_tab: FormTab, port: u16) {
let port_color = self.theme().auth_port; let port_color = self.theme().auth_port;
let id = Self::form_tab_id(form_tab, AuthFormId::Port); let id = Self::form_tab_id(form_tab, AuthFormId::Port);
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
id, id,
Box::new(components::InputPort::new(port, form_tab, port_color)), Box::new(components::InputPort::new(port, form_tab, port_color)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
pub(super) fn mount_username(&mut self, form_tab: FormTab, username: &str) { pub(super) fn mount_username(&mut self, form_tab: FormTab, username: &str) {
let username_color = self.theme().auth_username; let username_color = self.theme().auth_username;
let id = Self::form_tab_id(form_tab, AuthFormId::Username); let id = Self::form_tab_id(form_tab, AuthFormId::Username);
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
id, id,
Box::new(components::InputUsername::new( Box::new(components::InputUsername::new(
username, username,
form_tab, form_tab,
username_color username_color,
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
pub(super) fn mount_password(&mut self, form_tab: FormTab, password: &str) { pub(super) fn mount_password(&mut self, form_tab: FormTab, password: &str) {
let password_color = self.theme().auth_password; let password_color = self.theme().auth_password;
let id = Self::form_tab_id(form_tab, AuthFormId::Password); let id = Self::form_tab_id(form_tab, AuthFormId::Password);
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
id, id,
Box::new(components::InputPassword::new( Box::new(components::InputPassword::new(
password, password,
form_tab, form_tab,
password_color password_color,
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
pub(super) fn mount_s3_bucket(&mut self, form_tab: FormTab, bucket: &str) { pub(super) fn mount_s3_bucket(&mut self, form_tab: FormTab, bucket: &str) {
let addr_color = self.theme().auth_address; let addr_color = self.theme().auth_address;
let id = Self::form_tab_id(form_tab, AuthFormId::S3Bucket); let id = Self::form_tab_id(form_tab, AuthFormId::S3Bucket);
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
id, id,
Box::new(components::InputS3Bucket::new(bucket, form_tab, addr_color)), Box::new(components::InputS3Bucket::new(bucket, form_tab, addr_color)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
pub(super) fn mount_s3_region(&mut self, form_tab: FormTab, region: &str) { pub(super) fn mount_s3_region(&mut self, form_tab: FormTab, region: &str) {
let port_color = self.theme().auth_port; let port_color = self.theme().auth_port;
let id = Self::form_tab_id(form_tab, AuthFormId::S3Region); let id = Self::form_tab_id(form_tab, AuthFormId::S3Region);
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
id, id,
Box::new(components::InputS3Region::new(region, form_tab, port_color)), Box::new(components::InputS3Region::new(region, form_tab, port_color)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
pub(super) fn mount_s3_endpoint(&mut self, form_tab: FormTab, endpoint: &str) { pub(super) fn mount_s3_endpoint(&mut self, form_tab: FormTab, endpoint: &str) {
let username_color = self.theme().auth_username; let username_color = self.theme().auth_username;
let id = Self::form_tab_id(form_tab, AuthFormId::S3Endpoint); let id = Self::form_tab_id(form_tab, AuthFormId::S3Endpoint);
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
id, id,
Box::new(components::InputS3Endpoint::new( Box::new(components::InputS3Endpoint::new(
endpoint, endpoint,
form_tab, form_tab,
username_color username_color,
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
pub(super) fn mount_s3_profile(&mut self, form_tab: FormTab, profile: &str) { pub(super) fn mount_s3_profile(&mut self, form_tab: FormTab, profile: &str) {
let color = self.theme().auth_password; let color = self.theme().auth_password;
let id = Self::form_tab_id(form_tab, AuthFormId::S3Profile); let id = Self::form_tab_id(form_tab, AuthFormId::S3Profile);
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
id, id,
Box::new(components::InputS3Profile::new(profile, form_tab, color)), Box::new(components::InputS3Profile::new(profile, form_tab, color)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
pub(super) fn mount_s3_access_key(&mut self, form_tab: FormTab, key: &str) { pub(super) fn mount_s3_access_key(&mut self, form_tab: FormTab, key: &str) {
let color = self.theme().auth_address; let color = self.theme().auth_address;
let id = Self::form_tab_id(form_tab, AuthFormId::S3AccessKey); let id = Self::form_tab_id(form_tab, AuthFormId::S3AccessKey);
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
id, id,
Box::new(components::InputS3AccessKey::new(key, form_tab, color)), Box::new(components::InputS3AccessKey::new(key, form_tab, color)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
pub(super) fn mount_s3_secret_access_key(&mut self, form_tab: FormTab, key: &str) { pub(super) fn mount_s3_secret_access_key(&mut self, form_tab: FormTab, key: &str) {
let color = self.theme().auth_port; let color = self.theme().auth_port;
let id = Self::form_tab_id(form_tab, AuthFormId::S3SecretAccessKey); let id = Self::form_tab_id(form_tab, AuthFormId::S3SecretAccessKey);
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
id, id,
Box::new(components::InputS3SecretAccessKey::new( Box::new(components::InputS3SecretAccessKey::new(
key, form_tab, color key, form_tab, color,
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
pub(super) fn mount_s3_security_token(&mut self, form_tab: FormTab, token: &str) { pub(super) fn mount_s3_security_token(&mut self, form_tab: FormTab, token: &str) {
let color = self.theme().auth_username; let color = self.theme().auth_username;
let id = Self::form_tab_id(form_tab, AuthFormId::S3SecurityToken); let id = Self::form_tab_id(form_tab, AuthFormId::S3SecurityToken);
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
id, id,
Box::new(components::InputS3SecurityToken::new( Box::new(components::InputS3SecurityToken::new(
token, form_tab, color token, form_tab, color,
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
pub(super) fn mount_s3_session_token(&mut self, form_tab: FormTab, token: &str) { pub(super) fn mount_s3_session_token(&mut self, form_tab: FormTab, token: &str) {
let color = self.theme().auth_password; let color = self.theme().auth_password;
let id = Self::form_tab_id(form_tab, AuthFormId::S3SessionToken); let id = Self::form_tab_id(form_tab, AuthFormId::S3SessionToken);
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
id, id,
Box::new(components::InputS3SessionToken::new(token, form_tab, color)), Box::new(components::InputS3SessionToken::new(token, form_tab, color)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
pub(super) fn mount_s3_new_path_style(&mut self, form_tab: FormTab, new_path_style: bool) { pub(super) fn mount_s3_new_path_style(&mut self, form_tab: FormTab, new_path_style: bool) {
let color = self.theme().auth_address; let color = self.theme().auth_address;
let id = Self::form_tab_id(form_tab, AuthFormId::S3NewPathStyle); let id = Self::form_tab_id(form_tab, AuthFormId::S3NewPathStyle);
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
id, id,
Box::new(components::RadioS3NewPathStyle::new( Box::new(components::RadioS3NewPathStyle::new(
new_path_style, new_path_style,
form_tab, form_tab,
color color,
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
pub(super) fn mount_kube_namespace(&mut self, form_tab: FormTab, value: &str) { pub(super) fn mount_kube_namespace(&mut self, form_tab: FormTab, value: &str) {
let color = self.theme().auth_port; let color = self.theme().auth_port;
let id = Self::form_tab_id(form_tab, AuthFormId::KubeNamespace); let id = Self::form_tab_id(form_tab, AuthFormId::KubeNamespace);
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
id, id,
Box::new(components::InputKubeNamespace::new(value, form_tab, color)), Box::new(components::InputKubeNamespace::new(value, form_tab, color)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
pub(super) fn mount_kube_cluster_url(&mut self, form_tab: FormTab, value: &str) { pub(super) fn mount_kube_cluster_url(&mut self, form_tab: FormTab, value: &str) {
let color = self.theme().auth_username; let color = self.theme().auth_username;
let id = Self::form_tab_id(form_tab, AuthFormId::KubeClusterUrl); let id = Self::form_tab_id(form_tab, AuthFormId::KubeClusterUrl);
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
id, id,
Box::new(components::InputKubeClusterUrl::new(value, form_tab, color)), Box::new(components::InputKubeClusterUrl::new(value, form_tab, color)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
pub(super) fn mount_kube_username(&mut self, form_tab: FormTab, value: &str) { pub(super) fn mount_kube_username(&mut self, form_tab: FormTab, value: &str) {
let color = self.theme().auth_password; let color = self.theme().auth_password;
let id = Self::form_tab_id(form_tab, AuthFormId::KubeUsername); let id = Self::form_tab_id(form_tab, AuthFormId::KubeUsername);
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
id, id,
Box::new(components::InputKubeUsername::new(value, form_tab, color)), Box::new(components::InputKubeUsername::new(value, form_tab, color)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
pub(super) fn mount_kube_client_cert(&mut self, form_tab: FormTab, value: &str) { pub(super) fn mount_kube_client_cert(&mut self, form_tab: FormTab, value: &str) {
let color = self.theme().auth_address; let color = self.theme().auth_address;
let id = Self::form_tab_id(form_tab, AuthFormId::KubeClientCert); let id = Self::form_tab_id(form_tab, AuthFormId::KubeClientCert);
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
id, id,
Box::new(components::InputKubeClientCert::new(value, form_tab, color)), Box::new(components::InputKubeClientCert::new(value, form_tab, color)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
pub(super) fn mount_kube_client_key(&mut self, form_tab: FormTab, value: &str) { pub(super) fn mount_kube_client_key(&mut self, form_tab: FormTab, value: &str) {
let color = self.theme().auth_port; let color = self.theme().auth_port;
let id = Self::form_tab_id(form_tab, AuthFormId::KubeClientKey); let id = Self::form_tab_id(form_tab, AuthFormId::KubeClientKey);
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
id, id,
Box::new(components::InputKubeClientKey::new(value, form_tab, color)), Box::new(components::InputKubeClientKey::new(value, form_tab, color)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
pub(super) fn mount_smb_share(&mut self, form_tab: FormTab, share: &str) { pub(super) fn mount_smb_share(&mut self, form_tab: FormTab, share: &str) {
let color = self.theme().auth_password; let color = self.theme().auth_password;
let id = Self::form_tab_id(form_tab, AuthFormId::SmbShare); let id = Self::form_tab_id(form_tab, AuthFormId::SmbShare);
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
id, id,
Box::new(components::InputSmbShare::new(share, form_tab, color)), Box::new(components::InputSmbShare::new(share, form_tab, color)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
#[cfg(posix)] #[cfg(posix)]
pub(super) fn mount_smb_workgroup(&mut self, form_tab: FormTab, workgroup: &str) { pub(super) fn mount_smb_workgroup(&mut self, form_tab: FormTab, workgroup: &str) {
let color = self.theme().auth_address; let color = self.theme().auth_address;
let id = Self::form_tab_id(form_tab, AuthFormId::SmbWorkgroup); let id = Self::form_tab_id(form_tab, AuthFormId::SmbWorkgroup);
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
id, id,
Box::new(components::InputSmbWorkgroup::new( Box::new(components::InputSmbWorkgroup::new(
workgroup, form_tab, color workgroup, form_tab, color,
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
pub(super) fn mount_webdav_uri(&mut self, form_tab: FormTab, uri: &str) { pub(super) fn mount_webdav_uri(&mut self, form_tab: FormTab, uri: &str) {
let addr_color = self.theme().auth_address; let addr_color = self.theme().auth_address;
let id = Self::form_tab_id(form_tab, AuthFormId::WebDAVUri); let id = Self::form_tab_id(form_tab, AuthFormId::WebDAVUri);
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
id, id,
Box::new(components::InputWebDAVUri::new(uri, form_tab, addr_color)), Box::new(components::InputWebDAVUri::new(uri, form_tab, addr_color)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
fn form_tab_id(form_tab: FormTab, id: AuthFormId) -> Id { fn form_tab_id(form_tab: FormTab, id: AuthFormId) -> Id {
@@ -1992,9 +1934,7 @@ impl AuthActivity {
fn init_global_listener(&mut self) { fn init_global_listener(&mut self) {
use tuirealm::event::{Key, KeyEvent, KeyModifiers}; use tuirealm::event::{Key, KeyEvent, KeyModifiers};
assert!( if let Err(err) = self.app.mount(
self.app
.mount(
Id::GlobalListener, Id::GlobalListener,
Box::<components::GlobalListener>::default(), Box::<components::GlobalListener>::default(),
vec![ vec![
@@ -2047,11 +1987,11 @@ impl AuthActivity {
}), }),
Self::no_popup_mounted_clause(), Self::no_popup_mounted_clause(),
), ),
Sub::new(SubEventClause::WindowResize, SubClause::Always) Sub::new(SubEventClause::WindowResize, SubClause::Always),
] ],
) ) {
.is_ok() error!("Failed to mount component: {err}");
); }
} }
pub(super) fn get_current_form_tab(&self) -> FormTab { pub(super) fn get_current_form_tab(&self) -> FormTab {
+6 -2
View File
@@ -135,7 +135,9 @@ impl SetupActivity {
error!("Could not leave alternate screen: {}", err); error!("Could not leave alternate screen: {}", err);
} }
// Lock ports // Lock ports
assert!(self.app.lock_ports().is_ok()); if let Err(err) = self.app.lock_ports() {
error!("Failed to lock ports: {err}");
}
// Write key to file // Write key to file
let res = match edit::edit(placeholder.as_bytes()) { let res = match edit::edit(placeholder.as_bytes()) {
Ok(rsa_key) => { Ok(rsa_key) => {
@@ -168,7 +170,9 @@ impl SetupActivity {
error!("Could not clear screen screen: {}", err); error!("Could not clear screen screen: {}", err);
} }
// Unlock ports // Unlock ports
assert!(self.app.unlock_ports().is_ok()); if let Err(err) = self.app.unlock_ports() {
error!("Failed to unlock ports: {err}");
}
} }
res res
+6 -2
View File
@@ -71,7 +71,9 @@ impl SetupActivity {
error!("Could not leave alternate screen: {}", err); error!("Could not leave alternate screen: {}", err);
} }
// Lock ports // Lock ports
assert!(self.app.lock_ports().is_ok()); if let Err(err) = self.app.lock_ports() {
error!("Failed to lock ports: {err}");
}
// Get result // Get result
let result: Result<(), String> = match ctx.config().iter_ssh_keys().nth(idx) { let result: Result<(), String> = match ctx.config().iter_ssh_keys().nth(idx) {
Some(key) => { Some(key) => {
@@ -100,7 +102,9 @@ impl SetupActivity {
error!("Failed to enter raw mode: {}", err); error!("Failed to enter raw mode: {}", err);
} }
// Unlock ports // Unlock ports
assert!(self.app.unlock_ports().is_ok()); if let Err(err) = self.app.unlock_ports() {
error!("Failed to unlock ports: {err}");
}
// Return result // Return result
result result
} }
+238 -172
View File
@@ -103,110 +103,120 @@ impl SetupActivity {
fn config_update(&mut self, msg: ConfigMsg) -> Option<Msg> { fn config_update(&mut self, msg: ConfigMsg) -> Option<Msg> {
match msg { match msg {
ConfigMsg::CheckUpdatesBlurDown => { ConfigMsg::CheckUpdatesBlurDown => {
assert!( if let Err(err) = self.app.active(&Id::Config(IdConfig::PromptOnFileReplace)) {
self.app error!("Failed to activate component: {err}");
.active(&Id::Config(IdConfig::PromptOnFileReplace)) }
.is_ok()
);
} }
ConfigMsg::CheckUpdatesBlurUp => { ConfigMsg::CheckUpdatesBlurUp => {
assert!(self.app.active(&Id::Config(IdConfig::HiddenFiles)).is_ok()); if let Err(err) = self.app.active(&Id::Config(IdConfig::HiddenFiles)) {
error!("Failed to activate component: {err}");
}
} }
ConfigMsg::DefaultProtocolBlurDown => { ConfigMsg::DefaultProtocolBlurDown => {
assert!(self.app.active(&Id::Config(IdConfig::HiddenFiles)).is_ok()); if let Err(err) = self.app.active(&Id::Config(IdConfig::HiddenFiles)) {
error!("Failed to activate component: {err}");
}
} }
ConfigMsg::DefaultProtocolBlurUp => { ConfigMsg::DefaultProtocolBlurUp => {
assert!(self.app.active(&Id::Config(IdConfig::TextEditor)).is_ok()); if let Err(err) = self.app.active(&Id::Config(IdConfig::TextEditor)) {
error!("Failed to activate component: {err}");
}
} }
ConfigMsg::GroupDirsBlurDown => { ConfigMsg::GroupDirsBlurDown => {
assert!(self.app.active(&Id::Config(IdConfig::LocalFileFmt)).is_ok()); if let Err(err) = self.app.active(&Id::Config(IdConfig::LocalFileFmt)) {
error!("Failed to activate component: {err}");
}
} }
ConfigMsg::GroupDirsBlurUp => { ConfigMsg::GroupDirsBlurUp => {
assert!( if let Err(err) = self.app.active(&Id::Config(IdConfig::PromptOnFileReplace)) {
self.app error!("Failed to activate component: {err}");
.active(&Id::Config(IdConfig::PromptOnFileReplace)) }
.is_ok()
);
} }
ConfigMsg::HiddenFilesBlurDown => { ConfigMsg::HiddenFilesBlurDown => {
assert!(self.app.active(&Id::Config(IdConfig::CheckUpdates)).is_ok()); if let Err(err) = self.app.active(&Id::Config(IdConfig::CheckUpdates)) {
error!("Failed to activate component: {err}");
}
} }
ConfigMsg::HiddenFilesBlurUp => { ConfigMsg::HiddenFilesBlurUp => {
assert!( if let Err(err) = self.app.active(&Id::Config(IdConfig::DefaultProtocol)) {
self.app error!("Failed to activate component: {err}");
.active(&Id::Config(IdConfig::DefaultProtocol)) }
.is_ok()
);
} }
ConfigMsg::LocalFileFmtBlurDown => { ConfigMsg::LocalFileFmtBlurDown => {
assert!( if let Err(err) = self.app.active(&Id::Config(IdConfig::RemoteFileFmt)) {
self.app error!("Failed to activate component: {err}");
.active(&Id::Config(IdConfig::RemoteFileFmt)) }
.is_ok()
);
} }
ConfigMsg::LocalFileFmtBlurUp => { ConfigMsg::LocalFileFmtBlurUp => {
assert!(self.app.active(&Id::Config(IdConfig::GroupDirs)).is_ok()); if let Err(err) = self.app.active(&Id::Config(IdConfig::GroupDirs)) {
error!("Failed to activate component: {err}");
}
} }
ConfigMsg::NotificationsEnabledBlurDown => { ConfigMsg::NotificationsEnabledBlurDown => {
assert!( if let Err(err) = self
self.app .app
.active(&Id::Config(IdConfig::NotificationsThreshold)) .active(&Id::Config(IdConfig::NotificationsThreshold))
.is_ok() {
); error!("Failed to activate component: {err}");
}
} }
ConfigMsg::NotificationsEnabledBlurUp => { ConfigMsg::NotificationsEnabledBlurUp => {
assert!( if let Err(err) = self.app.active(&Id::Config(IdConfig::RemoteFileFmt)) {
self.app error!("Failed to activate component: {err}");
.active(&Id::Config(IdConfig::RemoteFileFmt)) }
.is_ok()
);
} }
ConfigMsg::NotificationsThresholdBlurDown => { ConfigMsg::NotificationsThresholdBlurDown => {
assert!(self.app.active(&Id::Config(IdConfig::SshConfig)).is_ok()); if let Err(err) = self.app.active(&Id::Config(IdConfig::SshConfig)) {
error!("Failed to activate component: {err}");
}
} }
ConfigMsg::NotificationsThresholdBlurUp => { ConfigMsg::NotificationsThresholdBlurUp => {
assert!( if let Err(err) = self.app.active(&Id::Config(IdConfig::NotificationsEnabled)) {
self.app error!("Failed to activate component: {err}");
.active(&Id::Config(IdConfig::NotificationsEnabled)) }
.is_ok()
);
} }
ConfigMsg::PromptOnFileReplaceBlurDown => { ConfigMsg::PromptOnFileReplaceBlurDown => {
assert!(self.app.active(&Id::Config(IdConfig::GroupDirs)).is_ok()); if let Err(err) = self.app.active(&Id::Config(IdConfig::GroupDirs)) {
error!("Failed to activate component: {err}");
}
} }
ConfigMsg::PromptOnFileReplaceBlurUp => { ConfigMsg::PromptOnFileReplaceBlurUp => {
assert!(self.app.active(&Id::Config(IdConfig::CheckUpdates)).is_ok()); if let Err(err) = self.app.active(&Id::Config(IdConfig::CheckUpdates)) {
error!("Failed to activate component: {err}");
}
} }
ConfigMsg::RemoteFileFmtBlurDown => { ConfigMsg::RemoteFileFmtBlurDown => {
assert!( if let Err(err) = self.app.active(&Id::Config(IdConfig::NotificationsEnabled)) {
self.app error!("Failed to activate component: {err}");
.active(&Id::Config(IdConfig::NotificationsEnabled)) }
.is_ok()
);
} }
ConfigMsg::RemoteFileFmtBlurUp => { ConfigMsg::RemoteFileFmtBlurUp => {
assert!(self.app.active(&Id::Config(IdConfig::LocalFileFmt)).is_ok()); if let Err(err) = self.app.active(&Id::Config(IdConfig::LocalFileFmt)) {
error!("Failed to activate component: {err}");
}
} }
ConfigMsg::TextEditorBlurDown => { ConfigMsg::TextEditorBlurDown => {
assert!( if let Err(err) = self.app.active(&Id::Config(IdConfig::DefaultProtocol)) {
self.app error!("Failed to activate component: {err}");
.active(&Id::Config(IdConfig::DefaultProtocol)) }
.is_ok()
);
} }
ConfigMsg::TextEditorBlurUp => { ConfigMsg::TextEditorBlurUp => {
assert!(self.app.active(&Id::Config(IdConfig::SshConfig)).is_ok()); if let Err(err) = self.app.active(&Id::Config(IdConfig::SshConfig)) {
error!("Failed to activate component: {err}");
}
} }
ConfigMsg::SshConfigBlurDown => { ConfigMsg::SshConfigBlurDown => {
assert!(self.app.active(&Id::Config(IdConfig::TextEditor)).is_ok()); if let Err(err) = self.app.active(&Id::Config(IdConfig::TextEditor)) {
error!("Failed to activate component: {err}");
}
} }
ConfigMsg::SshConfigBlurUp => { ConfigMsg::SshConfigBlurUp => {
assert!( if let Err(err) = self
self.app .app
.active(&Id::Config(IdConfig::NotificationsThreshold)) .active(&Id::Config(IdConfig::NotificationsThreshold))
.is_ok() {
); error!("Failed to activate component: {err}");
}
} }
ConfigMsg::ConfigChanged => { ConfigMsg::ConfigChanged => {
self.set_config_changed(true); self.set_config_changed(true);
@@ -251,10 +261,14 @@ impl SetupActivity {
self.mount_new_ssh_key(); self.mount_new_ssh_key();
} }
SshMsg::SshHostBlur => { SshMsg::SshHostBlur => {
assert!(self.app.active(&Id::Ssh(IdSsh::SshUsername)).is_ok()); if let Err(err) = self.app.active(&Id::Ssh(IdSsh::SshUsername)) {
error!("Failed to activate component: {err}");
}
} }
SshMsg::SshUsernameBlur => { SshMsg::SshUsernameBlur => {
assert!(self.app.active(&Id::Ssh(IdSsh::SshHost)).is_ok()); if let Err(err) = self.app.active(&Id::Ssh(IdSsh::SshHost)) {
error!("Failed to activate component: {err}");
}
} }
} }
None None
@@ -263,222 +277,274 @@ impl SetupActivity {
fn theme_update(&mut self, msg: ThemeMsg) -> Option<Msg> { fn theme_update(&mut self, msg: ThemeMsg) -> Option<Msg> {
match msg { match msg {
ThemeMsg::AuthAddressBlurDown => { ThemeMsg::AuthAddressBlurDown => {
assert!(self.app.active(&Id::Theme(IdTheme::AuthPort)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::AuthPort)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::AuthAddressBlurUp => { ThemeMsg::AuthAddressBlurUp => {
assert!(self.app.active(&Id::Theme(IdTheme::AuthProtocol)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::AuthProtocol)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::AuthBookmarksBlurDown => { ThemeMsg::AuthBookmarksBlurDown => {
assert!( if let Err(err) = self.app.active(&Id::Theme(IdTheme::AuthRecentHosts)) {
self.app error!("Failed to activate component: {err}");
.active(&Id::Theme(IdTheme::AuthRecentHosts)) }
.is_ok()
);
} }
ThemeMsg::AuthBookmarksBlurUp => { ThemeMsg::AuthBookmarksBlurUp => {
assert!(self.app.active(&Id::Theme(IdTheme::AuthPassword)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::AuthPassword)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::AuthPasswordBlurDown => { ThemeMsg::AuthPasswordBlurDown => {
assert!(self.app.active(&Id::Theme(IdTheme::AuthBookmarks)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::AuthBookmarks)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::AuthPasswordBlurUp => { ThemeMsg::AuthPasswordBlurUp => {
assert!(self.app.active(&Id::Theme(IdTheme::AuthUsername)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::AuthUsername)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::AuthPortBlurDown => { ThemeMsg::AuthPortBlurDown => {
assert!(self.app.active(&Id::Theme(IdTheme::AuthUsername)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::AuthUsername)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::AuthPortBlurUp => { ThemeMsg::AuthPortBlurUp => {
assert!(self.app.active(&Id::Theme(IdTheme::AuthAddress)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::AuthAddress)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::AuthProtocolBlurDown => { ThemeMsg::AuthProtocolBlurDown => {
assert!(self.app.active(&Id::Theme(IdTheme::AuthAddress)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::AuthAddress)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::AuthProtocolBlurUp => { ThemeMsg::AuthProtocolBlurUp => {
assert!(self.app.active(&Id::Theme(IdTheme::StatusSync)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::StatusSync)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::AuthRecentHostsBlurDown => { ThemeMsg::AuthRecentHostsBlurDown => {
assert!(self.app.active(&Id::Theme(IdTheme::MiscError)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::MiscError)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::AuthRecentHostsBlurUp => { ThemeMsg::AuthRecentHostsBlurUp => {
assert!(self.app.active(&Id::Theme(IdTheme::AuthBookmarks)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::AuthBookmarks)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::AuthUsernameBlurDown => { ThemeMsg::AuthUsernameBlurDown => {
assert!(self.app.active(&Id::Theme(IdTheme::AuthPassword)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::AuthPassword)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::AuthUsernameBlurUp => { ThemeMsg::AuthUsernameBlurUp => {
assert!(self.app.active(&Id::Theme(IdTheme::AuthPort)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::AuthPort)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::MiscErrorBlurDown => { ThemeMsg::MiscErrorBlurDown => {
assert!(self.app.active(&Id::Theme(IdTheme::MiscInfo)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::MiscInfo)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::MiscErrorBlurUp => { ThemeMsg::MiscErrorBlurUp => {
assert!( if let Err(err) = self.app.active(&Id::Theme(IdTheme::AuthRecentHosts)) {
self.app error!("Failed to activate component: {err}");
.active(&Id::Theme(IdTheme::AuthRecentHosts)) }
.is_ok()
);
} }
ThemeMsg::MiscInfoBlurDown => { ThemeMsg::MiscInfoBlurDown => {
assert!(self.app.active(&Id::Theme(IdTheme::MiscInput)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::MiscInput)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::MiscInfoBlurUp => { ThemeMsg::MiscInfoBlurUp => {
assert!(self.app.active(&Id::Theme(IdTheme::MiscError)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::MiscError)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::MiscInputBlurDown => { ThemeMsg::MiscInputBlurDown => {
assert!(self.app.active(&Id::Theme(IdTheme::MiscKeys)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::MiscKeys)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::MiscInputBlurUp => { ThemeMsg::MiscInputBlurUp => {
assert!(self.app.active(&Id::Theme(IdTheme::MiscInfo)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::MiscInfo)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::MiscKeysBlurDown => { ThemeMsg::MiscKeysBlurDown => {
assert!(self.app.active(&Id::Theme(IdTheme::MiscQuit)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::MiscQuit)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::MiscKeysBlurUp => { ThemeMsg::MiscKeysBlurUp => {
assert!(self.app.active(&Id::Theme(IdTheme::MiscInput)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::MiscInput)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::MiscQuitBlurDown => { ThemeMsg::MiscQuitBlurDown => {
assert!(self.app.active(&Id::Theme(IdTheme::MiscSave)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::MiscSave)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::MiscQuitBlurUp => { ThemeMsg::MiscQuitBlurUp => {
assert!(self.app.active(&Id::Theme(IdTheme::MiscKeys)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::MiscKeys)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::MiscSaveBlurDown => { ThemeMsg::MiscSaveBlurDown => {
assert!(self.app.active(&Id::Theme(IdTheme::MiscWarn)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::MiscWarn)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::MiscSaveBlurUp => { ThemeMsg::MiscSaveBlurUp => {
assert!(self.app.active(&Id::Theme(IdTheme::MiscQuit)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::MiscQuit)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::MiscWarnBlurDown => { ThemeMsg::MiscWarnBlurDown => {
assert!( if let Err(err) = self.app.active(&Id::Theme(IdTheme::ExplorerLocalBg)) {
self.app error!("Failed to activate component: {err}");
.active(&Id::Theme(IdTheme::ExplorerLocalBg)) }
.is_ok()
);
} }
ThemeMsg::MiscWarnBlurUp => { ThemeMsg::MiscWarnBlurUp => {
assert!(self.app.active(&Id::Theme(IdTheme::MiscSave)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::MiscSave)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::ExplorerLocalBgBlurDown => { ThemeMsg::ExplorerLocalBgBlurDown => {
assert!( if let Err(err) = self.app.active(&Id::Theme(IdTheme::ExplorerLocalFg)) {
self.app error!("Failed to activate component: {err}");
.active(&Id::Theme(IdTheme::ExplorerLocalFg)) }
.is_ok()
);
} }
ThemeMsg::ExplorerLocalBgBlurUp => { ThemeMsg::ExplorerLocalBgBlurUp => {
assert!(self.app.active(&Id::Theme(IdTheme::MiscWarn)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::MiscWarn)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::ExplorerLocalFgBlurDown => { ThemeMsg::ExplorerLocalFgBlurDown => {
assert!( if let Err(err) = self.app.active(&Id::Theme(IdTheme::ExplorerLocalHg)) {
self.app error!("Failed to activate component: {err}");
.active(&Id::Theme(IdTheme::ExplorerLocalHg)) }
.is_ok()
);
} }
ThemeMsg::ExplorerLocalFgBlurUp => { ThemeMsg::ExplorerLocalFgBlurUp => {
assert!( if let Err(err) = self.app.active(&Id::Theme(IdTheme::ExplorerLocalBg)) {
self.app error!("Failed to activate component: {err}");
.active(&Id::Theme(IdTheme::ExplorerLocalBg)) }
.is_ok()
);
} }
ThemeMsg::ExplorerLocalHgBlurDown => { ThemeMsg::ExplorerLocalHgBlurDown => {
assert!( if let Err(err) = self.app.active(&Id::Theme(IdTheme::ExplorerRemoteBg)) {
self.app error!("Failed to activate component: {err}");
.active(&Id::Theme(IdTheme::ExplorerRemoteBg)) }
.is_ok()
);
} }
ThemeMsg::ExplorerLocalHgBlurUp => { ThemeMsg::ExplorerLocalHgBlurUp => {
assert!( if let Err(err) = self.app.active(&Id::Theme(IdTheme::ExplorerLocalFg)) {
self.app error!("Failed to activate component: {err}");
.active(&Id::Theme(IdTheme::ExplorerLocalFg)) }
.is_ok()
);
} }
ThemeMsg::ExplorerRemoteBgBlurDown => { ThemeMsg::ExplorerRemoteBgBlurDown => {
assert!( if let Err(err) = self.app.active(&Id::Theme(IdTheme::ExplorerRemoteFg)) {
self.app error!("Failed to activate component: {err}");
.active(&Id::Theme(IdTheme::ExplorerRemoteFg)) }
.is_ok()
);
} }
ThemeMsg::ExplorerRemoteBgBlurUp => { ThemeMsg::ExplorerRemoteBgBlurUp => {
assert!( if let Err(err) = self.app.active(&Id::Theme(IdTheme::ExplorerLocalHg)) {
self.app error!("Failed to activate component: {err}");
.active(&Id::Theme(IdTheme::ExplorerLocalHg)) }
.is_ok()
);
} }
ThemeMsg::ExplorerRemoteFgBlurDown => { ThemeMsg::ExplorerRemoteFgBlurDown => {
assert!( if let Err(err) = self.app.active(&Id::Theme(IdTheme::ExplorerRemoteHg)) {
self.app error!("Failed to activate component: {err}");
.active(&Id::Theme(IdTheme::ExplorerRemoteHg)) }
.is_ok()
);
} }
ThemeMsg::ExplorerRemoteFgBlurUp => { ThemeMsg::ExplorerRemoteFgBlurUp => {
assert!( if let Err(err) = self.app.active(&Id::Theme(IdTheme::ExplorerRemoteBg)) {
self.app error!("Failed to activate component: {err}");
.active(&Id::Theme(IdTheme::ExplorerRemoteBg)) }
.is_ok()
);
} }
ThemeMsg::ExplorerRemoteHgBlurDown => { ThemeMsg::ExplorerRemoteHgBlurDown => {
assert!(self.app.active(&Id::Theme(IdTheme::ProgBarFull)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::ProgBarFull)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::ExplorerRemoteHgBlurUp => { ThemeMsg::ExplorerRemoteHgBlurUp => {
assert!( if let Err(err) = self.app.active(&Id::Theme(IdTheme::ExplorerRemoteFg)) {
self.app error!("Failed to activate component: {err}");
.active(&Id::Theme(IdTheme::ExplorerRemoteFg)) }
.is_ok()
);
} }
ThemeMsg::ProgBarFullBlurDown => { ThemeMsg::ProgBarFullBlurDown => {
assert!(self.app.active(&Id::Theme(IdTheme::ProgBarPartial)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::ProgBarPartial)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::ProgBarFullBlurUp => { ThemeMsg::ProgBarFullBlurUp => {
assert!( if let Err(err) = self.app.active(&Id::Theme(IdTheme::ExplorerRemoteHg)) {
self.app error!("Failed to activate component: {err}");
.active(&Id::Theme(IdTheme::ExplorerRemoteHg)) }
.is_ok()
);
} }
ThemeMsg::ProgBarPartialBlurDown => { ThemeMsg::ProgBarPartialBlurDown => {
assert!(self.app.active(&Id::Theme(IdTheme::LogBg)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::LogBg)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::ProgBarPartialBlurUp => { ThemeMsg::ProgBarPartialBlurUp => {
assert!(self.app.active(&Id::Theme(IdTheme::ProgBarFull)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::ProgBarFull)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::LogBgBlurDown => { ThemeMsg::LogBgBlurDown => {
assert!(self.app.active(&Id::Theme(IdTheme::LogWindow)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::LogWindow)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::LogBgBlurUp => { ThemeMsg::LogBgBlurUp => {
assert!(self.app.active(&Id::Theme(IdTheme::ProgBarPartial)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::ProgBarPartial)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::LogWindowBlurDown => { ThemeMsg::LogWindowBlurDown => {
assert!(self.app.active(&Id::Theme(IdTheme::StatusSorting)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::StatusSorting)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::LogWindowBlurUp => { ThemeMsg::LogWindowBlurUp => {
assert!(self.app.active(&Id::Theme(IdTheme::LogBg)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::LogBg)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::StatusSortingBlurDown => { ThemeMsg::StatusSortingBlurDown => {
assert!(self.app.active(&Id::Theme(IdTheme::StatusHidden)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::StatusHidden)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::StatusSortingBlurUp => { ThemeMsg::StatusSortingBlurUp => {
assert!(self.app.active(&Id::Theme(IdTheme::LogWindow)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::LogWindow)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::StatusHiddenBlurDown => { ThemeMsg::StatusHiddenBlurDown => {
assert!(self.app.active(&Id::Theme(IdTheme::StatusSync)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::StatusSync)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::StatusHiddenBlurUp => { ThemeMsg::StatusHiddenBlurUp => {
assert!(self.app.active(&Id::Theme(IdTheme::StatusSorting)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::StatusSorting)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::StatusSyncBlurDown => { ThemeMsg::StatusSyncBlurDown => {
assert!(self.app.active(&Id::Theme(IdTheme::AuthProtocol)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::AuthProtocol)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::StatusSyncBlurUp => { ThemeMsg::StatusSyncBlurUp => {
assert!(self.app.active(&Id::Theme(IdTheme::StatusHidden)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::StatusHidden)) {
error!("Failed to activate component: {err}");
}
} }
ThemeMsg::ColorChanged(id, color) => { ThemeMsg::ColorChanged(id, color) => {
self.action_save_color(id, color); self.action_save_color(id, color);
+42 -48
View File
@@ -40,16 +40,16 @@ impl SetupActivity {
/// Mount error box /// Mount error box
pub(super) fn mount_error<S: AsRef<str>>(&mut self, text: S) { pub(super) fn mount_error<S: AsRef<str>>(&mut self, text: S) {
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Common(IdCommon::ErrorPopup), Id::Common(IdCommon::ErrorPopup),
Box::new(components::ErrorPopup::new(text)), Box::new(components::ErrorPopup::new(text)),
vec![], vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!(self.app.active(&Id::Common(IdCommon::ErrorPopup)).is_ok()); if let Err(err) = self.app.active(&Id::Common(IdCommon::ErrorPopup)) {
error!("Failed to activate component: {err}");
}
} }
/// Umount error message /// Umount error message
@@ -59,16 +59,16 @@ impl SetupActivity {
/// Mount quit popup /// Mount quit popup
pub(super) fn mount_quit(&mut self) { pub(super) fn mount_quit(&mut self) {
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Common(IdCommon::QuitPopup), Id::Common(IdCommon::QuitPopup),
Box::<components::QuitPopup>::default(), Box::<components::QuitPopup>::default(),
vec![], vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!(self.app.active(&Id::Common(IdCommon::QuitPopup)).is_ok()); if let Err(err) = self.app.active(&Id::Common(IdCommon::QuitPopup)) {
error!("Failed to activate component: {err}");
}
} }
/// Umount quit /// Umount quit
@@ -78,16 +78,16 @@ impl SetupActivity {
/// Mount save popup /// Mount save popup
pub(super) fn mount_save_popup(&mut self) { pub(super) fn mount_save_popup(&mut self) {
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Common(IdCommon::SavePopup), Id::Common(IdCommon::SavePopup),
Box::<components::SavePopup>::default(), Box::<components::SavePopup>::default(),
vec![], vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!(self.app.active(&Id::Common(IdCommon::SavePopup)).is_ok()); if let Err(err) = self.app.active(&Id::Common(IdCommon::SavePopup)) {
error!("Failed to activate component: {err}");
}
} }
/// Umount quit /// Umount quit
@@ -97,16 +97,16 @@ impl SetupActivity {
/// Mount help /// Mount help
pub(super) fn mount_help(&mut self) { pub(super) fn mount_help(&mut self) {
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Common(IdCommon::Keybindings), Id::Common(IdCommon::Keybindings),
Box::<components::Keybindings>::default(), Box::<components::Keybindings>::default(),
vec![], vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!(self.app.active(&Id::Common(IdCommon::Keybindings)).is_ok()); if let Err(err) = self.app.active(&Id::Common(IdCommon::Keybindings)) {
error!("Failed to activate component: {err}");
}
} }
/// Umount help /// Umount help
@@ -148,32 +148,26 @@ impl SetupActivity {
/// Mount common components /// Mount common components
fn mount_commons(&mut self, layout: ViewLayout) { fn mount_commons(&mut self, layout: ViewLayout) {
// Radio tab // Radio tab
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Common(IdCommon::Header), Id::Common(IdCommon::Header),
Box::new(components::Header::new(layout)), Box::new(components::Header::new(layout)),
vec![], vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
// Footer // Footer
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Common(IdCommon::Footer), Id::Common(IdCommon::Footer),
Box::<components::Footer>::default(), Box::<components::Footer>::default(),
vec![], vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
/// Mount global listener /// Mount global listener
fn mount_global_listener(&mut self) { fn mount_global_listener(&mut self) {
assert!( if let Err(err) = self.app.mount(
self.app
.mount(
Id::Common(IdCommon::GlobalListener), Id::Common(IdCommon::GlobalListener),
Box::<components::GlobalListener>::default(), Box::<components::GlobalListener>::default(),
vec![ vec![
@@ -233,11 +227,11 @@ impl SetupActivity {
}), }),
Self::no_popup_mounted_clause(), Self::no_popup_mounted_clause(),
), ),
Sub::new(SubEventClause::WindowResize, SubClause::Always) Sub::new(SubEventClause::WindowResize, SubClause::Always),
] ],
) ) {
.is_ok() error!("Failed to mount component: {err}");
); }
} }
/// Returns a sub clause which requires that no popup is mounted in order to be satisfied /// Returns a sub clause which requires that no popup is mounted in order to be satisfied
+67 -87
View File
@@ -32,7 +32,9 @@ impl SetupActivity {
// Load values // Load values
self.load_input_values(); self.load_input_values();
// Active text editor // Active text editor
assert!(self.app.active(&Id::Config(IdConfig::TextEditor)).is_ok()); if let Err(err) = self.app.active(&Id::Config(IdConfig::TextEditor)) {
error!("Failed to activate component: {err}");
}
} }
pub(super) fn view_setup(&mut self) { pub(super) fn view_setup(&mut self) {
@@ -145,133 +147,111 @@ impl SetupActivity {
// Text editor // Text editor
let text_editor: String = let text_editor: String =
String::from(self.config().get_text_editor().as_path().to_string_lossy()); String::from(self.config().get_text_editor().as_path().to_string_lossy());
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Config(IdConfig::TextEditor), Id::Config(IdConfig::TextEditor),
Box::new(components::TextEditor::new(text_editor.as_str())), Box::new(components::TextEditor::new(text_editor.as_str())),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
// Protocol // Protocol
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Config(IdConfig::DefaultProtocol), Id::Config(IdConfig::DefaultProtocol),
Box::new(components::DefaultProtocol::new( Box::new(components::DefaultProtocol::new(
self.config().get_default_protocol() self.config().get_default_protocol(),
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
// Hidden files // Hidden files
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Config(IdConfig::HiddenFiles), Id::Config(IdConfig::HiddenFiles),
Box::new(components::HiddenFiles::new( Box::new(components::HiddenFiles::new(
self.config().get_show_hidden_files() self.config().get_show_hidden_files(),
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
// Updates // Updates
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Config(IdConfig::CheckUpdates), Id::Config(IdConfig::CheckUpdates),
Box::new(components::CheckUpdates::new( Box::new(components::CheckUpdates::new(
self.config().get_check_for_updates() self.config().get_check_for_updates(),
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
// File replace // File replace
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Config(IdConfig::PromptOnFileReplace), Id::Config(IdConfig::PromptOnFileReplace),
Box::new(components::PromptOnFileReplace::new( Box::new(components::PromptOnFileReplace::new(
self.config().get_prompt_on_file_replace() self.config().get_prompt_on_file_replace(),
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
// Group dirs // Group dirs
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Config(IdConfig::GroupDirs), Id::Config(IdConfig::GroupDirs),
Box::new(components::GroupDirs::new(self.config().get_group_dirs())), Box::new(components::GroupDirs::new(self.config().get_group_dirs())),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
// Local File Fmt // Local File Fmt
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Config(IdConfig::LocalFileFmt), Id::Config(IdConfig::LocalFileFmt),
Box::new(components::LocalFileFmt::new( Box::new(components::LocalFileFmt::new(
&self.config().get_local_file_fmt().unwrap_or_default() &self.config().get_local_file_fmt().unwrap_or_default(),
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
// Remote File Fmt // Remote File Fmt
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Config(IdConfig::RemoteFileFmt), Id::Config(IdConfig::RemoteFileFmt),
Box::new(components::RemoteFileFmt::new( Box::new(components::RemoteFileFmt::new(
&self.config().get_remote_file_fmt().unwrap_or_default() &self.config().get_remote_file_fmt().unwrap_or_default(),
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
// Notifications enabled // Notifications enabled
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Config(IdConfig::NotificationsEnabled), Id::Config(IdConfig::NotificationsEnabled),
Box::new(components::NotificationsEnabled::new( Box::new(components::NotificationsEnabled::new(
self.config().get_notifications() self.config().get_notifications(),
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
// Notifications threshold // Notifications threshold
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Config(IdConfig::NotificationsThreshold), Id::Config(IdConfig::NotificationsThreshold),
Box::new(components::NotificationsThreshold::new(&fmt_bytes( Box::new(components::NotificationsThreshold::new(&fmt_bytes(
self.config().get_notification_threshold() self.config().get_notification_threshold(),
))), ))),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
// Ssh config // Ssh config
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Config(IdConfig::SshConfig), Id::Config(IdConfig::SshConfig),
Box::new(components::SshConfig::new( Box::new(components::SshConfig::new(
self.config().get_ssh_config().unwrap_or("") self.config().get_ssh_config().unwrap_or(""),
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
/// Collect values from input and put them into the configuration /// Collect values from input and put them into the configuration
+29 -31
View File
@@ -74,16 +74,16 @@ impl SetupActivity {
/// Mount delete ssh key component /// Mount delete ssh key component
pub(crate) fn mount_del_ssh_key(&mut self) { pub(crate) fn mount_del_ssh_key(&mut self) {
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Ssh(IdSsh::DelSshKeyPopup), Id::Ssh(IdSsh::DelSshKeyPopup),
Box::<components::DelSshKeyPopup>::default(), Box::<components::DelSshKeyPopup>::default(),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!(self.app.active(&Id::Ssh(IdSsh::DelSshKeyPopup)).is_ok()); if let Err(err) = self.app.active(&Id::Ssh(IdSsh::DelSshKeyPopup)) {
error!("Failed to activate component: {err}");
}
} }
/// Umount delete ssh key /// Umount delete ssh key
@@ -93,25 +93,23 @@ impl SetupActivity {
/// Mount new ssh key prompt /// Mount new ssh key prompt
pub(crate) fn mount_new_ssh_key(&mut self) { pub(crate) fn mount_new_ssh_key(&mut self) {
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Ssh(IdSsh::SshHost), Id::Ssh(IdSsh::SshHost),
Box::<components::SshHost>::default(), Box::<components::SshHost>::default(),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Ssh(IdSsh::SshUsername), Id::Ssh(IdSsh::SshUsername),
Box::<components::SshUsername>::default(), Box::<components::SshUsername>::default(),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!(self.app.active(&Id::Ssh(IdSsh::SshHost)).is_ok()); if let Err(err) = self.app.active(&Id::Ssh(IdSsh::SshHost)) {
error!("Failed to activate component: {err}");
}
} }
/// Umount new ssh key prompt /// Umount new ssh key prompt
@@ -130,15 +128,15 @@ impl SetupActivity {
format!("{username} at {addr}") format!("{username} at {addr}")
}) })
.collect(); .collect();
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Ssh(IdSsh::SshKeys), Id::Ssh(IdSsh::SshKeys),
Box::new(components::SshKeys::new(&keys)), Box::new(components::SshKeys::new(&keys)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!(self.app.active(&Id::Ssh(IdSsh::SshKeys)).is_ok()); if let Err(err) = self.app.active(&Id::Ssh(IdSsh::SshKeys)) {
error!("Failed to activate component: {err}");
}
} }
} }
+168 -228
View File
@@ -21,7 +21,9 @@ impl SetupActivity {
// Load styles // Load styles
self.load_styles(); self.load_styles();
// Active first field // Active first field
assert!(self.app.active(&Id::Theme(IdTheme::AuthProtocol)).is_ok()); if let Err(err) = self.app.active(&Id::Theme(IdTheme::AuthProtocol)) {
error!("Failed to activate component: {err}");
}
} }
pub(super) fn view_theme(&mut self) { pub(super) fn view_theme(&mut self) {
@@ -242,309 +244,247 @@ impl SetupActivity {
} }
fn load_titles(&mut self) { fn load_titles(&mut self) {
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::AuthTitle), Id::Theme(IdTheme::AuthTitle),
Box::<components::AuthTitle>::default(), Box::<components::AuthTitle>::default(),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::MiscTitle), Id::Theme(IdTheme::MiscTitle),
Box::<components::MiscTitle>::default(), Box::<components::MiscTitle>::default(),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::TransferTitle), Id::Theme(IdTheme::TransferTitle),
Box::<components::TransferTitle>::default(), Box::<components::TransferTitle>::default(),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::TransferTitle2), Id::Theme(IdTheme::TransferTitle2),
Box::<components::TransferTitle2>::default(), Box::<components::TransferTitle2>::default(),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
/// Load values from theme into input fields /// Load values from theme into input fields
pub(crate) fn load_styles(&mut self) { pub(crate) fn load_styles(&mut self) {
let theme: Theme = self.theme().clone(); let theme: Theme = self.theme().clone();
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::AuthAddress), Id::Theme(IdTheme::AuthAddress),
Box::new(components::AuthAddress::new(theme.auth_address)), Box::new(components::AuthAddress::new(theme.auth_address)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::AuthBookmarks), Id::Theme(IdTheme::AuthBookmarks),
Box::new(components::AuthBookmarks::new(theme.auth_bookmarks)), Box::new(components::AuthBookmarks::new(theme.auth_bookmarks)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::AuthPassword), Id::Theme(IdTheme::AuthPassword),
Box::new(components::AuthPassword::new(theme.auth_password)), Box::new(components::AuthPassword::new(theme.auth_password)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::AuthPort), Id::Theme(IdTheme::AuthPort),
Box::new(components::AuthPort::new(theme.auth_port)), Box::new(components::AuthPort::new(theme.auth_port)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::AuthProtocol), Id::Theme(IdTheme::AuthProtocol),
Box::new(components::AuthProtocol::new(theme.auth_protocol)), Box::new(components::AuthProtocol::new(theme.auth_protocol)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::AuthRecentHosts), Id::Theme(IdTheme::AuthRecentHosts),
Box::new(components::AuthRecentHosts::new(theme.auth_recents)), Box::new(components::AuthRecentHosts::new(theme.auth_recents)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::AuthUsername), Id::Theme(IdTheme::AuthUsername),
Box::new(components::AuthUsername::new(theme.auth_username)), Box::new(components::AuthUsername::new(theme.auth_username)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::MiscError), Id::Theme(IdTheme::MiscError),
Box::new(components::MiscError::new(theme.misc_error_dialog)), Box::new(components::MiscError::new(theme.misc_error_dialog)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::MiscInfo), Id::Theme(IdTheme::MiscInfo),
Box::new(components::MiscInfo::new(theme.misc_info_dialog)), Box::new(components::MiscInfo::new(theme.misc_info_dialog)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::MiscInput), Id::Theme(IdTheme::MiscInput),
Box::new(components::MiscInput::new(theme.misc_input_dialog)), Box::new(components::MiscInput::new(theme.misc_input_dialog)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::MiscKeys), Id::Theme(IdTheme::MiscKeys),
Box::new(components::MiscKeys::new(theme.misc_keys)), Box::new(components::MiscKeys::new(theme.misc_keys)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::MiscQuit), Id::Theme(IdTheme::MiscQuit),
Box::new(components::MiscQuit::new(theme.misc_quit_dialog)), Box::new(components::MiscQuit::new(theme.misc_quit_dialog)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::MiscSave), Id::Theme(IdTheme::MiscSave),
Box::new(components::MiscSave::new(theme.misc_save_dialog)), Box::new(components::MiscSave::new(theme.misc_save_dialog)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::MiscWarn), Id::Theme(IdTheme::MiscWarn),
Box::new(components::MiscWarn::new(theme.misc_warn_dialog)), Box::new(components::MiscWarn::new(theme.misc_warn_dialog)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::ExplorerLocalBg), Id::Theme(IdTheme::ExplorerLocalBg),
Box::new(components::ExplorerLocalBg::new( Box::new(components::ExplorerLocalBg::new(
theme.transfer_local_explorer_background theme.transfer_local_explorer_background,
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::ExplorerLocalFg), Id::Theme(IdTheme::ExplorerLocalFg),
Box::new(components::ExplorerLocalFg::new( Box::new(components::ExplorerLocalFg::new(
theme.transfer_local_explorer_foreground theme.transfer_local_explorer_foreground,
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::ExplorerLocalHg), Id::Theme(IdTheme::ExplorerLocalHg),
Box::new(components::ExplorerLocalHg::new( Box::new(components::ExplorerLocalHg::new(
theme.transfer_local_explorer_highlighted theme.transfer_local_explorer_highlighted,
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::ExplorerRemoteBg), Id::Theme(IdTheme::ExplorerRemoteBg),
Box::new(components::ExplorerRemoteBg::new( Box::new(components::ExplorerRemoteBg::new(
theme.transfer_remote_explorer_background theme.transfer_remote_explorer_background,
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::ExplorerRemoteFg), Id::Theme(IdTheme::ExplorerRemoteFg),
Box::new(components::ExplorerRemoteFg::new( Box::new(components::ExplorerRemoteFg::new(
theme.transfer_remote_explorer_foreground theme.transfer_remote_explorer_foreground,
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::ExplorerRemoteHg), Id::Theme(IdTheme::ExplorerRemoteHg),
Box::new(components::ExplorerRemoteHg::new( Box::new(components::ExplorerRemoteHg::new(
theme.transfer_remote_explorer_highlighted theme.transfer_remote_explorer_highlighted,
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::ProgBarFull), Id::Theme(IdTheme::ProgBarFull),
Box::new(components::ProgBarFull::new( Box::new(components::ProgBarFull::new(
theme.transfer_progress_bar_full theme.transfer_progress_bar_full,
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::ProgBarPartial), Id::Theme(IdTheme::ProgBarPartial),
Box::new(components::ProgBarPartial::new( Box::new(components::ProgBarPartial::new(
theme.transfer_progress_bar_partial theme.transfer_progress_bar_partial,
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::LogBg), Id::Theme(IdTheme::LogBg),
Box::new(components::LogBg::new(theme.transfer_log_background)), Box::new(components::LogBg::new(theme.transfer_log_background)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::LogWindow), Id::Theme(IdTheme::LogWindow),
Box::new(components::LogWindow::new(theme.transfer_log_window)), Box::new(components::LogWindow::new(theme.transfer_log_window)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::StatusSorting), Id::Theme(IdTheme::StatusSorting),
Box::new(components::StatusSorting::new( Box::new(components::StatusSorting::new(
theme.transfer_status_sorting theme.transfer_status_sorting,
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::StatusHidden), Id::Theme(IdTheme::StatusHidden),
Box::new(components::StatusHidden::new(theme.transfer_status_hidden)), Box::new(components::StatusHidden::new(theme.transfer_status_hidden)),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
assert!( if let Err(err) = self.app.remount(
self.app
.remount(
Id::Theme(IdTheme::StatusSync), Id::Theme(IdTheme::StatusSync),
Box::new(components::StatusSync::new( Box::new(components::StatusSync::new(
theme.transfer_status_sync_browsing theme.transfer_status_sync_browsing,
)), )),
vec![] vec![],
) ) {
.is_ok() error!("Failed to remount component: {err}");
); }
} }
} }