From 1dd7aafb0c51a6f2119159c11ea27a8e06ad9647 Mon Sep 17 00:00:00 2001 From: yggverse Date: Wed, 26 Mar 2025 05:32:23 +0200 Subject: [PATCH] fix header row widget --- .../page/navigation/request/info/dialog.rs | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/app/browser/window/tab/item/page/navigation/request/info/dialog.rs b/src/app/browser/window/tab/item/page/navigation/request/info/dialog.rs index cea4a690..957ec6c2 100644 --- a/src/app/browser/window/tab/item/page/navigation/request/info/dialog.rs +++ b/src/app/browser/window/tab/item/page/navigation/request/info/dialog.rs @@ -5,7 +5,7 @@ use adw::{ ActionRowExt, ExpanderRowExt, PreferencesDialogExt, PreferencesGroupExt, PreferencesPageExt, }, }; -use gtk::glib::gformat; +use gtk::{Align, glib::gformat}; pub trait Dialog { fn info(profile: &Profile, info: &Info) -> Self; @@ -61,8 +61,6 @@ impl Dialog for PreferencesDialog { t += l; g.add(&{ let e = adw::ExpanderRow::builder() - /* @TODO this class does not work with `ExpanderRow` - .css_classes(["property"]) */ .enable_expansion(true) .expanded(false) .subtitle(l.bytes()) @@ -70,20 +68,23 @@ impl Dialog for PreferencesDialog { .title("Header") .build(); e.add_row( - >k::Label::builder() - .css_classes(["dim-label", "caption"]) - .ellipsize(gtk::pango::EllipsizeMode::None) - .halign(gtk::Align::Start) - .label(h) - .margin_bottom(2) - .margin_end(12) - .margin_start(12) - .margin_top(14) - .selectable(true) - .valign(gtk::Align::Center) - .wrap(false) - .build(), // @TODO replace with `ActionRow` after fix empty subtitle issue + &ActionRow::builder() + .css_classes(["property"]) + .title_selectable(true) + .title(h.escape_default().to_string()) // escape \r\n + .build(), ); + { + use gtk::prelude::{ListBoxRowExt, WidgetExt}; + e.child().map(|c| { + c.first_child().map(|c| { + c.first_child().map_or_else( + || println!("Deprecated child order!"), + |c| c.add_css_class("property"), + ) + }) + }); // @TODO unstable! + } e }) } @@ -230,8 +231,8 @@ impl Dialog for PreferencesDialog { ]) .label(c.to_string()) .sensitive(false) - .valign(gtk::Align::Center) - .halign(gtk::Align::Center) + .valign(Align::Center) + .halign(Align::Center) .build() }); // show total redirection time in ms