chore: Prelease

This commit is contained in:
Fabio Lenherr / DashieTM 2023-12-12 20:52:12 +01:00
parent 83d31000eb
commit 42477b9b02
11 changed files with 76 additions and 60 deletions

View file

@ -5,8 +5,8 @@ edition = "2021"
description = "A wip universal Linux settings application."
[dependencies]
reset_daemon = "0.4.6"
re_set-lib = { git = "https://github.com/Xetibo/ReSet-Lib", branch = "main" }
reset_daemon = "0.4.9"
re_set-lib = "0.7.9"
adw = { version = "0.5.3", package = "libadwaita", features = ["v1_4"] }
dbus = "0.9.7"
gtk = { version = "0.7.3", package = "gtk4", features = ["v4_12"] }

View file

@ -13,7 +13,7 @@ pub struct BluetoothEntry {
pub remove_device_button: RefCell<Button>,
pub connecting_label: RefCell<Label>,
pub device_name: RefCell<String>,
pub bluetooth_device: RefCell<BluetoothDevice>
pub bluetooth_device: RefCell<BluetoothDevice>,
}
#[glib::object_subclass]

View file

@ -1,7 +1,7 @@
pub mod audio_box;
pub mod input_stream_entry;
pub mod input_stream_entry_impl;
pub mod sink_box;
pub mod sink_box_impl;
pub mod sink_entry;
pub mod sink_entry_impl;
pub mod audio_box;

View file

@ -2,18 +2,18 @@ use std::rc::Rc;
use std::time::Duration;
use crate::components::wifi::saved_wifi_entry_impl;
use crate::components::wifi::utils::get_connection_settings;
use crate::components::wifi::wifi_box_impl::WifiBox;
use crate::components::wifi::wifi_options::WifiOptions;
use adw::glib;
use adw::glib::Object;
use adw::prelude::{ActionRowExt, ButtonExt, PreferencesRowExt, PreferencesGroupExt};
use adw::prelude::{ActionRowExt, ButtonExt, PreferencesGroupExt, PreferencesRowExt};
use dbus::blocking::Connection;
use dbus::{Error, Path};
use glib::subclass::types::ObjectSubclassIsExt;
use glib::{clone, PropertySet};
use gtk::{Align, Button, gio, Orientation};
use gtk::prelude::{BoxExt, ListBoxRowExt};
use crate::components::wifi::utils::get_connection_settings;
use crate::components::wifi::wifi_options::WifiOptions;
use gtk::{gio, Align, Button, Orientation};
glib::wrapper! {
pub struct SavedWifiEntry(ObjectSubclass<saved_wifi_entry_impl::SavedWifiEntry>)

View file

@ -10,7 +10,7 @@ use adw::prelude::PreferencesRowExt;
use glib::clone;
use glib::subclass::prelude::ObjectSubclassIsExt;
use gtk::prelude::{ButtonExt, EditableExt, WidgetExt};
use re_set_lib::network::connection::{Connection};
use re_set_lib::network::connection::Connection;
use crate::components::wifi::utils::IpProtocol;
use crate::components::wifi::wifi_address_entry_impl;

View file

@ -17,7 +17,7 @@ use dbus::Path;
use glib::{clone, Cast, PropertySet};
use gtk::glib::Variant;
use gtk::prelude::{ActionableExt, WidgetExt};
use gtk::{gio, StringObject, StringList};
use gtk::{gio, StringList, StringObject};
use re_set_lib::network::network_structures::{AccessPoint, WifiDevice, WifiStrength};
use re_set_lib::signals::{AccessPointAdded, WifiDeviceChanged};
use re_set_lib::signals::{AccessPointChanged, AccessPointRemoved};
@ -394,12 +394,18 @@ pub fn start_event_listener(listeners: Arc<Listeners>, wifi_box: Arc<WifiBox>) {
WifiStrength::None => Some("network-wireless-signal-none-symbolic"),
});
if !ir.access_point.stored {
entry_imp.reset_wifi_edit_button.borrow().set_sensitive(false);
entry_imp
.reset_wifi_edit_button
.borrow()
.set_sensitive(false);
}
if ir.access_point.dbus_path
== imp.reset_current_wifi_device.borrow().active_access_point
{
entry_imp.reset_wifi_connected.borrow().set_text("Connected");
entry_imp
.reset_wifi_connected
.borrow()
.set_text("Connected");
} else {
entry_imp.reset_wifi_connected.borrow().set_text("");
}

