merge systemd + machinectl into one module/applet (step 1)
This commit is contained in:
parent
96bfc1fd5a
commit
6fc7e8bc8a
16 changed files with 274 additions and 1042 deletions
|
|
@ -24,7 +24,13 @@ dirs = "6.0.0"
|
|||
tracing = "0.1.44"
|
||||
tracing-subscriber = { version = "0.3.23", features = ["env-filter"] }
|
||||
zbus = { version = "5.15.0", default-features = false, features = ["tokio"] }
|
||||
tokio = { version = "1.52.2", features = ["macros", "net", "rt", "sync", "time"] }
|
||||
tokio = { version = "1.52.2", features = [
|
||||
"macros",
|
||||
"net",
|
||||
"rt",
|
||||
"sync",
|
||||
"time",
|
||||
] }
|
||||
|
||||
[build-dependencies]
|
||||
cxx-qt-build = "0.8.1"
|
||||
|
|
|
|||
|
|
@ -101,11 +101,9 @@ pub mod qobject {
|
|||
#[qproperty(bool, dock_applet_mpris, cxx_name = "dockAppletMpris")]
|
||||
#[qproperty(bool, dock_applet_notifications, cxx_name = "dockAppletNotifications")]
|
||||
#[qproperty(bool, dock_applet_power, cxx_name = "dockAppletPower")]
|
||||
// Systemd / machinectl bar modules.
|
||||
// Unified systemd bar module (covers local + nspawn containers, and later remotes).
|
||||
#[qproperty(bool, systemd_enable, cxx_name = "systemdEnable")]
|
||||
#[qproperty(i32, systemd_interval, cxx_name = "systemdInterval")]
|
||||
#[qproperty(bool, machinectl_enable, cxx_name = "machinectlEnable")]
|
||||
#[qproperty(i32, machinectl_interval, cxx_name = "machinectlInterval")]
|
||||
type ModulesService = super::ModulesServiceRust;
|
||||
}
|
||||
|
||||
|
|
@ -522,8 +520,6 @@ mod data {
|
|||
#[serde(default)]
|
||||
pub systemd: WithInterval,
|
||||
#[serde(default)]
|
||||
pub machinectl: WithInterval,
|
||||
#[serde(default)]
|
||||
pub stats_daemon: StatsDaemon,
|
||||
}
|
||||
}
|
||||
|
|
@ -599,8 +595,6 @@ pub struct ModulesServiceRust {
|
|||
dock_applet_power: bool,
|
||||
systemd_enable: bool,
|
||||
systemd_interval: i32,
|
||||
machinectl_enable: bool,
|
||||
machinectl_interval: i32,
|
||||
}
|
||||
|
||||
impl Default for ModulesServiceRust {
|
||||
|
|
@ -684,8 +678,6 @@ impl ModulesServiceRust {
|
|||
dock_applet_power: d.dock.applets.power,
|
||||
systemd_enable: d.systemd.enable,
|
||||
systemd_interval: d.systemd.interval,
|
||||
machinectl_enable: d.machinectl.enable,
|
||||
machinectl_interval: d.machinectl.interval,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -746,7 +738,6 @@ fn parse_modules(raw: &str, path: &std::path::Path) -> ModulesData {
|
|||
"lock",
|
||||
"dock",
|
||||
"systemd",
|
||||
"machinectl",
|
||||
"statsDaemon",
|
||||
];
|
||||
for key in map.keys() {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use cxx_qt_lib::QString;
|
|||
use serde::Serialize;
|
||||
use std::sync::OnceLock;
|
||||
use tokio::runtime::Runtime;
|
||||
use zbus::{proxy, Connection};
|
||||
use zbus::{Connection, proxy};
|
||||
|
||||
#[cxx_qt::bridge]
|
||||
pub mod qobject {
|
||||
|
|
@ -72,11 +72,8 @@ trait SystemdManager {
|
|||
|
||||
fn list_units_filtered(&self, states: Vec<&str>) -> zbus::Result<Vec<UnitTuple>>;
|
||||
|
||||
fn restart_unit(
|
||||
&self,
|
||||
name: &str,
|
||||
mode: &str,
|
||||
) -> zbus::Result<zbus::zvariant::OwnedObjectPath>;
|
||||
fn restart_unit(&self, name: &str, mode: &str)
|
||||
-> zbus::Result<zbus::zvariant::OwnedObjectPath>;
|
||||
}
|
||||
|
||||
#[proxy(
|
||||
|
|
@ -242,9 +239,11 @@ impl qobject::SystemdService {
|
|||
|
||||
self.as_mut().set_system_state(QString::from(sys_state));
|
||||
self.as_mut().set_user_state(QString::from(user_state));
|
||||
self.as_mut().set_failed_units_json(QString::from(failed_json));
|
||||
self.as_mut()
|
||||
.set_failed_units_json(QString::from(failed_json));
|
||||
self.as_mut().set_failed_count(count);
|
||||
self.as_mut().set_containers_json(QString::from(containers_json));
|
||||
self.as_mut()
|
||||
.set_containers_json(QString::from(containers_json));
|
||||
}
|
||||
|
||||
fn restart_unit(self: Pin<&mut Self>, name: QString, scope: QString, machine: QString) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue