mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-04-16 17:21:28 +03:00
Encryption and One-Way-Control (#200)
This is a major rewrite of the core networking logic enabling one-way control and encryption through the webrtc-dtls crate. closes #164 closes #104
This commit is contained in:
committed by
GitHub
parent
0d074e19f1
commit
7677fae14b
48
lan-mouse-gtk/src/key_row.rs
Normal file
48
lan-mouse-gtk/src/key_row.rs
Normal file
@@ -0,0 +1,48 @@
|
||||
mod imp;
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
use gtk::glib::{self, Object};
|
||||
|
||||
use super::KeyObject;
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct KeyRow(ObjectSubclass<imp::KeyRow>)
|
||||
@extends gtk::ListBoxRow, gtk::Widget, adw::PreferencesRow, adw::ExpanderRow,
|
||||
@implements gtk::Accessible, gtk::Actionable, gtk::Buildable, gtk::ConstraintTarget;
|
||||
}
|
||||
|
||||
impl Default for KeyRow {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl KeyRow {
|
||||
pub fn new() -> Self {
|
||||
Object::builder().build()
|
||||
}
|
||||
|
||||
pub fn bind(&self, key_object: &KeyObject) {
|
||||
let mut bindings = self.imp().bindings.borrow_mut();
|
||||
|
||||
let title_binding = key_object
|
||||
.bind_property("description", self, "title")
|
||||
.sync_create()
|
||||
.build();
|
||||
|
||||
let subtitle_binding = key_object
|
||||
.bind_property("fingerprint", self, "subtitle")
|
||||
.sync_create()
|
||||
.build();
|
||||
|
||||
bindings.push(title_binding);
|
||||
bindings.push(subtitle_binding);
|
||||
}
|
||||
|
||||
pub fn unbind(&self) {
|
||||
for binding in self.imp().bindings.borrow_mut().drain(..) {
|
||||
binding.unbind();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user