View file

@ -10,8 +10,8 @@ use adw::subclass::prelude::ObjectSubclassIsExt;
use dbus::blocking::Connection;
use dbus::Error;
use glib::clone;
use gtk::{Align, Button, gio, Image, Orientation};
use gtk::prelude::{BoxExt, ListBoxRowExt, WidgetExt};
use gtk::{gio, Align, Button, Image, Orientation};
use re_set_lib::network::network_structures::{AccessPoint, WifiStrength};
use crate::components::wifi::wifi_box_impl::WifiBox;
@ -40,27 +40,33 @@ impl WifiEntry {
entry_imp.wifi_strength.set(strength);
entry.set_title(name);
entry_imp.connected.set(connected);
entry_imp.reset_wifi_edit_button.replace(Button::builder()
.icon_name("document-edit-symbolic")
.valign(Align::Center)
.build());
entry_imp.reset_wifi_edit_button.replace(
Button::builder()
.icon_name("document-edit-symbolic")
.valign(Align::Center)
.build(),
);
// TODO handle encryption thing
let wifi_strength = Image::builder().icon_name(match strength {
WifiStrength::Excellent => "network-wireless-signal-excellent-symbolic",
WifiStrength::Ok => "network-wireless-signal-ok-symbolic",
WifiStrength::Weak => "network-wireless-signal-weak-symbolic",
WifiStrength::None => "network-wireless-signal-none-symbolic",
}).build();
let wifi_strength = Image::builder()
.icon_name(match strength {
WifiStrength::Excellent => "network-wireless-signal-excellent-symbolic",
WifiStrength::Ok => "network-wireless-signal-ok-symbolic",
WifiStrength::Weak => "network-wireless-signal-weak-symbolic",
WifiStrength::None => "network-wireless-signal-none-symbolic",
})
.build();
let prefix_box = gtk::Box::new(Orientation::Horizontal, 0);
prefix_box.append(&wifi_strength);
prefix_box.append(&Image::builder()
.icon_name("system-lock-screen-symbolic")
.valign(Align::End)
.pixel_size(9)
.margin_bottom(12)
.build());
prefix_box.append(
&Image::builder()
.icon_name("system-lock-screen-symbolic")
.valign(Align::End)
.pixel_size(9)
.margin_bottom(12)
.build(),
);
entry.add_prefix(&prefix_box);
let suffix_box = gtk::Box::new(Orientation::Horizontal, 5);
@ -69,10 +75,16 @@ impl WifiEntry {
entry.add_suffix(&suffix_box);
if !access_point.stored {
entry_imp.reset_wifi_edit_button.borrow().set_sensitive(false);
entry_imp
.reset_wifi_edit_button
.borrow()
.set_sensitive(false);
}
if connected {
entry_imp.reset_wifi_connected.borrow().set_text("Connected");
entry_imp
.reset_wifi_connected
.borrow()
.set_text("Connected");
}
{
let mut wifi_name = entry_imp.wifi_name.borrow_mut();

View file

@ -4,15 +4,17 @@ use std::str::FromStr;
use std::sync::Arc;
use std::time::Duration;
use adw::{gio, glib};
use adw::glib::Object;
use adw::prelude::{ActionRowExt, ComboRowExt, PreferencesGroupExt};
use adw::subclass::prelude::ObjectSubclassIsExt;
use dbus::{Error, Path};
use adw::{gio, glib};
use dbus::arg::PropMap;
use dbus::{Error, Path};
use glib::{clone, PropertySet};
use gtk::prelude::{ActionableExt, ButtonExt, EditableExt, ListBoxRowExt, WidgetExt};
use re_set_lib::network::connection::{Connection, DNSMethod4, DNSMethod6, Enum, KeyManagement, TypeSettings};
use re_set_lib::network::connection::{
Connection, DNSMethod4, DNSMethod6, Enum, KeyManagement, TypeSettings,
};
use IpProtocol::{IPv4, IPv6};
@ -51,7 +53,6 @@ impl WifiOptions {
ip4_route_length = conn.ipv4.route_data.len();
ip6_address_length = conn.ipv4.address_data.len();
ip6_route_length = conn.ipv4.route_data.len();
// dbg!(&conn);
// General
self_imp
.reset_wifi_auto_connect
@ -104,10 +105,13 @@ impl WifiOptions {
.map(|addr| Ipv4Addr::from(*addr))
.collect();
self_imp.reset_ip4_dns.set_text(&ipv4_dns.iter()
.map(|ip| ip.to_string())
.collect::<Vec<String>>()
.join(", "));
self_imp.reset_ip4_dns.set_text(
&ipv4_dns
.iter()
.map(|ip| ip.to_string())
.collect::<Vec<String>>()
.join(", "),
);
self_imp.reset_ip4_gateway.set_text(&conn.ipv4.gateway);
// IPv6
self_imp
@ -132,7 +136,7 @@ impl WifiOptions {
// Security
match &conn.security.key_management {
match &conn.security.key_management {
KeyManagement::NONE => {
self_imp.reset_wifi_security_dropdown.set_selected(0);
self_imp.reset_wifi_password.set_visible(false);
@ -141,9 +145,7 @@ impl WifiOptions {
KeyManagement::WPAPSK => {
self_imp.reset_wifi_security_dropdown.set_selected(1);
self_imp.reset_wifi_password.set_visible(true);
self_imp
.reset_wifi_password
.set_text(&conn.security.psk);
self_imp.reset_wifi_password.set_text(&conn.security.psk);
}
_ => {}
}
@ -242,7 +244,6 @@ fn setup_callbacks(wifi_options: &Arc<WifiOptions>, path: Path<'static>) {
imp.wifi_options_apply_button
.connect_clicked(clone!(@weak imp => move |_| {
let prop = imp.connection.borrow().convert_to_propmap();
dbg!(&prop);
set_connection_settings(path.clone(), prop);
}));
// IPv4
@ -367,16 +368,17 @@ fn setup_callbacks(wifi_options: &Arc<WifiOptions>, path: Path<'static>) {
}
}));
imp.reset_wifi_password.connect_changed(clone!(@weak imp => move |entry| {
let password_input = entry.text();
if password_input.len() < 8 && !password_input.is_empty() {
entry.add_css_class("error");
} else {
entry.remove_css_class("error");
}
let mut conn = imp.connection.borrow_mut();
conn.security.psk = password_input.to_string();
}));
imp.reset_wifi_password
.connect_changed(clone!(@weak imp => move |entry| {
let password_input = entry.text();
if password_input.len() < 8 && !password_input.is_empty() {
entry.add_css_class("error");
} else {
entry.remove_css_class("error");
}
let mut conn = imp.connection.borrow_mut();
conn.security.psk = password_input.to_string();
}));
imp.reset_available_networks.set_activatable(true);
imp.reset_available_networks

View file

@ -55,7 +55,6 @@ impl WifiRouteEntry {
fn setup_callbacks(&self, connection: Rc<RefCell<Connection>>) {
let self_imp = self.imp();
let conn = connection.clone();
dbg!(conn.borrow());
self_imp.reset_route_address.connect_changed(clone!(@weak self_imp => move |entry| {
let address_input = entry.text();
let mut conn = conn.borrow_mut();

View file

@ -2,8 +2,8 @@ use gtk::prelude::FrameExt;
use std::cell::RefCell;
use std::hint::spin_loop;
use std::rc::Rc;
use std::sync::Arc;
use std::sync::atomic::Ordering;
use std::sync::Arc;
use crate::components::base::setting_box::SettingBox;
use crate::components::base::utils::{start_audio_listener, Listeners, Position};

View file

@ -77,9 +77,6 @@ async fn daemon_check() {
});
let res = handle.join();
if res.unwrap().is_err() {
println!("Daemon was not running");
run_daemon().await;
} else {
println!("Daemon was running");
}
}
}