Keep the approval dialog inside the window
This commit is contained in:
1 file changed
+11
-2
+11
-2
@@ -49,7 +49,10 @@ async fn present(widget: >k::Widget, question: &ApprovalRequest) -> Decision {
|
||||
.body_use_markup(false)
|
||||
.heading(heading(&question.request))
|
||||
.body(story(&question.request))
|
||||
.content_width(460)
|
||||
// Narrower than the 420px default window: a floating `AdwDialog` is
|
||||
// part of the window and is clipped by it, so it must be able to shrink
|
||||
// to fit rather than poke out of the sides.
|
||||
.content_width(360)
|
||||
.extra_child(&details(question))
|
||||
.build();
|
||||
|
||||
@@ -223,14 +226,20 @@ fn note(text: &str) -> gtk::Label {
|
||||
}
|
||||
|
||||
/// The one way client-supplied text reaches the screen.
|
||||
///
|
||||
/// `WordChar` wrapping matters: the values include long tokens with no spaces
|
||||
/// (an `npub`, a URL). With the default `Word` mode a long token cannot be
|
||||
/// broken, so the label's *minimum* width becomes the whole token — which makes
|
||||
/// the whole dialog wider than the window, and the floating dialog gets clipped.
|
||||
fn plain(text: &str) -> gtk::Label {
|
||||
gtk::Label::builder()
|
||||
.label(text)
|
||||
.use_markup(false)
|
||||
.selectable(true)
|
||||
.wrap(true)
|
||||
.wrap_mode(gtk::pango::WrapMode::WordChar)
|
||||
.xalign(0.0)
|
||||
.max_width_chars(56)
|
||||
.max_width_chars(48)
|
||||
.halign(gtk::Align::Start)
|
||||
.build()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user