Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,24 @@
- **nmrs-gui**: Renamed crate from `nmrs-ui` to `nmrs-gui`

### Added
- Core: `StateReason` enum and `reason_to_error()` for mapping NetworkManager failure codes to typed errors ([#82](https://github.com/cachebag/nmrs/issues/82))
- Core: `StateReason` enum and `reason_to_error()` for mapping NetworkManager failure codes to typed errors ([#82](https://github.com/cachebag/nmrs/issues/82), [#85](https://github.com/cachebag/nmrs/issues/85))
- Core: Comprehensive documentation across all modules ([#82](https://github.com/cachebag/nmrs/issues/82))
- Core: Logging support via `log` crate facade ([#87](https://github.com/cachebag/nmrs/issues/87))
- UI: Pre-defined themes (Catppuccin, Dracula, Gruvbox, Nord, Tokyo) ([#106](https://github.com/cachebag/nmrs/issues/106))
- CLI: `--version` flag with build hash extraction ([#108](https://github.com/cachebag/nmrs/issues/108))

### Changed
- Core: Decomposed `connect()` into smaller helper functions ([#81](https://github.com/cachebag/nmrs/issues/81))
- Core: Extracted disconnect + wait logic to unified helper ([#79](https://github.com/cachebag/nmrs/issues/79))
- Core: Unified state polling logic ([#80](https://github.com/cachebag/nmrs/issues/80))
- Core: Eliminated network lookup duplication via shared helper function ([#83](https://github.com/cachebag/nmrs/issues/83))
- Core: Replaced `eprintln!` with structured logging (`debug!`, `info!`, `warn!`, `error!`) ([#87](https://github.com/cachebag/nmrs/issues/87))

### Fixed
- Core: Auth error mapping now properly distinguishes supplicant failures, DHCP errors, and timeouts ([#82](https://github.com/cachebag/nmrs/issues/82), [#116](https://github.com/cachebag/nmrs/issues/116))
- Core: Auth error mapping now properly distinguishes supplicant failures, DHCP errors, and timeouts ([#82](https://github.com/cachebag/nmrs/issues/82), [#85](https://github.com/cachebag/nmrs/issues/85), [#116](https://github.com/cachebag/nmrs/issues/116))
- Core: `bitrate` property now fetches real connection speeds ([#110](https://github.com/cachebag/nmrs/issues/110))
- UI: Re-aligned refresh button ([#111](https://github.com/cachebag/nmrs/issues/111))
- UI: Show connection status when connecting with saved credentials ([#61](https://github.com/cachebag/nmrs/issues/61))

## [0.3.0-beta] - 2025-12-08
### Fixed
Expand Down
6 changes: 4 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions nmrs-gui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.4.0"
edition = "2024"

[dependencies]
log = "0.4.29"
nmrs = { path = "../nmrs" }
tokio = { version = "1.47.1", features = ["full"] }
gtk = { version = "0.10.1", package = "gtk4" }
Expand Down
9 changes: 5 additions & 4 deletions nmrs-gui/src/ui/connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use gtk::{
ApplicationWindow, Box as GtkBox, Dialog, Entry, EventControllerKey, Label, Orientation,
prelude::*,
};
use log::{debug, error};
use nmrs::{
NetworkManager,
models::{EapMethod, EapOptions, Phase2, WifiSecurity},
Expand All @@ -23,7 +24,7 @@ pub fn connect_modal(
if let Some(current) = nm.current_ssid().await
&& current == ssid_owned
{
println!("Already connected to {current}, skipping modal");
debug!("Already connected to {current}, skipping modal");
return;
}

Expand Down Expand Up @@ -128,17 +129,17 @@ fn draw_connect_modal(
WifiSecurity::WpaPsk { psk: pwd }
};

println!("Calling nm.connect() for '{ssid}'");
debug!("Calling nm.connect() for '{ssid}'");
match nm.connect(&ssid, creds).await {
Ok(_) => {
println!("nm.connect() succeeded!");
debug!("nm.connect() succeeded!");
status.set_text("✓ Connected!");
on_success();
glib::timeout_future_seconds(1).await;
dialog.close();
}
Err(err) => {
eprintln!("nm.connect() failed: {err}");
error!("nm.connect() failed: {err}");
let err_str = err.to_string().to_lowercase();
if err_str.contains("authentication")
|| err_str.contains("supplicant")
Expand Down
12 changes: 10 additions & 2 deletions nmrs-gui/src/ui/networks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,14 @@ impl NetworkRowController {
let have = nm_c.has_saved_connection(&ssid_c).await.unwrap_or(false);

if have {
status_c.set_text(&format!("Connecting to {}...", ssid_c));
window_c.set_sensitive(false);
let creds = WifiSecurity::WpaPsk { psk: "".into() };
match nm_c.connect(&ssid_c, creds).await {
Ok(_) => on_success_c(),
Ok(_) => {
status_c.set_text("");
on_success_c();
}
Err(e) => status_c.set_text(&format!("Failed to connect: {e}")),
}
window_c.set_sensitive(true);
Expand All @@ -143,10 +147,14 @@ impl NetworkRowController {
);
}
} else {
status_c.set_text(&format!("Connecting to {}...", ssid_c));
window_c.set_sensitive(false);
let creds = WifiSecurity::Open;
match nm_c.connect(&ssid_c, creds).await {
Ok(_) => on_success_c(),
Ok(_) => {
status_c.set_text("");
on_success_c();
}
Err(e) => status_c.set_text(&format!("Failed to connect: {e}")),
}
window_c.set_sensitive(true);
Expand Down
7 changes: 7 additions & 0 deletions nmrs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@
name = "nmrs"
version = "0.4.0"
edition = "2024"
description = "A Rust library for NetworkManager over D-Bus"
license = "MIT"
repository = "https://github.com/cachebag/nmrs"
documentation = "https://docs.rs/nmrs"
keywords = ["networkmanager", "dbus", "wifi", "linux", "networking"]
categories = ["api-bindings", "asynchronous"]

[dependencies]
log = "0.4.29"
zbus = "5.11.0"
zvariant = "5.7.0"
serde = { version = "1", features = ["derive"] }
Expand Down
Loading
Loading