Libadwaita gui (#19)

Major Update: Functional GUI Frontend!
This commit is contained in:
Ferdinand Schober
2023-09-20 15:23:33 +02:00
committed by GitHub
parent c50b746816
commit d042c0aa4a
28 changed files with 1202 additions and 187 deletions

View File

@@ -1,5 +1,6 @@
use std::io::{Read, Result};
use std::{str, net::SocketAddr};
use std::net::IpAddr;
use std::str;
#[cfg(unix)]
use std::{env, path::{Path, PathBuf}};
@@ -24,11 +25,11 @@ pub mod gtk;
#[derive(Debug, Eq, PartialEq, Clone, Serialize, Deserialize)]
pub enum FrontendEvent {
RequestPortChange(u16),
RequestClientAdd(SocketAddr, Position),
RequestClientDelete(Client),
RequestClientUpdate(Client),
RequestShutdown(),
ChangePort(u16),
AddClient(String, u16, Position),
DelClient(String, u16),
AddIp(String, Option<IpAddr>),
Shutdown(),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -78,6 +79,7 @@ impl FrontendAdapter {
let json = str::from_utf8(&buf)
.unwrap()
.trim_end_matches(char::from(0)); // remove trailing 0-bytes
log::debug!("{json}");
let event = serde_json::from_str(json).unwrap();
log::debug!("{:?}", event);
Ok(event)
@@ -117,5 +119,3 @@ impl Drop for FrontendAdapter {
std::fs::remove_file(&self.socket_path).unwrap();
}
}
pub trait Frontend { }