daily commit

This commit is contained in:
Candifloss 2024-08-28 16:57:57 +05:30
parent abe3019300
commit 1ea24e900d

View File

@ -51,14 +51,15 @@ impl fmt::Display for Notif<'_> {
)?; )?;
let actions_len = self.actions.len(); let actions_len = self.actions.len();
let i = 0; let mut i = 0;
while i < actions_len { while i < actions_len {
let a:NotifAction; let a = NotifAction {
a.action_id = &self.actions[i]; action_id: &self.actions[i],
a.action = &self.actions[i+1]; action: &self.actions[i+1],
};
println!("{a}"); println!("{a}");
i += 1; i += 2;
}; };
writeln!(f, "Hints:")?; writeln!(f, "Hints:")?;
for (key, value) in &self.hints { for (key, value) in &self.hints {
@ -66,8 +67,8 @@ impl fmt::Display for Notif<'_> {
} }
match self.expir_timeout { match self.expir_timeout {
-1 => writeln!(f, "None")?, -1 => writeln!(f, "None")?,
Some(millisec) => writeln!(f, "Expiration Timeout: {millisec}")?, _ => writeln!(f, "Expiration Timeout: {}", self.expir_timeout)?,
None => writeln!(f, "Error getting timeout")?, //None => writeln!(f, "Error getting timeout")?,
} }
Ok(()) // Return Ok to indicate success Ok(()) // Return Ok to indicate success
} }
@ -82,17 +83,6 @@ async fn main() -> Result<()> {
// Establish a connection to the session bus // Establish a connection to the session bus
let connection = Connection::session().await?; let connection = Connection::session().await?;
// Create a match rule for the Notify signal
/*let match_rule = MatchRule::builder()
.msg_type(zbus::message::Type::Signal)
.sender("org.freedesktop.Notifications")?
.interface("org.freedesktop.Notifications")?
.arg_path(0, "/org/freedesktop/Notifications")?
.member("Notify")?
.build();*/
// Create a message iterator for the match rule
//let mut iterator = MessageIterator::for_match_rule(match_rule, &connection, None)?;
// Loop to handle incoming messages // Loop to handle incoming messages
loop { loop {
@ -106,7 +96,6 @@ async fn main() -> Result<()> {
// handle invalid calls, introspection, errors etc // handle invalid calls, introspection, errors etc
let arg: &str = msg.body()?; let arg: &str = msg.body()?;
println!("Msg.body: {arg}"); println!("Msg.body: {arg}");
//connection.reply(&msg, &(format!("Hello {}!", arg)))?;
} }
_ => continue, _ => continue,
} }