feat: simplify and change configuration (#279)

*breaking change*
this changes the configuration syntax, allowing for an unlimited amount of configured clients.
Also a first step towards enabling a "save config" feature.
This commit is contained in:
Ferdinand Schober
2025-03-15 18:45:19 +01:00
committed by GitHub
parent 2f6a3629ad
commit 92f652df2e
10 changed files with 226 additions and 245 deletions

View File

@@ -18,7 +18,15 @@ use gtk::{gio, glib, prelude::ApplicationExt};
use self::client_object::ClientObject;
use self::key_object::KeyObject;
pub fn run() -> glib::ExitCode {
use thiserror::Error;
#[derive(Error, Debug)]
pub enum GtkError {
#[error("gtk frontend exited with non zero exit code: {0}")]
NonZeroExitCode(i32),
}
pub fn run() -> Result<(), GtkError> {
log::debug!("running gtk frontend");
#[cfg(windows)]
let ret = std::thread::Builder::new()
@@ -31,13 +39,10 @@ pub fn run() -> glib::ExitCode {
#[cfg(not(windows))]
let ret = gtk_main();
if ret == glib::ExitCode::FAILURE {
log::error!("frontend exited with failure");
} else {
log::info!("frontend exited successfully");
match ret {
glib::ExitCode::SUCCESS => Ok(()),
e => Err(GtkError::NonZeroExitCode(e.value())),
}
ret
}
fn gtk_main() -> glib::ExitCode {

View File

@@ -126,7 +126,7 @@ impl Window {
#[strong]
window,
move |row: ClientRow, hostname: String| {
log::info!("request-hostname-change");
log::debug!("request-hostname-change");
if let Some(client) = window.client_by_idx(row.index() as u32) {
let hostname = Some(hostname).filter(|s| !s.is_empty());
/* changed in response to FrontendEvent
@@ -163,7 +163,7 @@ impl Window {
window,
move |row: ClientRow, active: bool| {
if let Some(client) = window.client_by_idx(row.index() as u32) {
log::info!(
log::debug!(
"request: {} client",
if active { "activating" } else { "deactivating" }
);