chore: Use less margin

This commit is contained in:
Fabio Lenherr / DashieTM 2023-12-06 19:03:31 +01:00
parent c4af8696a8
commit 64a5a67e29
9 changed files with 47 additions and 77 deletions

View file

@ -8,14 +8,14 @@ use adw::subclass::prelude::ObjectSubclassIsExt;
use adw::{glib, ActionRow};
use dbus::blocking::Connection;
use dbus::{Error, Path};
use gtk::prelude::{ButtonExt, WidgetExt};
use gtk::prelude::{ButtonExt, ListBoxRowExt, WidgetExt};
use gtk::{gio, GestureClick};
use re_set_lib::bluetooth::bluetooth_structures::BluetoothDevice;
glib::wrapper! {
pub struct BluetoothEntry(ObjectSubclass<bluetooth_entry_impl::BluetoothEntry>)
@extends ActionRow, gtk::Widget,
@implements gtk::Accessible, gtk::Buildable, gtk::Actionable, gtk::ConstraintTarget;
@implements gtk::Accessible, gtk::Buildable, gtk::Actionable, gtk::ConstraintTarget, gtk::ListBoxRow;
}
unsafe impl Send for BluetoothEntry {}
@ -24,13 +24,13 @@ unsafe impl Sync for BluetoothEntry {}
impl BluetoothEntry {
pub fn new(device: &BluetoothDevice) -> Self {
let entry: BluetoothEntry = Object::builder().build();
entry.set_sensitive(true);
let entry_imp = entry.imp();
entry_imp
.reset_bluetooth_label
.get()
.set_text(&device.alias);
entry.set_subtitle(&device.address);
entry.set_activatable(true);
if device.icon.is_empty() {
entry_imp
.reset_bluetooth_device_type
@ -40,7 +40,7 @@ impl BluetoothEntry {
.reset_bluetooth_device_type
.set_icon_name(Some(&device.icon));
}
if device.paired {
if device.connected || device.paired {
entry_imp.reset_bluetooth_button.set_sensitive(true);
} else {
entry_imp.reset_bluetooth_button.set_sensitive(false);

View file

@ -60,7 +60,7 @@ impl ReSetWindow {
let self_imp = self.imp();
self_imp
.reset_sidebar_breakpoint
.set_condition(BreakpointCondition::parse("max-width: 950sp").as_ref().ok());
.set_condition(BreakpointCondition::parse("max-width: 860sp").as_ref().ok());
self_imp.reset_sidebar_breakpoint.add_setter(
&Object::from(self_imp.reset_overlay_split_view.get()),
"collapsed",

View file

@ -77,19 +77,19 @@ impl ObjectImpl for ReSetWindow {
impl WidgetImpl for ReSetWindow {
fn size_allocate(&self, width: i32, height: i32, baseline: i32) {
// felixusan, use "the force" for debugging
// aka this variable
// println!("{width}");
self.parent_size_allocate(width, height, baseline);
if width > 738 {
self.reset_main.set_margin_start(100);
self.reset_main.set_margin_end(100);
} else if width > 600 {
self.reset_main.set_margin_start((width - 600) / 2);
self.reset_main.set_margin_end((width - 600) / 2);
if width > 658 {
self.reset_main.set_margin_start(60);
self.reset_main.set_margin_end(60);
} else {
self.reset_main.set_margin_start(0);
self.reset_main.set_margin_end(0);
let div = (width - 540) / 2;
if div > 1 {
self.reset_main.set_margin_start(div);
self.reset_main.set_margin_end(div);
} else {
self.reset_main.set_margin_start(0);
self.reset_main.set_margin_end(0);
}
}
}
}