feat: improve spacing and margins on gpu/profile select (#860)

* improve spacing/margins in profiles popup

* improve spacing/margins in profiles popup

* move Label from Frame

* fix empty popup

* fmt
This commit is contained in:
Roman Makarov
2026-01-17 17:44:12 +02:00
committed by GitHub
parent b1ea5215a3
commit 2b7c91f74c
2 changed files with 22 additions and 16 deletions
+13 -13
View File
@@ -19,6 +19,7 @@ use profile_rename_dialog::ProfileRenameDialog;
use profile_row::{ProfileRow, ProfileRowType};
use profile_rule_window::ProfileRuleWindow;
use relm4::{
css,
factory::FactoryVecDeque,
prelude::DynamicIndex,
typed_view::list::{RelmListItem, TypedListView},
@@ -73,17 +74,15 @@ impl Component for Header {
set_label: &model.selector_label,
#[wrap(Some)]
set_popover = &gtk::Popover {
set_margin_horizontal: 5,
gtk::Box {
set_orientation: gtk::Orientation::Vertical,
set_spacing: 5,
set_spacing: 8,
gtk::Label {
set_label: "GPU",
add_css_class: css::HEADING,
},
gtk::Frame {
set_label: Some("GPU"),
set_label_align: 0.05,
set_margin_all: 5,
gtk::ScrolledWindow {
set_policy: (gtk::PolicyType::Never, gtk::PolicyType::Automatic),
set_propagate_natural_height: true,
@@ -93,18 +92,18 @@ impl Component for Header {
}
},
gtk::Frame {
set_label: Some(&fl!(I18N, "settings-profile")),
set_label_align: 0.05,
set_margin_all: 5,
gtk::Label {
set_label: &fl!(I18N, "settings-profile"),
add_css_class: css::HEADING,
},
gtk::Frame {
gtk::Box {
set_orientation: gtk::Orientation::Vertical,
set_spacing: 5,
gtk::CheckButton {
set_margin_top: 5,
set_label: Some(&fl!(I18N, "auto-switch-profiles")),
set_margin_horizontal: 5,
#[watch]
#[block_signal(toggle_auto_profile_handler)]
set_active: model.profiles_info.auto_switch,
@@ -126,6 +125,7 @@ impl Component for Header {
gtk::Box {
set_orientation: gtk::Orientation::Horizontal,
set_spacing: 5,
set_margin_horizontal: 5,
gtk::Button {
set_expand: true,
+9 -3
View File
@@ -46,13 +46,15 @@ impl FactoryComponent for ProfileRow {
view! {
gtk::Box {
set_spacing: 5,
set_margin_horizontal: 5,
#[name = "name_label"]
gtk::Label {
set_label: &match &self.row {
ProfileRowType::Default => fl!(I18N, "default-profile"),
ProfileRowType::Profile { name, .. } => name.clone(),
},
set_margin_all: 5,
set_halign: gtk::Align::Start,
set_hexpand: true,
set_xalign: 0.0,
@@ -71,8 +73,9 @@ impl FactoryComponent for ProfileRow {
set_spacing: 5,
gtk::Button {
inline_css: "color: @theme_text_color",
set_label: &fl!(I18N, "rename-profile"),
set_sensitive: matches!(self.row, ProfileRowType::Profile { .. }),
set_visible: matches!(self.row, ProfileRowType::Profile { .. }),
connect_clicked[sender, index] => move |_| {
sender.output(HeaderMsg::RenameProfile(index.clone())).unwrap();
},
@@ -80,8 +83,9 @@ impl FactoryComponent for ProfileRow {
},
gtk::Button {
inline_css: "color: @theme_text_color",
set_label: &fl!(I18N, "delete-profile"),
set_sensitive: matches!(self.row, ProfileRowType::Profile { .. }),
set_visible: matches!(self.row, ProfileRowType::Profile { .. }),
connect_clicked[profile = self.row.clone()] => move |_| {
if let ProfileRowType::Profile { name, .. } = profile.clone() {
APP_BROKER.send(AppMsg::DeleteProfile(name));
@@ -91,6 +95,7 @@ impl FactoryComponent for ProfileRow {
},
gtk::Button {
inline_css: "color: @theme_text_color",
set_label: &fl!(I18N, "edit-rules"),
connect_clicked[sender, index] => move |_| {
sender.output(HeaderMsg::ShowProfileEditor(index.clone())).unwrap();
@@ -99,6 +104,7 @@ impl FactoryComponent for ProfileRow {
},
gtk::Button {
inline_css: "color: @theme_text_color",
set_label: &fl!(I18N, "export-to-file"),
connect_clicked[sender, index] => move |_| {
sender.output(HeaderMsg::ExportProfile(index.clone())).unwrap();