mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-04-13 00:21:28 +03:00
use slab instead of reinventing the wheel (#112)
This commit is contained in:
committed by
GitHub
parent
279e582698
commit
3e96b42067
@@ -10,9 +10,9 @@ glib::wrapper! {
|
||||
}
|
||||
|
||||
impl ClientObject {
|
||||
pub fn new(client: Client, active: bool) -> Self {
|
||||
pub fn new(handle: ClientHandle, client: Client, active: bool) -> Self {
|
||||
Object::builder()
|
||||
.property("handle", client.handle)
|
||||
.property("handle", handle)
|
||||
.property("hostname", client.hostname)
|
||||
.property("port", client.port as u32)
|
||||
.property("position", client.pos.to_string())
|
||||
|
||||
@@ -87,8 +87,8 @@ impl Window {
|
||||
row
|
||||
}
|
||||
|
||||
pub fn new_client(&self, client: Client, active: bool) {
|
||||
let client = ClientObject::new(client, active);
|
||||
pub fn new_client(&self, handle: ClientHandle, client: Client, active: bool) {
|
||||
let client = ClientObject::new(handle, client, active);
|
||||
self.clients().append(&client);
|
||||
self.set_placeholder_visible(false);
|
||||
}
|
||||
@@ -115,9 +115,9 @@ impl Window {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn update_client(&self, client: Client) {
|
||||
let Some(idx) = self.client_idx(client.handle) else {
|
||||
log::warn!("could not find client with handle {}", client.handle);
|
||||
pub fn update_client(&self, handle: ClientHandle, client: Client) {
|
||||
let Some(idx) = self.client_idx(handle) else {
|
||||
log::warn!("could not find client with handle {}", handle);
|
||||
return;
|
||||
};
|
||||
let client_object = self.clients().item(idx as u32).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user