From 907661e49b878b1dee892f9943d91cf3e4d7b3cb Mon Sep 17 00:00:00 2001 From: yggverse Date: Sat, 22 Mar 2025 16:29:55 +0200 Subject: [PATCH] use single setter, make values selectable, add comments --- .../page/navigation/request/info/dialog.rs | 48 ++++++++++++------- 1 file changed, 31 insertions(+), 17 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 48cda27b..06570710 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 @@ -28,7 +28,9 @@ impl Dialog for PreferencesDialog { g.add( &ActionRow::builder() .css_classes(["property"]) + .subtitle_selectable(true) .subtitle(mime) + .title_selectable(true) .title("Content type") .build(), ) @@ -44,7 +46,9 @@ impl Dialog for PreferencesDialog { use crate::tool::Format; ActionRow::builder() .css_classes(["property"]) + .subtitle_selectable(true) .subtitle(size.bytes()) + .title_selectable(true) .title("Content") .build() }) @@ -76,23 +80,15 @@ impl Dialog for PreferencesDialog { chain(&mut b, info); b.reverse(); let l = b.len(); // calculate once - let t = b[0].event[0].time(); + let t = b[0].event[0].time(); // first event time to count from for (i, r) in b.iter().enumerate() { g.add(&{ - let a = ActionRow::builder().title(r.request().unwrap()).build(); - if i == 0 { - a.set_subtitle(&t.format_iso8601().unwrap()) - } else { - a.set_subtitle(&gformat!( - "{} ms", - r.event - .last() - .unwrap() - .time() - .difference(t) - .as_milliseconds() - )) - } + let a = ActionRow::builder() + .subtitle_selectable(true) + .title_selectable(true) + .title(r.request().unwrap()) + .build(); + // show redirections counter a.add_prefix(&{ let c = i + 1; gtk::Button::builder() @@ -100,18 +96,32 @@ impl Dialog for PreferencesDialog { "circular", if c == l { "success" } else { "accent" }, ]) - .label(&c.to_string()) + .label(c.to_string()) .sensitive(false) .valign(gtk::Align::Center) .build() }); + // show total redirection time in ms + a.set_subtitle(&if i == 0 { + t.format_iso8601().unwrap() + } else { + gformat!( + "{} ms", + r.event + .last() + .unwrap() + .time() + .difference(t) + .as_milliseconds() + ) + }); a }); } g }); p - }) // @TODO reverse, time total + }) // @TODO clickable navigation, copy } if !info.event.is_empty() { d.add(&{ @@ -126,7 +136,9 @@ impl Dialog for PreferencesDialog { let n = e.name(); g.add( &ActionRow::builder() + .subtitle_selectable(true) .subtitle(t.format_iso8601().unwrap()) + .title_selectable(true) .title(n) .build(), ); @@ -137,6 +149,8 @@ impl Dialog for PreferencesDialog { "{} ms", e.time().difference(t).as_milliseconds() )) + .subtitle_selectable(true) + .title_selectable(true) .title(e.name()) .build(), )