-fn update_map(arc_map: Arc<Mutex<HashMap<String, String>>>, key: String, val: String) {
+// Custom signal type impl
+// Mostly copied from library examples
+#[derive(Debug)]
+pub struct ComJacobCasperMailUnreadCount {
+ pub count: u32,
+}
+
+impl arg::AppendAll for ComJacobCasperMailUnreadCount {
+ fn append(&self, iter: &mut arg::IterAppend) {
+ arg::RefArg::append(&self.count, iter);
+ }
+}
+
+impl arg::ReadAll for ComJacobCasperMailUnreadCount {
+ fn read(iter: &mut arg::Iter) -> Result<Self, arg::TypeMismatchError> {
+ Ok(ComJacobCasperMailUnreadCount {
+ count: iter.read()?,
+ })
+ }
+}
+
+impl dbus::message::SignalArgs for ComJacobCasperMailUnreadCount {
+ const NAME: &'static str = "UnreadCount";
+ const INTERFACE: &'static str = "com.jacobcasper.Mail";
+}
+
+fn get_local_time_string() -> std::string::String {
+ use chrono::prelude::*;
+ let local_time = chrono::prelude::Local::now();
+ return format!(
+ "{}-{}-{:02} {}:{}",
+ local_time.year(),
+ local_time.month(),
+ local_time.day(),
+ local_time.hour(),
+ local_time.minute(),
+ );
+}
+
+fn update_map(arc_map: Arc<Mutex<HashMap<String, String>>>, key: &str, val: &str) {