diff --git a/src/info_settings_page.rs b/src/info_settings_page.rs index 39a4a0d..38dd14e 100644 --- a/src/info_settings_page.rs +++ b/src/info_settings_page.rs @@ -103,7 +103,7 @@ impl InfoSettingsPage { //Set filter: only running VM's let filter_model = FilterListModel::new(Some(model), Some(CustomFilter::new(|item: &Object| { if let Some(vm_obj) = item.downcast_ref::() { - if vm_obj.status() == VMGObject::status_u8(VMStatus::Running) { + if vm_obj.status() == (VMStatus::Running as u8) { return true; } } diff --git a/src/trust_level.rs b/src/trust_level.rs index cb465f5..906007d 100644 --- a/src/trust_level.rs +++ b/src/trust_level.rs @@ -19,6 +19,13 @@ impl Default for TrustLevel { } } +/*impl StaticType for TrustLevel { + fn static_type() -> Type { + u8::static_type() + } +}*/ + + /*unsafe impl<'a> FromValue<'a> for TrustLevel { type Checker = glib::value::GenericValueTypeChecker; diff --git a/src/vm_gobject.rs b/src/vm_gobject.rs index 47b6046..f6865af 100755 --- a/src/vm_gobject.rs +++ b/src/vm_gobject.rs @@ -50,8 +50,8 @@ impl VMGObject { Object::builder() .property("name", name) .property("details", details) - .property("status", Self::status_u8(status)) - .property("trust-level", Self::trust_level_u8(trust_level)) + .property("status", status as u8) + .property("trust-level", trust_level as u8) .build() } @@ -61,23 +61,7 @@ impl VMGObject { pub fn update(&self, query_result: QueryResult) { self.set_property("details", query_result.description); - self.set_property("status", Self::status_u8(query_result.status)); - self.set_property("trust-level", Self::trust_level_u8(query_result.trust_level)); - } - - pub fn trust_level_u8(value: TrustLevel) -> u8 { - match value { - TrustLevel::Secure => 0, - TrustLevel::Warning => 1, - TrustLevel::NotSecure => 2, - } - } - - pub fn status_u8(value: VMStatus) -> u8 { - match value { - VMStatus::Running => 0, - VMStatus::PoweredOff => 1, - VMStatus::Paused => 2, - } + self.set_property("status", query_result.status as u8); + self.set_property("trust-level", query_result.trust_level as u8); } }