message-text: Don't use GtkBox for HTML is there is a single block
Seems to fix Gtk-CRITICALS for ContentMessageContent
This commit is contained in:
parent
9d59cbac8d
commit
c495d381c4
1 changed files with 14 additions and 9 deletions
|
@ -212,17 +212,22 @@ impl MessageText {
|
|||
}
|
||||
|
||||
fn build_html(&self, blocks: Vec<HtmlBlock>, room: &Room) {
|
||||
let child = gtk::Box::new(gtk::Orientation::Vertical, 6);
|
||||
self.set_child(Some(&child));
|
||||
|
||||
let ellipsize = self.format() == ContentFormat::Ellipsized;
|
||||
let len = blocks.len();
|
||||
for block in blocks {
|
||||
let widget = create_widget_for_html_block(&block, room, ellipsize, len > 1);
|
||||
child.append(&widget);
|
||||
|
||||
if ellipsize {
|
||||
break;
|
||||
if blocks.len() == 1 {
|
||||
let widget = create_widget_for_html_block(&blocks[0], room, ellipsize, false);
|
||||
self.set_child(Some(&widget));
|
||||
} else {
|
||||
let child = gtk::Box::new(gtk::Orientation::Vertical, 6);
|
||||
self.set_child(Some(&child));
|
||||
|
||||
for block in blocks {
|
||||
let widget = create_widget_for_html_block(&block, room, ellipsize, true);
|
||||
child.append(&widget);
|
||||
|
||||
if ellipsize {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue