Skip to content

Commit

Permalink
Merge pull request #579 from marhkb/fix/container/state/configured
Browse files Browse the repository at this point in the history
fix(container/status): Handle `configured`
  • Loading branch information
marhkb authored Mar 2, 2023
2 parents dcc5132 + 3c8f0bc commit c9a8132
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions data/resources/style-hc.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
font-weight: bold;
}

.container-status-configured
.container-status-created,
.container-status-exited,
.container-status-removing,
Expand Down
1 change: 1 addition & 0 deletions data/resources/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ connectionchooserpage connectionswitchermenu row {
margin: 0 0 -4px -2px;
}

.container-status-configured,
.container-status-created,
.container-status-exited,
.container-status-initialized,
Expand Down
9 changes: 8 additions & 1 deletion src/model/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use crate::utils;
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq, glib::Enum)]
#[enum_type(name = "ContainerStatus")]
pub(crate) enum Status {
Configured,
Created,
Dead,
Exited,
Expand All @@ -43,6 +44,7 @@ impl FromStr for Status {

fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(match s {
"configured" => Self::Configured,
"created" => Self::Created,
"dead" => Self::Dead,
"exited" => Self::Exited,
Expand All @@ -64,6 +66,7 @@ impl fmt::Display for Status {
f,
"{}",
match self {
Self::Configured => gettext("Configured"),
Self::Created => gettext("Created"),
Self::Dead => gettext("Dead"),
Self::Exited => gettext("Exited"),
Expand Down Expand Up @@ -716,7 +719,11 @@ impl Container {
pub(crate) fn can_start(&self) -> bool {
matches!(
self.status(),
Status::Created | Status::Exited | Status::Initialized | Status::Stopped
Status::Configured
| Status::Created
| Status::Exited
| Status::Initialized
| Status::Stopped
)
}

Expand Down
1 change: 1 addition & 0 deletions src/view/container/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ fn container_status_css_class(status: model::ContainerStatus) -> &'static str {
use model::ContainerStatus::*;

match status {
Configured => "container-status-configured",
Created => "container-status-created",
Dead => "container-status-dead",
Exited => "container-status-exited",
Expand Down

0 comments on commit c9a8132

Please sign in to comment.